|
|
@@ -6,6 +6,8 @@
|
|
|
#include <anki/renderer/Ssgi.h>
|
|
|
#include <anki/renderer/Renderer.h>
|
|
|
#include <anki/renderer/DepthDownscale.h>
|
|
|
+#include <anki/renderer/GBuffer.h>
|
|
|
+#include <anki/renderer/DownscaleBlur.h>
|
|
|
#include <anki/core/ConfigSet.h>
|
|
|
#include <shaders/glsl_cpp_common/Ssgi.h>
|
|
|
|
|
|
@@ -84,7 +86,7 @@ void Ssgi::populateRenderGraph(RenderingContext& ctx)
|
|
|
|
|
|
void Ssgi::run(RenderPassWorkContext& rgraphCtx)
|
|
|
{
|
|
|
- // RenderingContext& ctx = *m_runCtx.m_ctx;
|
|
|
+ RenderingContext& ctx = *m_runCtx.m_ctx;
|
|
|
CommandBufferPtr& cmdb = rgraphCtx.m_commandBuffer;
|
|
|
cmdb->bindShaderProgram(m_main.m_grProg[m_r->getFrameCount() & 1u]);
|
|
|
|
|
|
@@ -94,6 +96,20 @@ void Ssgi::run(RenderPassWorkContext& rgraphCtx)
|
|
|
SsgiUniforms* unis = allocateAndBindUniforms<SsgiUniforms*>(sizeof(SsgiUniforms), cmdb, 0, 1);
|
|
|
unis->m_depthBufferSize = UVec2(m_r->getWidth(), m_r->getHeight()) >> (m_main.m_depthLod + 1);
|
|
|
unis->m_framebufferSize = UVec2(m_r->getWidth(), m_r->getHeight());
|
|
|
+ unis->m_invProjMat = ctx.m_matrices.m_projectionJitter.getInverse();
|
|
|
+
|
|
|
+ cmdb->bindSampler(0, 2, m_r->getSamplers().m_trilinearClamp);
|
|
|
+
|
|
|
+ rgraphCtx.bindColorTexture(0, 3, m_r->getGBuffer().getColorRt(2));
|
|
|
+
|
|
|
+ TextureSubresourceInfo hizSubresource;
|
|
|
+ hizSubresource.m_firstMipmap = m_main.m_depthLod;
|
|
|
+ rgraphCtx.bindTexture(0, 4, m_r->getDepthDownscale().getHiZRt(), hizSubresource);
|
|
|
+
|
|
|
+ rgraphCtx.bindColorTexture(0, 5, m_r->getDownscaleBlur().getRt());
|
|
|
+
|
|
|
+ cmdb->bindSampler(0, 6, m_r->getSamplers().m_trilinearRepeat);
|
|
|
+ cmdb->bindTexture(0, 7, m_main.m_noiseTex->getGrTextureView(), TextureUsageBit::SAMPLED_ALL);
|
|
|
|
|
|
// Dispatch
|
|
|
dispatchPPCompute(cmdb, 16, 16, m_r->getWidth() / 2, m_r->getHeight());
|