diff options
Diffstat (limited to 'src/renderergl2/tr_local.h')
-rw-r--r-- | src/renderergl2/tr_local.h | 216 |
1 files changed, 77 insertions, 139 deletions
diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h index 77adcc38..746eccde 100644 --- a/src/renderergl2/tr_local.h +++ b/src/renderergl2/tr_local.h @@ -719,6 +719,81 @@ enum GLSL_MAT16 }; +enum +{ + UNIFORM_DIFFUSEMAP = 0, + UNIFORM_LIGHTMAP, + UNIFORM_NORMALMAP, + UNIFORM_DELUXEMAP, + UNIFORM_SPECULARMAP, + + UNIFORM_TEXTUREMAP, + UNIFORM_LEVELSMAP, + + UNIFORM_SCREENIMAGEMAP, + UNIFORM_SCREENDEPTHMAP, + + UNIFORM_SHADOWMAP, + UNIFORM_SHADOWMAP2, + UNIFORM_SHADOWMAP3, + + UNIFORM_SHADOWMVP, + UNIFORM_SHADOWMVP2, + UNIFORM_SHADOWMVP3, + + UNIFORM_DIFFUSETEXMATRIX, + UNIFORM_DIFFUSETEXOFFTURB, + UNIFORM_TEXTURE1ENV, + + UNIFORM_TCGEN0, + UNIFORM_TCGEN0VECTOR0, + UNIFORM_TCGEN0VECTOR1, + + UNIFORM_DEFORMGEN, + UNIFORM_DEFORMPARAMS, + + UNIFORM_COLORGEN, + UNIFORM_ALPHAGEN, + UNIFORM_COLOR, + UNIFORM_BASECOLOR, + UNIFORM_VERTCOLOR, + + UNIFORM_DLIGHTINFO, + UNIFORM_LIGHTFORWARD, + UNIFORM_LIGHTUP, + UNIFORM_LIGHTRIGHT, + UNIFORM_LIGHTORIGIN, + UNIFORM_LIGHTRADIUS, + UNIFORM_AMBIENTLIGHT, + UNIFORM_DIRECTEDLIGHT, + + UNIFORM_PORTALRANGE, + + UNIFORM_FOGDISTANCE, + UNIFORM_FOGDEPTH, + UNIFORM_FOGEYET, + UNIFORM_FOGCOLORMASK, + + UNIFORM_MODELMATRIX, + UNIFORM_MODELVIEWPROJECTIONMATRIX, + + UNIFORM_TIME, + UNIFORM_VERTEXLERP, + UNIFORM_MATERIALINFO, + + UNIFORM_VIEWINFO, // znear, zfar, width/2, height/2 + UNIFORM_VIEWORIGIN, + UNIFORM_VIEWFORWARD, + UNIFORM_VIEWLEFT, + UNIFORM_VIEWUP, + + UNIFORM_INVTEXRES, + UNIFORM_AUTOEXPOSUREMINMAX, + UNIFORM_TONEMINAVGMAXLINEAR, + + UNIFORM_COUNT +} uniform_t; + // shaderProgram_t represents a pair of one // GLSL vertex and one GLSL fragment shader typedef struct shaderProgram_s @@ -731,146 +806,11 @@ typedef struct shaderProgram_s uint32_t attribs; // vertex array attributes // uniform parameters - int numUniforms; - GLint *uniforms; - char *uniformTypes; // max 127 uniform types - short *uniformBufferOffsets; // max 32767/64=511 uniforms + GLint uniforms[UNIFORM_COUNT]; + short uniformBufferOffsets[UNIFORM_COUNT]; // max 32767/64=511 uniforms char *uniformBuffer; } shaderProgram_t; - -enum -{ - TEXTURECOLOR_UNIFORM_MODELVIEWPROJECTIONMATRIX = 0, - TEXTURECOLOR_UNIFORM_INVTEXRES, - TEXTURECOLOR_UNIFORM_AUTOEXPOSUREMINMAX, - TEXTURECOLOR_UNIFORM_TONEMINAVGMAXLINEAR, - TEXTURECOLOR_UNIFORM_TEXTUREMAP, - TEXTURECOLOR_UNIFORM_LEVELSMAP, - TEXTURECOLOR_UNIFORM_COLOR, - TEXTURECOLOR_UNIFORM_COUNT -}; - - -enum -{ - FOGPASS_UNIFORM_FOGDISTANCE = 0, - FOGPASS_UNIFORM_FOGDEPTH, - FOGPASS_UNIFORM_FOGEYET, - FOGPASS_UNIFORM_DEFORMGEN, - FOGPASS_UNIFORM_DEFORMPARAMS, - FOGPASS_UNIFORM_TIME, - FOGPASS_UNIFORM_COLOR, - FOGPASS_UNIFORM_MODELVIEWPROJECTIONMATRIX, - FOGPASS_UNIFORM_VERTEXLERP, - FOGPASS_UNIFORM_COUNT -}; - - -enum -{ - DLIGHT_UNIFORM_DIFFUSEMAP = 0, - DLIGHT_UNIFORM_DLIGHTINFO, - DLIGHT_UNIFORM_DEFORMGEN, - DLIGHT_UNIFORM_DEFORMPARAMS, - DLIGHT_UNIFORM_TIME, - DLIGHT_UNIFORM_COLOR, - DLIGHT_UNIFORM_MODELVIEWPROJECTIONMATRIX, - DLIGHT_UNIFORM_VERTEXLERP, - DLIGHT_UNIFORM_COUNT -}; - - -enum -{ - PSHADOW_UNIFORM_SHADOWMAP = 0, - PSHADOW_UNIFORM_MODELVIEWPROJECTIONMATRIX, - PSHADOW_UNIFORM_LIGHTFORWARD, - PSHADOW_UNIFORM_LIGHTUP, - PSHADOW_UNIFORM_LIGHTRIGHT, - PSHADOW_UNIFORM_LIGHTORIGIN, - PSHADOW_UNIFORM_LIGHTRADIUS, - PSHADOW_UNIFORM_COUNT -}; - - -enum -{ - GENERIC_UNIFORM_DIFFUSEMAP = 0, - GENERIC_UNIFORM_LIGHTMAP, - GENERIC_UNIFORM_NORMALMAP, - GENERIC_UNIFORM_DELUXEMAP, - GENERIC_UNIFORM_SPECULARMAP, - GENERIC_UNIFORM_SHADOWMAP, - GENERIC_UNIFORM_DIFFUSETEXMATRIX, - GENERIC_UNIFORM_DIFFUSETEXOFFTURB, - //GENERIC_UNIFORM_NORMALTEXMATRIX, - //GENERIC_UNIFORM_SPECULARTEXMATRIX, - GENERIC_UNIFORM_TEXTURE1ENV, - GENERIC_UNIFORM_VIEWORIGIN, - GENERIC_UNIFORM_TCGEN0, - GENERIC_UNIFORM_TCGEN0VECTOR0, - GENERIC_UNIFORM_TCGEN0VECTOR1, - GENERIC_UNIFORM_DEFORMGEN, - GENERIC_UNIFORM_DEFORMPARAMS, - GENERIC_UNIFORM_COLORGEN, - GENERIC_UNIFORM_ALPHAGEN, - GENERIC_UNIFORM_BASECOLOR, - GENERIC_UNIFORM_VERTCOLOR, - GENERIC_UNIFORM_AMBIENTLIGHT, - GENERIC_UNIFORM_DIRECTEDLIGHT, - GENERIC_UNIFORM_LIGHTORIGIN, - GENERIC_UNIFORM_LIGHTRADIUS, - GENERIC_UNIFORM_PORTALRANGE, - GENERIC_UNIFORM_FOGDISTANCE, - GENERIC_UNIFORM_FOGDEPTH, - GENERIC_UNIFORM_FOGEYET, - GENERIC_UNIFORM_FOGCOLORMASK, - GENERIC_UNIFORM_MODELMATRIX, - GENERIC_UNIFORM_MODELVIEWPROJECTIONMATRIX, - GENERIC_UNIFORM_TIME, - GENERIC_UNIFORM_VERTEXLERP, - GENERIC_UNIFORM_MATERIALINFO, - GENERIC_UNIFORM_COUNT -}; - -enum -{ - SHADOWMASK_UNIFORM_SCREENDEPTHMAP = 0, - SHADOWMASK_UNIFORM_SHADOWMAP, - SHADOWMASK_UNIFORM_SHADOWMAP2, - SHADOWMASK_UNIFORM_SHADOWMAP3, - SHADOWMASK_UNIFORM_SHADOWMVP, - SHADOWMASK_UNIFORM_SHADOWMVP2, - SHADOWMASK_UNIFORM_SHADOWMVP3, - SHADOWMASK_UNIFORM_VIEWORIGIN, - SHADOWMASK_UNIFORM_VIEWINFO, // znear, zfar, width/2, height/2 - SHADOWMASK_UNIFORM_VIEWFORWARD, - SHADOWMASK_UNIFORM_VIEWLEFT, - SHADOWMASK_UNIFORM_VIEWUP, - SHADOWMASK_UNIFORM_COUNT -}; - -enum -{ - SSAO_UNIFORM_SCREENDEPTHMAP = 0, - SSAO_UNIFORM_VIEWINFO, // znear, zfar, width/2, height/2 - SSAO_UNIFORM_COUNT -}; - -enum -{ - DEPTHBLUR_UNIFORM_SCREENIMAGEMAP = 0, - DEPTHBLUR_UNIFORM_SCREENDEPTHMAP, - DEPTHBLUR_UNIFORM_VIEWINFO, // znear, zfar, width/2, height/2 - DEPTHBLUR_UNIFORM_COUNT -}; - -// -// These are fire wall functions to avoid expensive redundant glUniform* calls -//#define USE_UNIFORM_FIREWALL 1 -//#define LOG_GLSL_UNIFORMS 1 - // trRefdef_t holds everything that comes in refdef_t, // as well as the locally generated scene information typedef struct { @@ -2437,8 +2377,6 @@ void GLSL_VertexAttribPointers(uint32_t attribBits); void GLSL_BindProgram(shaderProgram_t * program); void GLSL_BindNullProgram(void); -void GLSL_SetNumUniforms(shaderProgram_t *program, int numUniforms); -void GLSL_SetUniformName(shaderProgram_t *program, int uniformNum, const char *name); void GLSL_SetUniformInt(shaderProgram_t *program, int uniformNum, GLint value); void GLSL_SetUniformFloat(shaderProgram_t *program, int uniformNum, GLfloat value); void GLSL_SetUniformFloat5(shaderProgram_t *program, int uniformNum, const vec5_t v); |