Changeset 39044 in vbox for trunk/src/VBox/Additions/WINNT/Graphics
- Timestamp:
- Oct 19, 2011 5:41:52 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/VBoxDispD3D.cpp
r38988 r39044 1631 1631 } 1632 1632 1633 static HRESULT vboxWddmMemsetAlloc(PVBOXWDDMDISP_RESOURCE pRc, UINT iAlloc, char c) 1634 { 1635 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[iAlloc]; 1636 IDirect3DSurface9 *pD3D9Surf = NULL; 1637 HRESULT hr = vboxWddmSurfGet(pRc, iAlloc, &pD3D9Surf); 1638 if (SUCCEEDED(hr)) 1639 { 1640 PVBOXWDDMDISP_DEVICE pDevice = pRc->pDevice; 1641 hr = pRc->pDevice->pDevice9If->ColorFill(pD3D9Surf, NULL, D3DCOLOR_ARGB(c,c,c,c)); 1642 pD3D9Surf->Release(); 1643 if (SUCCEEDED(hr)) 1644 { 1645 return hr; 1646 } 1647 1648 WARN(("ColorFill failed, hr 0x%x", hr)); 1649 /* fallback to lock-memset-unlock */ 1650 } 1651 1652 /* unless this is a fallback */ 1653 Assert(pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_VERTEXBUFFER 1654 || pAlloc->enmD3DIfType == VBOXDISP_D3DIFTYPE_INDEXBUFFER); 1655 1656 D3DLOCKED_RECT Rect; 1657 hr = vboxWddmLockRect(pRc, iAlloc, &Rect, NULL, D3DLOCK_DISCARD); 1658 if (FAILED(hr)) 1659 { 1660 WARN(("vboxWddmLockRect failed, hr(0x%x)", hr)); 1661 return hr; 1662 } 1663 1664 UINT cbAllocPitch = pAlloc->SurfDesc.pitch; 1665 if(Rect.Pitch == cbAllocPitch) 1666 { 1667 memset(Rect.pBits, 0, Rect.Pitch * pAlloc->SurfDesc.height); 1668 } 1669 else 1670 { 1671 Assert(0); 1672 Assert(cbAllocPitch < (UINT)Rect.Pitch); 1673 uint8_t *pData = (uint8_t*)Rect.pBits; 1674 for (UINT j = 0; j < pAlloc->SurfDesc.height; ++j) 1675 { 1676 memset(Rect.pBits, c, cbAllocPitch); 1677 pData += Rect.Pitch; 1678 } 1679 } 1680 1681 hr = vboxWddmUnlockRect(pRc, iAlloc); 1682 Assert(SUCCEEDED(hr)); 1683 1684 return S_OK; 1685 } 1686 1633 1687 static HRESULT vboxWddmMemsetRc(PVBOXWDDMDISP_RESOURCE pRc, char c) 1634 1688 { 1689 HRESULT hr = S_OK; 1635 1690 for (UINT i = 0; i < pRc->cAllocations; ++i) 1636 1691 { 1637 D3DLOCKED_RECT Rect; 1638 HRESULT hr = vboxWddmLockRect(pRc, i, &Rect, NULL, D3DLOCK_DISCARD); 1692 hr = vboxWddmMemsetAlloc(pRc, i, c); 1639 1693 if (FAILED(hr)) 1640 1694 { 1641 WARN(("vboxWddm LockRectfailed, hr(0x%x)", hr));1695 WARN(("vboxWddmMemsetAlloc failed, hr(0x%x)", hr)); 1642 1696 return hr; 1643 1697 } 1644 1645 PVBOXWDDMDISP_ALLOCATION pAlloc = &pRc->aAllocations[i];1646 UINT cbAllocPitch = pAlloc->SurfDesc.pitch;1647 if(Rect.Pitch == cbAllocPitch)1648 {1649 memset(Rect.pBits, 0, Rect.Pitch * pAlloc->SurfDesc.height);1650 }1651 else1652 {1653 Assert(0);1654 Assert(cbAllocPitch < (UINT)Rect.Pitch);1655 uint8_t *pData = (uint8_t*)Rect.pBits;1656 for (UINT j = 0; j < pAlloc->SurfDesc.height; ++j)1657 {1658 memset(Rect.pBits, c, cbAllocPitch);1659 pData += Rect.Pitch;1660 }1661 }1662 1663 hr = vboxWddmUnlockRect(pRc, i);1664 Assert(SUCCEEDED(hr));1665 1698 } 1666 1699 return S_OK; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/surface.c
r39016 r39044 1262 1262 context = device->contexts[i]; 1263 1263 /* pretty hacky, @todo: check if the context is acquired and re-acquire it with the new swapchain */ 1264 if (context->current_rt == This)1264 if (context->current_rt == (IWineD3DSurface*)This) 1265 1265 { 1266 1266 context->current_rt = NULL; … … 1807 1807 1808 1808 surface_prepare_texture(This, gl_info, FALSE); 1809 surface_bind_and_dirtify(This, FALSE); 1809 /* no need to bind it here */ 1810 // surface_bind_and_dirtify(This, FALSE); 1810 1811 1811 1812 if (context) context_release(context); … … 4804 4805 } 4805 4806 } 4807 4808 #ifdef VBOX_WITH_WDDM 4809 { 4810 /* sometimes wine can call ModifyLocation(SFLAG_INTEXTURE, TRUE) for surfaces that do not yet have 4811 * ogl texture backend assigned, e.g. when doing ColorFill right after surface creation 4812 * to prevent wine state breakage that could occur later on in that case, we check 4813 * whether tex gen is needed here and generate it accordingly */ 4814 if (!This->texture_name) 4815 { 4816 Assert(!(This->Flags & SFLAG_INTEXTURE)); 4817 if (flag & SFLAG_INTEXTURE) 4818 { 4819 struct wined3d_context *context = NULL; 4820 IWineD3DDeviceImpl *device = This->resource.device; 4821 const struct wined3d_gl_info *gl_info; 4822 4823 if (!device->isInDraw) context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 4824 gl_info = context->gl_info; 4825 4826 surface_prepare_texture(This, gl_info, FALSE); 4827 4828 if (context) context_release(context); 4829 } 4830 } 4831 4832 if (!This->texture_name_srgb) 4833 { 4834 Assert(!(This->Flags & SFLAG_INSRGBTEX)); 4835 if (flag & SFLAG_INSRGBTEX) 4836 { 4837 struct wined3d_context *context = NULL; 4838 IWineD3DDeviceImpl *device = This->resource.device; 4839 const struct wined3d_gl_info *gl_info; 4840 4841 if (!device->isInDraw) context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); 4842 gl_info = context->gl_info; 4843 4844 surface_prepare_texture(This, gl_info, TRUE); 4845 4846 if (context) context_release(context); 4847 } 4848 } 4849 } 4850 #endif 4806 4851 4807 4852 This->Flags &= ~SFLAG_LOCATIONS;
Note:
See TracChangeset
for help on using the changeset viewer.