Changeset 102626 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Dec 17, 2023 3:39:15 PM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp
r102622 r102626 404 404 /* Static function prototypes. */ 405 405 static int dxDeviceFlush(DXDEVICE *pDevice); 406 static int dxDefineUnorderedAccessView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId, SVGACOTableDXUAViewEntry const *pEntry);407 static int dxDefineRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGACOTableDXRTViewEntry const *pEntry);408 static int dxDefineDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId, SVGACOTableDXDSViewEntry const *pEntry);409 406 static int dxSetRenderTargets(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext); 410 407 static int dxSetCSUnorderedAccessViews(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext); … … 1645 1642 1646 1643 1647 static SVGACOTableDXSRViewEntry const *dxGetShaderResourceViewEntry(PVMSVGA3DDXCONTEXT pDXContext, uint32_t shaderResourceViewId)1648 {1649 ASSERT_GUEST_RETURN(shaderResourceViewId < pDXContext->cot.cSRView, NULL);1650 1651 SVGACOTableDXSRViewEntry const *pSRViewEntry = &pDXContext->cot.paSRView[shaderResourceViewId];1652 return pSRViewEntry;1653 }1654 1655 1656 static SVGACOTableDXUAViewEntry const *dxGetUnorderedAccessViewEntry(PVMSVGA3DDXCONTEXT pDXContext, uint32_t uaViewId)1657 {1658 ASSERT_GUEST_RETURN(uaViewId < pDXContext->cot.cUAView, NULL);1659 1660 SVGACOTableDXUAViewEntry const *pUAViewEntry = &pDXContext->cot.paUAView[uaViewId];1661 return pUAViewEntry;1662 }1663 1664 1665 static SVGACOTableDXDSViewEntry const *dxGetDepthStencilViewEntry(PVMSVGA3DDXCONTEXT pDXContext, uint32_t depthStencilViewId)1666 {1667 ASSERT_GUEST_RETURN(depthStencilViewId < pDXContext->cot.cDSView, NULL);1668 1669 SVGACOTableDXDSViewEntry const *pDSViewEntry = &pDXContext->cot.paDSView[depthStencilViewId];1670 return pDSViewEntry;1671 }1672 1673 1674 static SVGACOTableDXRTViewEntry const *dxGetRenderTargetViewEntry(PVMSVGA3DDXCONTEXT pDXContext, uint32_t renderTargetViewId)1675 {1676 ASSERT_GUEST_RETURN(renderTargetViewId < pDXContext->cot.cRTView, NULL);1677 1678 SVGACOTableDXRTViewEntry const *pRTViewEntry = &pDXContext->cot.paRTView[renderTargetViewId];1679 return pRTViewEntry;1680 }1681 1682 1683 1644 static int dxTrackRenderTargets(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext) 1684 1645 { … … 6501 6462 break; 6502 6463 } 6464 case DXGI_FORMAT_R8G8B8A8_SINT: 6465 { 6466 uint8_t const *pValues = (uint8_t const *)pvElementData; 6467 Log8(("{ /*8sint*/ %d, %d, %d, %d },", 6468 pValues[0], pValues[1], pValues[2], pValues[3])); 6469 break; 6470 } 6471 case DXGI_FORMAT_R8G8B8A8_UINT: 6472 { 6473 uint8_t const *pValues = (uint8_t const *)pvElementData; 6474 Log8(("{ /*8uint*/ %u, %u, %u, %u },", 6475 pValues[0], pValues[1], pValues[2], pValues[3])); 6476 break; 6477 } 6503 6478 case DXGI_FORMAT_R8G8B8A8_UNORM: 6504 6479 { … … 6782 6757 6783 6758 6784 static int dxCreate ShaderResourceView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderResourceViewId shaderResourceViewId, SVGACOTableDXSRViewEntry const *pEntry)6759 static int dxCreateRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGACOTableDXRTViewEntry const *pEntry) 6785 6760 { 6786 6761 PVMSVGA3DSURFACE pSurface; … … 6789 6764 AssertRCReturn(rc, rc); 6790 6765 6766 DXVIEW *pView = &pDXContext->pBackendDXContext->paRenderTargetView[renderTargetViewId]; 6767 Assert(pView->u.pView == NULL); 6768 6769 ID3D11RenderTargetView *pRenderTargetView; 6770 HRESULT hr = dxRenderTargetViewCreate(pThisCC, pDXContext, pEntry, pSurface, &pRenderTargetView); 6771 AssertReturn(SUCCEEDED(hr), VERR_INVALID_STATE); 6772 6773 return dxViewInit(pView, pSurface, pDXContext, renderTargetViewId, VMSVGA3D_VIEWTYPE_RENDERTARGET, pRenderTargetView); 6774 } 6775 6776 6777 static int dxEnsureRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId viewId, DXVIEW **ppResult) 6778 { 6779 ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cRTView, VERR_INVALID_PARAMETER); 6780 6781 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paRenderTargetView[viewId]; 6782 if (!pDXView->u.pView) 6783 { 6784 SVGACOTableDXRTViewEntry const *pEntry = &pDXContext->cot.paRTView[viewId]; 6785 int rc = dxCreateRenderTargetView(pThisCC, pDXContext, viewId, pEntry); 6786 AssertRCReturn(rc, rc); 6787 } 6788 *ppResult = pDXView; 6789 return VINF_SUCCESS; 6790 } 6791 6792 6793 static int dxCreateDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId, SVGACOTableDXDSViewEntry const *pEntry) 6794 { 6795 PVMSVGA3DSURFACE pSurface; 6796 ID3D11Resource *pResource; 6797 int rc = dxEnsureResource(pThisCC, pDXContext, pEntry->sid, &pSurface, &pResource); 6798 AssertRCReturn(rc, rc); 6799 6800 DXVIEW *pView = &pDXContext->pBackendDXContext->paDepthStencilView[depthStencilViewId]; 6801 Assert(pView->u.pView == NULL); 6802 6803 ID3D11DepthStencilView *pDepthStencilView; 6804 HRESULT hr = dxDepthStencilViewCreate(pThisCC, pDXContext, pEntry, pSurface, &pDepthStencilView); 6805 AssertReturn(SUCCEEDED(hr), VERR_INVALID_STATE); 6806 6807 return dxViewInit(pView, pSurface, pDXContext, depthStencilViewId, VMSVGA3D_VIEWTYPE_DEPTHSTENCIL, pDepthStencilView); 6808 } 6809 6810 6811 static int dxEnsureDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId viewId, DXVIEW **ppResult) 6812 { 6813 ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cDSView, VERR_INVALID_PARAMETER); 6814 6815 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paDepthStencilView[viewId]; 6816 if (!pDXView->u.pView) 6817 { 6818 SVGACOTableDXDSViewEntry const *pEntry = &pDXContext->cot.paDSView[viewId]; 6819 int rc = dxCreateDepthStencilView(pThisCC, pDXContext, viewId, pEntry); 6820 AssertRCReturn(rc, rc); 6821 } 6822 *ppResult = pDXView; 6823 return VINF_SUCCESS; 6824 } 6825 6826 6827 static int dxCreateShaderResourceView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dShaderResourceViewId shaderResourceViewId, SVGACOTableDXSRViewEntry const *pEntry) 6828 { 6829 PVMSVGA3DSURFACE pSurface; 6830 ID3D11Resource *pResource; 6831 int rc = dxEnsureResource(pThisCC, pDXContext, pEntry->sid, &pSurface, &pResource); 6832 AssertRCReturn(rc, rc); 6833 6791 6834 DXVIEW *pView = &pDXContext->pBackendDXContext->paShaderResourceView[shaderResourceViewId]; 6792 6835 Assert(pView->u.pView == NULL); … … 6814 6857 return VINF_SUCCESS; 6815 6858 } 6859 6860 6861 static int dxCreateUnorderedAccessView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId, SVGACOTableDXUAViewEntry const *pEntry) 6862 { 6863 PVMSVGA3DSURFACE pSurface; 6864 ID3D11Resource *pResource; 6865 int rc = dxEnsureResource(pThisCC, pDXContext, pEntry->sid, &pSurface, &pResource); 6866 AssertRCReturn(rc, rc); 6867 6868 DXVIEW *pView = &pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId]; 6869 Assert(pView->u.pView == NULL); 6870 6871 ID3D11UnorderedAccessView *pUnorderedAccessView; 6872 HRESULT hr = dxUnorderedAccessViewCreate(pThisCC, pDXContext, pEntry, pSurface, &pUnorderedAccessView); 6873 AssertReturn(SUCCEEDED(hr), VERR_INVALID_STATE); 6874 6875 return dxViewInit(pView, pSurface, pDXContext, uaViewId, VMSVGA3D_VIEWTYPE_UNORDEREDACCESS, pUnorderedAccessView); 6876 } 6877 6878 6879 static int dxEnsureUnorderedAccessView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId viewId, DXVIEW **ppResult) 6880 { 6881 ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cUAView, VERR_INVALID_PARAMETER); 6882 6883 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paUnorderedAccessView[viewId]; 6884 if (!pDXView->u.pView) 6885 { 6886 SVGACOTableDXUAViewEntry const *pEntry = &pDXContext->cot.paUAView[viewId]; 6887 int rc = dxCreateUnorderedAccessView(pThisCC, pDXContext, viewId, pEntry); 6888 AssertRCReturn(rc, rc); 6889 } 6890 *ppResult = pDXView; 6891 return VINF_SUCCESS; 6892 } 6893 6816 6894 6817 6895 static void dxSetupPipeline(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext) … … 6853 6931 6854 6932 #ifdef LOG_ENABLED 6855 SVGACOTableDXSRViewEntry const *pSRViewEntry = dxGetShaderResourceViewEntry(pDXContext, shaderResourceViewId);6933 SVGACOTableDXSRViewEntry const *pSRViewEntry = &pDXContext->cot.paSRView[shaderResourceViewId]; 6856 6934 PVMSVGA3DSURFACE pSurface = NULL; 6857 6935 vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, pDXView->sid, &pSurface); … … 6888 6966 for (uint32_t idxUA = 0; idxUA < SVGA3D_DX11_1_MAX_UAVIEWS; ++idxUA) 6889 6967 { 6890 SVGA3dUAViewId const uaViewId = pDXContext->svgaDXContext.csuaViewIds[idxUA]; 6891 if (uaViewId != SVGA3D_INVALID_ID) 6892 { 6893 //DEBUG_BREAKPOINT_TEST(); 6894 ASSERT_GUEST_RETURN_VOID(uaViewId < pDXContext->pBackendDXContext->cUnorderedAccessView); 6895 6896 SVGACOTableDXUAViewEntry const *pUAViewEntry = dxGetUnorderedAccessViewEntry(pDXContext, uaViewId); 6897 AssertContinue(pUAViewEntry != NULL); 6898 6899 uint32_t const sid = pUAViewEntry->sid; 6900 6901 PVMSVGA3DSURFACE pSurface; 6902 rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, sid, &pSurface); 6903 AssertRCReturnVoid(rc); 6904 6905 /* The guest might have invalidated the surface in which case pSurface->pBackendSurface is NULL. */ 6906 /** @todo This is not needed for "single DX device" mode. */ 6907 if (pSurface->pBackendSurface) 6908 { 6909 /* Wait for the surface to finish drawing. */ 6910 dxSurfaceWait(pThisCC->svga.p3dState, pSurface, pDXContext->cid); 6911 } 6912 6913 /* If a view has not been created yet, do it now. */ 6914 if (!pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId].u.pView) 6915 { 6916 LogFunc(("Re-creating UAV: sid=%u uaid = %u\n", sid, uaViewId)); 6917 rc = dxDefineUnorderedAccessView(pThisCC, pDXContext, uaViewId, pUAViewEntry); 6918 AssertContinue(RT_SUCCESS(rc)); 6919 } 6920 6921 LogFunc(("csuav[%d] sid = %u, uaid = %u\n", idxUA, sid, uaViewId)); 6968 SVGA3dUAViewId const viewId = pDXContext->svgaDXContext.csuaViewIds[idxUA]; 6969 if (viewId != SVGA3D_INVALID_ID) 6970 { 6971 DXVIEW *pDXView; 6972 rc = dxEnsureUnorderedAccessView(pThisCC, pDXContext, viewId, &pDXView); 6973 AssertContinue(RT_SUCCESS(rc)); 6974 6975 #ifdef LOG_ENABLED 6976 SVGACOTableDXUAViewEntry const *pUAViewEntry = &pDXContext->cot.paUAView[viewId]; 6977 LogFunc(("csuav[%d] sid = %u, uaid = %u, format = %s(%d)\n", idxUA, pDXView->sid, viewId, vmsvgaLookupEnum((int)pUAViewEntry->format, &g_SVGA3dSurfaceFormat2String), pUAViewEntry->format)); 6978 #endif 6922 6979 } 6923 6980 } … … 6934 6991 AssertReturnVoid(pDevice->pDevice); 6935 6992 6936 /* Make sure that the render target views exist. Similar to SRVs.*/6993 /* Make sure that the render target views exist. */ 6937 6994 if (pDXContext->svgaDXContext.renderState.depthStencilViewId != SVGA3D_INVALID_ID) 6938 6995 { 6939 6996 uint32_t const viewId = pDXContext->svgaDXContext.renderState.depthStencilViewId; 6940 6997 6941 ASSERT_GUEST_RETURN_VOID(viewId < pDXContext->pBackendDXContext->cDepthStencilView); 6942 6943 SVGACOTableDXDSViewEntry const *pDSViewEntry = dxGetDepthStencilViewEntry(pDXContext, viewId); 6944 AssertReturnVoid(pDSViewEntry != NULL); 6945 6946 PVMSVGA3DSURFACE pSurface; 6947 rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, pDSViewEntry->sid, &pSurface); 6948 AssertRCReturnVoid(rc); 6949 6950 /* If a view has not been created yet, do it now. */ 6951 if (!pDXContext->pBackendDXContext->paDepthStencilView[viewId].u.pView) 6952 { 6953 //DEBUG_BREAKPOINT_TEST(); 6954 LogFunc(("Re-creating DSV: sid=%u dsvid = %u\n", pDSViewEntry->sid, viewId)); 6955 rc = dxDefineDepthStencilView(pThisCC, pDXContext, viewId, pDSViewEntry); 6956 AssertReturnVoid(RT_SUCCESS(rc)); 6957 } 6958 6959 LogFunc(("dsv sid = %u, dsvid = %u\n", pDSViewEntry->sid, viewId)); 6998 DXVIEW *pDXView; 6999 rc = dxEnsureDepthStencilView(pThisCC, pDXContext, viewId, &pDXView); 7000 AssertRC(rc); 7001 7002 #ifdef LOG_ENABLED 7003 SVGACOTableDXDSViewEntry const *pDSViewEntry = &pDXContext->cot.paDSView[viewId]; 7004 LogFunc(("dsv sid = %u, dsvid = %u, format = %s(%d)\n", pDXView->sid, viewId, vmsvgaLookupEnum((int)pDSViewEntry->format, &g_SVGA3dSurfaceFormat2String), pDSViewEntry->format)); 7005 #endif 6960 7006 } 6961 7007 6962 7008 for (uint32_t i = 0; i < SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS; ++i) 6963 7009 { 6964 if (pDXContext->svgaDXContext.renderState.renderTargetViewIds[i] != SVGA3D_INVALID_ID) 6965 { 6966 uint32_t const viewId = pDXContext->svgaDXContext.renderState.renderTargetViewIds[i]; 6967 6968 ASSERT_GUEST_RETURN_VOID(viewId < pDXContext->pBackendDXContext->cRenderTargetView); 6969 6970 SVGACOTableDXRTViewEntry const *pRTViewEntry = dxGetRenderTargetViewEntry(pDXContext, viewId); 6971 AssertReturnVoid(pRTViewEntry != NULL); 6972 6973 PVMSVGA3DSURFACE pSurface; 6974 rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, pRTViewEntry->sid, &pSurface); 6975 AssertRCReturnVoid(rc); 6976 6977 /* If a view has not been created yet, do it now. */ 6978 if (!pDXContext->pBackendDXContext->paRenderTargetView[viewId].u.pView) 6979 { 6980 //DEBUG_BREAKPOINT_TEST(); 6981 LogFunc(("Re-creating RTV: sid=%u rtvid = %u\n", pRTViewEntry->sid, viewId)); 6982 rc = dxDefineRenderTargetView(pThisCC, pDXContext, viewId, pRTViewEntry); 6983 AssertReturnVoid(RT_SUCCESS(rc)); 6984 } 6985 6986 LogFunc(("rtv sid = %u, rtvid = %u, format = %s(%d)\n", pRTViewEntry->sid, viewId, vmsvgaLookupEnum((int)pRTViewEntry->format, &g_SVGA3dSurfaceFormat2String), pRTViewEntry->format)); 7010 uint32_t const viewId = pDXContext->svgaDXContext.renderState.renderTargetViewIds[i]; 7011 if (viewId != SVGA3D_INVALID_ID) 7012 { 7013 DXVIEW *pDXView; 7014 rc = dxEnsureRenderTargetView(pThisCC, pDXContext, viewId, &pDXView); 7015 AssertContinue(RT_SUCCESS(rc)); 7016 7017 #ifdef LOG_ENABLED 7018 SVGACOTableDXRTViewEntry const *pRTViewEntry = &pDXContext->cot.paRTView[viewId]; 7019 LogFunc(("rtv sid = %u, rtvid = %u, format = %s(%d)\n", pDXView->sid, viewId, vmsvgaLookupEnum((int)pRTViewEntry->format, &g_SVGA3dSurfaceFormat2String), pRTViewEntry->format)); 7020 #endif 6987 7021 } 6988 7022 } … … 6990 7024 for (uint32_t idxUA = 0; idxUA < SVGA3D_DX11_1_MAX_UAVIEWS; ++idxUA) 6991 7025 { 6992 SVGA3dUAViewId const uaViewId = pDXContext->svgaDXContext.uaViewIds[idxUA]; 6993 if (uaViewId != SVGA3D_INVALID_ID) 6994 { 6995 //DEBUG_BREAKPOINT_TEST(); 6996 ASSERT_GUEST_RETURN_VOID(uaViewId < pDXContext->pBackendDXContext->cUnorderedAccessView); 6997 6998 SVGACOTableDXUAViewEntry const *pUAViewEntry = dxGetUnorderedAccessViewEntry(pDXContext, uaViewId); 6999 AssertContinue(pUAViewEntry != NULL); 7000 7001 uint32_t const sid = pUAViewEntry->sid; 7002 7003 PVMSVGA3DSURFACE pSurface; 7004 rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, sid, &pSurface); 7005 AssertRCReturnVoid(rc); 7006 7007 /* The guest might have invalidated the surface in which case pSurface->pBackendSurface is NULL. */ 7008 /** @todo This is not needed for "single DX device" mode. */ 7009 if (pSurface->pBackendSurface) 7010 { 7011 /* Wait for the surface to finish drawing. */ 7012 dxSurfaceWait(pThisCC->svga.p3dState, pSurface, pDXContext->cid); 7013 } 7014 7015 /* If a view has not been created yet, do it now. */ 7016 if (!pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId].u.pView) 7017 { 7018 LogFunc(("Re-creating UAV: sid=%u uaid = %u\n", sid, uaViewId)); 7019 rc = dxDefineUnorderedAccessView(pThisCC, pDXContext, uaViewId, pUAViewEntry); 7020 AssertContinue(RT_SUCCESS(rc)); 7021 } 7022 7023 LogFunc(("uav[%d] sid = %u, uaid = %u\n", idxUA, sid, uaViewId)); 7026 SVGA3dUAViewId const viewId = pDXContext->svgaDXContext.uaViewIds[idxUA]; 7027 if (viewId != SVGA3D_INVALID_ID) 7028 { 7029 DXVIEW *pDXView; 7030 rc = dxEnsureUnorderedAccessView(pThisCC, pDXContext, viewId, &pDXView); 7031 AssertContinue(RT_SUCCESS(rc)); 7032 7033 #ifdef LOG_ENABLED 7034 SVGACOTableDXUAViewEntry const *pUAViewEntry = &pDXContext->cot.paUAView[viewId]; 7035 LogFunc(("uav[%d] sid = %u, uaid = %u, format = %s(%d)\n", idxUA, pDXView->sid, viewId, vmsvgaLookupEnum((int)pUAViewEntry->format, &g_SVGA3dSurfaceFormat2String), pUAViewEntry->format)); 7036 #endif 7024 7037 } 7025 7038 } … … 7060 7073 if (shaderResourceViewId != SVGA3D_INVALID_ID) 7061 7074 { 7062 SVGACOTableDXSRViewEntry const *pSRViewEntry = dxGetShaderResourceViewEntry(pDXContext, shaderResourceViewId);7063 AssertContinue(pSRViewEntry != NULL);7075 ASSERT_GUEST_CONTINUE(shaderResourceViewId < pDXContext->cot.cSRView); 7076 SVGACOTableDXSRViewEntry const *pSRViewEntry = &pDXContext->cot.paSRView[shaderResourceViewId]; 7064 7077 7065 7078 PVMSVGA3DSURFACE pSurface; … … 7842 7855 for (uint32_t idxUA = 0; idxUA < SVGA3D_DX11_1_MAX_UAVIEWS; ++idxUA) 7843 7856 { 7857 apUnorderedAccessViews[idxUA] = NULL; 7858 aUAVInitialCounts[idxUA] = (UINT)-1; 7859 7844 7860 SVGA3dUAViewId const uaViewId = pDXContext->svgaDXContext.uaViewIds[idxUA]; 7845 7861 if (uaViewId != SVGA3D_INVALID_ID) 7846 7862 { 7863 ASSERT_GUEST_CONTINUE(uaViewId < pDXContext->cot.cUAView); 7864 7847 7865 if (NumUAVs == 0) 7848 7866 UAVStartSlot = idxUA; … … 7850 7868 apUnorderedAccessViews[idxUA] = pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId].u.pUnorderedAccessView; 7851 7869 7852 SVGACOTableDXUAViewEntry const *pEntry = dxGetUnorderedAccessViewEntry(pDXContext, uaViewId);7870 SVGACOTableDXUAViewEntry const *pEntry = &pDXContext->cot.paUAView[uaViewId]; 7853 7871 aUAVInitialCounts[idxUA] = pEntry->structureCount; 7854 }7855 else7856 {7857 apUnorderedAccessViews[idxUA] = NULL;7858 aUAVInitialCounts[idxUA] = (UINT)-1;7859 7872 } 7860 7873 } … … 8327 8340 static DECLCALLBACK(int) vmsvga3dBackDXClearRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGA3dRGBAFloat const *pRGBA) 8328 8341 { 8329 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 8330 RT_NOREF(pBackend); 8331 8342 DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 8343 AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE); 8344 8345 DXVIEW *pDXView; 8346 int rc = dxEnsureRenderTargetView(pThisCC, pDXContext, renderTargetViewId, &pDXView); 8347 AssertRCReturn(rc, rc); 8348 8349 pDXDevice->pImmediateContext->ClearRenderTargetView(pDXView->u.pRenderTargetView, pRGBA->value); 8350 return VINF_SUCCESS; 8351 } 8352 8353 8354 static DECLCALLBACK(int) vmsvga3dBackVBDXClearRenderTargetViewRegion(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, 8355 SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect) 8356 { 8357 DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 8358 AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE); 8359 8360 DXVIEW *pDXView; 8361 int rc = dxEnsureRenderTargetView(pThisCC, pDXContext, renderTargetViewId, &pDXView); 8362 AssertRCReturn(rc, rc); 8363 8364 pDXDevice->pImmediateContext->ClearView(pDXView->u.pRenderTargetView, pColor->value, (D3D11_RECT *)paRect, cRect); 8365 return VINF_SUCCESS; 8366 } 8367 8368 8369 static DECLCALLBACK(int) vmsvga3dBackDXClearDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t flags, SVGA3dDepthStencilViewId depthStencilViewId, float depth, uint8_t stencil) 8370 { 8332 8371 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 8333 8372 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 8334 8373 8335 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paRenderTargetView[renderTargetViewId]; 8336 if (!pDXView->u.pRenderTargetView) 8337 { 8338 //DEBUG_BREAKPOINT_TEST(); 8339 /* (Re-)create the render target view, because a creation of a view is deferred until a draw or a clear call. */ 8340 SVGACOTableDXRTViewEntry const *pEntry = &pDXContext->cot.paRTView[renderTargetViewId]; 8341 int rc = dxDefineRenderTargetView(pThisCC, pDXContext, renderTargetViewId, pEntry); 8342 AssertRCReturn(rc, rc); 8343 } 8344 pDevice->pImmediateContext->ClearRenderTargetView(pDXView->u.pRenderTargetView, pRGBA->value); 8345 return VINF_SUCCESS; 8346 } 8347 8348 8349 static DECLCALLBACK(int) vmsvga3dBackVBDXClearRenderTargetViewRegion(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, 8350 SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect) 8351 { 8352 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 8353 RT_NOREF(pBackend); 8354 8355 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 8356 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 8357 8358 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paRenderTargetView[renderTargetViewId]; 8359 if (!pDXView->u.pRenderTargetView) 8360 { 8361 /* (Re-)create the render target view, because a creation of a view is deferred until a draw or a clear call. */ 8362 SVGACOTableDXRTViewEntry const *pEntry = &pDXContext->cot.paRTView[renderTargetViewId]; 8363 int rc = dxDefineRenderTargetView(pThisCC, pDXContext, renderTargetViewId, pEntry); 8364 AssertRCReturn(rc, rc); 8365 } 8366 pDevice->pImmediateContext->ClearView(pDXView->u.pRenderTargetView, pColor->value, (D3D11_RECT *)paRect, cRect); 8367 return VINF_SUCCESS; 8368 } 8369 8370 8371 static DECLCALLBACK(int) vmsvga3dBackDXClearDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t flags, SVGA3dDepthStencilViewId depthStencilViewId, float depth, uint8_t stencil) 8372 { 8373 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 8374 RT_NOREF(pBackend); 8375 8376 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 8377 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 8378 8379 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paDepthStencilView[depthStencilViewId]; 8380 if (!pDXView->u.pDepthStencilView) 8381 { 8382 //DEBUG_BREAKPOINT_TEST(); 8383 /* (Re-)create the depth stencil view, because a creation of a view is deferred until a draw or a clear call. */ 8384 SVGACOTableDXDSViewEntry const *pEntry = &pDXContext->cot.paDSView[depthStencilViewId]; 8385 int rc = dxDefineDepthStencilView(pThisCC, pDXContext, depthStencilViewId, pEntry); 8386 AssertRCReturn(rc, rc); 8387 } 8374 DXVIEW *pDXView; 8375 int rc = dxEnsureDepthStencilView(pThisCC, pDXContext, depthStencilViewId, &pDXView); 8376 AssertRCReturn(rc, rc); 8377 8388 8378 pDevice->pImmediateContext->ClearDepthStencilView(pDXView->u.pDepthStencilView, flags, depth, stencil); 8389 8379 return VINF_SUCCESS; … … 8944 8934 8945 8935 8946 static int dxDefineRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGACOTableDXRTViewEntry const *pEntry)8947 {8948 /* Get corresponding resource for pEntry->sid. Create the surface if does not yet exist. */8949 PVMSVGA3DSURFACE pSurface;8950 int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, pEntry->sid, &pSurface);8951 AssertRCReturn(rc, rc);8952 8953 DXVIEW *pView = &pDXContext->pBackendDXContext->paRenderTargetView[renderTargetViewId];8954 Assert(pView->u.pView == NULL);8955 8956 if (pSurface->pBackendSurface == NULL)8957 {8958 /* Create the actual texture. */8959 rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDXContext, pSurface);8960 AssertRCReturn(rc, rc);8961 }8962 8963 ID3D11RenderTargetView *pRenderTargetView;8964 HRESULT hr = dxRenderTargetViewCreate(pThisCC, pDXContext, pEntry, pSurface, &pRenderTargetView);8965 AssertReturn(SUCCEEDED(hr), VERR_INVALID_STATE);8966 8967 return dxViewInit(pView, pSurface, pDXContext, renderTargetViewId, VMSVGA3D_VIEWTYPE_RENDERTARGET, pRenderTargetView);8968 }8969 8970 8971 8936 static DECLCALLBACK(int) vmsvga3dBackDXDefineRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGACOTableDXRTViewEntry const *pEntry) 8937 { 8938 /* The view is created when it is used in setupPipeline or ClearView. */ 8939 RT_NOREF(pThisCC, pDXContext, renderTargetViewId, pEntry); 8940 return VINF_SUCCESS; 8941 } 8942 8943 8944 static DECLCALLBACK(int) vmsvga3dBackDXDestroyRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId) 8972 8945 { 8973 8946 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 8974 8947 RT_NOREF(pBackend); 8975 8948 8976 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 8977 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 8978 8979 return dxDefineRenderTargetView(pThisCC, pDXContext, renderTargetViewId, pEntry); 8980 } 8981 8982 8983 static DECLCALLBACK(int) vmsvga3dBackDXDestroyRenderTargetView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId) 8949 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paRenderTargetView[renderTargetViewId]; 8950 return dxViewDestroy(pDXView); 8951 } 8952 8953 8954 static DECLCALLBACK(int) vmsvga3dBackDXDefineDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId, SVGACOTableDXDSViewEntry const *pEntry) 8955 { 8956 /* The view is created when it is used in setupPipeline or ClearView. */ 8957 RT_NOREF(pThisCC, pDXContext, depthStencilViewId, pEntry); 8958 return VINF_SUCCESS; 8959 } 8960 8961 8962 static DECLCALLBACK(int) vmsvga3dBackDXDestroyDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId) 8984 8963 { 8985 8964 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 8986 8965 RT_NOREF(pBackend); 8987 8966 8988 return dxViewDestroy(&pDXContext->pBackendDXContext->paRenderTargetView[renderTargetViewId]); 8989 } 8990 8991 8992 static int dxDefineDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId, SVGACOTableDXDSViewEntry const *pEntry) 8993 { 8994 /* Get corresponding resource for pEntry->sid. Create the surface if does not yet exist. */ 8995 PVMSVGA3DSURFACE pSurface; 8996 int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, pEntry->sid, &pSurface); 8997 AssertRCReturn(rc, rc); 8998 8999 DXVIEW *pView = &pDXContext->pBackendDXContext->paDepthStencilView[depthStencilViewId]; 9000 Assert(pView->u.pView == NULL); 9001 9002 if (pSurface->pBackendSurface == NULL) 9003 { 9004 /* Create the actual texture. */ 9005 rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDXContext, pSurface); 9006 AssertRCReturn(rc, rc); 9007 } 9008 9009 ID3D11DepthStencilView *pDepthStencilView; 9010 HRESULT hr = dxDepthStencilViewCreate(pThisCC, pDXContext, pEntry, pSurface, &pDepthStencilView); 9011 AssertReturn(SUCCEEDED(hr), VERR_INVALID_STATE); 9012 9013 return dxViewInit(pView, pSurface, pDXContext, depthStencilViewId, VMSVGA3D_VIEWTYPE_DEPTHSTENCIL, pDepthStencilView); 9014 } 9015 9016 static DECLCALLBACK(int) vmsvga3dBackDXDefineDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId, SVGACOTableDXDSViewEntry const *pEntry) 9017 { 9018 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 9019 RT_NOREF(pBackend); 9020 9021 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 9022 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 9023 9024 return dxDefineDepthStencilView(pThisCC, pDXContext, depthStencilViewId, pEntry); 9025 } 9026 9027 9028 static DECLCALLBACK(int) vmsvga3dBackDXDestroyDepthStencilView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dDepthStencilViewId depthStencilViewId) 9029 { 9030 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 9031 RT_NOREF(pBackend); 9032 9033 return dxViewDestroy(&pDXContext->pBackendDXContext->paDepthStencilView[depthStencilViewId]); 8967 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paDepthStencilView[depthStencilViewId]; 8968 return dxViewDestroy(pDXView); 9034 8969 } 9035 8970 … … 9397 9332 if (pDXView->u.pView) 9398 9333 dxViewAddToList(pThisCC, pDXView); 9399 else if (pDXView->enmViewType == VMSVGA3D_VIEWTYPE_NONE)9400 dxDefineRenderTargetView(pThisCC, pDXContext, i, pEntry);9401 9334 } 9402 9335 break; … … 9429 9362 if (pDXView->u.pView) 9430 9363 dxViewAddToList(pThisCC, pDXView); 9431 else if (pDXView->enmViewType == VMSVGA3D_VIEWTYPE_NONE)9432 dxDefineDepthStencilView(pThisCC, pDXContext, i, pEntry);9433 9364 } 9434 9365 break; … … 9672 9603 if (pDXView->u.pView) 9673 9604 dxViewAddToList(pThisCC, pDXView); 9674 else if (pDXView->enmViewType == VMSVGA3D_VIEWTYPE_NONE)9675 dxDefineUnorderedAccessView(pThisCC, pDXContext, i, pEntry);9676 9605 } 9677 9606 break; … … 10041 9970 10042 9971 10043 static int dxDefineUnorderedAccessView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId, SVGACOTableDXUAViewEntry const *pEntry)10044 {10045 /* Get corresponding resource for pEntry->sid. Create the surface if does not yet exist. */10046 PVMSVGA3DSURFACE pSurface;10047 int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, pEntry->sid, &pSurface);10048 AssertRCReturn(rc, rc);10049 10050 ID3D11UnorderedAccessView *pUnorderedAccessView;10051 DXVIEW *pView = &pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId];10052 Assert(pView->u.pView == NULL);10053 10054 if (pSurface->pBackendSurface == NULL)10055 {10056 /* Create the actual texture or buffer. */10057 /** @todo One function to create all resources from surfaces. */10058 if (pSurface->format != SVGA3D_BUFFER)10059 rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDXContext, pSurface);10060 else10061 rc = vmsvga3dBackSurfaceCreateResource(pThisCC, pDXContext, pSurface);10062 10063 AssertRCReturn(rc, rc);10064 }10065 10066 HRESULT hr = dxUnorderedAccessViewCreate(pThisCC, pDXContext, pEntry, pSurface, &pUnorderedAccessView);10067 AssertReturn(SUCCEEDED(hr), VERR_INVALID_STATE);10068 10069 return dxViewInit(pView, pSurface, pDXContext, uaViewId, VMSVGA3D_VIEWTYPE_UNORDEREDACCESS, pUnorderedAccessView);10070 }10071 10072 10073 9972 static DECLCALLBACK(int) vmsvga3dBackDXDefineUAView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId, SVGACOTableDXUAViewEntry const *pEntry) 9973 { 9974 /* The view is created in setupPipeline or ClearView. */ 9975 RT_NOREF(pThisCC, pDXContext, uaViewId, pEntry); 9976 return VINF_SUCCESS; 9977 } 9978 9979 9980 static DECLCALLBACK(int) vmsvga3dBackDXDestroyUAView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId) 10074 9981 { 10075 9982 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 10076 9983 RT_NOREF(pBackend); 10077 9984 10078 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 10079 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 10080 10081 /** @todo Probably not necessary because UAVs are defined in setupPipeline. */ 10082 return dxDefineUnorderedAccessView(pThisCC, pDXContext, uaViewId, pEntry); 10083 } 10084 10085 10086 static DECLCALLBACK(int) vmsvga3dBackDXDestroyUAView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId) 10087 { 10088 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 10089 RT_NOREF(pBackend); 10090 10091 return dxViewDestroy(&pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId]); 9985 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId]; 9986 return dxViewDestroy(pDXView); 10092 9987 } 10093 9988 … … 10095 9990 static DECLCALLBACK(int) vmsvga3dBackDXClearUAViewUint(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId, uint32_t const aValues[4]) 10096 9991 { 10097 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 10098 RT_NOREF(pBackend); 10099 10100 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 10101 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 10102 10103 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId]; 10104 if (!pDXView->u.pUnorderedAccessView) 10105 { 10106 /* (Re-)create the view, because a creation of a view is deferred until a draw or a clear call. */ 10107 SVGACOTableDXUAViewEntry const *pEntry = dxGetUnorderedAccessViewEntry(pDXContext, uaViewId); 10108 int rc = dxDefineUnorderedAccessView(pThisCC, pDXContext, uaViewId, pEntry); 10109 AssertRCReturn(rc, rc); 10110 } 10111 pDevice->pImmediateContext->ClearUnorderedAccessViewUint(pDXView->u.pUnorderedAccessView, aValues); 9992 DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 9993 AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE); 9994 9995 DXVIEW *pDXView; 9996 int rc = dxEnsureUnorderedAccessView(pThisCC, pDXContext, uaViewId, &pDXView); 9997 AssertRCReturn(rc, rc); 9998 9999 pDXDevice->pImmediateContext->ClearUnorderedAccessViewUint(pDXView->u.pUnorderedAccessView, aValues); 10112 10000 return VINF_SUCCESS; 10113 10001 } … … 10116 10004 static DECLCALLBACK(int) vmsvga3dBackDXClearUAViewFloat(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId uaViewId, float const aValues[4]) 10117 10005 { 10118 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 10119 RT_NOREF(pBackend); 10120 10121 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 10122 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 10123 10124 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId]; 10125 if (!pDXView->u.pUnorderedAccessView) 10126 { 10127 /* (Re-)create the view, because a creation of a view is deferred until a draw or a clear call. */ 10128 SVGACOTableDXUAViewEntry const *pEntry = &pDXContext->cot.paUAView[uaViewId]; 10129 int rc = dxDefineUnorderedAccessView(pThisCC, pDXContext, uaViewId, pEntry); 10130 AssertRCReturn(rc, rc); 10131 } 10132 pDevice->pImmediateContext->ClearUnorderedAccessViewFloat(pDXView->u.pUnorderedAccessView, aValues); 10006 DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 10007 AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE); 10008 10009 DXVIEW *pDXView; 10010 int rc = dxEnsureUnorderedAccessView(pThisCC, pDXContext, uaViewId, &pDXView); 10011 AssertRCReturn(rc, rc); 10012 10013 pDXDevice->pImmediateContext->ClearUnorderedAccessViewFloat(pDXView->u.pUnorderedAccessView, aValues); 10133 10014 return VINF_SUCCESS; 10134 10015 } … … 10137 10018 static DECLCALLBACK(int) vmsvga3dBackDXCopyStructureCount(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId srcUAViewId, SVGA3dSurfaceId destSid, uint32_t destByteOffset) 10138 10019 { 10139 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 10140 RT_NOREF(pBackend); 10141 10142 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 10143 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 10020 DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 10021 AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE); 10144 10022 10145 10023 /* Get corresponding resource. Create the buffer if does not yet exist. */ … … 10148 10026 { 10149 10027 PVMSVGA3DSURFACE pSurface; 10150 int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, destSid, &pSurface); 10028 ID3D11Resource *pResource; 10029 int rc = dxEnsureResource(pThisCC, pDXContext, destSid, &pSurface, &pResource); 10151 10030 AssertRCReturn(rc, rc); 10152 10153 if (pSurface->pBackendSurface == NULL) 10154 { 10155 /* Create the resource and initialize it with the current surface data. */ 10156 rc = vmsvga3dBackSurfaceCreateResource(pThisCC, pDXContext, pSurface); 10157 AssertRCReturn(rc, rc); 10158 } 10159 10160 pDstBuffer = pSurface->pBackendSurface->u.pBuffer; 10031 AssertReturn(pSurface->pBackendSurface->enmResType == VMSVGA3D_RESTYPE_BUFFER, VERR_INVALID_STATE); 10032 10033 pDstBuffer = (ID3D11Buffer *)pResource; 10161 10034 } 10162 10035 else … … 10173 10046 pSrcView = NULL; 10174 10047 10175 pDevice->pImmediateContext->CopyStructureCount(pDstBuffer, destByteOffset, pSrcView); 10176 10048 pDXDevice->pImmediateContext->CopyStructureCount(pDstBuffer, destByteOffset, pSrcView); 10177 10049 return VINF_SUCCESS; 10178 10050 } … … 10181 10053 static DECLCALLBACK(int) vmsvga3dBackDXSetUAViews(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t uavSpliceIndex, uint32_t cUAViewId, SVGA3dUAViewId const *paUAViewId) 10182 10054 { 10183 PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend; 10184 RT_NOREF(pBackend); 10185 10186 DXDEVICE *pDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext); 10187 AssertReturn(pDevice->pDevice, VERR_INVALID_STATE); 10188 10189 RT_NOREF(uavSpliceIndex, cUAViewId, paUAViewId); 10190 10055 /* Views are set in setupPipeline. */ 10056 RT_NOREF(pThisCC, pDXContext, uavSpliceIndex, cUAViewId, paUAViewId); 10191 10057 return VINF_SUCCESS; 10192 10058 } … … 10414 10280 for (uint32_t i = 0; i < SVGA3D_DX11_1_MAX_UAVIEWS; ++i) 10415 10281 { 10282 papUnorderedAccessView[i] = NULL; 10283 aUAVInitialCounts[i] = (UINT)-1; 10284 10416 10285 SVGA3dUAViewId const uaViewId = pUAIds[i]; 10417 10286 if (uaViewId != SVGA3D_INVALID_ID) 10418 10287 { 10419 ASSERT_GUEST_ RETURN(uaViewId < pDXContext->pBackendDXContext->cUnorderedAccessView, VERR_INVALID_PARAMETER);10288 ASSERT_GUEST_CONTINUE(uaViewId < pDXContext->cot.cUAView); 10420 10289 10421 10290 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paUnorderedAccessView[uaViewId]; … … 10423 10292 papUnorderedAccessView[i] = pDXView->u.pUnorderedAccessView; 10424 10293 10425 SVGACOTableDXUAViewEntry const *pEntry = dxGetUnorderedAccessViewEntry(pDXContext, uaViewId);10294 SVGACOTableDXUAViewEntry const *pEntry = &pDXContext->cot.paUAView[uaViewId]; 10426 10295 aUAVInitialCounts[i] = pEntry->structureCount; 10427 }10428 else10429 {10430 papUnorderedAccessView[i] = NULL;10431 aUAVInitialCounts[i] = (UINT)-1;10432 10296 } 10433 10297 } … … 11947 11811 AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE); 11948 11812 11949 DXVIEW *pDXView = &pDXContext->pBackendDXContext->paUnorderedAccessView[viewId]; 11950 if (!pDXView->u.pView) 11951 { 11952 /* (Re-)create the view, because a creation of a view is deferred until a draw or a clear call. */ 11953 SVGACOTableDXUAViewEntry const *pEntry = &pDXContext->cot.paUAView[viewId]; 11954 int rc = dxDefineUnorderedAccessView(pThisCC, pDXContext, viewId, pEntry); 11955 AssertRCReturn(rc, rc); 11956 } 11813 DXVIEW *pDXView; 11814 int rc = dxEnsureUnorderedAccessView(pThisCC, pDXContext, viewId, &pDXView); 11815 AssertRCReturn(rc, rc); 11816 11957 11817 pDXDevice->pImmediateContext->ClearView(pDXView->u.pView, pColor->value, (D3D11_RECT *)paRect, cRect); 11958 11818 return VINF_SUCCESS;
Note:
See TracChangeset
for help on using the changeset viewer.