Changeset 35822 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c
- Timestamp:
- Feb 2, 2011 1:23:37 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note:
See TracChangeset
for help on using the changeset viewer.