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

Method CopyTextureColor

PostProcess/Common/src/PostFXContext.cpp:407–436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407void PostFXContext::CopyTextureColor(const TextureOperationAttribs& Attribs, ITextureView* pSRV, ITextureView* pRTV)
408{
409 auto& RenderTech = GetRenderTechnique(RENDER_TECH_COPY_COLOR, FEATURE_FLAG_NONE, pRTV->GetDesc().Format);
410 if (!RenderTech.IsInitializedPSO())
411 {
412 PipelineResourceLayoutDescX ResourceLayout;
413 ResourceLayout.AddVariable(SHADER_TYPE_PIXEL, "g_Texture", SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC);
414 ResourceLayout.AddImmutableSampler(SHADER_TYPE_PIXEL, "g_Texture", Sam_LinearClamp);
415
416 RenderTech.InitializePSO(Attribs.pDevice,
417 nullptr, "PostFXContext::CopyTextureColor",
418 m_pVSCopyTexture, m_pPSCopyTexture, ResourceLayout,
419 {
420 pRTV->GetDesc().Format,
421 },
422 TEX_FORMAT_UNKNOWN,
423 DSS_DisableDepth, BS_Default, false);
424 }
425
426 if (!RenderTech.IsInitializedSRB())
427 RenderTech.InitializeSRB(false);
428
429 ShaderResourceVariableX{RenderTech.SRB, SHADER_TYPE_PIXEL, "g_Texture"}.Set(pSRV);
430
431 Attribs.pDeviceContext->SetRenderTargets(1, &pRTV, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
432 Attribs.pDeviceContext->SetPipelineState(RenderTech.PSO);
433 Attribs.pDeviceContext->CommitShaderResources(RenderTech.SRB, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
434 Attribs.pDeviceContext->Draw({3, DRAW_FLAG_VERIFY_ALL, 1});
435 Attribs.pDeviceContext->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_NONE);
436}
437
438bool PostFXContext::PrepareShadersAndPSO(const RenderAttributes& RenderAttribs, FEATURE_FLAGS FeatureFlags)
439{

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