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

Method ComputeDownsampledTextures

PostProcess/Bloom/src/Bloom.cpp:288–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286}
287
288void Bloom::ComputeDownsampledTextures(const RenderAttributes& RenderAttribs)
289{
290 auto& RenderTech = GetRenderTechnique(RENDER_TECH_COMPUTE_DOWNSAMPLED_TEXTURE, m_FeatureFlags);
291
292 if (!RenderTech.IsInitializedSRB())
293 RenderTech.InitializeSRB(false);
294
295 ScopedDebugGroup DebugGroup{RenderAttribs.pDeviceContext, "ComputeDownsampledTexture"};
296
297 Int32 MipCount = ComputeMipCount(m_DownsampledTextures[0]->GetDesc().Width, m_DownsampledTextures[0]->GetDesc().Height, m_BloomAttribs->Radius);
298 ShaderResourceVariableX TextureInputSV{RenderTech.SRB, SHADER_TYPE_PIXEL, "g_TextureInput"};
299 for (Int32 TextureIdx = 1; TextureIdx < MipCount; TextureIdx++)
300 {
301 ITextureView* pRTVs[] = {
302 m_DownsampledTextures[TextureIdx]->GetDefaultView(TEXTURE_VIEW_RENDER_TARGET),
303 };
304
305 TextureInputSV.Set(m_DownsampledTextures[TextureIdx - 1]->GetDefaultView(TEXTURE_VIEW_SHADER_RESOURCE));
306 RenderAttribs.pDeviceContext->SetRenderTargets(1, pRTVs, nullptr, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
307 RenderAttribs.pDeviceContext->SetPipelineState(RenderTech.PSO);
308 RenderAttribs.pDeviceContext->CommitShaderResources(RenderTech.SRB, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
309 RenderAttribs.pDeviceContext->Draw({3, DRAW_FLAG_VERIFY_ALL, 1});
310 RenderAttribs.pDeviceContext->SetRenderTargets(0, nullptr, nullptr, RESOURCE_STATE_TRANSITION_MODE_NONE);
311 }
312}
313
314void Bloom::ComputeUpsampledTextures(const RenderAttributes& RenderAttribs)
315{

Callers

nothing calls this directly

Calls 4

IsInitializedSRBMethod · 0.80
InitializeSRBMethod · 0.80
SetPipelineStateMethod · 0.80
CommitShaderResourcesMethod · 0.80

Tested by

no test coverage detected