Changeset 32577 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine
- Timestamp:
- Sep 16, 2010 6:11:27 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/context.c
r32546 r32577 855 855 context_validate(context 856 856 #ifdef VBOXWDDM/* tmp work-around */ 857 , context->device->swapchains[context->device->NumberOfSwapChains-1]857 , (IWineD3DSwapChainImpl*)context->device->swapchains[context->device->NumberOfSwapChains-1] 858 858 #endif 859 859 ); … … 1293 1293 HDC hdc; 1294 1294 1295 #if defined(VBOXWDDM) && defined(DEBUG_misha) 1296 Assert(0); 1297 #endif 1298 1295 1299 TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle); 1296 1300 … … 1592 1596 #ifdef VBOXWDDM 1593 1597 static void context_setup_target(IWineD3DDeviceImpl *device, struct wined3d_context *context, IWineD3DSurface *target); 1598 static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceImpl *device, enum ContextUsage usage); 1599 1600 BOOL context_acquire_context(struct wined3d_context * context, IWineD3DSurface *target, enum ContextUsage usage, BOOL bReValidate) 1601 { 1602 IWineD3DDeviceImpl *device = context->device; 1603 struct wined3d_context *current_context = context_get_current(); 1604 if (bReValidate) 1605 { 1606 IWineD3DSwapChain *swapchain = NULL; 1607 if (target && SUCCEEDED(IWineD3DSurface_GetContainer(target, &IID_IWineD3DSwapChain, (void **)&swapchain))) { 1608 context_validate(current_context, (IWineD3DSwapChainImpl*)swapchain); 1609 IWineD3DSwapChain_Release(swapchain); 1610 } 1611 else { 1612 /* tmp work-around */ 1613 context_validate(current_context, (IWineD3DSwapChainImpl*)current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]); 1614 } 1615 } 1616 context_setup_target(device, context, target); 1617 context_enter(context); 1618 Assert(context->valid); 1619 if (!context->valid) return FALSE; 1620 1621 if (context != current_context) 1622 { 1623 if (!context_set_current(context)) ERR("Failed to activate the new context.\n"); 1624 else device->frag_pipe->enable_extension((IWineD3DDevice *)device, !context->last_was_blit); 1625 1626 if (context->vshader_const_dirty) 1627 { 1628 memset(context->vshader_const_dirty, 1, 1629 sizeof(*context->vshader_const_dirty) * device->d3d_vshader_constantF); 1630 device->highest_dirty_vs_const = device->d3d_vshader_constantF; 1631 } 1632 if (context->pshader_const_dirty) 1633 { 1634 memset(context->pshader_const_dirty, 1, 1635 sizeof(*context->pshader_const_dirty) * device->d3d_pshader_constantF); 1636 device->highest_dirty_ps_const = device->d3d_pshader_constantF; 1637 } 1638 } 1639 else if (context->restore_ctx) 1640 { 1641 if (!pwglMakeCurrent(context->hdc, context->glCtx)) 1642 { 1643 DWORD err = GetLastError(); 1644 ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", 1645 context->hdc, context->glCtx, err); 1646 } 1647 } 1648 1649 context_apply_state(context, device, usage); 1650 1651 return TRUE; 1652 } 1594 1653 1595 1654 struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, 1596 1655 const struct wined3d_format_desc *ds_format_desc) 1597 1656 { 1598 inti;1657 UINT i; 1599 1658 DWORD tid = GetCurrentThreadId(); 1600 1659 struct wined3d_context *context = NULL; … … 1619 1678 else 1620 1679 { 1621 context_validate(context, swapchain); 1622 context_setup_target(device, context, target); 1623 context_enter(context); 1624 Assert(context->valid); 1680 if(!context_acquire_context(context, (IWineD3DSurface*)target, CTXUSAGE_RESOURCELOAD, TRUE)) 1681 { 1682 ERR("Failed to acquire the context.\n"); 1683 Assert(0); 1684 Assert(!context->valid); 1685 context = NULL; 1686 } 1687 else 1688 { 1689 Assert(context->valid); 1690 } 1625 1691 } 1626 1692 … … 1970 2036 { 1971 2037 #ifdef VBOXWDDM 1972 IWineD3DSwapChain Impl*swapchain = NULL;2038 IWineD3DSwapChain *swapchain = NULL; 1973 2039 if (SUCCEEDED(IWineD3DSurface_GetContainer(target, &IID_IWineD3DSwapChain, (void **)&swapchain))) { 1974 context_validate(current_context, swapchain);2040 context_validate(current_context, (IWineD3DSwapChainImpl*)swapchain); 1975 2041 IWineD3DSwapChain_Release(swapchain); 1976 2042 } 1977 2043 else { 1978 2044 /* tmp work-around */ 1979 context_validate(current_context, current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]);2045 context_validate(current_context, (IWineD3DSwapChainImpl*)current_context->device->swapchains[current_context->device->NumberOfSwapChains-1]); 1980 2046 } 1981 2047 #else … … 1990 2056 context = findThreadContextForSwapChain(swapchain, tid); 1991 2057 #ifdef VBOXWDDM 1992 context_validate(context, swapchain);2058 context_validate(context, (IWineD3DSwapChainImpl*)swapchain); 1993 2059 #endif 1994 2060 IWineD3DSwapChain_Release(swapchain); … … 2025 2091 #ifdef VBOXWDDM 2026 2092 context_validate(context, 2027 This->swapchains[This->NumberOfSwapChains-1] /* tmp work-around */2093 (IWineD3DSwapChainImpl*)This->swapchains[This->NumberOfSwapChains-1] /* tmp work-around */ 2028 2094 ); 2029 2095 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/device.c
r32545 r32577 6863 6863 static HRESULT WINAPI IWineD3DDeviceImpl_Flush(IWineD3DDevice *iface) 6864 6864 { 6865 IWineD3DSwapChain *swapChain = NULL; 6865 IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; 6866 struct wined3d_context *context; 6866 6867 int i; 6867 int swapchains = IWineD3DDeviceImpl_GetNumberOfSwapChains(iface); 6868 6869 TRACE("iface %p.\n", iface); 6870 6871 for(i = 0 ; i < swapchains ; i ++) { 6872 6873 IWineD3DDeviceImpl_GetSwapChain(iface, i, &swapChain); 6874 TRACE("presentinng chain %d, %p\n", i, swapChain); 6875 IWineD3DSwapChain_Flush(swapChain); 6876 IWineD3DSwapChain_Release(swapChain); 6877 } 6878 6868 for (i = 0; i < This->numContexts; ++i) 6869 { 6870 context = This->contexts[i]; 6871 if (context_acquire_context(context, NULL, CTXUSAGE_RESOURCELOAD, TRUE)) 6872 { 6873 Assert(context->valid); 6874 wglFlush(); 6875 context_release(context); 6876 } 6877 else 6878 { 6879 WARN("Invalid context, skipping flush.\n"); 6880 } 6881 } 6879 6882 return WINED3D_OK; 6880 6883 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain.c
r32545 r32577 555 555 } 556 556 557 #ifdef VBOXWDDM558 static HRESULT WINAPI IWineD3DSwapChainImpl_Flush(IWineD3DSwapChain *iface)559 {560 IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;561 struct wined3d_context *context;562 RECT src_rect, dst_rect;563 BOOL render_to_fbo;564 unsigned int sync;565 int retval;566 567 context = context_acquire(This->device, This->backBuffer[0], CTXUSAGE_RESOURCELOAD);568 569 if (context->valid) wglFlush();570 else WARN("Invalid context, skipping flush.\n");571 572 context_release(context);573 574 return WINED3D_OK;575 }576 #endif577 578 557 static const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl = 579 558 { … … 595 574 IWineD3DBaseSwapChainImpl_SetGammaRamp, 596 575 IWineD3DBaseSwapChainImpl_GetGammaRamp, 597 #ifdef VBOXWDDM598 IWineD3DSwapChainImpl_Flush,599 #endif600 576 }; 601 577 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/swapchain_gdi.c
r32545 r32577 254 254 return WINED3D_OK; 255 255 } 256 257 #ifdef VBOXWDDM258 static HRESULT WINAPI IWineGDISwapChainImpl_Flush(IWineD3DSwapChain *iface) {259 IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface;260 261 WARN("GDI Swapchain doesn't implement flush, returning WINED3DERR_INVALIDCALL\n");262 return WINED3DERR_INVALIDCALL;263 }264 #endif265 256 266 257 const IWineD3DSwapChainVtbl IWineGDISwapChain_Vtbl = … … 283 274 IWineD3DBaseSwapChainImpl_SetGammaRamp, 284 275 IWineD3DBaseSwapChainImpl_GetGammaRamp, 285 #ifdef VBOXWDM286 IWineGDISwapChainImpl_Flush,287 #endif288 276 }; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/wined3d_private.h
r32545 r32577 1249 1249 struct wined3d_context *context_find_create(IWineD3DDeviceImpl *device, IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, 1250 1250 const struct wined3d_format_desc *ds_format_desc) DECLSPEC_HIDDEN; 1251 BOOL context_acquire_context(struct wined3d_context * context, IWineD3DSurface *target, enum ContextUsage usage, BOOL bReValidate) DECLSPEC_HIDDEN; 1251 1252 #endif 1252 1253 void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN;
Note:
See TracChangeset
for help on using the changeset viewer.