From 5fa011d32ccfcedc9aad2332cb23ebd326b0a135 Mon Sep 17 00:00:00 2001 From: Axel Isouard Date: Wed, 25 Jul 2012 13:58:27 +0200 Subject: [PATCH] Added new files in the makefile --- gl_backend.c | 13 +++++++------ gl_backend.h | 4 +++- gl_cache.h | 2 +- gl_rmain.c | 6 +++++- makefile.inc | 1 + 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gl_backend.c b/gl_backend.c index bb20a109..e90ec468 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -1,4 +1,4 @@ - +#include "shadermodeinfo.h" #include "quakedef.h" #include "cl_collision.h" #include "dpsoftrast.h" @@ -2616,11 +2616,12 @@ void R_Mesh_Start(void) } } -static qboolean GL_Backend_CompileShader(int programobject, GLenum shadertypeenum, const char *shadertype, int numstrings, const char **strings) +static qboolean GL_Backend_CompileShader(shadermodeinfo_t *modeinfo, int programobject, GLenum shadertypeenum, const char *shadertype, int numstrings, const char **strings) { int shaderobject; int shadercompiled; char compilelog[MAX_INPUTLINE]; + shaderobject = qglCreateShader(shadertypeenum);CHECKGLERROR if (!shaderobject) return false; @@ -2647,7 +2648,7 @@ static qboolean GL_Backend_CompileShader(int programobject, GLenum shadertypeenu return true; } -unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list) +unsigned int GL_Backend_CompileProgram(shadermodeinfo_t *modeinfo, int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list) { GLint programlinked; GLuint programobject = 0; @@ -2673,15 +2674,15 @@ unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **ver qglBindFragDataLocation(programobject, 0, "dp_FragColor"); #endif - if (vertexstrings_count && !GL_Backend_CompileShader(programobject, GL_VERTEX_SHADER, "vertex", vertexstrings_count, vertexstrings_list)) + if (vertexstrings_count && !GL_Backend_CompileShader(modeinfo, programobject, GL_VERTEX_SHADER, "vertex", vertexstrings_count, vertexstrings_list)) goto cleanup; #ifdef GL_GEOMETRY_SHADER - if (geometrystrings_count && !GL_Backend_CompileShader(programobject, GL_GEOMETRY_SHADER, "geometry", geometrystrings_count, geometrystrings_list)) + if (geometrystrings_count && !GL_Backend_CompileShader(modeinfo, programobject, GL_GEOMETRY_SHADER, "geometry", geometrystrings_count, geometrystrings_list)) goto cleanup; #endif - if (fragmentstrings_count && !GL_Backend_CompileShader(programobject, GL_FRAGMENT_SHADER, "fragment", fragmentstrings_count, fragmentstrings_list)) + if (fragmentstrings_count && !GL_Backend_CompileShader(modeinfo, programobject, GL_FRAGMENT_SHADER, "fragment", fragmentstrings_count, fragmentstrings_list)) goto cleanup; qglLinkProgram(programobject);CHECKGLERROR diff --git a/gl_backend.h b/gl_backend.h index 86b2d310..b85be4b8 100644 --- a/gl_backend.h +++ b/gl_backend.h @@ -2,6 +2,8 @@ #ifndef GL_BACKEND_H #define GL_BACKEND_H +typedef struct shadermodeinfo_s shadermodeinfo_t; + extern r_viewport_t gl_viewport; extern matrix4x4_t gl_modelmatrix; extern matrix4x4_t gl_viewmatrix; @@ -54,7 +56,7 @@ int R_Mesh_CreateFramebufferObject(rtexture_t *depthtexture, rtexture_t *colorte void R_Mesh_DestroyFramebufferObject(int fbo); void R_Mesh_SetRenderTargets(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture, rtexture_t *colortexture2, rtexture_t *colortexture3, rtexture_t *colortexture4); -unsigned int GL_Backend_CompileProgram(int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list); +unsigned int GL_Backend_CompileProgram(shadermodeinfo_t *modeinfo, int vertexstrings_count, const char **vertexstrings_list, int geometrystrings_count, const char **geometrystrings_list, int fragmentstrings_count, const char **fragmentstrings_list); void GL_Backend_FreeProgram(unsigned int prog); extern cvar_t gl_paranoid; diff --git a/gl_cache.h b/gl_cache.h index dde21425..8ec5ffe8 100644 --- a/gl_cache.h +++ b/gl_cache.h @@ -1,6 +1,6 @@ #define GL_CACHE_VERSION 1 -typedefstruct gl_cache_header_s +typedef struct gl_cache_header_s { int version; int crc; diff --git a/gl_rmain.c b/gl_rmain.c index 002355cc..55cd9b7f 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // r_main.c +#include "shadermodeinfo.h" #include "quakedef.h" #include "cl_dyntexture.h" #include "r_shadow.h" @@ -616,6 +617,8 @@ typedef struct shaderpermutationinfo_s } shaderpermutationinfo_t; +// ~exidl: moved to shadermodeinfo.h +/* typedef struct shadermodeinfo_s { const char *vertexfilename; @@ -625,6 +628,7 @@ typedef struct shadermodeinfo_s const char *name; } shadermodeinfo_t; +*/ // NOTE: MUST MATCH ORDER OF SHADERPERMUTATION_* DEFINES! shaderpermutationinfo_t shaderpermutationinfo[SHADERPERMUTATION_COUNT] = @@ -1088,7 +1092,7 @@ static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode // compile the shader program if (vertstrings_count + geomstrings_count + fragstrings_count) - p->program = GL_Backend_CompileProgram(vertstrings_count, vertstrings_list, geomstrings_count, geomstrings_list, fragstrings_count, fragstrings_list); + p->program = GL_Backend_CompileProgram(modeinfo, vertstrings_count, vertstrings_list, geomstrings_count, geomstrings_list, fragstrings_count, fragstrings_list); if (p->program) { CHECKGLERROR diff --git a/makefile.inc b/makefile.inc index fe1eabe1..df0cdd82 100644 --- a/makefile.inc +++ b/makefile.inc @@ -124,6 +124,7 @@ OBJ_COMMON= \ ft2.o \ utf8lib.o \ gl_backend.o \ + gl_cache.o \ gl_draw.o \ gl_rmain.o \ gl_rsurf.o \ -- 2.39.2