VirtualBox

Ignore:
Timestamp:
Feb 2, 2011 1:23:37 PM (14 years ago)
Author:
vboxsync
Message:

wined3d: properly recreate shaders if multiply swapchains are used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c

    r35713 r35822  
    126126    struct ps_compile_args      ps_args;
    127127    UINT                        constant_version;
     128    const struct wined3d_context *context;
    128129#ifdef VBOX_WITH_WDDM
    129130    UINT                        inp2Fixup_info;
     
    145146
    146147typedef 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;
    151153} glsl_program_key_t;
    152154
     
    162164    struct ps_np2fixup_info         np2fixup;
    163165    GLhandleARB                     prgId;
     166    const struct wined3d_context    *context;
    164167};
    165168
     
    174177    struct vs_compile_args          args;
    175178    GLhandleARB                     prgId;
     179    const struct wined3d_context    *context;
    176180};
    177181
     
    36673671    key.vs_args = entry->vs_args;
    36683672    key.ps_args = entry->ps_args;
     3673    key.context = entry->context;
    36693674
    36703675    if (wine_rb_put(&priv->program_lookup, &key, &entry->program_lookup_entry) == -1)
     
    36763681static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_priv *priv,
    36773682        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) {
    36793684    struct wine_rb_entry *entry;
    36803685    glsl_program_key_t key;
     
    36843689    key.vs_args = *vs_args;
    36853690    key.ps_args = *ps_args;
     3691    key.context = context;
    36863692
    36873693    entry = wine_rb_get(&priv->program_lookup, &key);
     
    36993705    key.vs_args = entry->vs_args;
    37003706    key.ps_args = entry->ps_args;
     3707    key.context = entry->context;
    37013708    wine_rb_remove(&priv->program_lookup, &key);
    37023709
    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   
    37063721    if (entry->vshader) list_remove(&entry->vshader_entry);
    37073722    if (entry->pshader) list_remove(&entry->pshader_entry);
     
    42524267     */
    42534268    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) {
    42554271            if(args->np2_fixup) {
    42564272#ifdef VBOX_WITH_WDDM
     
    42844300    }
    42854301
     4302    shader_data->gl_shaders[shader_data->num_gl_shaders].context = context;
    42864303    shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args;
    42874304
     
    43384355     */
    43394356    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)) {
    43414359            return shader_data->gl_shaders[i].prgId;
    43424360        }
     
    43644382    }
    43654383
     4384    shader_data->gl_shaders[shader_data->num_gl_shaders].context = context;
    43664385    shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args;
    43674386
     
    44014420    if (pshader) find_ps_compile_args((IWineD3DPixelShaderImpl *)pshader, device->stateBlock, &ps_compile_args);
    44024421
    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);
    44044423    if (entry) {
    44054424        priv->glsl_program = entry;
     
    44134432    /* Create the entry */
    44144433    entry = HeapAlloc(GetProcessHeap(), 0, sizeof(struct glsl_shader_prog_link));
     4434    entry->context = context;
    44154435    entry->programId = programId;
    44164436    entry->vshader = vshader;
     
    48124832        ENTER_GL();
    48134833        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            }
    48174845        }
    48184846        LEAVE_GL();
     
    48264854        ENTER_GL();
    48274855        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            }
    48314867        }
    48324868        LEAVE_GL();
     
    48464882            const struct glsl_shader_prog_link, program_lookup_entry);
    48474883    int cmp;
     4884
     4885    if (k->context > prog->context) return 1;
     4886    else if (k->context < prog->context) return -1;
    48484887
    48494888    if (k->vshader > prog->vshader) return 1;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette