MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / CopyTextureDepth

Method CopyTextureDepth

PostProcess/Common/src/PostFXContext.cpp:376–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376void PostFXContext::CopyTextureDepth(const TextureOperationAttribs& Attribs, ITextureView* pSRV, ITextureView* pRTV)
377{
378 auto& RenderTech = GetRenderTechnique(RENDER_TECH_COPY_DEPTH, FEATURE_FLAG_NONE, pRTV->GetDesc().Format);
379 if (!RenderTech.IsInitializedPSO())
380 {
381 PipelineResourceLayoutDescX ResourceLayout;
382 ResourceLayout.AddVariable(SHADER_TYPE_PIXEL, "g_Texture", SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC, SHADER_VARIABLE_FLAG_UNFILTERABLE_FLOAT_TEXTURE_WEBGPU);
383 ResourceLayout.AddImmutableSampler(SHADER_TYPE_PIXEL, "g_Texture", Sam_PointClamp);
384
385 RenderTech.InitializePSO(Attribs.pDevice,
386 nullptr, "PostFXContext::CopyTextureDepth",
387 m_pVSCopyTexture, m_pPSCopyTexture, ResourceLayout,
388 {
389 pRTV->GetDesc().Format,
390 },
391 TEX_FORMAT_UNKNOWN,
392 DSS_DisableDepth, BS_Default, false);
393 }
394
395 if (!RenderTech.IsInitializedSRB())
396 RenderTech.InitializeSRB(false);
397
398 ShaderResourceVariableX{RenderTech.SRB, SHADER_TYPE_PIXEL, "g_Texture"}.Set(pSRV);
399
400 Attribs.pDeviceContext->SetRenderTargets(1, &pRTV, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
401 Attribs.pDeviceContext->SetPipelineState(RenderTech.PSO);
402 Attribs.pDeviceContext->CommitShaderResources(RenderTech.SRB, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
403 Attribs.pDeviceContext->Draw({3, DRAW_FLAG_VERIFY_ALL, 1});
404 Attribs.pDeviceContext->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_NONE);
405}
406
407void PostFXContext::CopyTextureColor(const TextureOperationAttribs& Attribs, ITextureView* pSRV, ITextureView* pRTV)
408{

Calls 6

IsInitializedPSOMethod · 0.80
InitializePSOMethod · 0.80
IsInitializedSRBMethod · 0.80
InitializeSRBMethod · 0.80
SetPipelineStateMethod · 0.80
CommitShaderResourcesMethod · 0.80

Tested by

no test coverage detected