From: havoc Date: Sun, 25 Mar 2018 21:29:52 +0000 (+0000) Subject: Change shader permutation flags to 64bit. X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=ff4d2345f3b3fd427852095c77fedc616bfdab5d Change shader permutation flags to 64bit. Added dpuint64 and dpint64 types. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12357 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/dpsoftrast.c b/dpsoftrast.c index 7f13246b..d9c72720 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -257,7 +257,7 @@ typedef ALIGN(struct DPSOFTRAST_State_Thread_s ALIGN(float fb_clipplane[4]); int shader_mode; - int shader_permutation; + dpuint64 shader_permutation; int shader_exactspecularmath; DPSOFTRAST_Texture *texbound[DPSOFTRAST_MAXTEXTUREUNITS]; @@ -336,7 +336,7 @@ typedef ALIGN(struct DPSOFTRAST_State_s int drawclipped; int shader_mode; - int shader_permutation; + dpuint64 shader_permutation; int shader_exactspecularmath; int texture_max; @@ -1339,14 +1339,14 @@ void DPSOFTRAST_SetTexCoordPointer(int unitnum, int numcomponents, size_t stride dpsoftrast.stride_texcoord[unitnum] = (int)stride; } -DEFCOMMAND(18, SetShader, int mode; int permutation; int exactspecularmath;) +DEFCOMMAND(18, SetShader, int mode; dpuint64 permutation; int exactspecularmath;) static void DPSOFTRAST_Interpret_SetShader(DPSOFTRAST_State_Thread *thread, DPSOFTRAST_Command_SetShader *command) { thread->shader_mode = command->mode; thread->shader_permutation = command->permutation; thread->shader_exactspecularmath = command->exactspecularmath; } -void DPSOFTRAST_SetShader(int mode, int permutation, int exactspecularmath) +void DPSOFTRAST_SetShader(int mode, dpuint64 permutation, int exactspecularmath) { DPSOFTRAST_Command_SetShader *command = DPSOFTRAST_ALLOCATECOMMAND(SetShader); command->mode = mode; diff --git a/dpsoftrast.h b/dpsoftrast.h index 3f107a35..40c48b1e 100644 --- a/dpsoftrast.h +++ b/dpsoftrast.h @@ -322,7 +322,7 @@ typedef enum DPSOFTRAST_UNIFORM_e } DPSOFTRAST_UNIFORM; -void DPSOFTRAST_SetShader(int mode, int permutation, int exactspecularmath); +void DPSOFTRAST_SetShader(int mode, dpuint64 permutation, int exactspecularmath); #define DPSOFTRAST_Uniform1f(index, v0) DPSOFTRAST_Uniform4f(index, v0, 0, 0, 0) #define DPSOFTRAST_Uniform2f(index, v0, v1) DPSOFTRAST_Uniform4f(index, v0, v1, 0, 0) #define DPSOFTRAST_Uniform3f(index, v0, v1, v2) DPSOFTRAST_Uniform4f(index, v0, v1, v2, 0) diff --git a/gl_rmain.c b/gl_rmain.c index bd40407f..fc644c0a 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -751,7 +751,7 @@ typedef struct r_glsl_permutation_s /// hash lookup data struct r_glsl_permutation_s *hashnext; unsigned int mode; - unsigned int permutation; + dpuint64 permutation; /// indicates if we have tried compiling this permutation already qboolean compiled; @@ -962,7 +962,7 @@ qboolean R_CompileShader_CheckStaticParms(void) shaderstaticparmstrings_list[shaderstaticparms_count++] = "#define " n "\n"; \ else \ shaderstaticparmstrings_list[shaderstaticparms_count++] = "\n" -static void R_CompileShader_AddStaticParms(unsigned int mode, unsigned int permutation) +static void R_CompileShader_AddStaticParms(unsigned int mode, dpuint64 permutation) { shaderstaticparms_count = 0; @@ -990,7 +990,7 @@ r_glsl_permutation_t *r_glsl_permutation; /// storage for permutations linked in the hash table memexpandablearray_t r_glsl_permutationarray; -static r_glsl_permutation_t *R_GLSL_FindPermutation(unsigned int mode, unsigned int permutation) +static r_glsl_permutation_t *R_GLSL_FindPermutation(unsigned int mode, dpuint64 permutation) { //unsigned int hashdepth = 0; unsigned int hashindex = (permutation * 0x1021) & (SHADERPERMUTATION_HASHSIZE - 1); @@ -1074,7 +1074,7 @@ static char *ShaderModeInfo_GetShaderText(shadermodeinfo_t *modeinfo, qboolean p return Mem_strdup(r_main_mempool, modeinfo->builtinstring); } -static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode, unsigned int permutation) +static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode, dpuint64 permutation) { int i; int ubibind; @@ -1156,7 +1156,7 @@ static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode // now add all the permutation pretexts for (i = 0;i < SHADERPERMUTATION_COUNT;i++) { - if (permutation & (1<currentcolor; float ambientscale = rtlight->ambientscale; @@ -6820,7 +6820,7 @@ static void R_Bloom_MakeTexture(void) static void R_BlendView(int fbo, rtexture_t *depthtexture, rtexture_t *colortexture) { - unsigned int permutation; + dpuint64 permutation; float uservecs[4][4]; R_EntityMatrix(&identitymatrix); diff --git a/qtypes.h b/qtypes.h index e0ba637b..6c09614e 100644 --- a/qtypes.h +++ b/qtypes.h @@ -35,6 +35,9 @@ typedef bool qboolean; #define RESTRICT #endif +typedef long long dpint64; +typedef unsigned long long dpuint64; + // LordHavoc: upgrade the prvm to double precision for better time values // LordHavoc: to be enabled when bugs are worked out... //#define PRVM_64