VirtualBox

Ignore:
Timestamp:
Aug 27, 2010 5:00:41 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: wine: shared resource handling fixes

File:
1 edited

Legend:

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

    r31936 r32061  
    482482        return hr;
    483483    }
    484 #ifdef VBOXWDDM
    485     if (shared_handle && !*shared_handle)
    486     {
    487         *shared_handle = VBOXSHRC_GET_SHAREHANDLE(surface);
    488     }
    489 #endif
    490484
    491485    return hr;
     
    497491
    498492#if defined(DEBUG_misha) && defined (VBOXWDDM)
    499     if (VBOXSHRC_IS_SHARED(This))
     493    if (VBOXSHRC_IS_INITIALIZED(This))
    500494    {
    501495        Assert(0);
     
    20252019    ENTER_GL();
    20262020    glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
    2027     if(This->texture_name)
    2028     {
    2029         surface_bind_and_dirtify(This, FALSE);
    2030         glTexImage2D(This->texture_target, This->texture_level,
    2031                      GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
    2032     }
    2033     if(This->texture_name_srgb)
    2034     {
    2035         surface_bind_and_dirtify(This, TRUE);
    2036         glTexImage2D(This->texture_target, This->texture_level,
    2037                      GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
     2021#ifdef VBOXWDDM
     2022    if (!VBOXSHRC_IS_SHARED_OPENED(This))
     2023#endif
     2024    {
     2025        if(This->texture_name)
     2026        {
     2027            surface_bind_and_dirtify(This, FALSE);
     2028            glTexImage2D(This->texture_target, This->texture_level,
     2029                         GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
     2030        }
     2031        if(This->texture_name_srgb)
     2032        {
     2033            surface_bind_and_dirtify(This, TRUE);
     2034            glTexImage2D(This->texture_target, This->texture_level,
     2035                         GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
     2036        }
    20382037    }
    20392038    glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
     
    42804279        if(((This->Flags & SFLAG_INTEXTURE) && !(flag & SFLAG_INTEXTURE)) ||
    42814280           ((This->Flags & SFLAG_INSRGBTEX) && !(flag & SFLAG_INSRGBTEX))) {
    4282 #ifdef VBOXWDDM
    4283             if (VBOXSHRC_IS_SHARED(This))
    4284             {
    4285                 IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);
    4286             }
    4287             else
    4288 #endif
    42894281            if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture) == WINED3D_OK) {
    42904282                TRACE("Passing to container\n");
     
    42934285            }
    42944286        }
     4287
    42954288        This->Flags &= ~SFLAG_LOCATIONS;
    42964289        This->Flags |= flag;
     
    43044297    } else {
    43054298        if((This->Flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) && (flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))) {
    4306 #ifdef VBOXWDDM
    4307             if (VBOXSHRC_IS_SHARED(This))
    4308             {
    4309                 IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);
    4310             }
    4311             else
    4312 #endif
    43134299            if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&texture) == WINED3D_OK) {
    43144300                TRACE("Passing to container\n");
     
    43174303            }
    43184304        }
     4305
    43194306        This->Flags &= ~flag;
    43204307    }
     4308
     4309#ifdef VBOXWDDM
     4310    if(VBOXSHRC_IS_INITIALIZED(This)) {
     4311        /* with the shared resource only texture can be considered valid
     4312         * to make sure changes done to the resource in the other device context are visible
     4313         * because the resource contents is shared via texture.
     4314         * This is why we ensure texture location is the one and only which is always valid */
     4315        if(!(This->Flags & SFLAG_INTEXTURE)) {
     4316            IWineD3DSurfaceImpl_LoadLocation(iface, SFLAG_INTEXTURE, NULL);
     4317        } else {
     4318            This->Flags &= ~SFLAG_LOCATIONS;
     4319            This->Flags |= SFLAG_INTEXTURE;
     4320        }
     4321    }
     4322#endif
    43214323
    43224324    if(!(This->Flags & SFLAG_LOCATIONS)) {
     
    46194621    }
    46204622
    4621     if(rect == NULL) {
    4622         This->Flags |= flag;
    4623     }
    4624 
    4625     if (in_fbo && (This->Flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE))) {
    4626         /* With ORM_FBO, SFLAG_INTEXTURE and SFLAG_INDRAWABLE are the same for offscreen targets. */
    4627         This->Flags |= (SFLAG_INTEXTURE | SFLAG_INDRAWABLE);
     4623#ifdef VBOXWDDM
     4624    if (VBOXSHRC_IS_INITIALIZED(This))
     4625    {
     4626        /* with the shared resource only texture can be considered valid
     4627         * to make sure changes done to the resource in the other device context are visible
     4628         * because the resource contents is shared via texture.
     4629         * One can load and use other locations as needed,
     4630         * but they should be reloaded each time on each usage */
     4631        Assert(!!(This->Flags & SFLAG_INTEXTURE) || !!(flag & SFLAG_INTEXTURE));
     4632        This->Flags &= ~SFLAG_LOCATIONS;
     4633        This->Flags |= SFLAG_INTEXTURE;
     4634        /* @todo: SFLAG_INSRGBTEX ?? */
     4635//        if (in_fbo)
     4636//        {
     4637//            This->Flags |= SFLAG_INDRAWABLE;
     4638//        }
     4639    }
     4640    else
     4641#endif
     4642    {
     4643        if(rect == NULL) {
     4644            This->Flags |= flag;
     4645        }
     4646
     4647        if (in_fbo && (This->Flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE))) {
     4648            /* With ORM_FBO, SFLAG_INTEXTURE and SFLAG_INDRAWABLE are the same for offscreen targets. */
     4649            This->Flags |= (SFLAG_INTEXTURE | SFLAG_INDRAWABLE);
     4650        }
    46284651    }
    46294652
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