Răsfoiți Sursa

Rename a renderer stage

Panagiotis Christopoulos Charitos 6 ani în urmă
părinte
comite
05358de595

+ 1 - 1
src/anki/Renderer.h

@@ -21,7 +21,7 @@
 #include <anki/renderer/TemporalAA.h>
 #include <anki/renderer/RenderQueue.h>
 #include <anki/renderer/Ssr.h>
-#include <anki/renderer/Indirect.h>
+#include <anki/renderer/ProbeReflections.h>
 #include <anki/renderer/Dbg.h>
 #include <anki/renderer/Ssao.h>
 #include <anki/renderer/Drawer.h>

+ 6 - 4
src/anki/math/Vec.h

@@ -2811,11 +2811,13 @@ public:
 		ANKI_ASSERT(w() == T(0));
 		ANKI_ASSERT(b.w() == T(0));
 		const auto& a = *this;
-		const int mask0 = _MM_SHUFFLE(3, 0, 2, 1);
-		const int mask1 = _MM_SHUFFLE(3, 1, 0, 2);
+		constexpr unsigned int mask0 = _MM_SHUFFLE(3, 0, 2, 1);
+		constexpr unsigned int mask1 = _MM_SHUFFLE(3, 1, 0, 2);
 
-		__m128 tmp0 = _mm_mul_ps(_mm_shuffle_ps(a.m_simd, a.m_simd, mask0), _mm_shuffle_ps(b.m_simd, b.m_simd, mask1));
-		__m128 tmp1 = _mm_mul_ps(_mm_shuffle_ps(a.m_simd, a.m_simd, mask1), _mm_shuffle_ps(b.m_simd, b.m_simd, mask0));
+		const __m128 tmp0 =
+			_mm_mul_ps(_mm_shuffle_ps(a.m_simd, a.m_simd, U8(mask0)), _mm_shuffle_ps(b.m_simd, b.m_simd, U8(mask1)));
+		const __m128 tmp1 =
+			_mm_mul_ps(_mm_shuffle_ps(a.m_simd, a.m_simd, U8(mask1)), _mm_shuffle_ps(b.m_simd, b.m_simd, U8(mask0)));
 
 		return TVec(_mm_sub_ps(tmp0, tmp1));
 	}

+ 1 - 1
src/anki/renderer/ClusterBin.cpp

@@ -336,7 +336,7 @@ void ClusterBin::binTile(U32 tileIdx, BinCtx& ctx, TileCtx& tileCtx)
 
 #define ANKI_SET_IDX(typeIdx) \
 	ClusterBin::TileCtx::ClusterMetaInfo& inf = tileCtx.m_clusterInfos[clusterZ]; \
-	if(ANKI_UNLIKELY(inf.m_offset + 1 >= m_avgObjectsPerCluster)) \
+	if(ANKI_UNLIKELY(U32(inf.m_offset) + 1 >= m_avgObjectsPerCluster)) \
 	{ \
 		ANKI_R_LOGW("Out of cluster indices. Increase r.avgObjectsPerCluster"); \
 		continue; \

+ 1 - 1
src/anki/renderer/Common.h

@@ -30,7 +30,7 @@ class Tonemapping;
 class Bloom;
 class FinalComposite;
 class Dbg;
-class Indirect;
+class ProbeReflections;
 class DownscaleBlur;
 class VolumetricFog;
 class DepthDownscale;

+ 5 - 5
src/anki/renderer/LightShading.cpp

@@ -6,7 +6,7 @@
 #include <anki/renderer/LightShading.h>
 #include <anki/renderer/Renderer.h>
 #include <anki/renderer/ShadowMapping.h>
-#include <anki/renderer/Indirect.h>
+#include <anki/renderer/ProbeReflections.h>
 #include <anki/renderer/GBuffer.h>
 #include <anki/renderer/RenderQueue.h>
 #include <anki/renderer/ForwardShading.h>
@@ -58,7 +58,7 @@ Error LightShading::initLightShading(const ConfigSet& config)
 		.add("CLUSTER_COUNT_Y", U32(m_r->getClusterCount()[1]))
 		.add("CLUSTER_COUNT_Z", U32(m_r->getClusterCount()[2]))
 		.add("CLUSTER_COUNT", U32(m_r->getClusterCount()[3]))
-		.add("IR_MIPMAP_COUNT", U32(m_r->getIndirect().getReflectionTextureMipmapCount()));
+		.add("IR_MIPMAP_COUNT", U32(m_r->getProbeReflections().getReflectionTextureMipmapCount()));
 
 	const ShaderProgramResourceVariant* variant;
 	m_lightShading.m_prog->getOrCreateVariant(consts.get(), variant);
@@ -116,8 +116,8 @@ void LightShading::run(RenderPassWorkContext& rgraphCtx)
 		rgraphCtx.bindColorTexture(0, 3, m_r->getShadowMapping().getShadowmapRt());
 
 		bindUniforms(cmdb, 0, 4, rsrc.m_reflectionProbesToken);
-		rgraphCtx.bindColorTexture(0, 5, m_r->getIndirect().getReflectionRt());
-		cmdb->bindTexture(0, 6, m_r->getIndirect().getIntegrationLut(), TextureUsageBit::SAMPLED_FRAGMENT);
+		rgraphCtx.bindColorTexture(0, 5, m_r->getProbeReflections().getReflectionRt());
+		cmdb->bindTexture(0, 6, m_r->getProbeReflections().getIntegrationLut(), TextureUsageBit::SAMPLED_FRAGMENT);
 
 		m_r->getGlobalIllumination().bindVolumeTextures(ctx, rgraphCtx, 0, 7);
 		bindUniforms(cmdb, 0, 8, rsrc.m_globalIlluminationProbesToken);
@@ -205,7 +205,7 @@ void LightShading::populateRenderGraph(RenderingContext& ctx)
 
 	// Refl & indirect
 	pass.newDependency({m_r->getSsr().getRt(), TextureUsageBit::SAMPLED_FRAGMENT});
-	pass.newDependency({m_r->getIndirect().getReflectionRt(), TextureUsageBit::SAMPLED_FRAGMENT});
+	pass.newDependency({m_r->getProbeReflections().getReflectionRt(), TextureUsageBit::SAMPLED_FRAGMENT});
 
 	m_r->getGlobalIllumination().setRenderGraphDependencies(ctx, pass, TextureUsageBit::SAMPLED_FRAGMENT);
 

+ 0 - 1
src/anki/renderer/MainRenderer.cpp

@@ -8,7 +8,6 @@
 #include <anki/renderer/FinalComposite.h>
 #include <anki/renderer/Dbg.h>
 #include <anki/renderer/GBuffer.h>
-#include <anki/renderer/Indirect.h>
 #include <anki/renderer/RenderQueue.h>
 #include <anki/util/Logger.h>
 #include <anki/util/File.h>

+ 23 - 23
src/anki/renderer/Indirect.cpp → src/anki/renderer/ProbeReflections.cpp

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-#include <anki/renderer/Indirect.h>
+#include <anki/renderer/ProbeReflections.h>
 #include <anki/renderer/LightShading.h>
 #include <anki/renderer/FinalComposite.h>
 #include <anki/renderer/GBuffer.h>
@@ -16,19 +16,19 @@
 namespace anki
 {
 
-Indirect::Indirect(Renderer* r)
+ProbeReflections::ProbeReflections(Renderer* r)
 	: RendererObject(r)
 	, m_lightShading(r)
 {
 }
 
-Indirect::~Indirect()
+ProbeReflections::~ProbeReflections()
 {
 	m_cacheEntries.destroy(getAllocator());
 	m_probeUuidToCacheEntryIdx.destroy(getAllocator());
 }
 
-Error Indirect::init(const ConfigSet& config)
+Error ProbeReflections::init(const ConfigSet& config)
 {
 	ANKI_R_LOGI("Initializing image reflections");
 
@@ -41,7 +41,7 @@ Error Indirect::init(const ConfigSet& config)
 	return err;
 }
 
-Error Indirect::initInternal(const ConfigSet& config)
+Error ProbeReflections::initInternal(const ConfigSet& config)
 {
 	// Init cache entries
 	m_cacheEntries.create(getAllocator(), config.getNumber("r.indirect.maxSimultaneousProbeCount"));
@@ -66,7 +66,7 @@ Error Indirect::initInternal(const ConfigSet& config)
 	return Error::NONE;
 }
 
-Error Indirect::initGBuffer(const ConfigSet& config)
+Error ProbeReflections::initGBuffer(const ConfigSet& config)
 {
 	m_gbuffer.m_tileSize = config.getNumber("r.indirect.reflectionResolution");
 
@@ -113,7 +113,7 @@ Error Indirect::initGBuffer(const ConfigSet& config)
 	return Error::NONE;
 }
 
-Error Indirect::initLightShading(const ConfigSet& config)
+Error ProbeReflections::initLightShading(const ConfigSet& config)
 {
 	m_lightShading.m_tileSize = config.getNumber("r.indirect.reflectionResolution");
 	m_lightShading.m_mipCount = computeMaxMipmapCount2d(m_lightShading.m_tileSize, m_lightShading.m_tileSize, 8);
@@ -141,7 +141,7 @@ Error Indirect::initLightShading(const ConfigSet& config)
 	return Error::NONE;
 }
 
-Error Indirect::initIrradiance(const ConfigSet& config)
+Error ProbeReflections::initIrradiance(const ConfigSet& config)
 {
 	m_irradiance.m_workgroupSize = config.getNumber("r.indirect.irradianceResolution");
 
@@ -173,7 +173,7 @@ Error Indirect::initIrradiance(const ConfigSet& config)
 	return Error::NONE;
 }
 
-Error Indirect::initIrradianceToRefl(const ConfigSet& cfg)
+Error ProbeReflections::initIrradianceToRefl(const ConfigSet& cfg)
 {
 	// Create program
 	ANKI_CHECK(
@@ -186,7 +186,7 @@ Error Indirect::initIrradianceToRefl(const ConfigSet& cfg)
 	return Error::NONE;
 }
 
-Error Indirect::initShadowMapping(const ConfigSet& cfg)
+Error ProbeReflections::initShadowMapping(const ConfigSet& cfg)
 {
 	const U resolution = cfg.getNumber("r.indirect.shadowMapResolution");
 	ANKI_ASSERT(resolution > 8);
@@ -216,7 +216,7 @@ Error Indirect::initShadowMapping(const ConfigSet& cfg)
 	return Error::NONE;
 }
 
-void Indirect::initCacheEntry(U32 cacheEntryIdx)
+void ProbeReflections::initCacheEntry(U32 cacheEntryIdx)
 {
 	CacheEntry& cacheEntry = m_cacheEntries[cacheEntryIdx];
 
@@ -233,7 +233,7 @@ void Indirect::initCacheEntry(U32 cacheEntryIdx)
 	}
 }
 
-void Indirect::prepareProbes(RenderingContext& ctx,
+void ProbeReflections::prepareProbes(RenderingContext& ctx,
 	ReflectionProbeQueueElement*& probeToUpdateThisFrame,
 	U32& probeToUpdateThisFrameCacheEntryIdx)
 {
@@ -337,7 +337,7 @@ void Indirect::prepareProbes(RenderingContext& ctx,
 	}
 }
 
-void Indirect::runGBuffer(U32 faceIdx, CommandBufferPtr& cmdb)
+void ProbeReflections::runGBuffer(U32 faceIdx, CommandBufferPtr& cmdb)
 {
 	ANKI_ASSERT(m_ctx.m_probe);
 	ANKI_TRACE_SCOPED_EVENT(R_CUBE_REFL);
@@ -367,7 +367,7 @@ void Indirect::runGBuffer(U32 faceIdx, CommandBufferPtr& cmdb)
 	cmdb->setScissor(0, 0, MAX_U32, MAX_U32);
 }
 
-void Indirect::runLightShading(U32 faceIdx, RenderPassWorkContext& rgraphCtx)
+void ProbeReflections::runLightShading(U32 faceIdx, RenderPassWorkContext& rgraphCtx)
 {
 	ANKI_ASSERT(faceIdx <= 6);
 	ANKI_TRACE_SCOPED_EVENT(R_CUBE_REFL);
@@ -415,7 +415,7 @@ void Indirect::runLightShading(U32 faceIdx, RenderPassWorkContext& rgraphCtx)
 		cmdb);
 }
 
-void Indirect::runMipmappingOfLightShading(U32 faceIdx, RenderPassWorkContext& rgraphCtx)
+void ProbeReflections::runMipmappingOfLightShading(U32 faceIdx, RenderPassWorkContext& rgraphCtx)
 {
 	ANKI_ASSERT(faceIdx < 6);
 	ANKI_ASSERT(m_ctx.m_cacheEntryIdx < m_cacheEntries.getSize());
@@ -433,7 +433,7 @@ void Indirect::runMipmappingOfLightShading(U32 faceIdx, RenderPassWorkContext& r
 	rgraphCtx.m_commandBuffer->generateMipmaps2d(getGrManager().newTextureView(viewInit));
 }
 
-void Indirect::runIrradiance(RenderPassWorkContext& rgraphCtx)
+void ProbeReflections::runIrradiance(RenderPassWorkContext& rgraphCtx)
 {
 	ANKI_TRACE_SCOPED_EVENT(R_CUBE_REFL);
 	const U32 cacheEntryIdx = m_ctx.m_cacheEntryIdx;
@@ -460,7 +460,7 @@ void Indirect::runIrradiance(RenderPassWorkContext& rgraphCtx)
 	cmdb->dispatchCompute(1, 1, 1);
 }
 
-void Indirect::runIrradianceToRefl(RenderPassWorkContext& rgraphCtx)
+void ProbeReflections::runIrradianceToRefl(RenderPassWorkContext& rgraphCtx)
 {
 	ANKI_TRACE_SCOPED_EVENT(R_CUBE_REFL);
 
@@ -488,7 +488,7 @@ void Indirect::runIrradianceToRefl(RenderPassWorkContext& rgraphCtx)
 	dispatchPPCompute(cmdb, 8, 8, m_lightShading.m_tileSize, m_lightShading.m_tileSize);
 }
 
-void Indirect::populateRenderGraph(RenderingContext& rctx)
+void ProbeReflections::populateRenderGraph(RenderingContext& rctx)
 {
 	ANKI_TRACE_SCOPED_EVENT(R_CUBE_REFL);
 
@@ -535,7 +535,7 @@ void Indirect::populateRenderGraph(RenderingContext& rctx)
 		pass.setFramebufferInfo(m_gbuffer.m_fbDescr, rts, m_ctx.m_gbufferDepthRt);
 		pass.setWork(
 			[](RenderPassWorkContext& rgraphCtx) {
-				static_cast<Indirect*>(rgraphCtx.m_userData)
+				static_cast<ProbeReflections*>(rgraphCtx.m_userData)
 					->runGBuffer(rgraphCtx.m_currentSecondLevelCommandBufferIndex, rgraphCtx.m_commandBuffer);
 			},
 			this,
@@ -593,7 +593,7 @@ void Indirect::populateRenderGraph(RenderingContext& rctx)
 		pass.setFramebufferInfo(m_shadowMapping.m_fbDescr, {}, m_ctx.m_shadowMapRt);
 		pass.setWork(
 			[](RenderPassWorkContext& rgraphCtx) {
-				static_cast<Indirect*>(rgraphCtx.m_userData)
+				static_cast<ProbeReflections*>(rgraphCtx.m_userData)
 					->runShadowMapping(rgraphCtx.m_currentSecondLevelCommandBufferIndex, rgraphCtx.m_commandBuffer);
 			},
 			this,
@@ -661,7 +661,7 @@ void Indirect::populateRenderGraph(RenderingContext& rctx)
 
 		pass.setWork(
 			[](RenderPassWorkContext& rgraphCtx) {
-				static_cast<Indirect*>(rgraphCtx.m_userData)->runIrradiance(rgraphCtx);
+				static_cast<ProbeReflections*>(rgraphCtx.m_userData)->runIrradiance(rgraphCtx);
 			},
 			this,
 			0);
@@ -681,7 +681,7 @@ void Indirect::populateRenderGraph(RenderingContext& rctx)
 
 		pass.setWork(
 			[](RenderPassWorkContext& rgraphCtx) {
-				static_cast<Indirect*>(rgraphCtx.m_userData)->runIrradianceToRefl(rgraphCtx);
+				static_cast<ProbeReflections*>(rgraphCtx.m_userData)->runIrradianceToRefl(rgraphCtx);
 			},
 			this,
 			0);
@@ -727,7 +727,7 @@ void Indirect::populateRenderGraph(RenderingContext& rctx)
 	}
 }
 
-void Indirect::runShadowMapping(U32 faceIdx, CommandBufferPtr& cmdb)
+void ProbeReflections::runShadowMapping(U32 faceIdx, CommandBufferPtr& cmdb)
 {
 	cmdb->setPolygonOffset(1.0f, 1.0f);
 

+ 6 - 6
src/anki/renderer/Indirect.h → src/anki/renderer/ProbeReflections.h

@@ -17,15 +17,15 @@ namespace anki
 /// @addtogroup renderer
 /// @{
 
-/// Probe reflections and irradiance.
-class Indirect : public RendererObject
+/// Probe reflections.
+class ProbeReflections : public RendererObject
 {
 	friend class IrTask;
 
 anki_internal:
-	Indirect(Renderer* r);
+	ProbeReflections(Renderer* r);
 
-	~Indirect();
+	~ProbeReflections();
 
 	ANKI_USE_RESULT Error init(const ConfigSet& cfg);
 
@@ -154,7 +154,7 @@ private:
 	template<U faceIdx>
 	static void runLightShadingCallback(RenderPassWorkContext& rgraphCtx)
 	{
-		Indirect* const self = static_cast<Indirect*>(rgraphCtx.m_userData);
+		ProbeReflections* const self = static_cast<ProbeReflections*>(rgraphCtx.m_userData);
 		self->runLightShading(faceIdx, rgraphCtx);
 	}
 
@@ -162,7 +162,7 @@ private:
 	template<U faceIdx>
 	static void runMipmappingOfLightShadingCallback(RenderPassWorkContext& rgraphCtx)
 	{
-		Indirect* const self = static_cast<Indirect*>(rgraphCtx.m_userData);
+		ProbeReflections* const self = static_cast<ProbeReflections*>(rgraphCtx.m_userData);
 		self->runMipmappingOfLightShading(faceIdx, rgraphCtx);
 	}
 };

+ 4 - 4
src/anki/renderer/Renderer.cpp

@@ -10,7 +10,7 @@
 #include <anki/util/HighRezTimer.h>
 #include <anki/collision/Aabb.h>
 
-#include <anki/renderer/Indirect.h>
+#include <anki/renderer/ProbeReflections.h>
 #include <anki/renderer/GBuffer.h>
 #include <anki/renderer/GBufferPost.h>
 #include <anki/renderer/LightShading.h>
@@ -128,8 +128,8 @@ Error Renderer::initInternal(const ConfigSet& config)
 	m_gi.reset(m_alloc.newInstance<GlobalIllumination>(this));
 	ANKI_CHECK(m_gi->init(config));
 
-	m_indirect.reset(m_alloc.newInstance<Indirect>(this));
-	ANKI_CHECK(m_indirect->init(config));
+	m_probeReflections.reset(m_alloc.newInstance<ProbeReflections>(this));
+	ANKI_CHECK(m_probeReflections->init(config));
 
 	m_gbuffer.reset(m_alloc.newInstance<GBuffer>(this));
 	ANKI_CHECK(m_gbuffer->init(config));
@@ -298,7 +298,7 @@ Error Renderer::populateRenderGraph(RenderingContext& ctx)
 	// Populate render graph. WARNING Watch the order
 	m_shadowMapping->populateRenderGraph(ctx);
 	m_gi->populateRenderGraph(ctx);
-	m_indirect->populateRenderGraph(ctx);
+	m_probeReflections->populateRenderGraph(ctx);
 	m_volLighting->populateRenderGraph(ctx);
 	m_gbuffer->populateRenderGraph(ctx);
 	m_gbufferPost->populateRenderGraph(ctx);

+ 3 - 3
src/anki/renderer/Renderer.h

@@ -96,9 +96,9 @@ public:
 
 	~Renderer();
 
-	Indirect& getIndirect()
+	ProbeReflections& getProbeReflections()
 	{
-		return *m_indirect;
+		return *m_probeReflections;
 	}
 
 	VolumetricLightingAccumulation& getVolumetricLightingAccumulation()
@@ -378,7 +378,7 @@ private:
 	/// @{
 	UniquePtr<VolumetricLightingAccumulation> m_volLighting;
 	UniquePtr<GlobalIllumination> m_gi;
-	UniquePtr<Indirect> m_indirect;
+	UniquePtr<ProbeReflections> m_probeReflections;
 	UniquePtr<ShadowMapping> m_shadowMapping; ///< Shadow mapping.
 	UniquePtr<GBuffer> m_gbuffer; ///< Material rendering stage
 	UniquePtr<GBufferPost> m_gbufferPost;