From 6fd4f8f6990426f9cb954f91420602ec33971738 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Tue, 6 Nov 2007 23:36:10 +0100 Subject: [PATCH] wined3d: Store integer uniform locations. --- dlls/wined3d/glsl_shader.c | 44 ++++++++++++++++++++---------------------- dlls/wined3d/wined3d_private.h | 2 ++ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 22e3dd05c76..ee9403789a4 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -230,15 +230,12 @@ static void shader_glsl_load_constantsI( IWineD3DBaseShaderImpl* This, WineD3D_GL_Info *gl_info, GLhandleARB programId, + GLhandleARB locations[MAX_CONST_I], unsigned max_constants, int* constants, BOOL* constants_set) { - GLhandleARB tmp_loc; int i; - char tmp_name[8]; - char is_pshader = shader_is_pshader_version(This->baseShader.hex_version); - const char* prefix = is_pshader? "PI":"VI"; struct list* ptr; for (i=0; ibaseShader.constantsI, ptr); } } @@ -375,7 +362,8 @@ void shader_glsl_load_constants( stateBlock->vertexShaderConstantF, constant_locations, constant_list); /* Load DirectX 9 integer constants/uniforms for vertex shader */ - shader_glsl_load_constantsI(vshader, gl_info, programId, MAX_CONST_I, + shader_glsl_load_constantsI(vshader, gl_info, programId, + prog->vuniformI_locations, MAX_CONST_I, stateBlock->vertexShaderConstantI, stateBlock->changed.vertexShaderConstantsI); @@ -393,7 +381,7 @@ void shader_glsl_load_constants( IWineD3DBaseShaderImpl* pshader = (IWineD3DBaseShaderImpl*) stateBlock->pixelShader; - constant_locations = stateBlock->glsl_program->puniformF_locations; + constant_locations = prog->puniformF_locations; constant_list = &stateBlock->set_pconstantsF; /* Load pixel shader samplers */ @@ -404,7 +392,8 @@ void shader_glsl_load_constants( stateBlock->pixelShaderConstantF, constant_locations, constant_list); /* Load DirectX 9 integer constants/uniforms for pixel shader */ - shader_glsl_load_constantsI(pshader, gl_info, programId, MAX_CONST_I, + shader_glsl_load_constantsI(pshader, gl_info, programId, + prog->puniformI_locations, MAX_CONST_I, stateBlock->pixelShaderConstantI, stateBlock->changed.pixelShaderConstantsI); @@ -3036,11 +3025,19 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use snprintf(glsl_name, sizeof(glsl_name), "VC[%i]", i); entry->vuniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); } + for (i = 0; i < MAX_CONST_I; ++i) { + snprintf(glsl_name, sizeof(glsl_name), "VI[%i]", i); + entry->vuniformI_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); + } entry->puniformF_locations = HeapAlloc(GetProcessHeap(), 0, sizeof(GLhandleARB) * GL_LIMITS(pshader_constantsF)); for (i = 0; i < GL_LIMITS(pshader_constantsF); ++i) { snprintf(glsl_name, sizeof(glsl_name), "PC[%i]", i); entry->puniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); } + for (i = 0; i < MAX_CONST_I; ++i) { + snprintf(glsl_name, sizeof(glsl_name), "PI[%i]", i); + entry->puniformI_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); + } entry->posFixup_location = GL_EXTCALL(glGetUniformLocationARB(programId, "posFixup")); entry->bumpenvmat_location = GL_EXTCALL(glGetUniformLocationARB(programId, "bumpenvmat")); @@ -3049,6 +3046,7 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use entry->srgb_comparison_location = GL_EXTCALL(glGetUniformLocationARB(programId, "srgb_comparison")); entry->srgb_mul_low_location = GL_EXTCALL(glGetUniformLocationARB(programId, "srgb_mul_low")); entry->ycorrection_location = GL_EXTCALL(glGetUniformLocationARB(programId, "ycorrection")); + checkGLcall("Find glsl program uniform locations"); } static GLhandleARB create_glsl_blt_shader(WineD3D_GL_Info *gl_info) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8bff54d184c..4100ad9d735 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1611,6 +1611,8 @@ struct glsl_shader_prog_link { GLhandleARB programId; GLhandleARB *vuniformF_locations; GLhandleARB *puniformF_locations; + GLhandleARB vuniformI_locations[MAX_CONST_I]; + GLhandleARB puniformI_locations[MAX_CONST_I]; GLhandleARB posFixup_location; GLhandleARB bumpenvmat_location; GLhandleARB luminancescale_location; -- 2.11.4.GIT