Changeset 30885 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine
- Timestamp:
- Jul 16, 2010 5:11:31 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c
r28475 r30885 126 126 struct ps_compile_args ps_args; 127 127 UINT constant_version; 128 #ifdef VBOXWDDM 129 UINT inp2Fixup_info; 130 #else 128 131 const struct ps_np2fixup_info *np2Fixup_info; 132 #endif 129 133 }; 134 135 #ifdef VBOXWDDM 136 #define WINEFIXUPINFO_NOINDEX (~0UL) 137 #define WINEFIXUPINFO_GET(_p) get_fixup_info((const IWineD3DPixelShaderImpl*)(_p)->pshader, (_p)->inp2Fixup_info) 138 #define WINEFIXUPINFO_ISVALID(_p) ((_p)->inp2Fixup_info != WINEFIXUPINFO_NOINDEX) 139 #define WINEFIXUPINFO_INIT(_p) ((_p)->inp2Fixup_info == WINEFIXUPINFO_NOINDEX) 140 #else 141 #define WINEFIXUPINFO_GET(_p) ((_p)->np2Fixup_info) 142 #define WINEFIXUPINFO_ISVALID(_p) (!!(_p)->np2Fixup_info) 143 #define WINEFIXUPINFO_INIT(_p) ((_p)->np2Fixup_info == NULL) 144 #endif 130 145 131 146 typedef struct { … … 673 688 } 674 689 690 #ifdef VBOXWDDM 691 static const struct ps_np2fixup_info * get_fixup_info(const IWineD3DPixelShaderImpl *shader, UINT inp2fixup_info) 692 { 693 struct glsl_pshader_private *shader_data = shader->baseShader.backend_data; 694 695 if (inp2fixup_info == WINEFIXUPINFO_NOINDEX) 696 return NULL; 697 698 if (!shader->baseShader.backend_data) 699 { 700 ERR("no backend data\n"); 701 return NULL; 702 } 703 shader_data = shader->baseShader.backend_data; 704 705 if (inp2fixup_info >= shader_data->num_gl_shaders) 706 { 707 ERR("invalid index\n"); 708 return NULL; 709 } 710 711 return &shader_data->gl_shaders[inp2fixup_info].np2fixup; 712 } 713 #endif 714 675 715 /** 676 716 * Loads the texture dimensions for NP2 fixup into the currently set GLSL program. … … 702 742 GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS]; 703 743 744 const struct ps_np2fixup_info *np2Fixup_info = WINEFIXUPINFO_GET(prog); 745 704 746 for (i = 0; fixup; fixup >>= 1, ++i) { 705 const unsigned char idx = prog->np2Fixup_info->idx[i];747 const unsigned char idx = np2Fixup_info->idx[i]; 706 748 const IWineD3DBaseTextureImpl* const tex = (const IWineD3DBaseTextureImpl*) stateBlock->textures[i]; 707 749 GLfloat* tex_dim = &np2fixup_constants[(idx >> 1) * 4]; … … 719 761 } 720 762 721 GL_EXTCALL(glUniform4fvARB(prog->np2Fixup_location, prog->np2Fixup_info->num_consts, np2fixup_constants));763 GL_EXTCALL(glUniform4fvARB(prog->np2Fixup_location, np2Fixup_info->num_consts, np2fixup_constants)); 722 764 } 723 765 } … … 4136 4178 static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, 4137 4179 struct wined3d_shader_buffer *buffer, IWineD3DPixelShaderImpl *shader, 4138 const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info) 4180 const struct ps_compile_args *args, 4181 #ifdef VBOXWDDM 4182 UINT *inp2fixup_info 4183 #else 4184 const struct ps_np2fixup_info **np2fixup_info 4185 #endif 4186 ) 4139 4187 { 4140 4188 UINT i; … … 4162 4210 for(i = 0; i < shader_data->num_gl_shaders; i++) { 4163 4211 if(memcmp(&shader_data->gl_shaders[i].args, args, sizeof(*args)) == 0) { 4164 if(args->np2_fixup) *np2fixup_info = &shader_data->gl_shaders[i].np2fixup; 4212 if(args->np2_fixup) { 4213 #ifdef VBOXWDDM 4214 *inp2fixup_info = i; 4215 #else 4216 *np2fixup_info = &shader_data->gl_shaders[i].np2fixup; 4217 #endif 4218 } 4165 4219 return shader_data->gl_shaders[i].prgId; 4166 4220 } … … 4197 4251 shader_buffer_clear(buffer); 4198 4252 ret = shader_glsl_generate_pshader(context, buffer, shader, args, np2fixup); 4253 #ifdef VBOXWDDM 4254 *inp2fixup_info = shader_data->num_gl_shaders; 4255 #else 4256 *np2fixup_info = np2fixup; 4257 #endif 4199 4258 shader_data->gl_shaders[shader_data->num_gl_shaders++].prgId = ret; 4200 *np2fixup_info = np2fixup;4201 4259 4202 4260 return ret; … … 4318 4376 entry->ps_args = ps_compile_args; 4319 4377 entry->constant_version = 0; 4320 entry->np2Fixup_info = NULL;4378 WINEFIXUPINFO_INIT(entry); 4321 4379 /* Add the hash table entry */ 4322 4380 add_glsl_program_entry(priv, entry); … … 4371 4429 { 4372 4430 GLhandleARB pshader_id = find_glsl_pshader(context, &priv->shader_buffer, 4373 (IWineD3DPixelShaderImpl *)pshader, &ps_compile_args, &entry->np2Fixup_info); 4431 (IWineD3DPixelShaderImpl *)pshader, &ps_compile_args, 4432 #ifdef VBOXWDDM 4433 &entry->inp2Fixup_info 4434 #else 4435 &entry->np2Fixup_info 4436 #endif 4437 ); 4374 4438 TRACE("Attaching GLSL shader object %u to program %u\n", pshader_id, programId); 4375 4439 GL_EXTCALL(glAttachObjectARB(programId, pshader_id)); … … 4422 4486 4423 4487 if (ps_compile_args.np2_fixup) { 4424 if ( entry->np2Fixup_info) {4488 if (WINEFIXUPINFO_ISVALID(entry)) { 4425 4489 entry->np2Fixup_location = GL_EXTCALL(glGetUniformLocationARB(programId, "PsamplerNP2Fixup")); 4426 4490 } else { … … 4585 4649 * constants. This has to be done because it can't be guaranteed that sampler() (from state.c) is 4586 4650 * called between selecting the shader and using it, which results in wrong fixup for some frames. */ 4587 if (priv->glsl_program && priv->glsl_program->np2Fixup_info)4651 if (priv->glsl_program && WINEFIXUPINFO_ISVALID(priv->glsl_program)) 4588 4652 { 4589 4653 shader_glsl_load_np2fixup_constants((IWineD3DDevice *)device, usePS, useVS);
Note:
See TracChangeset
for help on using the changeset viewer.