ソースを参照

Some renaming

Panagiotis Christopoulos Charitos 4 年 前
コミット
4e8c3f0f8e

+ 1 - 1
AnKi/Renderer.h

@@ -28,7 +28,7 @@
 #include <AnKi/Renderer/RendererObject.h>
 #include <AnKi/Renderer/Bloom.h>
 #include <AnKi/Renderer/VolumetricLightingAccumulation.h>
-#include <AnKi/Renderer/GlobalIllumination.h>
+#include <AnKi/Renderer/IndirectDiffuseProbes.h>
 #include <AnKi/Renderer/GenericCompute.h>
 #include <AnKi/Renderer/ShadowmapsResolve.h>
 #include <AnKi/Renderer/IndirectDiffuse.h>

+ 3 - 3
AnKi/Renderer/IndirectDiffuse.cpp

@@ -9,7 +9,7 @@
 #include <AnKi/Renderer/GBuffer.h>
 #include <AnKi/Renderer/DownscaleBlur.h>
 #include <AnKi/Renderer/MotionVectors.h>
-#include <AnKi/Renderer/GlobalIllumination.h>
+#include <AnKi/Renderer/IndirectDiffuseProbes.h>
 #include <AnKi/Core/ConfigSet.h>
 #include <AnKi/Shaders/Include/IndirectDiffuseTypes.h>
 
@@ -105,7 +105,7 @@ void IndirectDiffuse::populateRenderGraph(RenderingContext& ctx)
 			RenderPassDependency(m_runCtx.m_mainRtHandles[WRITE], TextureUsageBit::IMAGE_COMPUTE_WRITE));
 
 		const TextureUsageBit readUsage = TextureUsageBit::SAMPLED_COMPUTE;
-		m_r->getGlobalIllumination().setRenderGraphDependencies(ctx, rpass, readUsage);
+		m_r->getIndirectDiffuseProbes().setRenderGraphDependencies(ctx, rpass, readUsage);
 		rpass.newDependency(RenderPassDependency(m_r->getGBuffer().getColorRt(2), readUsage));
 		TextureSubresourceInfo hizSubresource;
 		hizSubresource.m_mipmapCount = 1;
@@ -121,7 +121,7 @@ void IndirectDiffuse::populateRenderGraph(RenderingContext& ctx)
 
 			const ClusteredShadingContext& binning = ctx.m_clusteredShading;
 			bindUniforms(cmdb, 0, 0, binning.m_clusteredShadingUniformsToken);
-			m_r->getGlobalIllumination().bindVolumeTextures(ctx, rgraphCtx, 0, 1);
+			m_r->getIndirectDiffuseProbes().bindVolumeTextures(ctx, rgraphCtx, 0, 1);
 			bindUniforms(cmdb, 0, 2, binning.m_globalIlluminationProbesToken);
 			bindStorage(cmdb, 0, 3, binning.m_clustersToken);
 

+ 21 - 21
AnKi/Renderer/GlobalIllumination.cpp → AnKi/Renderer/IndirectDiffuseProbes.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include <AnKi/Renderer/GlobalIllumination.h>
+#include <AnKi/Renderer/IndirectDiffuseProbes.h>
 #include <AnKi/Renderer/Renderer.h>
 #include <AnKi/Renderer/RenderQueue.h>
 #include <AnKi/Core/ConfigSet.h>
@@ -30,10 +30,10 @@ static Vec3 computeProbeCellPosition(U32 cellIdx, const GlobalIlluminationProbeQ
 	return cellPos;
 }
 
-class GlobalIllumination::InternalContext
+class IndirectDiffuseProbes::InternalContext
 {
 public:
-	GlobalIllumination* m_gi ANKI_DEBUG_CODE(= numberToPtr<GlobalIllumination*>(1));
+	IndirectDiffuseProbes* m_gi ANKI_DEBUG_CODE(= numberToPtr<IndirectDiffuseProbes*>(1));
 	RenderingContext* m_ctx ANKI_DEBUG_CODE(= numberToPtr<RenderingContext*>(1));
 
 	GlobalIlluminationProbeQueueElement*
@@ -55,14 +55,14 @@ public:
 	}
 };
 
-GlobalIllumination::~GlobalIllumination()
+IndirectDiffuseProbes::~IndirectDiffuseProbes()
 {
 	m_cacheEntries.destroy(getAllocator());
 	m_probeUuidToCacheEntryIdx.destroy(getAllocator());
 }
 
 const RenderTargetHandle&
-GlobalIllumination::getVolumeRenderTarget(const GlobalIlluminationProbeQueueElement& probe) const
+IndirectDiffuseProbes::getVolumeRenderTarget(const GlobalIlluminationProbeQueueElement& probe) const
 {
 	ANKI_ASSERT(m_giCtx);
 	ANKI_ASSERT(&probe >= &m_giCtx->m_ctx->m_renderQueue->m_giProbes.getFront()
@@ -71,8 +71,8 @@ GlobalIllumination::getVolumeRenderTarget(const GlobalIlluminationProbeQueueElem
 	return m_giCtx->m_irradianceProbeRts[idx];
 }
 
-void GlobalIllumination::setRenderGraphDependencies(const RenderingContext& ctx, RenderPassDescriptionBase& pass,
-													TextureUsageBit usage) const
+void IndirectDiffuseProbes::setRenderGraphDependencies(const RenderingContext& ctx, RenderPassDescriptionBase& pass,
+													   TextureUsageBit usage) const
 {
 	for(U32 idx = 0; idx < ctx.m_renderQueue->m_giProbes.getSize(); ++idx)
 	{
@@ -80,8 +80,8 @@ void GlobalIllumination::setRenderGraphDependencies(const RenderingContext& ctx,
 	}
 }
 
-void GlobalIllumination::bindVolumeTextures(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx, U32 set,
-											U32 binding) const
+void IndirectDiffuseProbes::bindVolumeTextures(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx, U32 set,
+											   U32 binding) const
 {
 	for(U32 idx = 0; idx < MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES; ++idx)
 	{
@@ -96,7 +96,7 @@ void GlobalIllumination::bindVolumeTextures(const RenderingContext& ctx, RenderP
 	}
 }
 
-Error GlobalIllumination::init(const ConfigSet& cfg)
+Error IndirectDiffuseProbes::init(const ConfigSet& cfg)
 {
 	ANKI_R_LOGI("Initializing global illumination");
 
@@ -109,7 +109,7 @@ Error GlobalIllumination::init(const ConfigSet& cfg)
 	return err;
 }
 
-Error GlobalIllumination::initInternal(const ConfigSet& cfg)
+Error IndirectDiffuseProbes::initInternal(const ConfigSet& cfg)
 {
 	m_tileSize = cfg.getNumberU32("r_giTileResolution");
 	m_cacheEntries.create(getAllocator(), cfg.getNumberU32("r_giMaxCachedProbes"));
@@ -125,7 +125,7 @@ Error GlobalIllumination::initInternal(const ConfigSet& cfg)
 	return Error::NONE;
 }
 
-Error GlobalIllumination::initGBuffer(const ConfigSet& cfg)
+Error IndirectDiffuseProbes::initGBuffer(const ConfigSet& cfg)
 {
 	// Create RT descriptions
 	{
@@ -167,7 +167,7 @@ Error GlobalIllumination::initGBuffer(const ConfigSet& cfg)
 	return Error::NONE;
 }
 
-Error GlobalIllumination::initShadowMapping(const ConfigSet& cfg)
+Error IndirectDiffuseProbes::initShadowMapping(const ConfigSet& cfg)
 {
 	const U32 resolution = cfg.getNumberU32("r_giShadowMapResolution");
 	ANKI_ASSERT(resolution > 8);
@@ -197,7 +197,7 @@ Error GlobalIllumination::initShadowMapping(const ConfigSet& cfg)
 	return Error::NONE;
 }
 
-Error GlobalIllumination::initLightShading(const ConfigSet& cfg)
+Error IndirectDiffuseProbes::initLightShading(const ConfigSet& cfg)
 {
 	// Init RT descr
 	{
@@ -219,7 +219,7 @@ Error GlobalIllumination::initLightShading(const ConfigSet& cfg)
 	return Error::NONE;
 }
 
-Error GlobalIllumination::initIrradiance(const ConfigSet& cfg)
+Error IndirectDiffuseProbes::initIrradiance(const ConfigSet& cfg)
 {
 	ANKI_CHECK(m_r->getResourceManager().loadResource("Shaders/IrradianceDice.ankiprog", m_irradiance.m_prog));
 
@@ -236,7 +236,7 @@ Error GlobalIllumination::initIrradiance(const ConfigSet& cfg)
 	return Error::NONE;
 }
 
-void GlobalIllumination::populateRenderGraph(RenderingContext& rctx)
+void IndirectDiffuseProbes::populateRenderGraph(RenderingContext& rctx)
 {
 	ANKI_TRACE_SCOPED_EVENT(R_GI);
 
@@ -382,7 +382,7 @@ void GlobalIllumination::populateRenderGraph(RenderingContext& rctx)
 	}
 }
 
-void GlobalIllumination::prepareProbes(InternalContext& giCtx)
+void IndirectDiffuseProbes::prepareProbes(InternalContext& giCtx)
 {
 	RenderingContext& ctx = *giCtx.m_ctx;
 	giCtx.m_probeToUpdateThisFrame = nullptr;
@@ -545,7 +545,7 @@ void GlobalIllumination::prepareProbes(InternalContext& giCtx)
 	}
 }
 
-void GlobalIllumination::runGBufferInThread(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx) const
+void IndirectDiffuseProbes::runGBufferInThread(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx) const
 {
 	ANKI_ASSERT(giCtx.m_probeToUpdateThisFrame);
 	ANKI_TRACE_SCOPED_EVENT(R_GI);
@@ -590,7 +590,7 @@ void GlobalIllumination::runGBufferInThread(RenderPassWorkContext& rgraphCtx, In
 	// It's secondary, no need to restore the state
 }
 
-void GlobalIllumination::runShadowmappingInThread(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx) const
+void IndirectDiffuseProbes::runShadowmappingInThread(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx) const
 {
 	ANKI_ASSERT(giCtx.m_probeToUpdateThisFrame);
 	ANKI_TRACE_SCOPED_EVENT(R_GI);
@@ -639,7 +639,7 @@ void GlobalIllumination::runShadowmappingInThread(RenderPassWorkContext& rgraphC
 	// It's secondary, no need to restore the state
 }
 
-void GlobalIllumination::runLightShading(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx)
+void IndirectDiffuseProbes::runLightShading(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx)
 {
 	ANKI_TRACE_SCOPED_EVENT(R_GI);
 
@@ -699,7 +699,7 @@ void GlobalIllumination::runLightShading(RenderPassWorkContext& rgraphCtx, Inter
 	}
 }
 
-void GlobalIllumination::runIrradiance(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx)
+void IndirectDiffuseProbes::runIrradiance(RenderPassWorkContext& rgraphCtx, InternalContext& giCtx)
 {
 	ANKI_TRACE_SCOPED_EVENT(R_GI);
 

+ 3 - 3
AnKi/Renderer/GlobalIllumination.h → AnKi/Renderer/IndirectDiffuseProbes.h

@@ -19,16 +19,16 @@ namespace anki
 /// Ambient global illumination passes.
 ///
 /// It builds a volume clipmap with ambient GI information.
-class GlobalIllumination : public RendererObject
+class IndirectDiffuseProbes : public RendererObject
 {
 public:
-	GlobalIllumination(Renderer* r)
+	IndirectDiffuseProbes(Renderer* r)
 		: RendererObject(r)
 		, m_lightShading(r)
 	{
 	}
 
-	~GlobalIllumination();
+	~IndirectDiffuseProbes();
 
 	ANKI_USE_RESULT Error init(const ConfigSet& cfg);
 

+ 10 - 16
AnKi/Renderer/LightShading.cpp

@@ -13,7 +13,6 @@
 #include <AnKi/Renderer/VolumetricFog.h>
 #include <AnKi/Renderer/DepthDownscale.h>
 #include <AnKi/Renderer/Ssr.h>
-#include <AnKi/Renderer/GlobalIllumination.h>
 #include <AnKi/Renderer/ShadowmapsResolve.h>
 #include <AnKi/Renderer/RtShadows.h>
 #include <AnKi/Renderer/IndirectDiffuse.h>
@@ -141,27 +140,24 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 		rgraphCtx.bindColorTexture(0, 5, m_r->getProbeReflections().getReflectionRt());
 		cmdb->bindTexture(0, 6, m_r->getProbeReflections().getIntegrationLut());
 
-		m_r->getGlobalIllumination().bindVolumeTextures(ctx, rgraphCtx, 0, 7);
-		bindUniforms(cmdb, 0, 8, binning.m_globalIlluminationProbesToken);
+		bindStorage(cmdb, 0, 7, binning.m_clustersToken);
 
-		bindStorage(cmdb, 0, 9, binning.m_clustersToken);
-
-		cmdb->bindSampler(0, 10, m_r->getSamplers().m_nearestNearestClamp);
-		cmdb->bindSampler(0, 11, m_r->getSamplers().m_trilinearClamp);
-		rgraphCtx.bindColorTexture(0, 12, m_r->getGBuffer().getColorRt(0));
-		rgraphCtx.bindColorTexture(0, 13, m_r->getGBuffer().getColorRt(1));
-		rgraphCtx.bindColorTexture(0, 14, m_r->getGBuffer().getColorRt(2));
-		rgraphCtx.bindTexture(0, 15, m_r->getGBuffer().getDepthRt(),
+		cmdb->bindSampler(0, 8, m_r->getSamplers().m_nearestNearestClamp);
+		cmdb->bindSampler(0, 9, m_r->getSamplers().m_trilinearClamp);
+		rgraphCtx.bindColorTexture(0, 10, m_r->getGBuffer().getColorRt(0));
+		rgraphCtx.bindColorTexture(0, 11, m_r->getGBuffer().getColorRt(1));
+		rgraphCtx.bindColorTexture(0, 12, m_r->getGBuffer().getColorRt(2));
+		rgraphCtx.bindTexture(0, 13, m_r->getGBuffer().getDepthRt(),
 							  TextureSubresourceInfo(DepthStencilAspectBit::DEPTH));
-		rgraphCtx.bindColorTexture(0, 16, m_r->getSsr().getRt());
+		rgraphCtx.bindColorTexture(0, 14, m_r->getSsr().getRt());
 
 		if(m_r->getRtShadowsEnabled())
 		{
-			rgraphCtx.bindColorTexture(0, 17, m_r->getRtShadows().getRt());
+			rgraphCtx.bindColorTexture(0, 15, m_r->getRtShadows().getRt());
 		}
 		else
 		{
-			rgraphCtx.bindColorTexture(0, 18, m_r->getShadowmapsResolve().getRt());
+			rgraphCtx.bindColorTexture(0, 16, m_r->getShadowmapsResolve().getRt());
 		}
 
 		// Draw
@@ -272,8 +268,6 @@ void LightShading::populateRenderGraph(RenderingContext& ctx)
 	pass.newDependency(RenderPassDependency(m_r->getSsr().getRt(), readUsage));
 	pass.newDependency(RenderPassDependency(m_r->getProbeReflections().getReflectionRt(), readUsage));
 
-	m_r->getGlobalIllumination().setRenderGraphDependencies(ctx, pass, readUsage);
-
 	// Apply indirect
 	pass.newDependency(RenderPassDependency(m_r->getIndirectDiffuse().getRt(), readUsage));
 	pass.newDependency(RenderPassDependency(m_r->getDepthDownscale().getHiZRt(), readUsage, HIZ_HALF_DEPTH));

+ 4 - 4
AnKi/Renderer/Renderer.cpp

@@ -32,7 +32,7 @@
 #include <AnKi/Renderer/UiStage.h>
 #include <AnKi/Renderer/Ssr.h>
 #include <AnKi/Renderer/VolumetricLightingAccumulation.h>
-#include <AnKi/Renderer/GlobalIllumination.h>
+#include <AnKi/Renderer/IndirectDiffuseProbes.h>
 #include <AnKi/Renderer/GenericCompute.h>
 #include <AnKi/Renderer/ShadowmapsResolve.h>
 #include <AnKi/Renderer/RtShadows.h>
@@ -144,8 +144,8 @@ Error Renderer::initInternal(const ConfigSet& config)
 	m_volumetricLightingAccumulation.reset(m_alloc.newInstance<VolumetricLightingAccumulation>(this));
 	ANKI_CHECK(m_volumetricLightingAccumulation->init(config));
 
-	m_globalIllumination.reset(m_alloc.newInstance<GlobalIllumination>(this));
-	ANKI_CHECK(m_globalIllumination->init(config));
+	m_indirectDiffuseProbes.reset(m_alloc.newInstance<IndirectDiffuseProbes>(this));
+	ANKI_CHECK(m_indirectDiffuseProbes->init(config));
 
 	m_probeReflections.reset(m_alloc.newInstance<ProbeReflections>(this));
 	ANKI_CHECK(m_probeReflections->init(config));
@@ -340,7 +340,7 @@ Error Renderer::populateRenderGraph(RenderingContext& ctx)
 		m_accelerationStructureBuilder->populateRenderGraph(ctx);
 	}
 	m_shadowMapping->populateRenderGraph(ctx);
-	m_globalIllumination->populateRenderGraph(ctx);
+	m_indirectDiffuseProbes->populateRenderGraph(ctx);
 	m_probeReflections->populateRenderGraph(ctx);
 	m_volumetricLightingAccumulation->populateRenderGraph(ctx);
 	m_gbuffer->populateRenderGraph(ctx);

+ 1 - 1
AnKi/Renderer/RendererObjectDefs.h

@@ -21,7 +21,7 @@ ANKI_RENDERER_OBJECT_DEF(TemporalAA, temporalAA)
 ANKI_RENDERER_OBJECT_DEF(UiStage, uiStage)
 ANKI_RENDERER_OBJECT_DEF(Ssr, ssr)
 ANKI_RENDERER_OBJECT_DEF(VolumetricLightingAccumulation, volumetricLightingAccumulation)
-ANKI_RENDERER_OBJECT_DEF(GlobalIllumination, globalIllumination)
+ANKI_RENDERER_OBJECT_DEF(IndirectDiffuseProbes, indirectDiffuseProbes)
 ANKI_RENDERER_OBJECT_DEF(GenericCompute, genericCompute)
 ANKI_RENDERER_OBJECT_DEF(ShadowmapsResolve, shadowmapsResolve)
 ANKI_RENDERER_OBJECT_DEF(RtShadows, rtShadows)

+ 3 - 3
AnKi/Renderer/VolumetricLightingAccumulation.cpp

@@ -5,7 +5,7 @@
 
 #include <AnKi/Renderer/VolumetricLightingAccumulation.h>
 #include <AnKi/Renderer/ShadowMapping.h>
-#include <AnKi/Renderer/GlobalIllumination.h>
+#include <AnKi/Renderer/IndirectDiffuseProbes.h>
 #include <AnKi/Renderer/Renderer.h>
 #include <AnKi/Resource/ImageResource.h>
 #include <AnKi/Core/ConfigSet.h>
@@ -95,7 +95,7 @@ void VolumetricLightingAccumulation::populateRenderGraph(RenderingContext& ctx)
 	pass.newDependency(
 		RenderPassDependency(ctx.m_clusteredShading.m_clustersBufferHandle, BufferUsageBit::STORAGE_COMPUTE_READ));
 
-	m_r->getGlobalIllumination().setRenderGraphDependencies(ctx, pass, TextureUsageBit::SAMPLED_COMPUTE);
+	m_r->getIndirectDiffuseProbes().setRenderGraphDependencies(ctx, pass, TextureUsageBit::SAMPLED_COMPUTE);
 }
 
 void VolumetricLightingAccumulation::run(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx)
@@ -120,7 +120,7 @@ void VolumetricLightingAccumulation::run(const RenderingContext& ctx, RenderPass
 	bindUniforms(cmdb, 0, 7, rsrc.m_spotLightsToken);
 	rgraphCtx.bindColorTexture(0, 8, m_r->getShadowMapping().getShadowmapRt());
 
-	m_r->getGlobalIllumination().bindVolumeTextures(ctx, rgraphCtx, 0, 9);
+	m_r->getIndirectDiffuseProbes().bindVolumeTextures(ctx, rgraphCtx, 0, 9);
 	bindUniforms(cmdb, 0, 10, rsrc.m_globalIlluminationProbesToken);
 
 	bindUniforms(cmdb, 0, 11, rsrc.m_fogDensityVolumesToken);

+ 10 - 11
AnKi/Shaders/LightShading.ankiprog

@@ -23,22 +23,21 @@ ANKI_SPECIALIZATION_CONSTANT_U32(IR_MIPMAP_COUNT, 4u);
 #define CLUSTERED_SHADING_UNIFORMS_BINDING 0
 #define CLUSTERED_SHADING_LIGHTS_BINDING 1
 #define CLUSTERED_SHADING_REFLECTIONS_BINDING 4
-#define CLUSTERED_SHADING_GI_BINDING 7
-#define CLUSTERED_SHADING_CLUSTERS_BINDING 9
+#define CLUSTERED_SHADING_CLUSTERS_BINDING 7
 #include <AnKi/Shaders/ClusteredShadingCommon.glsl>
 
-layout(set = 0, binding = 10) uniform sampler u_nearestAnyClampSampler;
-layout(set = 0, binding = 11) uniform sampler u_trilinearClampSampler;
+layout(set = 0, binding = 8) uniform sampler u_nearestAnyClampSampler;
+layout(set = 0, binding = 9) uniform sampler u_trilinearClampSampler;
 
-layout(set = 0, binding = 12) uniform texture2D u_msRt0;
-layout(set = 0, binding = 13) uniform texture2D u_msRt1;
-layout(set = 0, binding = 14) uniform texture2D u_msRt2;
-layout(set = 0, binding = 15) uniform texture2D u_msDepthRt;
-layout(set = 0, binding = 16) uniform texture2D u_ssrRt;
+layout(set = 0, binding = 10) uniform texture2D u_msRt0;
+layout(set = 0, binding = 11) uniform texture2D u_msRt1;
+layout(set = 0, binding = 12) uniform texture2D u_msRt2;
+layout(set = 0, binding = 13) uniform texture2D u_msDepthRt;
+layout(set = 0, binding = 14) uniform texture2D u_ssrRt;
 #if USE_SHADOW_LAYERS
-layout(set = 0, binding = 17) uniform utexture2D u_shadowLayersTex;
+layout(set = 0, binding = 15) uniform utexture2D u_shadowLayersTex;
 #else
-layout(set = 0, binding = 18) uniform texture2D u_resolvedSm;
+layout(set = 0, binding = 16) uniform texture2D u_resolvedSm;
 #endif
 
 layout(location = 0) in Vec2 in_uv;