@@ -73,27 +73,14 @@ class SuperResolutionD3D12_DLSS final : public SuperResolutionDLSS<CreateDLSSFea
7373 if (pDLSSFeature == nullptr )
7474 return ;
7575
76- IDeviceContextD3D12* pCtxImpl = ClassPtrCast<IDeviceContextD3D12> (Attribs. pContext );
76+ TransitionResourceStates (Attribs);
7777
7878 auto GetD3D12Resource = [](ITextureView* pView) -> ID3D12Resource* {
7979 return pView != nullptr ?
8080 ClassPtrCast<ITextureD3D12>(pView->GetTexture ())->GetD3D12Texture () :
8181 nullptr ;
8282 };
8383
84- pCtxImpl->TransitionTextureState (Attribs.pColorTextureSRV ->GetTexture (), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
85- pCtxImpl->TransitionTextureState (Attribs.pDepthTextureSRV ->GetTexture (), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
86- pCtxImpl->TransitionTextureState (Attribs.pMotionVectorsSRV ->GetTexture (), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
87- pCtxImpl->TransitionTextureState (Attribs.pOutputTextureView ->GetTexture (), D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
88- if (Attribs.pExposureTextureSRV )
89- pCtxImpl->TransitionTextureState (Attribs.pExposureTextureSRV ->GetTexture (), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
90- if (Attribs.pReactiveMaskTextureSRV )
91- pCtxImpl->TransitionTextureState (Attribs.pReactiveMaskTextureSRV ->GetTexture (), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
92- if (Attribs.pIgnoreHistoryMaskTextureSRV )
93- pCtxImpl->TransitionTextureState (Attribs.pIgnoreHistoryMaskTextureSRV ->GetTexture (), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
94-
95- ID3D12GraphicsCommandList* pCmdList = pCtxImpl->GetD3D12CommandList ();
96-
9784 NVSDK_NGX_D3D12_DLSS_Eval_Params EvalParams{};
9885 EvalParams.Feature .pInColor = GetD3D12Resource (Attribs.pColorTextureSRV );
9986 EvalParams.Feature .pInOutput = GetD3D12Resource (Attribs.pOutputTextureView );
@@ -113,12 +100,15 @@ class SuperResolutionD3D12_DLSS final : public SuperResolutionDLSS<CreateDLSSFea
113100 EvalParams.InPreExposure = Attribs.PreExposure ;
114101 EvalParams.InExposureScale = Attribs.ExposureScale ;
115102
103+ IDeviceContextD3D12* pCtx = ClassPtrCast<IDeviceContextD3D12>(Attribs.pContext );
104+ ID3D12GraphicsCommandList* pCmdList = pCtx->GetD3D12CommandList ();
105+
116106 NVSDK_NGX_Result Result = NGX_D3D12_EVALUATE_DLSS_EXT (pCmdList, pDLSSFeature, m_pNGXParams, &EvalParams);
117107 if (NVSDK_NGX_FAILED (Result))
118108 LOG_ERROR_MESSAGE (" DLSS D3D12 evaluation failed. NGX Result: " , static_cast <Uint32>(Result));
119109
120- pCtxImpl ->TransitionTextureState (Attribs.pOutputTextureView ->GetTexture (), D3D12_RESOURCE_STATE_ALL_SHADER_RESOURCE);
121- pCtxImpl ->Flush ();
110+ pCtx ->TransitionTextureState (Attribs.pOutputTextureView ->GetTexture (), D3D12_RESOURCE_STATE_ALL_SHADER_RESOURCE);
111+ pCtx ->Flush ();
122112 }
123113};
124114
0 commit comments