Changeset 35822 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Feb 2, 2011 1:23:37 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/arb_program_shader.c
r33656 r35822 191 191 unsigned char numbumpenvmatconsts; 192 192 char num_int_consts; 193 const struct wined3d_context *context; 193 194 }; 194 195 … … 223 224 char need_color_unclamp; 224 225 UINT pos_fixup; 226 const struct wined3d_context *context; 225 227 }; 226 228 … … 4066 4068 4067 4069 /* GL locking is done by the caller */ 4068 static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *shader, const struct arb_ps_compile_args *args) 4070 static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *shader, 4071 const struct arb_ps_compile_args *args, const struct wined3d_context *context) 4069 4072 { 4070 4073 UINT i; … … 4104 4107 */ 4105 4108 for(i = 0; i < shader_data->num_gl_shaders; i++) { 4106 if(memcmp(&shader_data->gl_shaders[i].args, args, sizeof(*args)) == 0) { 4109 if(shader_data->gl_shaders[i].context==context 4110 && memcmp(&shader_data->gl_shaders[i].args, args, sizeof(*args)) == 0) { 4107 4111 return &shader_data->gl_shaders[i]; 4108 4112 } … … 4129 4133 } 4130 4134 4135 shader_data->gl_shaders[shader_data->num_gl_shaders].context = context; 4131 4136 shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; 4132 4137 … … 4161 4166 } 4162 4167 4163 static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl *shader, const struct arb_vs_compile_args *args) 4168 static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl *shader, 4169 const struct arb_vs_compile_args *args, const struct wined3d_context *context) 4164 4170 { 4165 4171 UINT i; … … 4183 4189 */ 4184 4190 for(i = 0; i < shader_data->num_gl_shaders; i++) { 4185 if (vs_args_equal(&shader_data->gl_shaders[i].args, args, 4186 use_map, gl_info->supported[NV_VERTEX_PROGRAM2_OPTION])) 4191 if (shader_data->gl_shaders[i].context==context 4192 && vs_args_equal(&shader_data->gl_shaders[i].args, args, 4193 use_map, gl_info->supported[NV_VERTEX_PROGRAM2_OPTION])) 4187 4194 { 4188 4195 return &shader_data->gl_shaders[i]; … … 4211 4218 } 4212 4219 4220 shader_data->gl_shaders[shader_data->num_gl_shaders].context = context; 4213 4221 shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; 4214 4222 … … 4378 4386 TRACE("Using pixel shader %p\n", This->stateBlock->pixelShader); 4379 4387 find_arb_ps_compile_args(ps, This->stateBlock, &compile_args); 4380 compiled = find_arb_pshader(ps, &compile_args );4388 compiled = find_arb_pshader(ps, &compile_args, context); 4381 4389 priv->current_fprogram_id = compiled->prgId; 4382 4390 priv->compiled_fprog = compiled; … … 4434 4442 TRACE("Using vertex shader %p\n", This->stateBlock->vertexShader); 4435 4443 find_arb_vs_compile_args(vs, This->stateBlock, &compile_args); 4436 compiled = find_arb_vshader(vs, &compile_args );4444 compiled = find_arb_vshader(vs, &compile_args, context); 4437 4445 priv->current_vprogram_id = compiled->prgId; 4438 4446 priv->compiled_vprog = compiled; … … 4530 4538 for (i = 0; i < shader_data->num_gl_shaders; ++i) 4531 4539 { 4532 GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); 4533 checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))"); 4540 if (shader_data->gl_shaders[i].context==context_get_current()) 4541 { 4542 GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); 4543 checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))"); 4544 } 4545 else 4546 { 4547 WARN("Attempting to delete fprog %u created in ctx %p from ctx %p\n", 4548 shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current()); 4549 } 4534 4550 } 4535 4551 LEAVE_GL(); … … 4556 4572 for (i = 0; i < shader_data->num_gl_shaders; ++i) 4557 4573 { 4558 GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); 4559 checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))"); 4574 if (shader_data->gl_shaders[i].context==context_get_current()) 4575 { 4576 GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId)); 4577 checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader_data->gl_shaders[i].prgId))"); 4578 } 4579 else 4580 { 4581 WARN("Attempting to delete vprog %u created in ctx %p from ctx %p\n", 4582 shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current()); 4583 } 4560 4584 } 4561 4585 LEAVE_GL(); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c
r35713 r35822 126 126 struct ps_compile_args ps_args; 127 127 UINT constant_version; 128 const struct wined3d_context *context; 128 129 #ifdef VBOX_WITH_WDDM 129 130 UINT inp2Fixup_info; … … 145 146 146 147 typedef struct { 147 IWineD3DVertexShader *vshader; 148 IWineD3DPixelShader *pshader; 149 struct ps_compile_args ps_args; 150 struct vs_compile_args vs_args; 148 IWineD3DVertexShader *vshader; 149 IWineD3DPixelShader *pshader; 150 struct ps_compile_args ps_args; 151 struct vs_compile_args vs_args; 152 const struct wined3d_context *context; 151 153 } glsl_program_key_t; 152 154 … … 162 164 struct ps_np2fixup_info np2fixup; 163 165 GLhandleARB prgId; 166 const struct wined3d_context *context; 164 167 }; 165 168 … … 174 177 struct vs_compile_args args; 175 178 GLhandleARB prgId; 179 const struct wined3d_context *context; 176 180 }; 177 181 … … 3667 3671 key.vs_args = entry->vs_args; 3668 3672 key.ps_args = entry->ps_args; 3673 key.context = entry->context; 3669 3674 3670 3675 if (wine_rb_put(&priv->program_lookup, &key, &entry->program_lookup_entry) == -1) … … 3676 3681 static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_priv *priv, 3677 3682 IWineD3DVertexShader *vshader, IWineD3DPixelShader *pshader, struct vs_compile_args *vs_args, 3678 struct ps_compile_args *ps_args ) {3683 struct ps_compile_args *ps_args, const struct wined3d_context *context) { 3679 3684 struct wine_rb_entry *entry; 3680 3685 glsl_program_key_t key; … … 3684 3689 key.vs_args = *vs_args; 3685 3690 key.ps_args = *ps_args; 3691 key.context = context; 3686 3692 3687 3693 entry = wine_rb_get(&priv->program_lookup, &key); … … 3699 3705 key.vs_args = entry->vs_args; 3700 3706 key.ps_args = entry->ps_args; 3707 key.context = entry->context; 3701 3708 wine_rb_remove(&priv->program_lookup, &key); 3702 3709 3703 TRACE("deleting program %u\n", entry->programId); 3704 GL_EXTCALL(glDeleteObjectARB(entry->programId)); 3705 checkGLcall("glDeleteObjectARB"); 3710 if (context_get_current() == entry->context) 3711 { 3712 TRACE("deleting program %u\n", entry->programId); 3713 GL_EXTCALL(glDeleteObjectARB(entry->programId)); 3714 checkGLcall("glDeleteObjectARB"); 3715 } 3716 else 3717 { 3718 WARN("Attempting to delete program %u created in ctx %p from ctx %p\n", entry->programId, entry->context, context_get_current()); 3719 } 3720 3706 3721 if (entry->vshader) list_remove(&entry->vshader_entry); 3707 3722 if (entry->pshader) list_remove(&entry->pshader_entry); … … 4252 4267 */ 4253 4268 for(i = 0; i < shader_data->num_gl_shaders; i++) { 4254 if(memcmp(&shader_data->gl_shaders[i].args, args, sizeof(*args)) == 0) { 4269 if(shader_data->gl_shaders[i].context==context 4270 && memcmp(&shader_data->gl_shaders[i].args, args, sizeof(*args)) == 0) { 4255 4271 if(args->np2_fixup) { 4256 4272 #ifdef VBOX_WITH_WDDM … … 4284 4300 } 4285 4301 4302 shader_data->gl_shaders[shader_data->num_gl_shaders].context = context; 4286 4303 shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; 4287 4304 … … 4338 4355 */ 4339 4356 for(i = 0; i < shader_data->num_gl_shaders; i++) { 4340 if(vs_args_equal(&shader_data->gl_shaders[i].args, args, use_map)) { 4357 if(shader_data->gl_shaders[i].context==context 4358 && vs_args_equal(&shader_data->gl_shaders[i].args, args, use_map)) { 4341 4359 return shader_data->gl_shaders[i].prgId; 4342 4360 } … … 4364 4382 } 4365 4383 4384 shader_data->gl_shaders[shader_data->num_gl_shaders].context = context; 4366 4385 shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; 4367 4386 … … 4401 4420 if (pshader) find_ps_compile_args((IWineD3DPixelShaderImpl *)pshader, device->stateBlock, &ps_compile_args); 4402 4421 4403 entry = get_glsl_program_entry(priv, vshader, pshader, &vs_compile_args, &ps_compile_args );4422 entry = get_glsl_program_entry(priv, vshader, pshader, &vs_compile_args, &ps_compile_args, context); 4404 4423 if (entry) { 4405 4424 priv->glsl_program = entry; … … 4413 4432 /* Create the entry */ 4414 4433 entry = HeapAlloc(GetProcessHeap(), 0, sizeof(struct glsl_shader_prog_link)); 4434 entry->context = context; 4415 4435 entry->programId = programId; 4416 4436 entry->vshader = vshader; … … 4812 4832 ENTER_GL(); 4813 4833 for(i = 0; i < shader_data->num_gl_shaders; i++) { 4814 TRACE("deleting pshader %u\n", shader_data->gl_shaders[i].prgId); 4815 GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId)); 4816 checkGLcall("glDeleteObjectARB"); 4834 if (shader_data->gl_shaders[i].context==context_get_current()) 4835 { 4836 TRACE("deleting pshader %u\n", shader_data->gl_shaders[i].prgId); 4837 GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId)); 4838 checkGLcall("glDeleteObjectARB"); 4839 } 4840 else 4841 { 4842 WARN("Attempting to delete pshader %u created in ctx %p from ctx %p\n", 4843 shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current()); 4844 } 4817 4845 } 4818 4846 LEAVE_GL(); … … 4826 4854 ENTER_GL(); 4827 4855 for(i = 0; i < shader_data->num_gl_shaders; i++) { 4828 TRACE("deleting vshader %u\n", shader_data->gl_shaders[i].prgId); 4829 GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId)); 4830 checkGLcall("glDeleteObjectARB"); 4856 if (shader_data->gl_shaders[i].context==context_get_current()) 4857 { 4858 TRACE("deleting vshader %u\n", shader_data->gl_shaders[i].prgId); 4859 GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId)); 4860 checkGLcall("glDeleteObjectARB"); 4861 } 4862 else 4863 { 4864 WARN("Attempting to delete vshader %u created in ctx %p from ctx %p\n", 4865 shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current()); 4866 } 4831 4867 } 4832 4868 LEAVE_GL(); … … 4846 4882 const struct glsl_shader_prog_link, program_lookup_entry); 4847 4883 int cmp; 4884 4885 if (k->context > prog->context) return 1; 4886 else if (k->context < prog->context) return -1; 4848 4887 4849 4888 if (k->vshader > prog->vshader) return 1; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r35720 r35822 709 709 }; 710 710 711 struct wined3d_context; 712 711 713 /* Stateblock dependent parameters which have to be hardcoded 712 714 * into the shader code … … 736 738 WORD swizzle_map; /* MAX_ATTRIBS, 16 */ 737 739 }; 738 739 struct wined3d_context;740 740 741 741 typedef struct {
Note:
See TracChangeset
for help on using the changeset viewer.