Browse Source

Some code style refactoring #18

Panagiotis Christopoulos Charitos 3 years ago
parent
commit
6f65f38e07
84 changed files with 619 additions and 635 deletions
  1. 7 7
      AnKi/Core/App.cpp
  2. 5 5
      AnKi/Input/Input.h
  3. 1 1
      AnKi/Input/InputSdl.cpp
  4. 3 3
      AnKi/Renderer/Bloom.cpp
  5. 34 36
      AnKi/Renderer/ClusterBinning.cpp
  6. 6 6
      AnKi/Renderer/FinalComposite.cpp
  7. 1 1
      AnKi/Renderer/FinalComposite.h
  8. 3 3
      AnKi/Renderer/GBufferPost.cpp
  9. 2 2
      AnKi/Renderer/IndirectDiffuseProbes.cpp
  10. 1 1
      AnKi/Renderer/LensFlare.cpp
  11. 5 5
      AnKi/Renderer/LightShading.cpp
  12. 2 1
      AnKi/Renderer/MotionVectors.cpp
  13. 10 10
      AnKi/Renderer/RtShadows.cpp
  14. 2 2
      AnKi/Renderer/RtShadows.h
  15. 4 3
      AnKi/Renderer/ShadowMapping.cpp
  16. 4 4
      AnKi/Renderer/ShadowmapsResolve.cpp
  17. 3 3
      AnKi/Renderer/TemporalAA.cpp
  18. 1 1
      AnKi/Renderer/Tonemapping.cpp
  19. 3 3
      AnKi/Renderer/VolumetricFog.cpp
  20. 4 4
      AnKi/Renderer/VolumetricLightingAccumulation.cpp
  21. 1 1
      AnKi/Scene/Components/DecalComponent.cpp
  22. 4 4
      AnKi/Scene/Components/LightComponent.cpp
  23. 3 3
      AnKi/Scene/DebugDrawer.cpp
  24. 1 1
      AnKi/Scene/GlobalIlluminationProbeNode.cpp
  25. 2 2
      AnKi/Scene/LightNode.cpp
  26. 1 1
      AnKi/Scene/ReflectionProbeNode.cpp
  27. 1 1
      AnKi/Shaders/BilateralFilter.glsl
  28. 6 7
      AnKi/Shaders/Bloom.glsl
  29. 22 22
      AnKi/Shaders/BloomUpscale.glsl
  30. 48 48
      AnKi/Shaders/ClusterBinning.ankiprog
  31. 19 19
      AnKi/Shaders/ClusteredShadingCommon.glsl
  32. 3 3
      AnKi/Shaders/CollisionFunctions.glsl
  33. 7 9
      AnKi/Shaders/Common.glsl
  34. 7 7
      AnKi/Shaders/DepthAwareBlur.glsl
  35. 3 4
      AnKi/Shaders/DownscaleBlur.glsl
  36. 20 20
      AnKi/Shaders/Evsm.glsl
  37. 9 9
      AnKi/Shaders/FinalComposite.ankiprog
  38. 1 1
      AnKi/Shaders/ForwardShadingCommon.glsl
  39. 1 1
      AnKi/Shaders/ForwardShadingGenericTransparent.ankiprog
  40. 2 2
      AnKi/Shaders/ForwardShadingParticles.ankiprog
  41. 15 15
      AnKi/Shaders/Functions.glsl
  42. 6 6
      AnKi/Shaders/GBufferCommon.glsl
  43. 5 5
      AnKi/Shaders/GBufferGeneric.ankiprog
  44. 4 4
      AnKi/Shaders/GBufferPost.ankiprog
  45. 12 12
      AnKi/Shaders/GaussianBlur.glsl
  46. 13 13
      AnKi/Shaders/GaussianBlurCommon.glsl
  47. 4 4
      AnKi/Shaders/GpuParticlesSimulation.ankiprog
  48. 2 2
      AnKi/Shaders/ImportanceSampling.glsl
  49. 20 20
      AnKi/Shaders/Include/ClusteredShadingTypes.h
  50. 6 6
      AnKi/Shaders/Include/MiscRendererTypes.h
  51. 17 17
      AnKi/Shaders/Include/ModelTypes.h
  52. 6 6
      AnKi/Shaders/IndirectDiffuse.glsl
  53. 4 4
      AnKi/Shaders/IndirectDiffuseDenoise.glsl
  54. 7 7
      AnKi/Shaders/IndirectDiffuseVrsSriGeneration.ankiprog
  55. 5 5
      AnKi/Shaders/IndirectSpecular.glsl
  56. 7 7
      AnKi/Shaders/IrradianceDice.ankiprog
  57. 1 1
      AnKi/Shaders/LensFlareSprite.ankiprog
  58. 8 8
      AnKi/Shaders/LensFlareUpdateIndirectInfo.ankiprog
  59. 12 13
      AnKi/Shaders/LightFunctions.glsl
  60. 7 7
      AnKi/Shaders/LightShading.ankiprog
  61. 3 3
      AnKi/Shaders/LightShadingApplyFog.ankiprog
  62. 6 6
      AnKi/Shaders/LumaAwareBlur.ankiprog
  63. 12 12
      AnKi/Shaders/MotionVectors.glsl
  64. 7 15
      AnKi/Shaders/PackFunctions.glsl
  65. 5 5
      AnKi/Shaders/RtShadows.glsl
  66. 16 16
      AnKi/Shaders/RtShadowsDenoise.ankiprog
  67. 1 1
      AnKi/Shaders/RtShadowsHit.ankiprog
  68. 5 5
      AnKi/Shaders/RtShadowsRayGen.ankiprog
  69. 19 19
      AnKi/Shaders/RtShadowsSvgfAtrous.ankiprog
  70. 16 16
      AnKi/Shaders/RtShadowsSvgfVariance.ankiprog
  71. 11 11
      AnKi/Shaders/RtShadowsUpscale.ankiprog
  72. 1 1
      AnKi/Shaders/RtShadowsVisualizeRenderTarget.ankiprog
  73. 2 2
      AnKi/Shaders/SceneDebug.ankiprog
  74. 9 9
      AnKi/Shaders/ShadowmapsResolve.glsl
  75. 12 13
      AnKi/Shaders/TemporalAA.glsl
  76. 4 5
      AnKi/Shaders/Tonemap.glsl
  77. 19 20
      AnKi/Shaders/TonemappingAverageLuminance.ankiprog
  78. 2 2
      AnKi/Shaders/TonemappingFunctions.glsl
  79. 2 2
      AnKi/Shaders/TonemappingResources.glsl
  80. 1 1
      AnKi/Shaders/TraditionalDeferredShading.ankiprog
  81. 12 12
      AnKi/Shaders/VolumetricFogAccumulation.ankiprog
  82. 21 21
      AnKi/Shaders/VolumetricLightingAccumulation.ankiprog
  83. 9 9
      AnKi/Shaders/VrsSriGenerationCompute.ankiprog
  84. 1 1
      Sandbox/Main.cpp

+ 7 - 7
AnKi/Core/App.cpp

@@ -47,15 +47,15 @@ void* App::MemStats::allocCallback(void* userData, void* ptr, PtrSize size, [[ma
 {
 	ANKI_ASSERT(userData);
 
-	constexpr PtrSize MAX_ALIGNMENT = 64;
+	constexpr PtrSize kMaxAlignment = 64;
 
-	struct alignas(MAX_ALIGNMENT) Header
+	struct alignas(kMaxAlignment) Header
 	{
 		PtrSize m_allocatedSize;
-		Array<U8, MAX_ALIGNMENT - sizeof(PtrSize)> _m_padding;
+		Array<U8, kMaxAlignment - sizeof(PtrSize)> _m_padding;
 	};
-	static_assert(sizeof(Header) == MAX_ALIGNMENT, "See file");
-	static_assert(alignof(Header) == MAX_ALIGNMENT, "See file");
+	static_assert(sizeof(Header) == kMaxAlignment, "See file");
+	static_assert(alignof(Header) == kMaxAlignment, "See file");
 
 	void* out = nullptr;
 
@@ -63,9 +63,9 @@ void* App::MemStats::allocCallback(void* userData, void* ptr, PtrSize size, [[ma
 	{
 		// Need to allocate
 		ANKI_ASSERT(size > 0);
-		ANKI_ASSERT(alignment > 0 && alignment <= MAX_ALIGNMENT);
+		ANKI_ASSERT(alignment > 0 && alignment <= kMaxAlignment);
 
-		const PtrSize newAlignment = MAX_ALIGNMENT;
+		const PtrSize newAlignment = kMaxAlignment;
 		const PtrSize newSize = sizeof(Header) + size;
 
 		// Allocate

+ 5 - 5
AnKi/Input/Input.h

@@ -19,10 +19,10 @@ class NativeWindow;
 
 enum class InputEvent : U8
 {
-	WINDOW_FOCUS_LOST,
-	WINDOW_FOCUS_GAINED,
-	WINDOW_CLOSED,
-	COUNT
+	kWindowFocusLost,
+	kWindowFocusGained,
+	kWindowClosed,
+	kCount
 };
 
 /// Handle the input and other events
@@ -153,7 +153,7 @@ protected:
 	Array<Vec2, U(TouchPointer::kCount)> m_touchPointerPosNdc;
 	Array<UVec2, U(TouchPointer::kCount)> m_touchPointerPosWin;
 
-	Array<U8, U(InputEvent::COUNT)> m_events;
+	Array<U8, U(InputEvent::kCount)> m_events;
 
 	/// The keybord input as ascii.
 	Array<char, U(KeyCode::kCount)> m_textInput;

+ 1 - 1
AnKi/Input/InputSdl.cpp

@@ -196,7 +196,7 @@ Error InputSdl::handleEventsInternal()
 			m_mousePosNdc.y() = -(F32(event.button.y) / F32(m_nativeWindow->getHeight()) * 2.0f - 1.0f);
 			break;
 		case SDL_QUIT:
-			addEvent(InputEvent::WINDOW_CLOSED);
+			addEvent(InputEvent::kWindowClosed);
 			break;
 		case SDL_TEXTINPUT:
 			std::strncpy(&m_textInput[0], event.text.text, m_textInput.getSize() - 1);

+ 3 - 3
AnKi/Renderer/Bloom.cpp

@@ -52,7 +52,7 @@ Error Bloom::initExposure()
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_exposure.m_prog);
 	if(getConfig().getRPreferCompute())
 	{
-		variantInitInfo.addConstant("FB_SIZE", UVec2(m_exposure.m_width, m_exposure.m_height));
+		variantInitInfo.addConstant("kViewport", UVec2(m_exposure.m_width, m_exposure.m_height));
 	}
 
 	const ShaderProgramResourceVariant* variant;
@@ -79,10 +79,10 @@ Error Bloom::initUpscale()
 												 m_upscale.m_prog));
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_upscale.m_prog);
-	variantInitInfo.addConstant("INPUT_TEX_SIZE", UVec2(m_exposure.m_width, m_exposure.m_height));
+	variantInitInfo.addConstant("kInputTextureSize", UVec2(m_exposure.m_width, m_exposure.m_height));
 	if(getConfig().getRPreferCompute())
 	{
-		variantInitInfo.addConstant("FB_SIZE", UVec2(m_upscale.m_width, m_upscale.m_height));
+		variantInitInfo.addConstant("kViewport", UVec2(m_upscale.m_width, m_upscale.m_height));
 	}
 
 	const ShaderProgramResourceVariant* variant;

+ 34 - 36
AnKi/Renderer/ClusterBinning.cpp

@@ -33,11 +33,11 @@ Error ClusterBinning::init()
 	ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/ClusterBinning.ankiprogbin", m_prog));
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
-	variantInitInfo.addConstant("TILE_SIZE", m_r->getTileSize());
-	variantInitInfo.addConstant("TILE_COUNT_X", m_r->getTileCounts().x());
-	variantInitInfo.addConstant("TILE_COUNT_Y", m_r->getTileCounts().y());
-	variantInitInfo.addConstant("Z_SPLIT_COUNT", m_r->getZSplitCount());
-	variantInitInfo.addConstant("RENDERING_SIZE",
+	variantInitInfo.addConstant("kTileSize", m_r->getTileSize());
+	variantInitInfo.addConstant("kTileCountX", m_r->getTileCounts().x());
+	variantInitInfo.addConstant("kTileCountY", m_r->getTileCounts().y());
+	variantInitInfo.addConstant("kZSplitCount", m_r->getZSplitCount());
+	variantInitInfo.addConstant("kRenderingSize",
 								UVec2(m_r->getInternalResolution().x(), m_r->getInternalResolution().y()));
 
 	const ShaderProgramResourceVariant* variant;
@@ -105,45 +105,45 @@ void ClusterBinning::writeClustererBuffers(RenderingContext& ctx)
 
 	// Check limits
 	RenderQueue& rqueue = *ctx.m_renderQueue;
-	if(ANKI_UNLIKELY(rqueue.m_pointLights.getSize() > MAX_VISIBLE_POINT_LIGHTS))
+	if(ANKI_UNLIKELY(rqueue.m_pointLights.getSize() > kMaxVisiblePointLights))
 	{
 		ANKI_R_LOGW("Visible point lights exceed the max value by %u",
-					rqueue.m_pointLights.getSize() - MAX_VISIBLE_POINT_LIGHTS);
-		rqueue.m_pointLights.setArray(rqueue.m_pointLights.getBegin(), MAX_VISIBLE_POINT_LIGHTS);
+					rqueue.m_pointLights.getSize() - kMaxVisiblePointLights);
+		rqueue.m_pointLights.setArray(rqueue.m_pointLights.getBegin(), kMaxVisiblePointLights);
 	}
 
-	if(ANKI_UNLIKELY(rqueue.m_spotLights.getSize() > MAX_VISIBLE_SPOT_LIGHTS))
+	if(ANKI_UNLIKELY(rqueue.m_spotLights.getSize() > kMaxVisibleSpotLights))
 	{
 		ANKI_R_LOGW("Visible spot lights exceed the max value by %u",
-					rqueue.m_spotLights.getSize() - MAX_VISIBLE_SPOT_LIGHTS);
-		rqueue.m_spotLights.setArray(rqueue.m_spotLights.getBegin(), MAX_VISIBLE_SPOT_LIGHTS);
+					rqueue.m_spotLights.getSize() - kMaxVisibleSpotLights);
+		rqueue.m_spotLights.setArray(rqueue.m_spotLights.getBegin(), kMaxVisibleSpotLights);
 	}
 
-	if(ANKI_UNLIKELY(rqueue.m_decals.getSize() > MAX_VISIBLE_DECALS))
+	if(ANKI_UNLIKELY(rqueue.m_decals.getSize() > kMaxVisibleDecals))
 	{
-		ANKI_R_LOGW("Visible decals exceed the max value by %u", rqueue.m_decals.getSize() - MAX_VISIBLE_DECALS);
-		rqueue.m_decals.setArray(rqueue.m_decals.getBegin(), MAX_VISIBLE_DECALS);
+		ANKI_R_LOGW("Visible decals exceed the max value by %u", rqueue.m_decals.getSize() - kMaxVisibleDecals);
+		rqueue.m_decals.setArray(rqueue.m_decals.getBegin(), kMaxVisibleDecals);
 	}
 
-	if(ANKI_UNLIKELY(rqueue.m_fogDensityVolumes.getSize() > MAX_VISIBLE_FOG_DENSITY_VOLUMES))
+	if(ANKI_UNLIKELY(rqueue.m_fogDensityVolumes.getSize() > kMaxVisibleFogDensityVolumes))
 	{
 		ANKI_R_LOGW("Visible fog volumes exceed the max value by %u",
-					rqueue.m_fogDensityVolumes.getSize() - MAX_VISIBLE_FOG_DENSITY_VOLUMES);
-		rqueue.m_fogDensityVolumes.setArray(rqueue.m_fogDensityVolumes.getBegin(), MAX_VISIBLE_FOG_DENSITY_VOLUMES);
+					rqueue.m_fogDensityVolumes.getSize() - kMaxVisibleFogDensityVolumes);
+		rqueue.m_fogDensityVolumes.setArray(rqueue.m_fogDensityVolumes.getBegin(), kMaxVisibleFogDensityVolumes);
 	}
 
-	if(ANKI_UNLIKELY(rqueue.m_reflectionProbes.getSize() > MAX_VISIBLE_REFLECTION_PROBES))
+	if(ANKI_UNLIKELY(rqueue.m_reflectionProbes.getSize() > kMaxVisibleReflectionProbes))
 	{
 		ANKI_R_LOGW("Visible reflection probes exceed the max value by %u",
-					rqueue.m_reflectionProbes.getSize() - MAX_VISIBLE_REFLECTION_PROBES);
-		rqueue.m_reflectionProbes.setArray(rqueue.m_reflectionProbes.getBegin(), MAX_VISIBLE_REFLECTION_PROBES);
+					rqueue.m_reflectionProbes.getSize() - kMaxVisibleReflectionProbes);
+		rqueue.m_reflectionProbes.setArray(rqueue.m_reflectionProbes.getBegin(), kMaxVisibleReflectionProbes);
 	}
 
-	if(ANKI_UNLIKELY(rqueue.m_giProbes.getSize() > MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES))
+	if(ANKI_UNLIKELY(rqueue.m_giProbes.getSize() > kMaxVisibleGlobalIlluminationProbes))
 	{
 		ANKI_R_LOGW("Visible GI probes exceed the max value by %u",
-					rqueue.m_giProbes.getSize() - MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES);
-		rqueue.m_giProbes.setArray(rqueue.m_giProbes.getBegin(), MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES);
+					rqueue.m_giProbes.getSize() - kMaxVisibleGlobalIlluminationProbes);
+		rqueue.m_giProbes.setArray(rqueue.m_giProbes.getBegin(), kMaxVisibleGlobalIlluminationProbes);
 	}
 
 	// Allocate buffers
@@ -436,19 +436,17 @@ void ClusterBinning::writeClustererBuffersTask()
 		unis.m_tileSize = m_r->getTileSize();
 		unis.m_lightVolumeLastZSplit = m_r->getVolumetricLightingAccumulation().getFinalZSplit();
 
-		unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_POINT_LIGHT].x() = rqueue.m_pointLights.getSize();
-		unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_SPOT_LIGHT].x() =
-			unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_SPOT_LIGHT - 1].x() + rqueue.m_spotLights.getSize();
-		unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_DECAL].x() =
-			unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_DECAL - 1].x() + rqueue.m_decals.getSize();
-		unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_FOG_DENSITY_VOLUME].x() =
-			unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_FOG_DENSITY_VOLUME - 1].x()
-			+ rqueue.m_fogDensityVolumes.getSize();
-		unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_REFLECTION_PROBE].x() =
-			unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_REFLECTION_PROBE - 1].x() + rqueue.m_reflectionProbes.getSize();
-		unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE].x() =
-			unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE - 1].x()
-			+ rqueue.m_giProbes.getSize();
+		unis.m_objectCountsUpTo[kClusterObjectTypePointLight].x() = rqueue.m_pointLights.getSize();
+		unis.m_objectCountsUpTo[kClusterObjectTypeSpotLight].x() =
+			unis.m_objectCountsUpTo[kClusterObjectTypeSpotLight - 1].x() + rqueue.m_spotLights.getSize();
+		unis.m_objectCountsUpTo[kClusterObjectTypeDecal].x() =
+			unis.m_objectCountsUpTo[kClusterObjectTypeDecal - 1].x() + rqueue.m_decals.getSize();
+		unis.m_objectCountsUpTo[kClusterObjectTypeFogDensityVolume].x() =
+			unis.m_objectCountsUpTo[kClusterObjectTypeFogDensityVolume - 1].x() + rqueue.m_fogDensityVolumes.getSize();
+		unis.m_objectCountsUpTo[kClusterObjectTypeReflectionProbe].x() =
+			unis.m_objectCountsUpTo[kClusterObjectTypeReflectionProbe - 1].x() + rqueue.m_reflectionProbes.getSize();
+		unis.m_objectCountsUpTo[kClusterObjectTypeGlobalIlluminationProbe].x() =
+			unis.m_objectCountsUpTo[kClusterObjectTypeGlobalIlluminationProbe - 1].x() + rqueue.m_giProbes.getSize();
 
 		unis.m_reflectionProbesMipCount = F32(m_r->getProbeReflections().getReflectionTextureMipmapCount());
 

+ 6 - 6
AnKi/Renderer/FinalComposite.cpp

@@ -43,9 +43,9 @@ Error FinalComposite::initInternal()
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
 	variantInitInfo.addMutation("FILM_GRAIN", (getConfig().getRFilmGrainStrength() > 0.0) ? 1 : 0);
 	variantInitInfo.addMutation("BLOOM_ENABLED", 1);
-	variantInitInfo.addConstant("LUT_SIZE", U32(LUT_SIZE));
-	variantInitInfo.addConstant("FB_SIZE", m_r->getPostProcessResolution());
-	variantInitInfo.addConstant("MOTION_BLUR_SAMPLES", getConfig().getRMotionBlurSamples());
+	variantInitInfo.addConstant("kLutSize", U32(kLutSize));
+	variantInitInfo.addConstant("kFramebufferSize", m_r->getPostProcessResolution());
+	variantInitInfo.addConstant("kMotionBlurSamples", getConfig().getRMotionBlurSamples());
 
 	for(U32 dbg = 0; dbg < 2; ++dbg)
 	{
@@ -79,9 +79,9 @@ Error FinalComposite::loadColorGradingTextureImage(CString filename)
 {
 	m_lut.reset(nullptr);
 	ANKI_CHECK(getResourceManager().loadResource(filename, m_lut));
-	ANKI_ASSERT(m_lut->getWidth() == LUT_SIZE);
-	ANKI_ASSERT(m_lut->getHeight() == LUT_SIZE);
-	ANKI_ASSERT(m_lut->getDepth() == LUT_SIZE);
+	ANKI_ASSERT(m_lut->getWidth() == kLutSize);
+	ANKI_ASSERT(m_lut->getHeight() == kLutSize);
+	ANKI_ASSERT(m_lut->getDepth() == kLutSize);
 
 	return Error::kNone;
 }

+ 1 - 1
AnKi/Renderer/FinalComposite.h

@@ -29,7 +29,7 @@ public:
 	Error loadColorGradingTextureImage(CString filename);
 
 private:
-	static constexpr U LUT_SIZE = 16;
+	static constexpr U kLutSize = 16;
 
 	FramebufferDescription m_fbDescr;
 

+ 3 - 3
AnKi/Renderer/GBufferPost.cpp

@@ -32,9 +32,9 @@ Error GBufferPost::initInternal()
 	ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/GBufferPost.ankiprogbin", m_prog));
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
-	variantInitInfo.addConstant("TILE_COUNTS", m_r->getTileCounts());
-	variantInitInfo.addConstant("Z_SPLIT_COUNT", m_r->getZSplitCount());
-	variantInitInfo.addConstant("TILE_SIZE", m_r->getTileSize());
+	variantInitInfo.addConstant("kTileCount", m_r->getTileCounts());
+	variantInitInfo.addConstant("kZSplitCount", m_r->getZSplitCount());
+	variantInitInfo.addConstant("kTileSize", m_r->getTileSize());
 
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);

+ 2 - 2
AnKi/Renderer/IndirectDiffuseProbes.cpp

@@ -82,7 +82,7 @@ void IndirectDiffuseProbes::setRenderGraphDependencies(const RenderingContext& c
 void IndirectDiffuseProbes::bindVolumeTextures(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx, U32 set,
 											   U32 binding) const
 {
-	for(U32 idx = 0; idx < MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES; ++idx)
+	for(U32 idx = 0; idx < kMaxVisibleGlobalIlluminationProbes; ++idx)
 	{
 		if(idx < ctx.m_renderQueue->m_giProbes.getSize())
 		{
@@ -111,7 +111,7 @@ Error IndirectDiffuseProbes::initInternal()
 	m_tileSize = getConfig().getRIndirectDiffuseProbeTileResolution();
 	m_cacheEntries.create(getMemoryPool(), getConfig().getRIndirectDiffuseProbeMaxCachedProbes());
 	m_maxVisibleProbes = getConfig().getRIndirectDiffuseProbeMaxVisibleProbes();
-	ANKI_ASSERT(m_maxVisibleProbes <= MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES);
+	ANKI_ASSERT(m_maxVisibleProbes <= kMaxVisibleGlobalIlluminationProbes);
 	ANKI_ASSERT(m_cacheEntries.getSize() >= m_maxVisibleProbes);
 
 	ANKI_CHECK(initGBuffer());

+ 1 - 1
AnKi/Renderer/LensFlare.cpp

@@ -72,7 +72,7 @@ Error LensFlare::initOcclusion()
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_updateIndirectBuffProg);
 	variantInitInfo.addConstant(
-		"IN_DEPTH_MAP_SIZE", UVec2(m_r->getInternalResolution().x() / 2 / 2, m_r->getInternalResolution().y() / 2 / 2));
+		"kInDepthMapSize", UVec2(m_r->getInternalResolution().x() / 2 / 2, m_r->getInternalResolution().y() / 2 / 2));
 	const ShaderProgramResourceVariant* variant;
 	m_updateIndirectBuffProg->getOrCreateVariant(variantInitInfo, variant);
 	m_updateIndirectBuffGrProg = variant->getProgram();

+ 5 - 5
AnKi/Renderer/LightShading.cpp

@@ -66,9 +66,9 @@ Error LightShading::initLightShading()
 	ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/LightShading.ankiprogbin", m_lightShading.m_prog));
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_lightShading.m_prog);
-	variantInitInfo.addConstant("TILE_COUNTS", m_r->getTileCounts());
-	variantInitInfo.addConstant("Z_SPLIT_COUNT", m_r->getZSplitCount());
-	variantInitInfo.addConstant("TILE_SIZE", m_r->getTileSize());
+	variantInitInfo.addConstant("kTileCount", m_r->getTileCounts());
+	variantInitInfo.addConstant("kZSplitCount", m_r->getZSplitCount());
+	variantInitInfo.addConstant("kTileSize", m_r->getTileSize());
 	const ShaderProgramResourceVariant* variant;
 
 	variantInitInfo.addMutation("USE_SHADOW_LAYERS", 0);
@@ -130,8 +130,8 @@ Error LightShading::initApplyFog()
 	ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/LightShadingApplyFog.ankiprogbin", m_applyFog.m_prog));
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_applyFog.m_prog);
-	variantInitInfo.addConstant("Z_SPLIT_COUNT", m_r->getZSplitCount());
-	variantInitInfo.addConstant("FINAL_Z_SPLIT", m_r->getVolumetricFog().getFinalClusterInZ());
+	variantInitInfo.addConstant("kZSplitCount", m_r->getZSplitCount());
+	variantInitInfo.addConstant("kFinalZSplit", m_r->getVolumetricFog().getFinalClusterInZ());
 
 	const ShaderProgramResourceVariant* variant;
 	m_applyFog.m_prog->getOrCreateVariant(variantInitInfo, variant);

+ 2 - 1
AnKi/Renderer/MotionVectors.cpp

@@ -35,7 +35,8 @@ Error MotionVectors::initInternal()
 													 : "ShaderBinaries/MotionVectorsRaster.ankiprogbin",
 												 m_prog));
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
-	variantInitInfo.addConstant("FB_SIZE", UVec2(m_r->getInternalResolution().x(), m_r->getInternalResolution().y()));
+	variantInitInfo.addConstant("kFramebufferSize",
+								UVec2(m_r->getInternalResolution().x(), m_r->getInternalResolution().y()));
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	m_grProg = variant->getProgram();

+ 10 - 10
AnKi/Renderer/RtShadows.cpp

@@ -66,10 +66,10 @@ Error RtShadows::initInternal()
 	{
 		ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/RtShadowsDenoise.ankiprogbin", m_denoiseProg));
 		ShaderProgramResourceVariantInitInfo variantInitInfo(m_denoiseProg);
-		variantInitInfo.addConstant("OUT_IMAGE_SIZE",
+		variantInitInfo.addConstant("kOutImageSize",
 									UVec2(m_r->getInternalResolution().x() / 2, m_r->getInternalResolution().y() / 2));
-		variantInitInfo.addConstant("MIN_SAMPLE_COUNT", 8u);
-		variantInitInfo.addConstant("MAX_SAMPLE_COUNT", 32u);
+		variantInitInfo.addConstant("kMinSampleCount", 8u);
+		variantInitInfo.addConstant("kMaxSampleCount", 32u);
 		variantInitInfo.addMutation("BLUR_ORIENTATION", 0);
 
 		const ShaderProgramResourceVariant* variant;
@@ -87,7 +87,7 @@ Error RtShadows::initInternal()
 		ANKI_CHECK(
 			getResourceManager().loadResource("ShaderBinaries/RtShadowsSvgfVariance.ankiprogbin", m_svgfVarianceProg));
 		ShaderProgramResourceVariantInitInfo variantInitInfo(m_svgfVarianceProg);
-		variantInitInfo.addConstant("FB_SIZE",
+		variantInitInfo.addConstant("kFramebufferSize",
 									UVec2(m_r->getInternalResolution().x() / 2, m_r->getInternalResolution().y() / 2));
 
 		const ShaderProgramResourceVariant* variant;
@@ -101,7 +101,7 @@ Error RtShadows::initInternal()
 		ANKI_CHECK(
 			getResourceManager().loadResource("ShaderBinaries/RtShadowsSvgfAtrous.ankiprogbin", m_svgfAtrousProg));
 		ShaderProgramResourceVariantInitInfo variantInitInfo(m_svgfAtrousProg);
-		variantInitInfo.addConstant("FB_SIZE",
+		variantInitInfo.addConstant("kFramebufferSize",
 									UVec2(m_r->getInternalResolution().x() / 2, m_r->getInternalResolution().y() / 2));
 		variantInitInfo.addMutation("LAST_PASS", 0);
 
@@ -118,7 +118,7 @@ Error RtShadows::initInternal()
 	{
 		ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/RtShadowsUpscale.ankiprogbin", m_upscaleProg));
 		ShaderProgramResourceVariantInitInfo variantInitInfo(m_upscaleProg);
-		variantInitInfo.addConstant("OUT_IMAGE_SIZE",
+		variantInitInfo.addConstant("kOutImageSize",
 									UVec2(m_r->getInternalResolution().x(), m_r->getInternalResolution().y()));
 
 		const ShaderProgramResourceVariant* variant;
@@ -390,7 +390,7 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 			ANKI_ASSERT(layerFound && "Directional can't fail");
 
 			rqueue.m_directionalLight.m_shadowLayer = U8(layerIdx);
-			ANKI_ASSERT(rqueue.m_directionalLight.m_shadowLayer < MAX_RT_SHADOW_LAYERS);
+			ANKI_ASSERT(rqueue.m_directionalLight.m_shadowLayer < kMaxRtShadowLayers);
 			m_runCtx.m_layersWithRejectedHistory.set(layerIdx, rejectHistory);
 		}
 
@@ -408,7 +408,7 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 			if(layerFound)
 			{
 				light.m_shadowLayer = U8(layerIdx);
-				ANKI_ASSERT(light.m_shadowLayer < MAX_RT_SHADOW_LAYERS);
+				ANKI_ASSERT(light.m_shadowLayer < kMaxRtShadowLayers);
 				m_runCtx.m_layersWithRejectedHistory.set(layerIdx, rejectHistory);
 			}
 			else
@@ -432,7 +432,7 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 			if(layerFound)
 			{
 				light.m_shadowLayer = U8(layerIdx);
-				ANKI_ASSERT(light.m_shadowLayer < MAX_RT_SHADOW_LAYERS);
+				ANKI_ASSERT(light.m_shadowLayer < kMaxRtShadowLayers);
 				m_runCtx.m_layersWithRejectedHistory.set(layerIdx, rejectHistory);
 			}
 			else
@@ -478,7 +478,7 @@ void RtShadows::run(const RenderingContext& ctx, RenderPassWorkContext& rgraphCt
 	cmdb->bindAllBindless(1);
 
 	RtShadowsUniforms unis;
-	for(U32 i = 0; i < MAX_RT_SHADOW_LAYERS; ++i)
+	for(U32 i = 0; i < kMaxRtShadowLayers; ++i)
 	{
 		unis.historyRejectFactor[i] = F32(m_runCtx.m_layersWithRejectedHistory.get(i));
 	}

+ 2 - 2
AnKi/Renderer/RtShadows.h

@@ -88,7 +88,7 @@ public:
 
 	ImageResourcePtr m_blueNoiseImage;
 
-	Array<ShadowLayer, MAX_RT_SHADOW_LAYERS> m_shadowLayers;
+	Array<ShadowLayer, kMaxRtShadowLayers> m_shadowLayers;
 
 	U32 m_sbtRecordSize = 256;
 
@@ -112,7 +112,7 @@ public:
 		PtrSize m_sbtOffset;
 		U32 m_hitGroupCount = 0;
 
-		BitSet<MAX_RT_SHADOW_LAYERS, U8> m_layersWithRejectedHistory = {false};
+		BitSet<kMaxRtShadowLayers, U8> m_layersWithRejectedHistory = {false};
 
 		U8 m_atrousPassIdx = 0;
 		U8 m_denoiseOrientation = 0;

+ 4 - 3
AnKi/Renderer/ShadowMapping.cpp

@@ -124,12 +124,13 @@ Error ShadowMapping::initAtlas()
 													 m_atlas.m_resolveProg));
 
 		ShaderProgramResourceVariantInitInfo variantInitInfo(m_atlas.m_resolveProg);
-		variantInitInfo.addConstant("INPUT_TEXTURE_SIZE", UVec2(m_scratch.m_tileCountX * m_scratch.m_tileResolution,
-																m_scratch.m_tileCountY * m_scratch.m_tileResolution));
+		variantInitInfo.addConstant("kInputTextureSize", UVec2(m_scratch.m_tileCountX * m_scratch.m_tileResolution,
+															   m_scratch.m_tileCountY * m_scratch.m_tileResolution));
 
 		if(!preferCompute)
 		{
-			variantInitInfo.addConstant("FB_SIZE", UVec2(m_atlas.m_tileCountBothAxis * m_atlas.m_tileResolution));
+			variantInitInfo.addConstant("kFramebufferSize",
+										UVec2(m_atlas.m_tileCountBothAxis * m_atlas.m_tileResolution));
 		}
 
 		const ShaderProgramResourceVariant* variant;

+ 4 - 4
AnKi/Renderer/ShadowmapsResolve.cpp

@@ -50,11 +50,11 @@ Error ShadowmapsResolve::initInternal()
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
 	if(getConfig().getRPreferCompute())
 	{
-		variantInitInfo.addConstant("FB_SIZE", UVec2(width, height));
+		variantInitInfo.addConstant("kFramebufferSize", UVec2(width, height));
 	}
-	variantInitInfo.addConstant("TILE_COUNTS", m_r->getTileCounts());
-	variantInitInfo.addConstant("Z_SPLIT_COUNT", m_r->getZSplitCount());
-	variantInitInfo.addConstant("TILE_SIZE", m_r->getTileSize());
+	variantInitInfo.addConstant("kTileCount", m_r->getTileCounts());
+	variantInitInfo.addConstant("kZSplitCount", m_r->getZSplitCount());
+	variantInitInfo.addConstant("kTileSize", m_r->getTileSize());
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	m_grProg = variant->getProgram();

+ 3 - 3
AnKi/Renderer/TemporalAA.cpp

@@ -44,14 +44,14 @@ Error TemporalAA::initInternal()
 
 	{
 		ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
-		variantInitInfo.addConstant("VARIANCE_CLIPPING_GAMMA", 2.7f); // Variance clipping paper proposes 1.0
-		variantInitInfo.addConstant("BLEND_FACTOR", 1.0f / 16.0f);
+		variantInitInfo.addConstant("kVarianceClippingGamma", 2.7f); // Variance clipping paper proposes 1.0
+		variantInitInfo.addConstant("kBlendFactor", 1.0f / 16.0f);
 		variantInitInfo.addMutation("VARIANCE_CLIPPING", 1);
 		variantInitInfo.addMutation("YCBCR", 0);
 
 		if(getConfig().getRPreferCompute())
 		{
-			variantInitInfo.addConstant("FB_SIZE",
+			variantInitInfo.addConstant("kFramebufferSize",
 										UVec2(m_r->getInternalResolution().x(), m_r->getInternalResolution().y()));
 		}
 

+ 1 - 1
AnKi/Renderer/Tonemapping.cpp

@@ -32,7 +32,7 @@ Error Tonemapping::initInternal()
 	ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/TonemappingAverageLuminance.ankiprogbin", m_prog));
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
-	variantInitInfo.addConstant("INPUT_TEX_SIZE", UVec2(width, height));
+	variantInitInfo.addConstant("kInputTexSize", UVec2(width, height));
 
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);

+ 3 - 3
AnKi/Renderer/VolumetricFog.cpp

@@ -31,9 +31,9 @@ Error VolumetricFog::init()
 	ANKI_CHECK(getResourceManager().loadResource("ShaderBinaries/VolumetricFogAccumulation.ankiprogbin", m_prog));
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
-	variantInitInfo.addConstant("VOLUME_SIZE", UVec3(m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]));
-	variantInitInfo.addConstant("Z_SPLIT_COUNT", m_r->getZSplitCount());
-	variantInitInfo.addConstant("FINAL_Z_SPLIT", m_finalZSplit);
+	variantInitInfo.addConstant("kVolumeSize", UVec3(m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]));
+	variantInitInfo.addConstant("kZSplitCount", m_r->getZSplitCount());
+	variantInitInfo.addConstant("kFinalZSplit", m_finalZSplit);
 
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);

+ 4 - 4
AnKi/Renderer/VolumetricLightingAccumulation.cpp

@@ -48,10 +48,10 @@ Error VolumetricLightingAccumulation::init()
 
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
 	variantInitInfo.addMutation("ENABLE_SHADOWS", 1);
-	variantInitInfo.addConstant("VOLUME_SIZE", UVec3(m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]));
-	variantInitInfo.addConstant("TILE_COUNT", UVec2(m_r->getTileCounts().x(), m_r->getTileCounts().y()));
-	variantInitInfo.addConstant("Z_SPLIT_COUNT", m_r->getZSplitCount());
-	variantInitInfo.addConstant("FINAL_Z_SPLIT", m_finalZSplit);
+	variantInitInfo.addConstant("kVolumeSize", UVec3(m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]));
+	variantInitInfo.addConstant("kTileCount", UVec2(m_r->getTileCounts().x(), m_r->getTileCounts().y()));
+	variantInitInfo.addConstant("kZSplitCount", m_r->getZSplitCount());
+	variantInitInfo.addConstant("kFinalZSplit", m_finalZSplit);
 
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);

+ 1 - 1
AnKi/Scene/Components/DecalComponent.cpp

@@ -62,7 +62,7 @@ void DecalComponent::updateInternal()
 
 	const Mat4 projMat =
 		Mat4::calculateOrthographicProjectionMatrix(halfBoxSize.x(), -halfBoxSize.x(), halfBoxSize.y(),
-													-halfBoxSize.y(), CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE, m_boxSize.z());
+													-halfBoxSize.y(), kClusterObjectFrustumNearPlane, m_boxSize.z());
 
 	static const Mat4 biasMat4(0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.5f, 0.0f, 0.5f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
 							   1.0f);

+ 4 - 4
AnKi/Scene/Components/LightComponent.cpp

@@ -44,8 +44,8 @@ Error LightComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 	{
 
 		const Mat4 biasMat4(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
-		const Mat4 proj = Mat4::calculatePerspectiveProjectionMatrix(
-			m_spot.m_outerAngle, m_spot.m_outerAngle, CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE, m_spot.m_distance);
+		const Mat4 proj = Mat4::calculatePerspectiveProjectionMatrix(m_spot.m_outerAngle, m_spot.m_outerAngle,
+																	 kClusterObjectFrustumNearPlane, m_spot.m_distance);
 		m_spot.m_textureMat = biasMat4 * proj * Mat4(m_worldtransform.getInverse());
 
 		Array<Vec4, 4> points;
@@ -167,7 +167,7 @@ void LightComponent::setupDirectionalLightQueueElement(const FrustumComponent& f
 			// Projection
 			const F32 far = (eye - sphereCenter).getLength() + sphereRadius;
 			Mat4 cascadeProjMat = Mat4::calculateOrthographicProjectionMatrix(
-				sphereRadius, -sphereRadius, sphereRadius, -sphereRadius, CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE, far);
+				sphereRadius, -sphereRadius, sphereRadius, -sphereRadius, kClusterObjectFrustumNearPlane, far);
 
 			// View
 			Transform cascadeTransform = m_worldtransform;
@@ -212,7 +212,7 @@ void LightComponent::setupDirectionalLightQueueElement(const FrustumComponent& f
 			const F32 bottom = plane.getOffset();
 
 			FrustumComponent& cascadeFrustumComp = cascadeFrustumComponents[i];
-			cascadeFrustumComp.setOrthographic(CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE, far, right, left, top, bottom);
+			cascadeFrustumComp.setOrthographic(kClusterObjectFrustumNearPlane, far, right, left, top, bottom);
 			cascadeFrustumComp.setWorldTransform(cascadeTransform);
 		}
 	}

+ 3 - 3
AnKi/Scene/DebugDrawer.cpp

@@ -162,7 +162,7 @@ void DebugDrawer2::drawCubes(ConstWeakArray<Mat4> mvps, const Vec4& color, F32 l
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
 	variantInitInfo.addMutation("COLOR_TEXTURE", 0);
 	variantInitInfo.addMutation("DITHERED_DEPTH_TEST", U32(ditherFailedDepth != 0));
-	variantInitInfo.addConstant("INSTANCE_COUNT", mvps.getSize());
+	variantInitInfo.addConstant("kInstanceCount", mvps.getSize());
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	cmdb->bindShaderProgram(variant->getProgram());
@@ -204,7 +204,7 @@ void DebugDrawer2::drawLines(ConstWeakArray<Mat4> mvps, const Vec4& color, F32 l
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
 	variantInitInfo.addMutation("COLOR_TEXTURE", 0);
 	variantInitInfo.addMutation("DITHERED_DEPTH_TEST", U32(ditherFailedDepth != 0));
-	variantInitInfo.addConstant("INSTANCE_COUNT", mvps.getSize());
+	variantInitInfo.addConstant("kInstanceCount", mvps.getSize());
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	cmdb->bindShaderProgram(variant->getProgram());
@@ -271,7 +271,7 @@ void DebugDrawer2::drawBillboardTextures(const Mat4& projMat, const Mat3x4& view
 	ShaderProgramResourceVariantInitInfo variantInitInfo(m_prog);
 	variantInitInfo.addMutation("COLOR_TEXTURE", 1);
 	variantInitInfo.addMutation("DITHERED_DEPTH_TEST", U32(ditherFailedDepth != 0));
-	variantInitInfo.addConstant("INSTANCE_COUNT", positions.getSize());
+	variantInitInfo.addConstant("kInstanceCount", positions.getSize());
 	const ShaderProgramResourceVariant* variant;
 	m_prog->getOrCreateVariant(variantInitInfo, variant);
 	cmdb->bindShaderProgram(variant->getProgram());

+ 1 - 1
AnKi/Scene/GlobalIlluminationProbeNode.cpp

@@ -90,7 +90,7 @@ GlobalIlluminationProbeNode::GlobalIlluminationProbeNode(SceneGraph* scene, CStr
 
 	// The frustum components
 	constexpr F32 ang = toRad(90.0f);
-	const F32 zNear = CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE;
+	const F32 zNear = kClusterObjectFrustumNearPlane;
 
 	Mat3 rot;
 	rot = Mat3(Euler(0.0f, -kPi / 2.0f, 0.0f)) * Mat3(Euler(0.0f, 0.0f, kPi));

+ 2 - 2
AnKi/Scene/LightNode.cpp

@@ -164,7 +164,7 @@ Error PointLightNode::frameUpdate([[maybe_unused]] Second prevUpdateTime, [[mayb
 
 		const F32 ang = toRad(90.0f);
 		const F32 dist = lightc.getRadius();
-		const F32 zNear = CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE;
+		const F32 zNear = kClusterObjectFrustumNearPlane;
 
 		Mat3 rot;
 
@@ -261,7 +261,7 @@ void SpotLightNode::onMoved(const MoveComponent& move)
 void SpotLightNode::onLightShapeUpdated(LightComponent& light)
 {
 	FrustumComponent& frc = getFirstComponentOfType<FrustumComponent>();
-	frc.setPerspective(CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE, light.getDistance(), light.getOuterAngle(),
+	frc.setPerspective(kClusterObjectFrustumNearPlane, light.getDistance(), light.getOuterAngle(),
 					   light.getOuterAngle());
 }
 

+ 1 - 1
AnKi/Scene/ReflectionProbeNode.cpp

@@ -104,7 +104,7 @@ ReflectionProbeNode::ReflectionProbeNode(SceneGraph* scene, CString name)
 
 		FrustumComponent* frc = newComponent<FrustumComponent>();
 		frc->setFrustumType(FrustumType::kPerspective);
-		frc->setPerspective(CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE, 10.0f, ang, ang);
+		frc->setPerspective(kClusterObjectFrustumNearPlane, 10.0f, ang, ang);
 		frc->setWorldTransform(m_frustumTransforms[i]);
 		frc->setEnabledVisibilityTests(FrustumComponentVisibilityTestFlag::kNone);
 		frc->setEffectiveShadowDistance(getConfig().getSceneReflectionProbeShadowEffectiveDistance());

+ 1 - 1
AnKi/Shaders/BilateralFilter.glsl

@@ -16,7 +16,7 @@ F32 calculateBilateralWeightDepth(F32 depthCenter, F32 depthTap, F32 phi)
 #if 0
 	return max(0.0, 1.0 - diff * phi);
 #else
-	return sqrt(1.0 / (EPSILON + diff)) * phi;
+	return sqrt(1.0 / (kEpsilonf + diff)) * phi;
 #endif
 }
 

+ 6 - 7
AnKi/Shaders/Bloom.glsl

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kViewport, 0u);
 
 #include <AnKi/Shaders/TonemappingFunctions.glsl>
 #include <AnKi/Shaders/Functions.glsl>
@@ -16,13 +16,12 @@ layout(push_constant) uniform b_pc
 	Vec4 u_thresholdScalePad2;
 };
 
-const U32 TONEMAPPING_SET = 0u;
-const U32 TONEMAPPING_BINDING = 2u;
+const U32 kTonemappingBinding = 2u;
 #include <AnKi/Shaders/TonemappingResources.glsl>
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(16, 16);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(16, 16);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 3) writeonly uniform image2D u_outImg;
 #else
@@ -33,12 +32,12 @@ layout(location = 0) out ANKI_RP Vec3 out_color;
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, FB_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kViewport))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(FB_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kViewport);
 #else
 	const Vec2 uv = in_uv;
 #endif

+ 22 - 22
AnKi/Shaders/BloomUpscale.glsl

@@ -3,8 +3,8 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(INPUT_TEX_SIZE, 2u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kViewport, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kInputTextureSize, 2u);
 
 #include <AnKi/Shaders/Functions.glsl>
 
@@ -13,8 +13,8 @@ layout(set = 0, binding = 1) uniform ANKI_RP texture2D u_tex;
 layout(set = 0, binding = 2) uniform ANKI_RP texture2D u_lensDirtTex;
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(16u, 16u);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(16u, 16u);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 3) writeonly uniform ANKI_RP image2D u_outImg;
 #else
@@ -23,13 +23,13 @@ layout(location = 0) out ANKI_RP Vec3 out_color;
 #endif
 
 // Constants
-const U32 MAX_GHOSTS = 4u;
-const F32 GHOST_DISPERSAL = 0.7;
-const F32 HALO_WIDTH = 0.4;
-const F32 CHROMATIC_DISTORTION = 3.0;
+const U32 kMaxGhosts = 4u;
+const F32 kGhostDispersal = 0.7;
+const F32 kHaloWidth = 0.4;
+const F32 kChromaticDistortion = 3.0;
 #define ENABLE_CHROMATIC_DISTORTION 1
 #define ENABLE_HALO 1
-const F32 HALO_OPACITY = 0.5;
+const F32 kHaloOpacity = 0.5;
 
 ANKI_RP Vec3 textureDistorted(ANKI_RP texture2D tex, sampler sampl, Vec2 uv,
 							  Vec2 direction, // direction of distortion
@@ -46,35 +46,35 @@ ANKI_RP Vec3 textureDistorted(ANKI_RP texture2D tex, sampler sampl, Vec2 uv,
 
 ANKI_RP Vec3 ssLensFlare(Vec2 uv)
 {
-	const Vec2 TEXEL_SIZE = 1.0 / Vec2(INPUT_TEX_SIZE);
-	const Vec3 DISTORTION = Vec3(-TEXEL_SIZE.x * CHROMATIC_DISTORTION, 0.0, TEXEL_SIZE.x * CHROMATIC_DISTORTION);
-	const F32 LEN_OF_HALF = length(Vec2(0.5));
+	const Vec2 kTexelSize = 1.0 / Vec2(kInputTextureSize);
+	const Vec3 kDistortion = Vec3(-kTexelSize.x * kChromaticDistortion, 0.0, kTexelSize.x * kChromaticDistortion);
+	const F32 kLensOfHalf = length(Vec2(0.5));
 
 	const Vec2 flipUv = Vec2(1.0) - uv;
 
-	const Vec2 ghostVec = (Vec2(0.5) - flipUv) * GHOST_DISPERSAL;
+	const Vec2 ghostVec = (Vec2(0.5) - flipUv) * kGhostDispersal;
 
 	const Vec2 direction = normalize(ghostVec);
 	ANKI_RP Vec3 result = Vec3(0.0);
 
 	// Sample ghosts
-	ANKI_UNROLL for(U32 i = 0u; i < MAX_GHOSTS; ++i)
+	ANKI_UNROLL for(U32 i = 0u; i < kMaxGhosts; ++i)
 	{
 		const Vec2 offset = fract(flipUv + ghostVec * F32(i));
 
-		ANKI_RP F32 weight = length(Vec2(0.5) - offset) / LEN_OF_HALF;
+		ANKI_RP F32 weight = length(Vec2(0.5) - offset) / kLensOfHalf;
 		weight = pow(1.0 - weight, 10.0);
 
-		result += textureDistorted(u_tex, u_linearAnyClampSampler, offset, direction, DISTORTION) * weight;
+		result += textureDistorted(u_tex, u_linearAnyClampSampler, offset, direction, kDistortion) * weight;
 	}
 
 	// Sample halo
 #if ENABLE_HALO
-	const Vec2 haloVec = normalize(ghostVec) * HALO_WIDTH;
-	ANKI_RP F32 weight = length(Vec2(0.5) - fract(flipUv + haloVec)) / LEN_OF_HALF;
+	const Vec2 haloVec = normalize(ghostVec) * kHaloWidth;
+	ANKI_RP F32 weight = length(Vec2(0.5) - fract(flipUv + haloVec)) / kLensOfHalf;
 	weight = pow(1.0 - weight, 20.0);
-	result += textureDistorted(u_tex, u_linearAnyClampSampler, flipUv + haloVec, direction, DISTORTION)
-			  * (weight * HALO_OPACITY);
+	result += textureDistorted(u_tex, u_linearAnyClampSampler, flipUv + haloVec, direction, kDistortion)
+			  * (weight * kHaloOpacity);
 #endif
 
 	// Lens dirt
@@ -98,12 +98,12 @@ ANKI_RP Vec3 upscale(Vec2 uv)
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, FB_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kViewport))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(FB_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kViewport);
 #else
 	const Vec2 uv = in_uv;
 #endif

+ 48 - 48
AnKi/Shaders/ClusterBinning.ankiprog

@@ -3,11 +3,11 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_U32(TILE_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_U32(TILE_COUNT_X, 1u);
-ANKI_SPECIALIZATION_CONSTANT_U32(TILE_COUNT_Y, 2u);
-ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 3u);
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(RENDERING_SIZE, 4u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kTileSize, 0u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kTileCountX, 1u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kTileCountY, 2u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kZSplitCount, 3u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kRenderingSize, 4u);
 
 #pragma anki start comp
 
@@ -15,8 +15,8 @@ ANKI_SPECIALIZATION_CONSTANT_UVEC2(RENDERING_SIZE, 4u);
 #include <AnKi/Shaders/Common.glsl>
 #include <AnKi/Shaders/CollisionFunctions.glsl>
 
-const U32 WORKGROUP_SIZE = 64u;
-layout(local_size_x = WORKGROUP_SIZE) in;
+const U32 kWorkgroupSize = 64u;
+layout(local_size_x = kWorkgroupSize) in;
 
 layout(set = 0, binding = 0) uniform b_unis
 {
@@ -30,93 +30,93 @@ layout(set = 0, binding = 1) writeonly buffer b_clusters
 
 layout(set = 0, binding = 2) uniform b_pointLights
 {
-	PointLight u_pointLights[MAX_VISIBLE_POINT_LIGHTS];
+	PointLight u_pointLights[kMaxVisiblePointLights];
 };
 
 layout(set = 0, binding = 3) uniform b_spotLights
 {
-	SpotLightBinning u_spotLights[MAX_VISIBLE_SPOT_LIGHTS];
+	SpotLightBinning u_spotLights[kMaxVisibleSpotLights];
 };
 
 layout(set = 0, binding = 4) uniform b_reflectionProbes
 {
-	ReflectionProbe u_reflectionProbes[MAX_VISIBLE_REFLECTION_PROBES];
+	ReflectionProbe u_reflectionProbes[kMaxVisibleReflectionProbes];
 };
 
 layout(set = 0, binding = 5) uniform b_giProbes
 {
-	GlobalIlluminationProbe u_giProbes[MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES];
+	GlobalIlluminationProbe u_giProbes[kMaxVisibleGlobalIlluminationProbes];
 };
 
 layout(set = 0, binding = 6) uniform b_fogVolumes
 {
-	FogDensityVolume u_fogVolumes[MAX_VISIBLE_FOG_DENSITY_VOLUMES];
+	FogDensityVolume u_fogVolumes[kMaxVisibleFogDensityVolumes];
 };
 
 layout(set = 0, binding = 7) uniform b_decals
 {
-	Decal u_decals[MAX_VISIBLE_DECALS];
+	Decal u_decals[kMaxVisibleDecals];
 };
 
-const U32 TILE_COUNT = TILE_COUNT_X * TILE_COUNT_Y;
+const U32 kTileCount = kTileCountX * kTileCountY;
 
 // DX Sample locations
-const U32 SAMPLE_COUNT = 4u;
-#define LOCATION(x, y) UVec2(Vec2(IVec2(x, y) + 8) / 16.0 * F32(TILE_SIZE))
-UVec2 SAMPLE_LOCATIONS[SAMPLE_COUNT] = UVec2[](LOCATION(-2, -6), LOCATION(6, -2), LOCATION(-6, 2), LOCATION(2, 6));
+const U32 kSampleCount = 4u;
+#define LOCATION(x, y) UVec2(Vec2(IVec2(x, y) + 8) / 16.0 * F32(kTileSize))
+UVec2 SAMPLE_LOCATIONS[kSampleCount] = UVec2[](LOCATION(-2, -6), LOCATION(6, -2), LOCATION(-6, 2), LOCATION(2, 6));
 #undef LOCATION
 
 // A mask per tile of this workgroup for the clusterer object being processed by this workgroup
-const U32 TILES_PER_WORKGROUP = WORKGROUP_SIZE / SAMPLE_COUNT;
-shared ExtendedClusterObjectMask s_tileMasks[TILES_PER_WORKGROUP];
+const U32 kTilesPerWorkgroup = kWorkgroupSize / kSampleCount;
+shared ExtendedClusterObjectMask s_tileMasks[kTilesPerWorkgroup];
 
 // A mask for each Z split for a specific clusterer object
-shared ExtendedClusterObjectMask s_zSplitMasks[Z_SPLIT_COUNT];
+shared ExtendedClusterObjectMask s_zSplitMasks[kZSplitCount];
 
 Bool isPointLight()
 {
-	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_POINT_LIGHT].x;
+	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[kClusterObjectTypePointLight].x;
 }
 
 Bool isSpotLight()
 {
-	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_SPOT_LIGHT].x;
+	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[kClusterObjectTypeSpotLight].x;
 }
 
 Bool isDecal()
 {
-	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_DECAL].x;
+	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[kClusterObjectTypeDecal].x;
 }
 
 Bool isFogVolume()
 {
-	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_FOG_DENSITY_VOLUME].x;
+	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[kClusterObjectTypeFogDensityVolume].x;
 }
 
 Bool isReflectionProbe()
 {
-	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_REFLECTION_PROBE].x;
+	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[kClusterObjectTypeReflectionProbe].x;
 }
 
 Bool isGiProbe()
 {
-	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE].x;
+	return gl_GlobalInvocationID.y < u_unis.m_objectCountsUpTo[kClusterObjectTypeGlobalIlluminationProbe].x;
 }
 
 void main()
 {
-	const U32 globalInvocationIDX = min(gl_GlobalInvocationID.x, TILE_COUNT * SAMPLE_COUNT);
-	const U32 tileIdx = globalInvocationIDX / SAMPLE_COUNT;
-	const U32 sampleIdx = globalInvocationIDX % SAMPLE_COUNT;
-	const U32 localTileIdx = gl_LocalInvocationIndex / SAMPLE_COUNT;
+	const U32 globalInvocationIDX = min(gl_GlobalInvocationID.x, kTileCount * kSampleCount);
+	const U32 tileIdx = globalInvocationIDX / kSampleCount;
+	const U32 sampleIdx = globalInvocationIDX % kSampleCount;
+	const U32 localTileIdx = gl_LocalInvocationIndex / kSampleCount;
 	const U32 clustererObjectIdx = gl_GlobalInvocationID.y;
 
-	const UVec2 tileXY = UVec2(tileIdx % TILE_COUNT_X, tileIdx / TILE_COUNT_X);
+	const UVec2 tileXY = UVec2(tileIdx % kTileCountX, tileIdx / kTileCountX);
 
 	// This is a pixel in one of the main framebuffers of the renderer, eg the gbuffer's framebuffers
-	const UVec2 pixel = tileXY * TILE_SIZE + SAMPLE_LOCATIONS[sampleIdx];
+	const UVec2 pixel = tileXY * kTileSize + SAMPLE_LOCATIONS[sampleIdx];
 
-	const Vec2 uv = Vec2(pixel) / Vec2(RENDERING_SIZE);
+	const Vec2 uv = Vec2(pixel) / Vec2(kRenderingSize);
 	const Vec2 ndc = UV_TO_NDC(uv);
 
 	// Unproject the sample in view space
@@ -129,9 +129,9 @@ void main()
 
 	// Zero shared memory
 	s_tileMasks[localTileIdx] = ExtendedClusterObjectMask(0);
-	const U32 splitsPerInvocation = max(1u, Z_SPLIT_COUNT / WORKGROUP_SIZE);
+	const U32 splitsPerInvocation = max(1u, kZSplitCount / kWorkgroupSize);
 	for(U32 i = gl_LocalInvocationIndex * splitsPerInvocation;
-		i < (gl_LocalInvocationIndex + 1u) * splitsPerInvocation && i < Z_SPLIT_COUNT; ++i)
+		i < (gl_LocalInvocationIndex + 1u) * splitsPerInvocation && i < kZSplitCount; ++i)
 	{
 		s_zSplitMasks[i] = ExtendedClusterObjectMask(0);
 	}
@@ -152,7 +152,7 @@ void main()
 	// Spot light
 	else if(isSpotLight())
 	{
-		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_SPOT_LIGHT - 1u].x;
+		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[kClusterObjectTypeSpotLight - 1u].x;
 		const SpotLightBinning light = u_spotLights[objectArrayIdx];
 
 		t0 = 10000.0;
@@ -190,7 +190,7 @@ void main()
 	// Decal
 	else if(isDecal())
 	{
-		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_DECAL - 1u].x;
+		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[kClusterObjectTypeDecal - 1u].x;
 		const Decal decal = u_decals[objectArrayIdx];
 
 		collides = testRayObb(rayOrigin, rayDir, decal.m_obbExtend, decal.m_invertedTransform, t0, t1);
@@ -198,7 +198,7 @@ void main()
 	// Fog volume
 	else if(isFogVolume())
 	{
-		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_FOG_DENSITY_VOLUME - 1u].x;
+		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[kClusterObjectTypeFogDensityVolume - 1u].x;
 		const FogDensityVolume vol = u_fogVolumes[objectArrayIdx];
 
 		if(vol.m_isBox != 0u)
@@ -215,7 +215,7 @@ void main()
 	// Reflection probe
 	else if(isReflectionProbe())
 	{
-		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_REFLECTION_PROBE - 1u].x;
+		objectArrayIdx = clustererObjectIdx - u_unis.m_objectCountsUpTo[kClusterObjectTypeReflectionProbe - 1u].x;
 		const ReflectionProbe probe = u_reflectionProbes[objectArrayIdx];
 
 		collides = testRayAabb(rayOrigin, rayDir, probe.m_aabbMin, probe.m_aabbMax, t0, t1);
@@ -224,7 +224,7 @@ void main()
 	else
 	{
 		objectArrayIdx =
-			clustererObjectIdx - u_unis.m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE - 1u].x;
+			clustererObjectIdx - u_unis.m_objectCountsUpTo[kClusterObjectTypeGlobalIlluminationProbe - 1u].x;
 		const GlobalIlluminationProbe probe = u_giProbes[objectArrayIdx];
 
 		collides = testRayAabb(rayOrigin, rayDir, probe.m_aabbMin, probe.m_aabbMax, t0, t1);
@@ -261,7 +261,7 @@ void main()
 
 		const I32 startZSplit = max(I32(minDistFromNearPlane * u_unis.m_zSplitCountOverFrustumLength), 0);
 		const I32 endZSplit =
-			clamp(I32(maxDistFromNearPlane * u_unis.m_zSplitCountOverFrustumLength), 0, I32(Z_SPLIT_COUNT) - 1);
+			clamp(I32(maxDistFromNearPlane * u_unis.m_zSplitCountOverFrustumLength), 0, I32(kZSplitCount) - 1);
 		for(I32 i = startZSplit; i <= endZSplit; ++i)
 		{
 			atomicOr(s_zSplitMasks[i], mask);
@@ -303,33 +303,33 @@ void main()
 
 	// All invocations write at least one Z split
 	for(U32 i = gl_LocalInvocationIndex * splitsPerInvocation;
-		i < (gl_LocalInvocationIndex + 1u) * splitsPerInvocation && i < Z_SPLIT_COUNT; ++i)
+		i < (gl_LocalInvocationIndex + 1u) * splitsPerInvocation && i < kZSplitCount; ++i)
 	{
 		if(s_zSplitMasks[i] != ExtendedClusterObjectMask(0))
 		{
 			if(isPointLight())
 			{
-				atomicOr(u_clusters[TILE_COUNT + i].m_pointLightsMask, s_zSplitMasks[i]);
+				atomicOr(u_clusters[kTileCount + i].m_pointLightsMask, s_zSplitMasks[i]);
 			}
 			else if(isSpotLight())
 			{
-				atomicOr(u_clusters[TILE_COUNT + i].m_spotLightsMask, s_zSplitMasks[i]);
+				atomicOr(u_clusters[kTileCount + i].m_spotLightsMask, s_zSplitMasks[i]);
 			}
 			else if(isDecal())
 			{
-				atomicOr(u_clusters[TILE_COUNT + i].m_decalsMask, s_zSplitMasks[i]);
+				atomicOr(u_clusters[kTileCount + i].m_decalsMask, s_zSplitMasks[i]);
 			}
 			else if(isFogVolume())
 			{
-				atomicOr(u_clusters[TILE_COUNT + i].m_fogDensityVolumesMask, U32(s_zSplitMasks[i]));
+				atomicOr(u_clusters[kTileCount + i].m_fogDensityVolumesMask, U32(s_zSplitMasks[i]));
 			}
 			else if(isReflectionProbe())
 			{
-				atomicOr(u_clusters[TILE_COUNT + i].m_reflectionProbesMask, U32(s_zSplitMasks[i]));
+				atomicOr(u_clusters[kTileCount + i].m_reflectionProbesMask, U32(s_zSplitMasks[i]));
 			}
 			else
 			{
-				atomicOr(u_clusters[TILE_COUNT + i].m_giProbesMask, U32(s_zSplitMasks[i]));
+				atomicOr(u_clusters[kTileCount + i].m_giProbesMask, U32(s_zSplitMasks[i]));
 			}
 		}
 	}

+ 19 - 19
AnKi/Shaders/ClusteredShadingCommon.glsl

@@ -23,12 +23,12 @@ layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_UNIFORMS_BINDING
 #if defined(CLUSTERED_SHADING_LIGHTS_BINDING)
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_LIGHTS_BINDING) uniform b_pointLights
 {
-	PointLight u_pointLights2[MAX_VISIBLE_POINT_LIGHTS];
+	PointLight u_pointLights2[kMaxVisiblePointLights];
 };
 
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_LIGHTS_BINDING + 1u) uniform b_spotLights
 {
-	SpotLight u_spotLights[MAX_VISIBLE_SPOT_LIGHTS];
+	SpotLight u_spotLights[kMaxVisibleSpotLights];
 };
 
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_LIGHTS_BINDING + 2u) uniform texture2D u_shadowAtlasTex;
@@ -40,7 +40,7 @@ layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_LIGHTS_BINDING +
 #if defined(CLUSTERED_SHADING_REFLECTIONS_BINDING)
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_REFLECTIONS_BINDING) uniform b_reflectionProbes
 {
-	ReflectionProbe u_reflectionProbes[MAX_VISIBLE_REFLECTION_PROBES];
+	ReflectionProbe u_reflectionProbes[kMaxVisibleReflectionProbes];
 };
 
 layout(set = CLUSTERED_SHADING_SET,
@@ -53,7 +53,7 @@ layout(set = CLUSTERED_SHADING_SET,
 #if defined(CLUSTERED_SHADING_DECALS_BINDING)
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_DECALS_BINDING) uniform b_decals
 {
-	Decal u_decals2[MAX_VISIBLE_DECALS];
+	Decal u_decals2[kMaxVisibleDecals];
 };
 
 layout(set = CLUSTERED_SHADING_SET,
@@ -68,7 +68,7 @@ layout(set = CLUSTERED_SHADING_SET,
 #if defined(CLUSTERED_SHADING_FOG_BINDING)
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_FOG_BINDING) uniform b_fogDensityVolumes
 {
-	FogDensityVolume u_fogDensityVolumes[MAX_VISIBLE_FOG_DENSITY_VOLUMES];
+	FogDensityVolume u_fogDensityVolumes[kMaxVisibleFogDensityVolumes];
 };
 #endif
 
@@ -77,11 +77,11 @@ layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_FOG_BINDING) uni
 //
 #if defined(CLUSTERED_SHADING_GI_BINDING)
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_GI_BINDING) uniform ANKI_RP texture3D
-	u_globalIlluminationTextures[MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES];
+	u_globalIlluminationTextures[kMaxVisibleGlobalIlluminationProbes];
 
 layout(set = CLUSTERED_SHADING_SET, binding = CLUSTERED_SHADING_GI_BINDING + 1u) uniform b_giProbes
 {
-	GlobalIlluminationProbe u_giProbes[MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES];
+	GlobalIlluminationProbe u_giProbes[kMaxVisibleGlobalIlluminationProbes];
 };
 #endif
 
@@ -101,39 +101,39 @@ Vec3 clusterHeatmap(Cluster cluster, U32 objectTypeMask)
 	U32 maxObjects = 0u;
 	I32 count = 0;
 
-	if((objectTypeMask & (1u << CLUSTER_OBJECT_TYPE_POINT_LIGHT)) != 0u)
+	if((objectTypeMask & (1u << kClusterObjectTypePointLight)) != 0u)
 	{
-		maxObjects += MAX_VISIBLE_POINT_LIGHTS;
+		maxObjects += kMaxVisiblePointLights;
 		count += I32(bitCount(cluster.m_pointLightsMask));
 	}
 
-	if((objectTypeMask & (1u << CLUSTER_OBJECT_TYPE_SPOT_LIGHT)) != 0u)
+	if((objectTypeMask & (1u << kClusterObjectTypeSpotLight)) != 0u)
 	{
-		maxObjects += MAX_VISIBLE_SPOT_LIGHTS;
+		maxObjects += kMaxVisibleSpotLights;
 		count += I32(bitCount(cluster.m_spotLightsMask));
 	}
 
-	if((objectTypeMask & (1u << CLUSTER_OBJECT_TYPE_DECAL)) != 0u)
+	if((objectTypeMask & (1u << kClusterObjectTypeDecal)) != 0u)
 	{
-		maxObjects += MAX_VISIBLE_DECALS;
+		maxObjects += kMaxVisibleDecals;
 		count += I32(bitCount(cluster.m_decalsMask));
 	}
 
-	if((objectTypeMask & (1u << CLUSTER_OBJECT_TYPE_FOG_DENSITY_VOLUME)) != 0u)
+	if((objectTypeMask & (1u << kClusterObjectTypeFogDensityVolume)) != 0u)
 	{
-		maxObjects += MAX_VISIBLE_FOG_DENSITY_VOLUMES;
+		maxObjects += kMaxVisibleFogDensityVolumes;
 		count += bitCount(cluster.m_fogDensityVolumesMask);
 	}
 
-	if((objectTypeMask & (1u << CLUSTER_OBJECT_TYPE_REFLECTION_PROBE)) != 0u)
+	if((objectTypeMask & (1u << kClusterObjectTypeReflectionProbe)) != 0u)
 	{
-		maxObjects += MAX_VISIBLE_REFLECTION_PROBES;
+		maxObjects += kMaxVisibleReflectionProbes;
 		count += bitCount(cluster.m_reflectionProbesMask);
 	}
 
-	if((objectTypeMask & (1u << CLUSTER_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE)) != 0u)
+	if((objectTypeMask & (1u << kClusterObjectTypeGlobalIlluminationProbe)) != 0u)
 	{
-		maxObjects += MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES;
+		maxObjects += kMaxVisibleGlobalIlluminationProbes;
 		count += bitCount(cluster.m_giProbesMask);
 	}
 

+ 3 - 3
AnKi/Shaders/CollisionFunctions.glsl

@@ -14,7 +14,7 @@ Bool testRayTriangle(Vec3 rayOrigin, Vec3 rayDir, Vec3 v0, Vec3 v1, Vec3 v2, Boo
 	const Vec3 pvec = cross(rayDir, v0v2);
 	const F32 det = dot(v0v1, pvec);
 
-	if((backfaceCulling && det < EPSILON) || abs(det) < EPSILON)
+	if((backfaceCulling && det < kEpsilonf) || abs(det) < kEpsilonf)
 	{
 		return false;
 	}
@@ -37,7 +37,7 @@ Bool testRayTriangle(Vec3 rayOrigin, Vec3 rayDir, Vec3 v0, Vec3 v1, Vec3 v2, Boo
 
 	t = dot(v0v2, qvec) * invDet;
 
-	if(t <= EPSILON)
+	if(t <= kEpsilonf)
 	{
 		// This is an addition to the original code. Can't have rays that don't touch the triangle
 		return false;
@@ -77,7 +77,7 @@ Bool testRayAabb(Vec3 rayOrigin, Vec3 rayDir, Vec3 aabbMin, Vec3 aabbMax, out F3
 	t0 = max(tmin.x, max(tmin.y, tmin.z));
 	t1 = min(tmax.x, min(tmax.y, tmax.z));
 
-	return t0 < t1 && t1 > EPSILON;
+	return t0 < t1 && t1 > kEpsilonf;
 }
 
 Bool testRayObb(Vec3 rayOrigin, Vec3 rayDir, Vec3 obbExtend, Mat4 obbTransformInv, out F32 t0, out F32 t1)

+ 7 - 9
AnKi/Shaders/Common.glsl

@@ -11,24 +11,22 @@
 #include <AnKi/Shaders/TextureFunctions.glsl>
 
 // Constants
-const F32 EPSILON = 0.000001;
-const F16 EPSILON_F16 = 0.0001hf; // Divisions by this should be OK according to http://weitz.de/ieee/
-const ANKI_RP F32 EPSILON_RP = F32(EPSILON_F16);
+const F32 kEpsilonf = 0.000001;
+const F16 kEpsilonf16 = 0.0001hf; // Divisions by this should be OK according to http://weitz.de/ieee/
+const ANKI_RP F32 kEpsilonRp = F32(kEpsilonf16);
 
 const U32 kMaxU32 = 0xFFFFFFFFu;
 const F32 kMaxF32 = 3.402823e+38;
-const F16 MAX_F16 = 65504.0hf;
-const F16 MIN_F16 = 0.00006104hf;
+const F16 kMaxF16 = 65504.0hf;
+const F16 kMinF16 = 0.00006104hf;
 
-const F32 PI = 3.14159265358979323846;
-const U32 MAX_UBO_SIZE = 16384u;
-const U32 MAX_SHARED_MEMORY = 32u * 1024u;
+const F32 kPi = 3.14159265358979323846;
 
 // Macros
 #define UV_TO_NDC(x_) ((x_)*2.0 - 1.0)
 #define NDC_TO_UV(x_) ((x_)*0.5 + 0.5)
 #define saturate(x_) clamp((x_), 0.0, 1.0)
-#define saturateRp(x) min(x, F32(MAX_F16))
+#define saturateRp(x) min(x, F32(kMaxF16))
 #define mad(a_, b_, c_) fma((a_), (b_), (c_))
 
 // Techniques

+ 7 - 7
AnKi/Shaders/DepthAwareBlur.glsl

@@ -7,7 +7,7 @@
 #pragma anki mutator SAMPLE_COUNT 3 5 7 9 11 13 15
 #pragma anki mutator COLOR_COMPONENTS 4 3 1
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(TEXTURE_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kTextureSize, 0u);
 
 #include <AnKi/Shaders/Common.glsl>
 
@@ -25,7 +25,7 @@ ANKI_SPECIALIZATION_CONSTANT_UVEC2(TEXTURE_SIZE, 0u);
 
 #if defined(ANKI_COMPUTE_SHADER)
 #	define USE_COMPUTE 1
-const UVec2 WORKGROUP_SIZE = UVec2(8u, 8u);
+const UVec2 kWorkgroupSize = UVec2(8u, 8u);
 #else
 #	define USE_COMPUTE 0
 #endif
@@ -52,7 +52,7 @@ layout(set = 0, binding = 1) uniform texture2D u_inTex;
 layout(set = 0, binding = 2) uniform texture2D u_depthTex;
 
 #if USE_COMPUTE
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 layout(set = 0, binding = 3) writeonly uniform image2D u_outImg;
 #else
 layout(location = 0) in Vec2 in_uv;
@@ -62,7 +62,7 @@ layout(location = 0) out COL_TYPE out_color;
 F32 computeDepthWeight(F32 refDepth, F32 depth)
 {
 	const F32 diff = abs(refDepth - depth);
-	const F32 weight = 1.0 / (EPSILON + diff);
+	const F32 weight = 1.0 / (kEpsilonf + diff);
 	return sqrt(weight);
 }
 
@@ -83,18 +83,18 @@ void main()
 {
 	// Set UVs
 #if USE_COMPUTE
-	ANKI_BRANCH if(gl_GlobalInvocationID.x >= TEXTURE_SIZE.x || gl_GlobalInvocationID.y >= TEXTURE_SIZE.y)
+	ANKI_BRANCH if(gl_GlobalInvocationID.x >= kTextureSize.x || gl_GlobalInvocationID.y >= kTextureSize.y)
 	{
 		// Out of bounds
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(TEXTURE_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kTextureSize);
 #else
 	const Vec2 uv = in_uv;
 #endif
 
-	const Vec2 TEXEL_SIZE = 1.0 / Vec2(TEXTURE_SIZE);
+	const Vec2 TEXEL_SIZE = 1.0 / Vec2(kTextureSize);
 
 	// Sample
 	COL_TYPE color = textureLod(u_inTex, u_linearAnyClampSampler, uv, 0.0).TEX_FETCH;

+ 3 - 4
AnKi/Shaders/DownscaleBlur.glsl

@@ -11,8 +11,7 @@
 layout(set = 0, binding = 0) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 1) uniform ANKI_RP texture2D u_tex;
 
-const U32 TONEMAPPING_SET = 0u;
-const U32 TONEMAPPING_BINDING = 2u;
+const U32 kTonemappingBinding = 2u;
 #include <AnKi/Shaders/TonemappingResources.glsl>
 
 layout(push_constant, row_major, std140) uniform b_pc
@@ -23,8 +22,8 @@ layout(push_constant, row_major, std140) uniform b_pc
 };
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(16, 16);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(16, 16);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 Vec2 in_uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(u_fbSize);
 layout(set = 0, binding = 3) writeonly uniform ANKI_RP image2D out_img;

+ 20 - 20
AnKi/Shaders/Evsm.glsl

@@ -3,8 +3,8 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(INPUT_TEXTURE_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 2u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kInputTextureSize, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kFramebufferSize, 2u);
 
 #include <AnKi/Shaders/Include/MiscRendererTypes.h>
 
@@ -27,7 +27,7 @@ void main()
 
 	out_uv = uv * uni.m_uvScale + uni.m_uvTranslation;
 
-	const Vec2 pos = UV_TO_NDC((Vec2(uni.m_viewportXY) + uni.m_viewportZW * uv) / Vec2(FB_SIZE));
+	const Vec2 pos = UV_TO_NDC((Vec2(uni.m_viewportXY) + uni.m_viewportZW * uv) / Vec2(kFramebufferSize));
 	gl_Position = Vec4(pos, 0.0, 1.0);
 
 	out_instanceIndex = gl_InstanceIndex;
@@ -38,7 +38,7 @@ void main()
 #	include <AnKi/Shaders/GaussianBlurCommon.glsl>
 #	include <AnKi/Shaders/LightFunctions.glsl>
 
-const F32 OFFSET = 1.25;
+const F32 kOffset = 1.25;
 
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 2) uniform texture2D u_inputTex;
@@ -74,28 +74,28 @@ void main()
 #	endif
 
 	// Compute the UV limits. We can't sample beyond those
-	const Vec2 TEXEL_SIZE = 1.0 / Vec2(INPUT_TEXTURE_SIZE);
-	const Vec2 HALF_TEXEL_SIZE = TEXEL_SIZE / 2.0;
-	const Vec2 maxUv = uni.m_uvMax - HALF_TEXEL_SIZE;
-	const Vec2 minUv = uni.m_uvMin + HALF_TEXEL_SIZE;
+	const Vec2 kTexelSize = 1.0 / Vec2(kInputTextureSize);
+	const Vec2 kHalfTexelSize = kTexelSize / 2.0;
+	const Vec2 maxUv = uni.m_uvMax - kHalfTexelSize;
+	const Vec2 minUv = uni.m_uvMin + kHalfTexelSize;
 
 	// Sample
-	const Vec2 UV_OFFSET = OFFSET * TEXEL_SIZE;
-	const F32 w0 = BOX_WEIGHTS[0u];
-	const F32 w1 = BOX_WEIGHTS[1u];
-	const F32 w2 = BOX_WEIGHTS[2u];
+	const Vec2 kUvOffset = kOffset * kTexelSize;
+	const F32 w0 = kBoxWeights[0u];
+	const F32 w1 = kBoxWeights[1u];
+	const F32 w2 = kBoxWeights[2u];
 	Vec4 moments;
 	if(uni.m_blur != 0u)
 	{
 		moments = computeMoments(uv) * w0;
-		moments += computeMoments(clamp(uv + Vec2(UV_OFFSET.x, 0.0), minUv, maxUv)) * w1;
-		moments += computeMoments(clamp(uv + Vec2(-UV_OFFSET.x, 0.0), minUv, maxUv)) * w1;
-		moments += computeMoments(clamp(uv + Vec2(0.0, UV_OFFSET.y), minUv, maxUv)) * w1;
-		moments += computeMoments(clamp(uv + Vec2(0.0, -UV_OFFSET.y), minUv, maxUv)) * w1;
-		moments += computeMoments(clamp(uv + Vec2(UV_OFFSET.x, UV_OFFSET.y), minUv, maxUv)) * w2;
-		moments += computeMoments(clamp(uv + Vec2(-UV_OFFSET.x, UV_OFFSET.y), minUv, maxUv)) * w2;
-		moments += computeMoments(clamp(uv + Vec2(UV_OFFSET.x, -UV_OFFSET.y), minUv, maxUv)) * w2;
-		moments += computeMoments(clamp(uv + Vec2(-UV_OFFSET.x, -UV_OFFSET.y), minUv, maxUv)) * w2;
+		moments += computeMoments(clamp(uv + Vec2(kUvOffset.x, 0.0), minUv, maxUv)) * w1;
+		moments += computeMoments(clamp(uv + Vec2(-kUvOffset.x, 0.0), minUv, maxUv)) * w1;
+		moments += computeMoments(clamp(uv + Vec2(0.0, kUvOffset.y), minUv, maxUv)) * w1;
+		moments += computeMoments(clamp(uv + Vec2(0.0, -kUvOffset.y), minUv, maxUv)) * w1;
+		moments += computeMoments(clamp(uv + Vec2(kUvOffset.x, kUvOffset.y), minUv, maxUv)) * w2;
+		moments += computeMoments(clamp(uv + Vec2(-kUvOffset.x, kUvOffset.y), minUv, maxUv)) * w2;
+		moments += computeMoments(clamp(uv + Vec2(kUvOffset.x, -kUvOffset.y), minUv, maxUv)) * w2;
+		moments += computeMoments(clamp(uv + Vec2(-kUvOffset.x, -kUvOffset.y), minUv, maxUv)) * w2;
 	}
 	else
 	{

+ 9 - 9
AnKi/Shaders/FinalComposite.ankiprog

@@ -7,9 +7,9 @@
 #pragma anki mutator BLOOM_ENABLED 0 1
 #pragma anki mutator DBG_ENABLED 0 1
 
-ANKI_SPECIALIZATION_CONSTANT_U32(LUT_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 1u);
-ANKI_SPECIALIZATION_CONSTANT_U32(MOTION_BLUR_SAMPLES, 3u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kLutSize, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kFramebufferSize, 1u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kMotionBlurSamples, 3u);
 
 #pragma anki start vert
 #include <AnKi/Shaders/QuadVert.glsl>
@@ -45,11 +45,11 @@ layout(location = 0) out ANKI_RP Vec3 out_color;
 
 ANKI_RP Vec3 colorGrading(ANKI_RP Vec3 color)
 {
-	const ANKI_RP Vec3 LUT_SCALE = Vec3((F32(LUT_SIZE) - 1.0) / F32(LUT_SIZE));
-	const ANKI_RP Vec3 LUT_OFFSET = Vec3(1.0 / (2.0 * F32(LUT_SIZE)));
+	const ANKI_RP Vec3 kLutScale = Vec3((F32(kLutSize) - 1.0) / F32(kLutSize));
+	const ANKI_RP Vec3 kLutOffset = Vec3(1.0 / (2.0 * F32(kLutSize)));
 
 	color = min(color, Vec3(1.0));
-	const ANKI_RP Vec3 lutCoords = color * LUT_SCALE + LUT_OFFSET;
+	const ANKI_RP Vec3 lutCoords = color * kLutScale + kLutOffset;
 	return textureLod(u_lut, u_trilinearRepeatSampler, lutCoords, 0.0).rgb;
 }
 
@@ -57,10 +57,10 @@ void main()
 {
 	const Vec2 uv = in_uv;
 
-	if(MOTION_BLUR_SAMPLES > 0u)
+	if(kMotionBlurSamples > 0u)
 	{
-		out_color = motionBlur(u_motionVectorsRt, u_nearestAnyClampSampler, u_lightShadingRt, Vec2(FB_SIZE),
-							   u_linearAnyClampSampler, uv, MOTION_BLUR_SAMPLES);
+		out_color = motionBlur(u_motionVectorsRt, u_nearestAnyClampSampler, u_lightShadingRt, Vec2(kFramebufferSize),
+							   u_linearAnyClampSampler, uv, kMotionBlurSamples);
 	}
 	else
 	{

+ 1 - 1
AnKi/Shaders/ForwardShadingCommon.glsl

@@ -17,7 +17,7 @@ ANKI_BINDLESS_SET(kMaterialSetBindless)
 // Vert
 //
 #if defined(ANKI_VERTEX_SHADER)
-layout(location = VERTEX_ATTRIBUTE_ID_POSITION) in Vec3 in_position;
+layout(location = kVertexAttributeIdPosition) in Vec3 in_position;
 #endif
 
 //

+ 1 - 1
AnKi/Shaders/ForwardShadingGenericTransparent.ankiprog

@@ -40,7 +40,7 @@ layout(set = kMaterialSetGlobal, binding = kMaterialBindingGlobalUniforms) unifo
 
 #pragma anki start vert
 
-layout(location = VERTEX_ATTRIBUTE_ID_UV0) in Vec2 in_uv;
+layout(location = kVertexAttributeIdUv0) in Vec2 in_uv;
 
 layout(location = 0) out Vec2 out_uv;
 layout(location = 1) out Vec3 out_worldPosition;

+ 2 - 2
AnKi/Shaders/ForwardShadingParticles.ankiprog

@@ -36,8 +36,8 @@ layout(set = kMaterialSetLocal, binding = kMaterialBindingRenderableGpuView) uni
 
 #pragma anki start vert
 
-layout(location = VERTEX_ATTRIBUTE_ID_SCALE) in F32 in_scale;
-layout(location = VERTEX_ATTRIBUTE_ID_ALPHA) in F32 in_alpha;
+layout(location = kVertexAttributeIdScale) in F32 in_scale;
+layout(location = kVertexAttributeIdAlpha) in F32 in_alpha;
 
 layout(location = 0) flat out ANKI_RP F32 out_alpha;
 layout(location = 1) out Vec2 out_uv;

+ 15 - 15
AnKi/Shaders/Functions.glsl

@@ -188,7 +188,7 @@ F32 _calcDepthWeight(texture2D depthLow, sampler nearestAnyClamp, Vec2 uv, F32 r
 {
 	const F32 d = textureLod(depthLow, nearestAnyClamp, uv, 0.0).r;
 	const F32 linearD = linearizeDepthOptimal(d, linearDepthCf.x, linearDepthCf.y);
-	return 1.0 / (EPSILON + abs(ref - linearD));
+	return 1.0 / (kEpsilonf + abs(ref - linearD));
 }
 
 Vec4 _sampleAndWeight(texture2D depthLow, texture2D colorLow, sampler linearAnyClamp, sampler nearestAnyClamp,
@@ -205,29 +205,29 @@ Vec4 _sampleAndWeight(texture2D depthLow, texture2D colorLow, sampler linearAnyC
 Vec4 bilateralUpsample(texture2D depthHigh, texture2D depthLow, texture2D colorLow, sampler linearAnyClamp,
 					   sampler nearestAnyClamp, const Vec2 lowInvSize, const Vec2 uv, const Vec2 linearDepthCf)
 {
-	const Vec3 WEIGHTS = Vec3(0.25, 0.125, 0.0625);
+	const Vec3 kWeights = Vec3(0.25, 0.125, 0.0625);
 	const F32 depthRef =
 		linearizeDepthOptimal(textureLod(depthHigh, nearestAnyClamp, uv, 0.0).r, linearDepthCf.x, linearDepthCf.y);
 	F32 normalize = 0.0;
 
 	Vec4 sum = _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(0.0, 0.0),
-								depthRef, WEIGHTS.x, linearDepthCf, normalize);
+								depthRef, kWeights.x, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(-1.0, 0.0),
-							depthRef, WEIGHTS.y, linearDepthCf, normalize);
+							depthRef, kWeights.y, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(0.0, -1.0),
-							depthRef, WEIGHTS.y, linearDepthCf, normalize);
+							depthRef, kWeights.y, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(1.0, 0.0),
-							depthRef, WEIGHTS.y, linearDepthCf, normalize);
+							depthRef, kWeights.y, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(0.0, 1.0),
-							depthRef, WEIGHTS.y, linearDepthCf, normalize);
+							depthRef, kWeights.y, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(1.0, 1.0),
-							depthRef, WEIGHTS.z, linearDepthCf, normalize);
+							depthRef, kWeights.z, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(1.0, -1.0),
-							depthRef, WEIGHTS.z, linearDepthCf, normalize);
+							depthRef, kWeights.z, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(-1.0, 1.0),
-							depthRef, WEIGHTS.z, linearDepthCf, normalize);
+							depthRef, kWeights.z, linearDepthCf, normalize);
 	sum += _sampleAndWeight(depthLow, colorLow, linearAnyClamp, nearestAnyClamp, lowInvSize, uv, Vec2(-1.0, -1.0),
-							depthRef, WEIGHTS.z, linearDepthCf, normalize);
+							depthRef, kWeights.z, linearDepthCf, normalize);
 
 	return sum / normalize;
 }
@@ -309,8 +309,8 @@ Vec3 grayScale(const Vec3 col)
 
 Vec3 saturateColor(const Vec3 col, const F32 factor)
 {
-	const Vec3 LUM_COEFF = Vec3(0.2125, 0.7154, 0.0721);
-	const Vec3 intensity = Vec3(dot(col, LUM_COEFF));
+	const Vec3 lumCoeff = Vec3(0.2125, 0.7154, 0.0721);
+	const Vec3 intensity = Vec3(dot(col, lumCoeff));
 	return mix(intensity, col, factor);
 }
 
@@ -461,7 +461,7 @@ Mat3 rotationFromDirection(Vec3 zAxis)
 {
 #if 0
 	const Vec3 z = zAxis;
-	const Bool alignsWithXBasis = abs(z.x - 1.0) <= EPSILON; // aka z == Vec3(1.0, 0.0, 0.0)
+	const Bool alignsWithXBasis = abs(z.x - 1.0) <= kEpsilonf; // aka z == Vec3(1.0, 0.0, 0.0)
 	Vec3 x = (alignsWithXBasis) ? Vec3(0.0, 0.0, 1.0) : Vec3(1.0, 0.0, 0.0);
 	const Vec3 y = normalize(cross(x, z));
 	x = normalize(cross(z, y));
@@ -557,7 +557,7 @@ UVec2 getOptimalGlobalInvocationId8x8Nvidia()
 // Gaussian distrubution function
 F32 gaussianWeight(F32 s, F32 x)
 {
-	F32 p = 1.0 / (s * sqrt(2.0 * PI));
+	F32 p = 1.0 / (s * sqrt(2.0 * kPi));
 	p *= exp((x * x) / (-2.0 * s * s));
 	return p;
 }

+ 6 - 6
AnKi/Shaders/GBufferCommon.glsl

@@ -30,20 +30,20 @@ ANKI_BINDLESS_SET(kMaterialSetBindless)
 //
 #if defined(ANKI_VERTEX_SHADER)
 
-layout(location = VERTEX_ATTRIBUTE_ID_POSITION) in Vec3 in_position;
+layout(location = kVertexAttributeIdPosition) in Vec3 in_position;
 
 #	if ANKI_TECHNIQUE == RENDERING_TECHNIQUE_GBUFFER
-layout(location = VERTEX_ATTRIBUTE_ID_NORMAL) in ANKI_RP Vec3 in_normal;
-layout(location = VERTEX_ATTRIBUTE_ID_TANGENT) in ANKI_RP Vec4 in_tangent;
+layout(location = kVertexAttributeIdNormal) in ANKI_RP Vec3 in_normal;
+layout(location = kVertexAttributeIdTangent) in ANKI_RP Vec4 in_tangent;
 #	endif
 
 #	if ANKI_TECHNIQUE == RENDERING_TECHNIQUE_GBUFFER || ALPHA_TEST
-layout(location = VERTEX_ATTRIBUTE_ID_UV0) in Vec2 in_uv;
+layout(location = kVertexAttributeIdUv0) in Vec2 in_uv;
 #	endif
 
 #	if ANKI_BONES
-layout(location = VERTEX_ATTRIBUTE_ID_BONE_WEIGHTS) in Vec4 in_boneWeights;
-layout(location = VERTEX_ATTRIBUTE_ID_BONE_INDICES) in UVec4 in_boneIndices;
+layout(location = kVertexAttributeIdBoneWeights) in Vec4 in_boneWeights;
+layout(location = kVertexAttributeIdBoneIndices) in UVec4 in_boneIndices;
 #	endif
 
 #endif // defined(ANKI_VERTEX_SHADER)

+ 5 - 5
AnKi/Shaders/GBufferGeneric.ankiprog

@@ -210,9 +210,9 @@ void main()
 #if REALLY_USING_PARALLAX
 Vec2 computeTextureCoordParallax(texture2D heightMap, sampler sampl, Vec2 uv, F32 heightMapScale)
 {
-	const U32 MAX_SAMPLES = 25u;
-	const U32 MIN_SAMPLES = 1u;
-	const F32 MAX_EFFECTIVE_DISTANCE = 32.0;
+	const U32 kMaxSamples = 25u;
+	const U32 kMinSamples = 1u;
+	const F32 kMaxEffectiveDistance = 32.0;
 
 	// Get that because we are sampling inside a loop
 	const Vec2 dPdx = dFdx(uv);
@@ -230,9 +230,9 @@ Vec2 computeTextureCoordParallax(texture2D heightMap, sampler sampl, Vec2 uv, F3
 	const Vec3 E = normalize(eyeTangentSpace);
 
 	const F32 factor0 = -dot(E, normTangentSpace);
-	const F32 factor1 = in_distFromTheCamera / -MAX_EFFECTIVE_DISTANCE;
+	const F32 factor1 = in_distFromTheCamera / -kMaxEffectiveDistance;
 	const F32 factor = saturate((1.0 - factor0) * (1.0 - factor1));
-	const F32 sampleCountf = mix(F32(MIN_SAMPLES), F32(MAX_SAMPLES), factor);
+	const F32 sampleCountf = mix(F32(kMinSamples), F32(kMaxSamples), factor);
 
 	const F32 stepSize = 1.0 / sampleCountf;
 

+ 4 - 4
AnKi/Shaders/GBufferPost.ankiprog

@@ -3,9 +3,9 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(TILE_COUNTS, 0u);
-ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 2u);
-ANKI_SPECIALIZATION_CONSTANT_U32(TILE_SIZE, 3u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kTileCount, 0u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kZSplitCount, 2u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kTileSize, 3u);
 
 #pragma anki start vert
 #include <AnKi/Shaders/QuadVert.glsl>
@@ -49,7 +49,7 @@ void main()
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 	// Get the cluster
-	Cluster cluster = getClusterFragCoord(Vec3(gl_FragCoord.xy, depth), TILE_SIZE, TILE_COUNTS, Z_SPLIT_COUNT,
+	Cluster cluster = getClusterFragCoord(Vec3(gl_FragCoord.xy, depth), kTileSize, kTileCount, kZSplitCount,
 										  u_clusteredShading.m_zSplitMagic.x, u_clusteredShading.m_zSplitMagic.y);
 
 	// Process decals

+ 12 - 12
AnKi/Shaders/GaussianBlur.glsl

@@ -9,12 +9,12 @@
 #pragma anki mutator KERNEL_SIZE 3 5 7 9 11
 #pragma anki mutator COLOR_COMPONENTS 4 3 1
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(TEXTURE_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kTextureSize, 0u);
 
 #include <AnKi/Shaders/GaussianBlurCommon.glsl>
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
+const UVec2 kWorkgroupSize = UVec2(8, 8);
 #	define USE_COMPUTE 1
 #else
 #	define USE_COMPUTE 0
@@ -49,7 +49,7 @@ layout(set = 0, binding = 0) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 1) uniform texture2D u_tex; ///< Input texture
 
 #if USE_COMPUTE
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 layout(set = 0, binding = 2) writeonly uniform image2D u_outImg;
 #else
 layout(location = 0) in Vec2 in_uv;
@@ -60,18 +60,18 @@ void main()
 {
 	// Set UVs
 #if USE_COMPUTE
-	ANKI_BRANCH if(gl_GlobalInvocationID.x >= TEXTURE_SIZE.x || gl_GlobalInvocationID.y >= TEXTURE_SIZE.y)
+	ANKI_BRANCH if(gl_GlobalInvocationID.x >= kTextureSize.x || gl_GlobalInvocationID.y >= kTextureSize.y)
 	{
 		// Out of bounds
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(TEXTURE_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kTextureSize);
 #else
 	const Vec2 uv = in_uv;
 #endif
 
-	const Vec2 TEXEL_SIZE = 1.0 / Vec2(TEXTURE_SIZE);
+	const Vec2 TEXEL_SIZE = 1.0 / Vec2(kTextureSize);
 
 #if !defined(BOX)
 	// Do seperable
@@ -82,16 +82,16 @@ void main()
 #		define X_OR_Y y
 #	endif
 
-	COL_TYPE color = textureLod(u_tex, u_linearAnyClampSampler, uv, 0.0).TEX_FETCH * WEIGHTS[0u];
+	COL_TYPE color = textureLod(u_tex, u_linearAnyClampSampler, uv, 0.0).TEX_FETCH * kWeights[0u];
 
 	Vec2 uvOffset = Vec2(0.0);
 	uvOffset.X_OR_Y = 1.5 * TEXEL_SIZE.X_OR_Y;
 
-	ANKI_UNROLL for(U32 i = 0u; i < STEP_COUNT; ++i)
+	ANKI_UNROLL for(U32 i = 0u; i < kStepCount; ++i)
 	{
 		COL_TYPE col = textureLod(u_tex, u_linearAnyClampSampler, uv + uvOffset, 0.0).TEX_FETCH;
 		col += textureLod(u_tex, u_linearAnyClampSampler, uv - uvOffset, 0.0).TEX_FETCH;
-		color += WEIGHTS[i + 1u] * col;
+		color += kWeights[i + 1u] * col;
 
 		uvOffset.X_OR_Y += 2.0 * TEXEL_SIZE.X_OR_Y;
 	}
@@ -100,20 +100,20 @@ void main()
 
 	const Vec2 OFFSET = 1.5 * TEXEL_SIZE;
 
-	COL_TYPE color = textureLod(u_tex, u_linearAnyClampSampler, uv, 0.0).TEX_FETCH * BOX_WEIGHTS[0u];
+	COL_TYPE color = textureLod(u_tex, u_linearAnyClampSampler, uv, 0.0).TEX_FETCH * kBoxWeights[0u];
 
 	COL_TYPE col;
 	col = textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(OFFSET.x, 0.0), 0.0).TEX_FETCH;
 	col += textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(0.0, OFFSET.y), 0.0).TEX_FETCH;
 	col += textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(-OFFSET.x, 0.0), 0.0).TEX_FETCH;
 	col += textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(0.0, -OFFSET.y), 0.0).TEX_FETCH;
-	color += col * BOX_WEIGHTS[1u];
+	color += col * kBoxWeights[1u];
 
 	col = textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(+OFFSET.x, +OFFSET.y), 0.0).TEX_FETCH;
 	col += textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(+OFFSET.x, -OFFSET.y), 0.0).TEX_FETCH;
 	col += textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(-OFFSET.x, +OFFSET.y), 0.0).TEX_FETCH;
 	col += textureLod(u_tex, u_linearAnyClampSampler, uv + Vec2(-OFFSET.x, -OFFSET.y), 0.0).TEX_FETCH;
-	color += col * BOX_WEIGHTS[2u];
+	color += col * kBoxWeights[2u];
 #endif
 
 	// Write value

+ 13 - 13
AnKi/Shaders/GaussianBlurCommon.glsl

@@ -8,20 +8,20 @@
 #include <AnKi/Shaders/Common.glsl>
 
 #if KERNEL_SIZE == 3
-const U32 STEP_COUNT = 1u;
-const F32 WEIGHTS[STEP_COUNT + 1u] = {0.361069, 0.319466};
+const U32 kStepCount = 1u;
+const F32 kWeights[kStepCount + 1u] = {0.361069, 0.319466};
 #elif KERNEL_SIZE == 5
-const U32 STEP_COUNT = 2u;
-const F32 WEIGHTS[STEP_COUNT + 1u] = {0.250301, 0.221461, 0.153388};
+const U32 kStepCount = 2u;
+const F32 kWeights[kStepCount + 1u] = {0.250301, 0.221461, 0.153388};
 #elif KERNEL_SIZE == 7
-const U32 STEP_COUNT = 3u;
-const F32 WEIGHTS[STEP_COUNT + 1u] = {0.214607, 0.189879, 0.131514, 0.071303};
+const U32 kStepCount = 3u;
+const F32 kWeights[kStepCount + 1u] = {0.214607, 0.189879, 0.131514, 0.071303};
 #elif KERNEL_SIZE == 9
-const U32 STEP_COUNT = 4u;
-const F32 WEIGHTS[STEP_COUNT + 1u] = {0.20236, 0.179044, 0.124009, 0.067234, 0.028532};
+const U32 kStepCount = 4u;
+const F32 kWeights[kStepCount + 1u] = {0.20236, 0.179044, 0.124009, 0.067234, 0.028532};
 #elif KERNEL_SIZE == 11
-const U32 STEP_COUNT = 5u;
-const F32 WEIGHTS[STEP_COUNT + 1u] = {0.198596, 0.175713, 0.121703, 0.065984, 0.028002, 0.0093};
+const U32 kStepCount = 5u;
+const F32 kWeights[kStepCount + 1u] = {0.198596, 0.175713, 0.121703, 0.065984, 0.028002, 0.0093};
 #endif
 
 // Imagine you are sampling a 3x3 area:
@@ -32,6 +32,6 @@ const F32 WEIGHTS[STEP_COUNT + 1u] = {0.198596, 0.175713, 0.121703, 0.065984, 0.
 // +-+-+-+
 // |c|b|c|
 // +-+-+-+
-// It's BOX_WEIGHTS[0] for the a texels. BOX_WEIGHTS[1] for the b texels. BOX_WEIGHTS[2] for the c texels.
-// Note: BOX_WEIGHTS[0] + BOX_WEIGHTS[1] * 4 + BOX_WEIGHTS[2] * 4 == 1.0
-const Vec3 BOX_WEIGHTS = Vec3(0.25, 0.125, 0.0625);
+// It's kBoxWeights[0] for the a texels. kBoxWeights[1] for the b texels. kBoxWeights[2] for the c texels.
+// Note: kBoxWeights[0] + kBoxWeights[1] * 4 + kBoxWeights[2] * 4 == 1.0
+const Vec3 kBoxWeights = Vec3(0.25, 0.125, 0.0625);

+ 4 - 4
AnKi/Shaders/GpuParticlesSimulation.ankiprog

@@ -64,10 +64,10 @@ Vec3 computeNormal(const Vec2 uv, const F32 depth)
 	const F32 ddy = smallerDelta(depthBottom, depth, depthTop);
 
 	const Vec2 ndc = UV_TO_NDC(uv);
-	const Vec2 TEXEL_SIZE = 1.0 / Vec2(textureSize(u_depthRt, 0));
-	const Vec2 NDC_TEXEL_SIZE = 2.0 * TEXEL_SIZE;
-	const Vec3 right = unproject(ndc + Vec2(NDC_TEXEL_SIZE.x, 0.0), depth + ddx);
-	const Vec3 top = unproject(ndc + Vec2(0.0, NDC_TEXEL_SIZE.y), depth + ddy);
+	const Vec2 texelSize = 1.0 / Vec2(textureSize(u_depthRt, 0));
+	const Vec2 ndcTexelSize = 2.0 * texelSize;
+	const Vec3 right = unproject(ndc + Vec2(ndcTexelSize.x, 0.0), depth + ddx);
+	const Vec3 top = unproject(ndc + Vec2(0.0, ndcTexelSize.y), depth + ddy);
 
 	const Vec3 origin = unproject(ndc, depth);
 	Vec3 normalVSpace = cross(origin - top, right - origin);

+ 2 - 2
AnKi/Shaders/ImportanceSampling.glsl

@@ -52,7 +52,7 @@ Vec2 hammersleyRandom16(U32 sampleIdx, U32 sampleCount, UVec2 random)
 /// From a uniform 2D point inside a circle get a 3D point in the surface of a hemisphere. It's oriented in the z axis
 Vec3 hemisphereSampleUniform(Vec2 uv)
 {
-	const F32 phi = uv.y * 2.0 * PI;
+	const F32 phi = uv.y * 2.0 * kPi;
 	const F32 cosTheta = 1.0 - uv.x;
 	const F32 sinTheta = sqrt(1.0 - cosTheta * cosTheta);
 	return Vec3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta);
@@ -62,7 +62,7 @@ Vec3 hemisphereSampleUniform(Vec2 uv)
 /// Same as hemisphereSampleUniform but it distributes points closer to the z axis
 Vec3 hemisphereSampleCos(Vec2 uv)
 {
-	const F32 phi = uv.y * 2.0 * PI;
+	const F32 phi = uv.y * 2.0 * kPi;
 	const F32 cosTheta = sqrt(1.0 - uv.x);
 	const F32 sinTheta = sqrt(1.0 - cosTheta * cosTheta);
 	return Vec3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta);

+ 20 - 20
AnKi/Shaders/Include/ClusteredShadingTypes.h

@@ -12,32 +12,32 @@
 ANKI_BEGIN_NAMESPACE
 
 // Enum of clusterer object types
-const U32 CLUSTER_OBJECT_TYPE_POINT_LIGHT = 0u;
-const U32 CLUSTER_OBJECT_TYPE_SPOT_LIGHT = 1u;
-const U32 CLUSTER_OBJECT_TYPE_DECAL = 2u;
-const U32 CLUSTER_OBJECT_TYPE_FOG_DENSITY_VOLUME = 3u;
-const U32 CLUSTER_OBJECT_TYPE_REFLECTION_PROBE = 4u;
-const U32 CLUSTER_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE = 5u;
-const U32 CLUSTER_OBJECT_TYPE_COUNT = 6u; ///< Point and spot lights, refl and GI probes, decals and fog volumes.
+const U32 kClusterObjectTypePointLight = 0u;
+const U32 kClusterObjectTypeSpotLight = 1u;
+const U32 kClusterObjectTypeDecal = 2u;
+const U32 kClusterObjectTypeFogDensityVolume = 3u;
+const U32 kClusterObjectTypeReflectionProbe = 4u;
+const U32 kClusterObjectTypeGlobalIlluminationProbe = 5u;
+const U32 kClusterObjectTypeCount = 6u; ///< Point and spot lights, refl and GI probes, decals and fog volumes.
 
 // Limits
 #if ANKI_CLUSTERED_SHADING_USE_64BIT
-const U32 MAX_VISIBLE_POINT_LIGHTS = 64u;
-const U32 MAX_VISIBLE_SPOT_LIGHTS = 64u;
-const U32 MAX_VISIBLE_DECALS = 64u;
+const U32 kMaxVisiblePointLights = 64u;
+const U32 kMaxVisibleSpotLights = 64u;
+const U32 kMaxVisibleDecals = 64u;
 #else
-const U32 MAX_VISIBLE_POINT_LIGHTS = 32u;
-const U32 MAX_VISIBLE_SPOT_LIGHTS = 32u;
-const U32 MAX_VISIBLE_DECALS = 32u;
+const U32 kMaxVisiblePointLights = 32u;
+const U32 kMaxVisibleSpotLights = 32u;
+const U32 kMaxVisibleDecals = 32u;
 #endif
-const U32 MAX_VISIBLE_FOG_DENSITY_VOLUMES = 16u;
-const U32 MAX_VISIBLE_REFLECTION_PROBES = 16u;
-const U32 MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES = 8u;
+const U32 kMaxVisibleFogDensityVolumes = 16u;
+const U32 kMaxVisibleReflectionProbes = 16u;
+const U32 kMaxVisibleGlobalIlluminationProbes = 8u;
 
 // Other consts
-const ANKI_RP F32 CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE = 0.1f / 4.0f; ///< Near plane of various clusterer object frustums.
+const ANKI_RP F32 kClusterObjectFrustumNearPlane = 0.1f / 4.0f; ///< Near plane of various clusterer object frustums.
 const U32 kMaxShadowCascades = 4u;
-const ANKI_RP F32 SUBSURFACE_MIN = 0.01f;
+const ANKI_RP F32 kSubsurfaceMin = 0.01f;
 
 /// Point light.
 struct PointLight
@@ -249,9 +249,9 @@ struct ClusteredShadingUniforms
 	CommonMatrices m_previousMatrices;
 
 	/// This are some additive counts used to map a flat index to the index of the specific object.
-	UVec4 m_objectCountsUpTo[CLUSTER_OBJECT_TYPE_COUNT];
+	UVec4 m_objectCountsUpTo[kClusterObjectTypeCount];
 };
-const U32 _ANKI_SIZEOF_ClusteredShadingUniforms = (6u + CLUSTER_OBJECT_TYPE_COUNT) * ANKI_SIZEOF(Vec4)
+const U32 _ANKI_SIZEOF_ClusteredShadingUniforms = (6u + kClusterObjectTypeCount) * ANKI_SIZEOF(Vec4)
 												  + 2u * ANKI_SIZEOF(CommonMatrices) + ANKI_SIZEOF(DirectionalLight);
 ANKI_SHADER_STATIC_ASSERT(sizeof(ClusteredShadingUniforms) == _ANKI_SIZEOF_ClusteredShadingUniforms);
 

+ 6 - 6
AnKi/Shaders/Include/MiscRendererTypes.h

@@ -12,10 +12,10 @@ ANKI_BEGIN_NAMESPACE
 // EVSM
 #define ANKI_EVSM4 0 // 2 component EVSM or 4 component EVSM
 
-const F32 EVSM_POSITIVE_CONSTANT = 40.0f; // EVSM positive constant
-const F32 EVSM_NEGATIVE_CONSTANT = 5.0f; // EVSM negative constant
-const F32 EVSM_BIAS = 0.01f;
-const F32 EVSM_LIGHT_BLEEDING_REDUCTION = 0.05f;
+const F32 kEvsmPositiveConstant = 40.0f; // EVSM positive constant
+const F32 kEvsmNegativeConstant = 5.0f; // EVSM negative constant
+const F32 kEvsmBias = 0.01f;
+const F32 kEvsmLightBleedingReduction = 0.05f;
 
 struct EvsmResolveUniforms
 {
@@ -35,11 +35,11 @@ struct EvsmResolveUniforms
 };
 
 // RT shadows
-const U32 MAX_RT_SHADOW_LAYERS = 8u;
+const U32 kMaxRtShadowLayers = 8u;
 
 struct RtShadowsUniforms
 {
-	F32 historyRejectFactor[MAX_RT_SHADOW_LAYERS]; // 1.0 means reject, 0.0 not reject
+	F32 historyRejectFactor[kMaxRtShadowLayers]; // 1.0 means reject, 0.0 not reject
 };
 
 struct RtShadowsDenoiseUniforms

+ 17 - 17
AnKi/Shaders/Include/ModelTypes.h

@@ -30,18 +30,18 @@ enum class VertexAttributeId : U8
 };
 ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(VertexAttributeId)
 #else
-const U32 VERTEX_ATTRIBUTE_ID_POSITION = 0u;
-const U32 VERTEX_ATTRIBUTE_ID_UV0 = 1u;
-const U32 VERTEX_ATTRIBUTE_ID_UV1 = 2u;
-const U32 VERTEX_ATTRIBUTE_ID_NORMAL = 3u;
-const U32 VERTEX_ATTRIBUTE_ID_TANGENT = 4u;
-const U32 VERTEX_ATTRIBUTE_ID_COLOR = 5u;
-const U32 VERTEX_ATTRIBUTE_ID_BONE_WEIGHTS = 6u;
-const U32 VERTEX_ATTRIBUTE_ID_BONE_INDICES = 7u;
-const U32 VERTEX_ATTRIBUTE_ID_COUNT = 8u;
-
-const U32 VERTEX_ATTRIBUTE_ID_SCALE = VERTEX_ATTRIBUTE_ID_UV0; ///< Only for particles.
-const U32 VERTEX_ATTRIBUTE_ID_ALPHA = VERTEX_ATTRIBUTE_ID_UV1; ///< Only for particles.
+const U32 kVertexAttributeIdPosition = 0u;
+const U32 kVertexAttributeIdUv0 = 1u;
+const U32 kVertexAttributeIdUv1 = 2u;
+const U32 kVertexAttributeIdNormal = 3u;
+const U32 kVertexAttributeIdTangent = 4u;
+const U32 kVertexAttributeIdColor = 5u;
+const U32 kVertexAttributeIdBoneWeights = 6u;
+const U32 kVertexAttributeIdBoneIndices = 7u;
+const U32 kVertexAttributeIdCount = 8u;
+
+const U32 kVertexAttributeIdScale = kVertexAttributeIdUv0; ///< Only for particles.
+const U32 kVertexAttributeIdAlpha = kVertexAttributeIdUv1; ///< Only for particles.
 #endif
 
 // Vertex buffers
@@ -56,10 +56,10 @@ enum class VertexAttributeBufferId : U8
 };
 ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(VertexAttributeBufferId)
 #else
-const U32 VERTEX_ATTRIBUTE_BUFFER_ID_POSITION = 0u;
-const U32 VERTEX_ATTRIBUTE_BUFFER_ID_NORMAL_TANGENT_UV0 = 1u;
-const U32 VERTEX_ATTRIBUTE_BUFFER_ID_BONE = 2u;
-const U32 VERTEX_ATTRIBUTE_BUFFER_ID_COUNT = 3u;
+const U32 kVertexAttributeBufferIdPosition = 0u;
+const U32 kVertexAttributeBufferIdNormalTangentUv0 = 1u;
+const U32 kVertexAttributeBufferIdBone = 2u;
+const U32 kVertexAttributeBufferIdCount = 3u;
 #endif
 
 /// The main vertex that contains normals, tangents and UVs.
@@ -92,7 +92,7 @@ struct MeshGpuDescriptor
 #if defined(__cplusplus)
 	Array<Address, U(VertexAttributeBufferId::kCount)> m_vertexBufferPtrs;
 #else
-	Address m_vertexBufferPtrs[VERTEX_ATTRIBUTE_BUFFER_ID_COUNT];
+	Address m_vertexBufferPtrs[kVertexAttributeBufferIdCount];
 #endif
 	U32 m_indexCount;
 	U32 m_vertexCount;

+ 6 - 6
AnKi/Shaders/IndirectDiffuse.glsl

@@ -34,8 +34,8 @@ layout(set = 0, binding = 9) uniform texture2D u_motionVectorsTex;
 layout(set = 0, binding = 10) uniform ANKI_RP texture2D u_historyLengthTex;
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y) in;
 
 layout(set = 0, binding = 11) writeonly uniform image2D u_outImage;
 #else
@@ -118,7 +118,7 @@ void main()
 			const F32 len = length(dir);
 			const Vec3 n = normalize(dir);
 			const F32 NoL = max(0.0, dot(viewNormal, n));
-			// const F32 distFactor = 1.0 - sin(min(1.0, len / u_unis.m_radius) * PI / 2.0);
+			// const F32 distFactor = 1.0 - sin(min(1.0, len / u_unis.m_radius) * kPi / 2.0);
 			const F32 distFactor = 1.0 - min(1.0, len / u_unis.m_radius);
 
 			// Compute the UV for sampling the pyramid
@@ -140,11 +140,11 @@ void main()
 			outColor += c * w;
 
 			// Compute SSAO as well
-			ssao += max(dot(viewNormal, dir) + u_unis.m_ssaoBias, EPSILON) / max(len * len, EPSILON);
+			ssao += max(dot(viewNormal, dir) + u_unis.m_ssaoBias, kEpsilonf) / max(len * len, kEpsilonf);
 		}
 
 		const ANKI_RP F32 scount = 1.0 / u_unis.m_sampleCountf;
-		outColor *= scount * 2.0 * PI;
+		outColor *= scount * 2.0 * kPi;
 		ssao *= scount;
 	}
 
@@ -173,7 +173,7 @@ void main()
 		{
 			// Zero or more than one probes, do a slow path that blends them together
 
-			F32 totalBlendWeight = EPSILON;
+			F32 totalBlendWeight = kEpsilonf;
 
 			// Loop probes
 			ANKI_LOOP while(cluster.m_giProbesMask != 0u)

+ 4 - 4
AnKi/Shaders/IndirectDiffuseDenoise.glsl

@@ -15,8 +15,8 @@ layout(set = 0, binding = 1) uniform ANKI_RP texture2D u_toDenoiseTex;
 layout(set = 0, binding = 2) uniform texture2D u_depthTex;
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(8u, 8u);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y) in;
+const UVec2 kWorkgroupSize = UVec2(8u, 8u);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y) in;
 
 layout(set = 0, binding = 3) writeonly uniform ANKI_RP image2D u_outImg;
 #else
@@ -39,7 +39,7 @@ Vec3 unproject(Vec2 ndc, F32 depth)
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, u_unis.m_viewportSize))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, u_unis.m_viewportSize))
 	{
 		return;
 	}
@@ -64,7 +64,7 @@ void main()
 	const Vec3 positionCenter = unproject(UV_TO_NDC(uv), depthCenter);
 
 	// Sample
-	ANKI_RP F32 weight = EPSILON_RP;
+	ANKI_RP F32 weight = kEpsilonRp;
 	ANKI_RP Vec3 color = Vec3(0.0);
 
 	for(F32 i = -u_unis.m_sampleCountDiv2; i <= u_unis.m_sampleCountDiv2; i += 1.0)

+ 7 - 7
AnKi/Shaders/IndirectDiffuseVrsSriGeneration.ankiprog

@@ -15,13 +15,13 @@ layout(set = 0, binding = 0) uniform texture2D u_inputTex;
 layout(set = 0, binding = 1) uniform sampler u_nearestClampSampler;
 
 #if SRI_TEXEL_DIMENSION == 8
-const UVec2 REGION_SIZE = UVec2(2u, 2u);
+const UVec2 kRegionSize = UVec2(2u, 2u);
 #else
-const UVec2 REGION_SIZE = UVec2(2u, 4u);
+const UVec2 kRegionSize = UVec2(2u, 4u);
 #endif
 
-const UVec2 WORKGROUP_SIZE = UVec2(SRI_TEXEL_DIMENSION) / REGION_SIZE;
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(SRI_TEXEL_DIMENSION) / kRegionSize;
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 2) uniform writeonly uimage2D u_sriImg;
 
@@ -37,8 +37,8 @@ layout(push_constant, std140, row_major) uniform b_pc
 // Ideally, we'd be able to calculate the min/max/average using subgroup operations, but there's no guarantee
 // subgroupSize is large enough so we need shared memory as a fallback. We need gl_NumSubgroups entries, but it is not a
 // constant, so estimate it assuming a subgroupSize of at least 8.
-const U32 SHARED_MEMORY_ENTRIES = WORKGROUP_SIZE.x * WORKGROUP_SIZE.y / 8u;
-shared Vec2 s_maxDerivative[SHARED_MEMORY_ENTRIES];
+const U32 kSharedMemoryEntries = kWorkgroupSize.x * kWorkgroupSize.y / 8u;
+shared Vec2 s_maxDerivative[kSharedMemoryEntries];
 #endif
 
 F32 sampleViewPositionZ(Vec2 uv, I32 offsetX, I32 offsetY)
@@ -53,7 +53,7 @@ F32 sampleViewPositionZ(Vec2 uv, I32 offsetX, I32 offsetY)
 
 void main()
 {
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) * Vec2(REGION_SIZE) + 0.5) * u_oneOverViewportSize;
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) * Vec2(kRegionSize) + 0.5) * u_oneOverViewportSize;
 	const Vec2 ndc = UV_TO_NDC(uv);
 
 #if SRI_TEXEL_DIMENSION == 8

+ 5 - 5
AnKi/Shaders/IndirectSpecular.glsl

@@ -38,8 +38,8 @@ const Vec2 NOISE_TEX_SIZE = Vec2(64.0);
 #include <AnKi/Shaders/ClusteredShadingCommon.glsl>
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 15) uniform writeonly image2D u_outImg;
 #else
@@ -50,7 +50,7 @@ layout(location = 0) out Vec3 out_color;
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, u_unis.m_framebufferSize))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, u_unis.m_framebufferSize))
 	{
 		return;
 	}
@@ -89,7 +89,7 @@ void main()
 
 	// Do the heavy work
 	Vec3 hitPoint;
-	if(ssrAttenuation > EPSILON)
+	if(ssrAttenuation > kEpsilonf)
 	{
 		const U32 lod = 8u; // Use the max LOD for ray marching
 		const U32 step = u_unis.m_firstStepPixels;
@@ -225,7 +225,7 @@ void main()
 		{
 			// Zero or more than one probes, do a slow path that blends them together
 
-			F32 totalBlendWeight = EPSILON;
+			F32 totalBlendWeight = kEpsilonf;
 
 			// Loop probes
 			ANKI_LOOP while(cluster.m_reflectionProbesMask != 0u)

+ 7 - 7
AnKi/Shaders/IrradianceDice.ankiprog

@@ -18,7 +18,7 @@
 
 #define DEBUG_MODE 0 // 0: disable, 1: different color per dice face, 2: different color per cell
 
-const U32 WORKGROUP_SIZE = U32(WORKGROUP_SIZE_XY) * U32(WORKGROUP_SIZE_XY);
+const U32 kWorkgroupSize = U32(WORKGROUP_SIZE_XY) * U32(WORKGROUP_SIZE_XY);
 
 layout(local_size_x = WORKGROUP_SIZE_XY, local_size_y = WORKGROUP_SIZE_XY, local_size_z = 1) in;
 
@@ -48,7 +48,7 @@ layout(set = 0, binding = 3) writeonly buffer b_ssbo1
 };
 #endif
 
-shared Vec3 s_integrationResults[6u][WORKGROUP_SIZE / 8u];
+shared Vec3 s_integrationResults[6u][kWorkgroupSize / 8u];
 
 ANKI_RP Vec3 sampleLightShadingTexture(const U32 face)
 {
@@ -69,10 +69,10 @@ ANKI_RP Vec3 sampleLightShadingTexture(const U32 face)
 
 void main()
 {
-	const F32 WORKGROUP_SIZE_XY_F = F32(WORKGROUP_SIZE_XY);
+	const F32 workgroupSizeXYf = F32(WORKGROUP_SIZE_XY);
 
 	// Compute the NDC used in cubeCoordSolidAngle
-	const Vec2 faceUv = (Vec2(gl_LocalInvocationID.xy) + 0.5) / WORKGROUP_SIZE_XY_F;
+	const Vec2 faceUv = (Vec2(gl_LocalInvocationID.xy) + 0.5) / workgroupSizeXYf;
 	const Vec2 ndc = UV_TO_NDC(faceUv);
 
 	// Compute result for a pixel
@@ -87,7 +87,7 @@ void main()
 		// Compute integral part
 		const ANKI_RP F32 lambert = max(0.0, dot(r, diceDir));
 		const ANKI_RP Vec3 lightShading = sampleLightShadingTexture(f);
-		const ANKI_RP Vec3 irradiance = lightShading * lambert * cubeCoordSolidAngle(ndc, WORKGROUP_SIZE_XY_F);
+		const ANKI_RP Vec3 irradiance = lightShading * lambert * cubeCoordSolidAngle(ndc, workgroupSizeXYf);
 
 		// Store
 		resultFaces[f] = irradiance;
@@ -138,7 +138,7 @@ void main()
 		const ANKI_RP F32 lambert = max(0.0, dot(r, diceDir));
 
 		// Read the gbuffer
-		Vec2 gbufferUv = (Vec2(gl_LocalInvocationID.xy) + 0.5) / WORKGROUP_SIZE_XY_F;
+		Vec2 gbufferUv = (Vec2(gl_LocalInvocationID.xy) + 0.5) / workgroupSizeXYf;
 		gbufferUv.x *= 1.0 / 6.0;
 		gbufferUv.x += (1.0 / 6.0) * F32(f);
 		GbufferInfo gbuffer;
@@ -155,7 +155,7 @@ void main()
 		// Compute 2nd bounce
 		const ANKI_RP Vec3 lightShading = sampleLightShadingTexture(f);
 		const ANKI_RP Vec3 irradiance =
-			(firstBounceIrradiance + lightShading * lambert) * cubeCoordSolidAngle(ndc, WORKGROUP_SIZE_XY_F);
+			(firstBounceIrradiance + lightShading * lambert) * cubeCoordSolidAngle(ndc, workgroupSizeXYf);
 
 		// Store
 		resultFaces[f] = irradiance;

+ 1 - 1
AnKi/Shaders/LensFlareSprite.ankiprog

@@ -8,7 +8,7 @@
 #include <AnKi/Shaders/Include/MiscRendererTypes.h>
 
 // The block contains data for all flares
-layout(std140, set = 0, binding = 0) readonly buffer ssbo00
+layout(std140, set = 0, binding = 0) readonly buffer b_ssbo
 {
 	LensFlareSprite u_sprites[];
 };

+ 8 - 8
AnKi/Shaders/LensFlareUpdateIndirectInfo.ankiprog

@@ -3,13 +3,13 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(IN_DEPTH_MAP_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kInDepthMapSize, 0u);
 
 #pragma anki start comp
 #include <AnKi/Shaders/Common.glsl>
 
-const U32 WORKGROUP_SIZE = 8u;
-layout(local_size_x = WORKGROUP_SIZE, local_size_y = WORKGROUP_SIZE, local_size_z = 1) in;
+const U32 kWorkgroupSize = 8u;
+layout(local_size_x = kWorkgroupSize, local_size_y = kWorkgroupSize, local_size_z = 1) in;
 
 struct DrawArraysIndirectInfo
 {
@@ -25,7 +25,7 @@ layout(set = 0, binding = 0, std430, row_major) readonly buffer b_lf
 	Vec4 u_flarePositions[];
 };
 
-layout(set = 0, binding = 1, std430) writeonly buffer ss1_
+layout(set = 0, binding = 1, std430) writeonly buffer b_indirectInfo
 {
 	DrawArraysIndirectInfo u_indirectInfo[];
 };
@@ -52,10 +52,10 @@ void main()
 	const F32 depth = posNdc.z;
 
 	// Compute the UVs to sample the depth map
-	// Belongs to [-WORKGROUP_SIZE, WORKGROUP_SIZE]
-	const Vec2 displacement = Vec2(gl_LocalInvocationID.xy) - Vec2(WORKGROUP_SIZE / 2u);
-	const Vec2 TEXEL_SIZE = 1.0 / Vec2(IN_DEPTH_MAP_SIZE);
-	const Vec2 uv = NDC_TO_UV(posNdc.xy) + displacement * TEXEL_SIZE;
+	// Belongs to [-kWorkgroupSize, kWorkgroupSize]
+	const Vec2 displacement = Vec2(gl_LocalInvocationID.xy) - Vec2(kWorkgroupSize / 2u);
+	const Vec2 texelSize = 1.0 / Vec2(kInDepthMapSize);
+	const Vec2 uv = NDC_TO_UV(posNdc.xy) + displacement * texelSize;
 
 	// Sample and store depth
 	const F32 refDepth = textureLod(u_depthMap, u_nearestAnyClampSampler, uv, 0.0).r;

+ 12 - 13
AnKi/Shaders/LightFunctions.glsl

@@ -17,8 +17,8 @@
 Vec2 evsmProcessDepth(F32 depth)
 {
 	depth = 2.0 * depth - 1.0;
-	const F32 pos = exp(EVSM_POSITIVE_CONSTANT * depth);
-	const F32 neg = -exp(EVSM_NEGATIVE_CONSTANT * depth);
+	const F32 pos = exp(kEvsmPositiveConstant * depth);
+	const F32 neg = -exp(kEvsmNegativeConstant * depth);
 	return Vec2(pos, neg);
 }
 
@@ -54,17 +54,16 @@ F32 chebyshevUpperBound(Vec2 moments, F32 mean, F32 minVariance, F32 lightBleedi
 F32 evsmComputeShadowFactor(F32 occluderDepth, Vec4 shadowMapMoments)
 {
 	const Vec2 evsmOccluderDepths = evsmProcessDepth(occluderDepth);
-	const Vec2 depthScale =
-		EVSM_BIAS * 0.01 * Vec2(EVSM_POSITIVE_CONSTANT, EVSM_NEGATIVE_CONSTANT) * evsmOccluderDepths;
+	const Vec2 depthScale = kEvsmBias * 0.01 * Vec2(kEvsmPositiveConstant, kEvsmNegativeConstant) * evsmOccluderDepths;
 	const Vec2 minVariance = depthScale * depthScale;
 
 #if !ANKI_EVSM4
-	return chebyshevUpperBound(shadowMapMoments.xy, evsmOccluderDepths.x, minVariance.x, EVSM_LIGHT_BLEEDING_REDUCTION);
+	return chebyshevUpperBound(shadowMapMoments.xy, evsmOccluderDepths.x, minVariance.x, kEvsmLightBleedingReduction);
 #else
 	const F32 pos =
-		chebyshevUpperBound(shadowMapMoments.xy, evsmOccluderDepths.x, minVariance.x, EVSM_LIGHT_BLEEDING_REDUCTION);
+		chebyshevUpperBound(shadowMapMoments.xy, evsmOccluderDepths.x, minVariance.x, kEvsmLightBleedingReduction);
 	const F32 neg =
-		chebyshevUpperBound(shadowMapMoments.zw, evsmOccluderDepths.y, minVariance.y, EVSM_LIGHT_BLEEDING_REDUCTION);
+		chebyshevUpperBound(shadowMapMoments.zw, evsmOccluderDepths.y, minVariance.y, kEvsmLightBleedingReduction);
 	return min(pos, neg);
 #endif
 }
@@ -97,7 +96,7 @@ ANKI_RP F32 D_GGX(ANKI_RP F32 roughness, ANKI_RP F32 NoH, ANKI_RP Vec3 h, ANKI_R
 	const ANKI_RP F32 a = roughness * roughness;
 	const ANKI_RP F32 v = NoH * a;
 	const ANKI_RP F32 k = a / (oneMinusNoHSquared + v * v);
-	const ANKI_RP F32 d = k * k * (1.0 / PI);
+	const ANKI_RP F32 d = k * k * (1.0 / kPi);
 	return saturateRp(d);
 }
 
@@ -120,7 +119,7 @@ ANKI_RP F32 V_SmithGGXCorrelatedFast(ANKI_RP F32 roughness, ANKI_RP F32 NoV, ANK
 
 ANKI_RP F32 Fd_Lambert()
 {
-	return 1.0 / PI;
+	return 1.0 / kPi;
 }
 
 ANKI_RP Vec3 diffuseLobe(ANKI_RP Vec3 diffuse)
@@ -195,7 +194,7 @@ ANKI_RP F32 computeShadowFactorPointLight(PointLight light, Vec3 frag2Light, tex
 
 	// 1) Project the dist to light's proj mat
 	//
-	const F32 near = CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE;
+	const F32 near = kClusterObjectFrustumNearPlane;
 	const F32 far = light.m_radius;
 	const F32 g = near - far;
 
@@ -353,14 +352,14 @@ ANKI_RP Vec3 sampleAmbientDice(ANKI_RP Vec3 posx, ANKI_RP Vec3 negx, ANKI_RP Vec
 	col += mix(negz, posz, uv.z) * axisWeights.z;
 
 	// Divide by weight
-	col /= axisWeights.x + axisWeights.y + axisWeights.z + EPSILON_RP;
+	col /= axisWeights.x + axisWeights.y + axisWeights.z + kEpsilonRp;
 
 	return col;
 }
 
 // Sample the irradiance term from the clipmap
 ANKI_RP Vec3 sampleGlobalIllumination(const Vec3 worldPos, const Vec3 normal, const GlobalIlluminationProbe probe,
-									  ANKI_RP texture3D textures[MAX_VISIBLE_GLOBAL_ILLUMINATION_PROBES],
+									  ANKI_RP texture3D textures[kMaxVisibleGlobalIlluminationProbes],
 									  sampler linearAnyClampSampler)
 {
 	// Find the UVW
@@ -434,7 +433,7 @@ Vec3 sampleGgxVndf(Vec3 v, F32 alphaX, F32 alphaY, F32 u1, F32 u2)
 
 	// Section 4.2: parameterization of the projected area
 	const F32 r = sqrt(u1);
-	const F32 phi = 2.0 * PI * u2;
+	const F32 phi = 2.0 * kPi * u2;
 	const F32 t1 = r * cos(phi);
 	F32 t2 = r * sin(phi);
 	const F32 s = 0.5 * (1.0 + vH.z);

+ 7 - 7
AnKi/Shaders/LightShading.ankiprog

@@ -5,9 +5,9 @@
 
 #pragma anki mutator USE_SHADOW_LAYERS 0 1
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(TILE_COUNTS, 0u);
-ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 2u);
-ANKI_SPECIALIZATION_CONSTANT_U32(TILE_SIZE, 3u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kTileCount, 0u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kZSplitCount, 2u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kTileSize, 3u);
 
 #pragma anki start vert
 #include <AnKi/Shaders/QuadVert.glsl>
@@ -66,21 +66,21 @@ void main()
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 	// Get the cluster
-	Cluster cluster = getClusterFragCoord(Vec3(gl_FragCoord.xy, depth), TILE_SIZE, TILE_COUNTS, Z_SPLIT_COUNT,
+	Cluster cluster = getClusterFragCoord(Vec3(gl_FragCoord.xy, depth), kTileSize, kTileCount, kZSplitCount,
 										  u_clusteredShading.m_zSplitMagic.x, u_clusteredShading.m_zSplitMagic.y);
 
-	// out_color = clusterHeatmap(cluster, 1u << CLUSTER_OBJECT_TYPE_POINT_LIGHT); return;
+	// out_color = clusterHeatmap(cluster, 1u << kClusterObjectTypePointLight); return;
 
 	// Decode GBuffer
 	GbufferInfo gbuffer;
 	unpackGBufferNoVelocity(textureLod(u_gbuffer0Tex, u_nearestAnyClampSampler, in_uv, 0.0),
 							textureLod(u_gbuffer1Tex, u_nearestAnyClampSampler, in_uv, 0.0),
 							textureLod(u_gbuffer2Tex, u_nearestAnyClampSampler, in_uv, 0.0), gbuffer);
-	gbuffer.m_subsurface = max(gbuffer.m_subsurface, SUBSURFACE_MIN);
+	gbuffer.m_subsurface = max(gbuffer.m_subsurface, kSubsurfaceMin);
 
 	// SM
 #if USE_SHADOW_LAYERS
-	ANKI_RP F32 resolvedSm[MAX_RT_SHADOW_LAYERS];
+	ANKI_RP F32 resolvedSm[kMaxRtShadowLayers];
 	unpackRtShadows(textureLod(u_shadowLayersTex, u_nearestAnyClampSampler, in_uv, 0.0), resolvedSm);
 #else
 	ANKI_RP Vec4 resolvedSm = textureLod(u_resolvedSm, u_trilinearClampSampler, in_uv, 0.0);

+ 3 - 3
AnKi/Shaders/LightShadingApplyFog.ankiprog

@@ -3,8 +3,8 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 0u);
-ANKI_SPECIALIZATION_CONSTANT_U32(FINAL_Z_SPLIT, 1u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kZSplitCount, 0u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kFinalZSplit, 1u);
 
 #pragma anki start vert
 #include <AnKi/Shaders/QuadVert.glsl>
@@ -36,7 +36,7 @@ void main()
 	// Compute W coordinate
 	const F32 depth = textureLod(u_depthRt, u_nearestAnyClampSampler, in_uv, 0.0).r;
 	const F32 linearDepth = linearizeDepth(depth, u_near, u_far);
-	uvw.z = linearDepth * (F32(Z_SPLIT_COUNT) / F32(FINAL_Z_SPLIT + 1u));
+	uvw.z = linearDepth * (F32(kZSplitCount) / F32(kFinalZSplit + 1u));
 
 	// Compute UV coordinates
 	uvw.xy = in_uv;

+ 6 - 6
AnKi/Shaders/LumaAwareBlur.ankiprog

@@ -7,7 +7,7 @@
 #pragma anki mutator KERNEL_SIZE 3 5 7 9 11 13 15
 #pragma anki mutator COLOR_COMPONENTS 4 3 1
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(TEXTURE_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kTextureSize, 0u);
 
 #pragma anki start vert
 #include <AnKi/Shaders/QuadVert.glsl>
@@ -40,7 +40,7 @@ F32 computeLumaWeight(F32 refLuma, COL_TYPE col)
 {
 	const F32 l = computeLuminance(Vec3(col));
 	const F32 diff = abs(refLuma - l);
-	const F32 weight = 1.0 / (EPSILON + diff);
+	const F32 weight = 1.0 / (kEpsilonf + diff);
 	return weight;
 }
 
@@ -50,16 +50,16 @@ layout(location = 0) out COL_TYPE out_color;
 void main()
 {
 #if HORIZONTAL
-	const Vec2 TEXEL_SIZE = Vec2(1.0 / F32(TEXTURE_SIZE.x), 0.0);
+	const Vec2 texelSize = Vec2(1.0 / F32(kTextureSize.x), 0.0);
 #else
-	const Vec2 TEXEL_SIZE = Vec2(0.0, 1.0 / F32(TEXTURE_SIZE.y));
+	const Vec2 texelSize = Vec2(0.0, 1.0 / F32(kTextureSize.y));
 #endif
 
 	COL_TYPE col = textureLod(u_tex, u_linearAnyClampSampler, in_uv, 0.0).TEX_FETCH;
 	out_color = col;
 	const F32 refLuma = computeLuminance(Vec3(col));
 	F32 weight = 1.0;
-	Vec2 texCoordOffset = 1.5 * TEXEL_SIZE;
+	Vec2 texCoordOffset = 1.5 * texelSize;
 
 	for(U32 i = 0u; i < U32(KERNEL_SIZE); ++i)
 	{
@@ -73,7 +73,7 @@ void main()
 		out_color += col * w;
 		weight += w;
 
-		texCoordOffset += 2.0 * TEXEL_SIZE;
+		texCoordOffset += 2.0 * texelSize;
 	}
 
 	out_color = out_color / weight;

+ 12 - 12
AnKi/Shaders/MotionVectors.glsl

@@ -5,9 +5,9 @@
 
 // Calculates the motion vectors that will be used to sample from the previous frame
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
-const F32 MAX_REJECTION_DISTANCE = 0.1; // In meters
-const F32 MAX_HISTORY_LENGTH = 16.0;
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kFramebufferSize, 0u);
+const F32 kMaxRejectionDistance = 0.1; // In meters
+const F32 kMaxHistoryLength = 16.0;
 
 #include <AnKi/Shaders/Functions.glsl>
 
@@ -33,8 +33,8 @@ layout(set = 0, binding = 5, std140, row_major) uniform b_unis
 layout(set = 0, binding = 6) uniform writeonly image2D u_motionVectorsImage;
 layout(set = 0, binding = 7) uniform writeonly image2D u_historyLengthImage;
 
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 #else
 layout(location = 0) in Vec2 in_uv;
 layout(location = 0) out Vec2 out_motionVectors;
@@ -50,7 +50,7 @@ Vec3 clipToWorld(Vec4 clip, Mat4 clipToWorldMat)
 /// Average the some depth values and unproject.
 Vec3 getAverageWorldPosition(texture2D tex, Vec2 uv, Mat4 clipToWorldMat)
 {
-	const Vec2 halfTexel = (1.0 / Vec2(FB_SIZE)) / 2.0;
+	const Vec2 halfTexel = (1.0 / Vec2(kFramebufferSize)) / 2.0;
 
 	Vec4 depths = textureGather(sampler2D(tex, u_linearAnyClampSampler), uv + halfTexel, 0);
 	depths += textureGather(sampler2D(tex, u_linearAnyClampSampler), uv - halfTexel, 0);
@@ -63,7 +63,7 @@ Vec3 getAverageWorldPosition(texture2D tex, Vec2 uv, Mat4 clipToWorldMat)
 /// Get the depths of some neighbour texels, unproject and find the AABB in world space that encloses them.
 void getMinMaxWorldPositions(texture2D tex, Vec2 uv, Mat4 clipToWorldMat, out Vec3 aabbMin, out Vec3 aabbMax)
 {
-	const Vec2 halfTexel = (1.0 / Vec2(FB_SIZE)) / 2.0;
+	const Vec2 halfTexel = (1.0 / Vec2(kFramebufferSize)) / 2.0;
 
 	const Vec4 depths1 = textureGather(sampler2D(tex, u_linearAnyClampSampler), uv + halfTexel, 0);
 	const Vec4 depths2 = textureGather(sampler2D(tex, u_linearAnyClampSampler), uv - halfTexel, 0);
@@ -103,7 +103,7 @@ F32 computeRejectionFactor(Vec2 uv, Vec2 historyUv)
 	// This factor shows when new pixels appeared by checking depth differences
 	const Vec3 delta = clampedHistoryWorldPos - historyWorldPos;
 	const F32 distSquared = dot(delta, delta);
-	const F32 disocclusionFactor = min(1.0, distSquared / (MAX_REJECTION_DISTANCE * MAX_REJECTION_DISTANCE));
+	const F32 disocclusionFactor = min(1.0, distSquared / (kMaxRejectionDistance * kMaxRejectionDistance));
 	F32 rejection = disocclusionFactor;
 
 	// New pixels might appeared, add them to the disocclusion
@@ -120,12 +120,12 @@ F32 computeRejectionFactor(Vec2 uv, Vec2 historyUv)
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, FB_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kFramebufferSize))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(FB_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kFramebufferSize);
 #else
 	const Vec2 uv = in_uv;
 #endif
@@ -151,12 +151,12 @@ void main()
 	if(rejection >= 0.5)
 	{
 		// Rejection factor too high, reset the temporal history
-		historyLength = 1.0 / MAX_HISTORY_LENGTH;
+		historyLength = 1.0 / kMaxHistoryLength;
 	}
 	else
 	{
 		historyLength = textureLod(u_historyLengthTex, u_linearAnyClampSampler, historyUv, 0.0).r;
-		historyLength += 1.0 / MAX_HISTORY_LENGTH;
+		historyLength += 1.0 / kMaxHistoryLength;
 	}
 
 	// Write out

+ 7 - 15
AnKi/Shaders/PackFunctions.glsl

@@ -8,20 +8,22 @@
 #include <AnKi/Shaders/Common.glsl>
 #include <AnKi/Shaders/TonemappingFunctions.glsl>
 
+const ANKI_RP F32 kMinRoughness = 0.05;
+
 /// Pack 3D normal to 2D vector
 /// See the clean code in comments in revision < r467
 Vec2 packNormal(const Vec3 normal)
 {
-	const F32 SCALE = 1.7777;
-	const F32 scalar1 = (normal.z + 1.0) * (SCALE * 2.0);
+	const F32 scale = 1.7777;
+	const F32 scalar1 = (normal.z + 1.0) * (scale * 2.0);
 	return normal.xy / scalar1 + 0.5;
 }
 
 /// Reverse the packNormal
 Vec3 unpackNormal(const Vec2 enc)
 {
-	const F32 SCALE = 1.7777;
-	const Vec2 nn = enc * (2.0 * SCALE) - SCALE;
+	const F32 scale = 1.7777;
+	const Vec2 nn = enc * (2.0 * scale) - scale;
 	const F32 g = 2.0 / (dot(nn.xy, nn.xy) + 1.0);
 	Vec3 normal;
 	normal.xy = g * nn.xy;
@@ -123,16 +125,6 @@ Vec2 unpackUnorm1ToUnorm2(F32 c)
 #endif
 }
 
-const ANKI_RP F32 ABSOLUTE_MAX_EMISSION = 1024.0;
-#if !defined(MAX_EMISSION)
-const ANKI_RP F32 MAX_EMISSION = 30.0; // Max emission. Keep as low as possible and less than ABSOLUTE_MAX_EMISSION
-#endif
-// Round the MAX_EMISSION to fit a U8_UNORM
-const ANKI_RP F32 FIXED_MAX_EMISSION =
-	F32(U32(MAX_EMISSION / ABSOLUTE_MAX_EMISSION * 255.0)) / 255.0 * ABSOLUTE_MAX_EMISSION;
-
-const ANKI_RP F32 MIN_ROUGHNESS = 0.05;
-
 // G-Buffer structure
 struct GbufferInfo
 {
@@ -175,7 +167,7 @@ ANKI_RP Vec3 unpackNormalFromGBuffer(ANKI_RP Vec4 rt2)
 ANKI_RP F32 unpackRoughnessFromGBuffer(ANKI_RP Vec4 rt1)
 {
 	ANKI_RP F32 r = rt1.x;
-	r = r * (1.0 - MIN_ROUGHNESS) + MIN_ROUGHNESS;
+	r = r * (1.0 - kMinRoughness) + kMinRoughness;
 	return r;
 }
 

+ 5 - 5
AnKi/Shaders/RtShadows.glsl

@@ -8,16 +8,16 @@
 #include <AnKi/Shaders/Include/MiscRendererTypes.h>
 #include <AnKi/Shaders/PackFunctions.glsl>
 
-const F32 RT_SHADOWS_MAX_HISTORY_LENGTH = 16.0;
+const F32 kRtShadowsMaxHistoryLength = 16.0;
 
-UVec4 packRtShadows(F32 shadowFactors[MAX_RT_SHADOW_LAYERS])
+UVec4 packRtShadows(F32 shadowFactors[kMaxRtShadowLayers])
 {
 	const U32 a = newPackUnorm4x8(Vec4(shadowFactors[0], shadowFactors[1], shadowFactors[2], shadowFactors[3]));
 	const U32 b = newPackUnorm4x8(Vec4(shadowFactors[4], shadowFactors[5], shadowFactors[6], shadowFactors[7]));
 	return UVec4(a, b, 0, 0);
 }
 
-void unpackRtShadows(UVec4 packed, out F32 shadowFactors[MAX_RT_SHADOW_LAYERS])
+void unpackRtShadows(UVec4 packed, out F32 shadowFactors[kMaxRtShadowLayers])
 {
 	const Vec4 a = newUnpackUnorm4x8(packed.x);
 	const Vec4 b = newUnpackUnorm4x8(packed.y);
@@ -31,9 +31,9 @@ void unpackRtShadows(UVec4 packed, out F32 shadowFactors[MAX_RT_SHADOW_LAYERS])
 	shadowFactors[7] = b[3];
 }
 
-void zeroRtShadowLayers(out F32 shadowFactors[MAX_RT_SHADOW_LAYERS])
+void zeroRtShadowLayers(out F32 shadowFactors[kMaxRtShadowLayers])
 {
-	ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+	ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 	{
 		shadowFactors[i] = 0.0;
 	}

+ 16 - 16
AnKi/Shaders/RtShadowsDenoise.ankiprog

@@ -7,17 +7,17 @@
 
 #pragma anki start comp
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(OUT_IMAGE_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_U32(MIN_SAMPLE_COUNT, 2u);
-ANKI_SPECIALIZATION_CONSTANT_U32(MAX_SAMPLE_COUNT, 3u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kOutImageSize, 0u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kMinSampleCount, 2u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kMaxSampleCount, 3u);
 
 #include <AnKi/Shaders/BilateralFilter.glsl>
 #include <AnKi/Shaders/PackFunctions.glsl>
 #include <AnKi/Shaders/RtShadows.glsl>
 #include <AnKi/Shaders/Functions.glsl>
 
-const UVec2 WORKGROUP_SIZE = UVec2(8u, 8u);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8u, 8u);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 0) uniform sampler u_nearestAnyClampSampler;
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
@@ -62,12 +62,12 @@ F32 computeVarianceCenter(Vec2 uv)
 
 void main()
 {
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, OUT_IMAGE_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kOutImageSize))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(OUT_IMAGE_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kOutImageSize);
 
 	// Reference
 	const F32 depthCenter = textureLod(u_depthTex, u_linearAnyClampSampler, uv, 0.0).r;
@@ -80,24 +80,24 @@ void main()
 	const Vec3 positionCenter = unproject(UV_TO_NDC(uv), depthCenter);
 	const Vec3 normalCenter = unpackNormalFromGBuffer(textureLod(u_gbuffer2Tex, u_linearAnyClampSampler, uv, 0.0));
 
-	F32 shadowFactors[MAX_RT_SHADOW_LAYERS];
+	F32 shadowFactors[kMaxRtShadowLayers];
 	unpackRtShadows(textureLod(u_inTex, u_nearestAnyClampSampler, uv, 0.0), shadowFactors);
 
 	// Decide the amount of blurring
 	const F32 varianceCenter = computeVarianceCenter(uv);
 	const F32 historyLength =
-		textureLod(u_historyLengthTex, u_linearAnyClampSampler, uv, 0.0).x * RT_SHADOWS_MAX_HISTORY_LENGTH;
+		textureLod(u_historyLengthTex, u_linearAnyClampSampler, uv, 0.0).x * kRtShadowsMaxHistoryLength;
 
 	U32 sampleCount;
 	if(historyLength < 2.0)
 	{
 		// Worst case
-		sampleCount = MAX_SAMPLE_COUNT;
+		sampleCount = kMaxSampleCount;
 	}
 	else if(historyLength > 4.0 && varianceCenter < 0.0001)
 	{
 		// Best case
-		sampleCount = MIN_SAMPLE_COUNT;
+		sampleCount = kMinSampleCount;
 	}
 	else
 	{
@@ -106,7 +106,7 @@ void main()
 		F32 blur = varianceCenter * 100.0;
 		blur = min(1.0, blur);
 
-		const F32 sampleCountf = mix(F32(MIN_SAMPLE_COUNT), F32(MAX_SAMPLE_COUNT), blur);
+		const F32 sampleCountf = mix(F32(kMinSampleCount), F32(kMaxSampleCount), blur);
 
 		sampleCount = U32(sampleCountf);
 	}
@@ -118,14 +118,14 @@ void main()
 
 	for(I32 i = -I32(sampleCount); i < I32(sampleCount); ++i)
 	{
-		const Vec2 texelSize = 1.0 / Vec2(OUT_IMAGE_SIZE);
+		const Vec2 texelSize = 1.0 / Vec2(kOutImageSize);
 #if BLUR_ORIENTATION == 0
 		const Vec2 sampleUv = Vec2(uv.x + F32(i) * texelSize.x, uv.y);
 #else
 		const Vec2 sampleUv = Vec2(uv.x, uv.y + F32(i) * texelSize.y);
 #endif
 
-		F32 localShadowFactors[MAX_RT_SHADOW_LAYERS];
+		F32 localShadowFactors[kMaxRtShadowLayers];
 		unpackRtShadows(textureLod(u_inTex, u_nearestAnyClampSampler, sampleUv, 0.0), localShadowFactors);
 
 		const F32 depthTap = textureLod(u_depthTex, u_linearAnyClampSampler, sampleUv, 0.0).r;
@@ -138,7 +138,7 @@ void main()
 
 		w *= gaussianWeight(0.4, abs(F32(i)) / F32(sampleCount + 1u));
 
-		ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+		ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 		{
 			shadowFactors[i] += localShadowFactors[i] * w;
 		}
@@ -147,7 +147,7 @@ void main()
 	}
 
 	// Write value
-	ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+	ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 	{
 		shadowFactors[i] /= weight;
 	}

+ 1 - 1
AnKi/Shaders/RtShadowsHit.ankiprog

@@ -43,7 +43,7 @@ void main()
 	load(mesh.m_indexBufferPtr + U64(offset), indices16);
 	const UVec3 indices = UVec3(indices16);
 
-	const U64 vertBufferPtr = mesh.m_vertexBufferPtrs[VERTEX_ATTRIBUTE_BUFFER_ID_NORMAL_TANGENT_UV0];
+	const U64 vertBufferPtr = mesh.m_vertexBufferPtrs[kVertexAttributeBufferIdNormalTangentUv0];
 
 	MainVertex vert0, vert1, vert2;
 	load(vertBufferPtr + U64(indices[0] * ANKI_SIZEOF(MainVertex)), vert0);

+ 5 - 5
AnKi/Shaders/RtShadowsRayGen.ankiprog

@@ -82,7 +82,7 @@ void main()
 	// Cluster
 	Cluster cluster = getClusterFragCoord(Vec3(uv * u_clusteredShading.m_renderingSize, depth));
 
-	F32 shadowFactors[MAX_RT_SHADOW_LAYERS];
+	F32 shadowFactors[kMaxRtShadowLayers];
 	zeroRtShadowLayers(shadowFactors);
 
 	// Get a random factor
@@ -178,14 +178,14 @@ void main()
 	// Compute blend fractor. Use nearest sampler because it's an integer texture
 	const F32 lowestBlendFactor = 0.1;
 	const F32 stableFrames = 4.0;
-	const F32 lerp = min(1.0, (historyLength * RT_SHADOWS_MAX_HISTORY_LENGTH - 1.0) / stableFrames);
+	const F32 lerp = min(1.0, (historyLength * kRtShadowsMaxHistoryLength - 1.0) / stableFrames);
 	const F32 blendFactor = mix(1.0, lowestBlendFactor, lerp);
 
 	// Blend with history
 	const UVec4 packedhistory = textureLod(u_historyShadowsTex, u_nearestAnyClampSampler, historyUv, 0.0);
-	F32 history[MAX_RT_SHADOW_LAYERS];
+	F32 history[kMaxRtShadowLayers];
 	unpackRtShadows(packedhistory, history);
-	for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+	for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 	{
 		const F32 lerp = min(1.0, u_unis.historyRejectFactor[i] + blendFactor);
 		shadowFactors[i] = mix(history[i], shadowFactors[i], lerp);
@@ -197,7 +197,7 @@ void main()
 
 	// Compute the moments that will give temporal variance
 	Vec2 moments = Vec2(0.0);
-	ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+	ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 	{
 		moments.x += shadowFactors[i];
 	}

+ 19 - 19
AnKi/Shaders/RtShadowsSvgfAtrous.ankiprog

@@ -5,7 +5,7 @@
 
 #pragma anki mutator LAST_PASS 0 1
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kFramebufferSize, 0u);
 
 #pragma anki start comp
 
@@ -13,8 +13,8 @@ ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
 #include <AnKi/Shaders/BilateralFilter.glsl>
 #include <AnKi/Shaders/Functions.glsl>
 
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 0) uniform sampler u_nearestAnyClampSampler;
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
@@ -32,8 +32,8 @@ layout(push_constant, row_major, std140) uniform b_pc
 	Mat4 u_invProjMat;
 };
 
-const I32 CONVOLUTION_RADIUS = 2;
-const F32 KERNEL_WEIGHTS[CONVOLUTION_RADIUS + 1] = F32[3](1.0, 2.0 / 3.0, 1.0 / 6.0);
+const I32 kConfolutionRadius = 2;
+const F32 kKernelWeights[kConfolutionRadius + 1] = F32[3](1.0, 2.0 / 3.0, 1.0 / 6.0);
 
 Vec3 toViewspace(Vec2 uv, F32 depth)
 {
@@ -42,10 +42,10 @@ Vec3 toViewspace(Vec2 uv, F32 depth)
 	return pos;
 }
 
-F32 computeShadowsLuma(F32 shadowLayers[MAX_RT_SHADOW_LAYERS])
+F32 computeShadowsLuma(F32 shadowLayers[kMaxRtShadowLayers])
 {
 	F32 l = 0.0;
-	ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+	ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 	{
 		l += shadowLayers[i];
 	}
@@ -74,12 +74,12 @@ F32 computeVarianceCenter(Vec2 uv)
 
 void main()
 {
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, FB_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kFramebufferSize))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(FB_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kFramebufferSize);
 
 	const F32 depth = textureLod(u_depthTex, u_linearAnyClampSampler, uv, 0.0).r;
 	if(depth == 1.0)
@@ -97,7 +97,7 @@ void main()
 	const Vec3 positionCenter = toViewspace(uv, depthCenter);
 
 	// Read center luma
-	F32 shadowLayers[MAX_RT_SHADOW_LAYERS];
+	F32 shadowLayers[kMaxRtShadowLayers];
 	unpackRtShadows(textureLod(u_shadowsTex, u_nearestAnyClampSampler, uv, 0.0), shadowLayers);
 	const F32 refLuma = computeShadowsLuma(shadowLayers);
 
@@ -105,21 +105,21 @@ void main()
 	const F32 varianceCenter = computeVarianceCenter(uv);
 
 	// Init the sums
-	F32 sumShadowLayers[MAX_RT_SHADOW_LAYERS];
+	F32 sumShadowLayers[kMaxRtShadowLayers];
 	zeroRtShadowLayers(sumShadowLayers);
 	F32 sumVariance = 0.0;
 	F32 sumWeight = 0.0;
 
 	// Convolve
 	const Vec2 texelSize = 1.0 / Vec2(textureSize(u_shadowsTex, 0).xy);
-	for(I32 offsetx = -CONVOLUTION_RADIUS; offsetx <= CONVOLUTION_RADIUS; offsetx++)
+	for(I32 offsetx = -kConfolutionRadius; offsetx <= kConfolutionRadius; offsetx++)
 	{
-		for(I32 offsety = -CONVOLUTION_RADIUS; offsety <= CONVOLUTION_RADIUS; offsety++)
+		for(I32 offsety = -kConfolutionRadius; offsety <= kConfolutionRadius; offsety++)
 		{
 			const Vec2 sampleUv = uv + Vec2(offsetx, offsety) * texelSize;
 
 			// Read shadows
-			F32 shadowLayers[MAX_RT_SHADOW_LAYERS];
+			F32 shadowLayers[kMaxRtShadowLayers];
 			unpackRtShadows(textureLod(u_shadowsTex, u_nearestAnyClampSampler, sampleUv, 0.0), shadowLayers);
 
 			// Compute luma weight
@@ -127,7 +127,7 @@ void main()
 			const F32 variance = textureLod(u_varianceTex, u_linearAnyClampSampler, sampleUv, 0.0).x;
 			const F32 sigmaL = 4.0;
 			const F32 lumaDiff = abs(luma - refLuma);
-			const F32 wl = min(1.0, exp(-lumaDiff / (sigmaL * sqrt(varianceCenter + 0.001) + EPSILON)));
+			const F32 wl = min(1.0, exp(-lumaDiff / (sigmaL * sqrt(varianceCenter + 0.001) + kEpsilonf)));
 
 			// Set the current sample
 			const F32 depthTap = textureLod(u_depthTex, u_linearAnyClampSampler, sampleUv, 0.0).r;
@@ -138,10 +138,10 @@ void main()
 
 			// Include more weights
 			w *= wl;
-			// w *= KERNEL_WEIGHTS[abs(offsetx)] * KERNEL_WEIGHTS[abs(offsety)];
+			// w *= kKernelWeights[abs(offsetx)] * kKernelWeights[abs(offsety)];
 
 			// Sum
-			ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+			ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 			{
 				sumShadowLayers[i] += shadowLayers[i] * w;
 			}
@@ -152,9 +152,9 @@ void main()
 	}
 
 	// Normalize
-	sumWeight += EPSILON;
+	sumWeight += kEpsilonf;
 
-	ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+	ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 	{
 		sumShadowLayers[i] /= sumWeight;
 	}

+ 16 - 16
AnKi/Shaders/RtShadowsSvgfVariance.ankiprog

@@ -3,7 +3,7 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kFramebufferSize, 0u);
 
 #pragma anki start comp
 
@@ -11,8 +11,8 @@ ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
 #include <AnKi/Shaders/BilateralFilter.glsl>
 #include <AnKi/Shaders/Functions.glsl>
 
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 0) uniform sampler u_nearestAnyClampSampler;
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
@@ -29,7 +29,7 @@ layout(push_constant, row_major, std140) uniform b_pc
 	Mat4 u_invProjMat;
 };
 
-const I32 CONVOLUTION_RADIUS = 1;
+const I32 kConvolutionRadius = 1;
 
 Vec3 toViewspace(Vec2 uv, F32 depth)
 {
@@ -40,12 +40,12 @@ Vec3 toViewspace(Vec2 uv, F32 depth)
 
 void main()
 {
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, FB_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kFramebufferSize))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(FB_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kFramebufferSize);
 
 	const F32 depth = textureLod(u_depthTex, u_linearAnyClampSampler, uv, 0.0).r;
 	if(depth == 1.0)
@@ -61,11 +61,11 @@ void main()
 	UVec4 outPackedShadowLayers;
 	F32 outVariance;
 
-	if(historyLength < 4.0 / RT_SHADOWS_MAX_HISTORY_LENGTH)
+	if(historyLength < 4.0 / kRtShadowsMaxHistoryLength)
 	{
 		// It's been stable less than 4 frames, need to do some work
 
-		const Vec2 texelSize = 1.0 / Vec2(FB_SIZE);
+		const Vec2 texelSize = 1.0 / Vec2(kFramebufferSize);
 
 		// Set the reference sample
 		const F32 depthCenter = depth;
@@ -74,13 +74,13 @@ void main()
 		// Init the sums
 		Vec2 sumMoments = Vec2(0.0);
 		F32 sumWeight = 0.0;
-		F32 sumShadowLayers[MAX_RT_SHADOW_LAYERS];
+		F32 sumShadowLayers[kMaxRtShadowLayers];
 		zeroRtShadowLayers(sumShadowLayers);
 
 		// Convolve
-		for(I32 offsetx = -CONVOLUTION_RADIUS; offsetx <= CONVOLUTION_RADIUS; offsetx++)
+		for(I32 offsetx = -kConvolutionRadius; offsetx <= kConvolutionRadius; offsetx++)
 		{
-			for(I32 offsety = -CONVOLUTION_RADIUS; offsety <= CONVOLUTION_RADIUS; offsety++)
+			for(I32 offsety = -kConvolutionRadius; offsety <= kConvolutionRadius; offsety++)
 			{
 				const Vec2 sampleUv = uv + Vec2(offsetx, offsety) * texelSize;
 
@@ -95,9 +95,9 @@ void main()
 				const Vec2 moments = textureLod(u_momentsTex, u_linearAnyClampSampler, sampleUv, 0.0).xy;
 				sumMoments += moments * w;
 
-				F32 shadowLayers[MAX_RT_SHADOW_LAYERS];
+				F32 shadowLayers[kMaxRtShadowLayers];
 				unpackRtShadows(textureLod(u_shadowsTex, u_nearestAnyClampSampler, sampleUv, 0.0), shadowLayers);
-				ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+				ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 				{
 					sumShadowLayers[i] += shadowLayers[i] * w;
 				}
@@ -106,9 +106,9 @@ void main()
 			}
 		}
 
-		sumWeight += EPSILON;
+		sumWeight += kEpsilonf;
 
-		ANKI_UNROLL for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+		ANKI_UNROLL for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 		{
 			sumShadowLayers[i] /= sumWeight;
 		}
@@ -119,7 +119,7 @@ void main()
 		outVariance = max(0.0, sumMoments.y - sumMoments.x * sumMoments.x);
 
 		// Give the variance a boost for the first frames
-		outVariance *= 4.0 / (historyLength * RT_SHADOWS_MAX_HISTORY_LENGTH);
+		outVariance *= 4.0 / (historyLength * kRtShadowsMaxHistoryLength);
 	}
 	else
 	{

+ 11 - 11
AnKi/Shaders/RtShadowsUpscale.ankiprog

@@ -9,10 +9,10 @@
 #include <AnKi/Shaders/Functions.glsl>
 #include <AnKi/Shaders/BilateralFilter.glsl>
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(OUT_IMAGE_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kOutImageSize, 0u);
 
-const UVec2 WORKGROUP_SIZE = UVec2(8u, 8u);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8u, 8u);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 0) uniform sampler u_nearestAnyClampSampler;
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
@@ -23,23 +23,23 @@ layout(set = 0, binding = 5) uniform texture2D u_fullDepthTex;
 
 void main()
 {
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, OUT_IMAGE_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kOutImageSize))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(OUT_IMAGE_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kOutImageSize);
 
 	// Reference
 	const F32 depthCenter = textureLod(u_fullDepthTex, u_linearAnyClampSampler, uv, 0.0).x;
 
-	F32 sumShadowLayers[MAX_RT_SHADOW_LAYERS];
+	F32 sumShadowLayers[kMaxRtShadowLayers];
 	zeroRtShadowLayers(sumShadowLayers);
 
 	// Do a bilateral upscale
-	const Vec2 texelSize = 1.0 / Vec2(OUT_IMAGE_SIZE / 2u);
+	const Vec2 texelSize = 1.0 / Vec2(kOutImageSize / 2u);
 	const I32 radius = 1;
-	F32 sumWeight = EPSILON;
+	F32 sumWeight = kEpsilonf;
 	for(I32 x = -radius; x <= radius; ++x)
 	{
 		for(I32 y = -radius; y <= radius; ++y)
@@ -49,10 +49,10 @@ void main()
 
 			const F32 w = calculateBilateralWeightDepth(depthCenter, depthTap, 1.0);
 
-			F32 shadowLayers[MAX_RT_SHADOW_LAYERS];
+			F32 shadowLayers[kMaxRtShadowLayers];
 			unpackRtShadows(textureLod(u_quarterShadowsTex, u_nearestAnyClampSampler, sampleUv, 0.0), shadowLayers);
 
-			for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+			for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 			{
 				sumShadowLayers[i] += shadowLayers[i] * w;
 			}
@@ -61,7 +61,7 @@ void main()
 		}
 	}
 
-	for(U32 i = 0u; i < MAX_RT_SHADOW_LAYERS; ++i)
+	for(U32 i = 0u; i < kMaxRtShadowLayers; ++i)
 	{
 		sumShadowLayers[i] /= sumWeight;
 	}

+ 1 - 1
AnKi/Shaders/RtShadowsVisualizeRenderTarget.ankiprog

@@ -21,7 +21,7 @@ layout(location = 0) out Vec3 out_color;
 void main()
 {
 	const UVec4 packed = textureLod(u_inTex, u_nearestAnyClampSampler, in_uv, 0.0);
-	F32 shadowFactors[MAX_RT_SHADOW_LAYERS];
+	F32 shadowFactors[kMaxRtShadowLayers];
 	unpackRtShadows(packed, shadowFactors);
 
 #if LAYER_GROUP == 0

+ 2 - 2
AnKi/Shaders/SceneDebug.ankiprog

@@ -6,11 +6,11 @@
 #pragma anki mutator COLOR_TEXTURE 0 1
 #pragma anki mutator DITHERED_DEPTH_TEST 0 1
 
-ANKI_SPECIALIZATION_CONSTANT_U32(INSTANCE_COUNT, 0u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kInstanceCount, 0u);
 
 layout(set = 1, binding = 0, row_major) uniform u0_
 {
-	Mat4 u_mvp[INSTANCE_COUNT];
+	Mat4 u_mvp[kInstanceCount];
 	Vec4 u_color;
 };
 

+ 9 - 9
AnKi/Shaders/ShadowmapsResolve.glsl

@@ -3,10 +3,10 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(TILE_COUNTS, 2u);
-ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 4u);
-ANKI_SPECIALIZATION_CONSTANT_U32(TILE_SIZE, 5u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kFramebufferSize, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kTileCount, 2u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kZSplitCount, 4u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kTileSize, 5u);
 
 #define CLUSTERED_SHADING_SET 0u
 #define CLUSTERED_SHADING_UNIFORMS_BINDING 0u
@@ -18,8 +18,8 @@ layout(set = 0, binding = 5) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 6) uniform texture2D u_depthRt;
 
 #if defined(ANKI_COMPUTE_SHADER)
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 layout(set = 0, binding = 7, rgba8) writeonly uniform ANKI_RP image2D u_outImg;
 #else
 layout(location = 0) in Vec2 in_uv;
@@ -29,11 +29,11 @@ layout(location = 0) out Vec4 out_color;
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, FB_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kFramebufferSize))
 	{
 		return;
 	}
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(FB_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kFramebufferSize);
 #else
 	const Vec2 uv = in_uv;
 #endif
@@ -46,7 +46,7 @@ void main()
 
 	// Cluster
 	const Vec2 fragCoord = uv * u_clusteredShading.m_renderingSize;
-	Cluster cluster = getClusterFragCoord(Vec3(fragCoord, depth), TILE_SIZE, TILE_COUNTS, Z_SPLIT_COUNT,
+	Cluster cluster = getClusterFragCoord(Vec3(fragCoord, depth), kTileSize, kTileCount, kZSplitCount,
 										  u_clusteredShading.m_zSplitMagic.x, u_clusteredShading.m_zSplitMagic.y);
 
 	// Layers

+ 12 - 13
AnKi/Shaders/TemporalAA.glsl

@@ -6,9 +6,9 @@
 #pragma anki mutator VARIANCE_CLIPPING 0 1
 #pragma anki mutator YCBCR 0 1
 
-ANKI_SPECIALIZATION_CONSTANT_F32(VARIANCE_CLIPPING_GAMMA, 0u);
-ANKI_SPECIALIZATION_CONSTANT_F32(BLEND_FACTOR, 1u);
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(FB_SIZE, 2u);
+ANKI_SPECIALIZATION_CONSTANT_F32(kVarianceClippingGamma, 0u);
+ANKI_SPECIALIZATION_CONSTANT_F32(kBlendFactor, 1u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kFramebufferSize, 2u);
 
 #include <AnKi/Shaders/Functions.glsl>
 #include <AnKi/Shaders/PackFunctions.glsl>
@@ -20,16 +20,15 @@ layout(set = 0, binding = 2) uniform ANKI_RP texture2D u_inputRt;
 layout(set = 0, binding = 3) uniform ANKI_RP texture2D u_historyRt;
 layout(set = 0, binding = 4) uniform texture2D u_motionVectorsTex;
 
-const U32 TONEMAPPING_SET = 0u;
-const U32 TONEMAPPING_BINDING = 5u;
+const U32 kTonemappingBinding = 5u;
 #include <AnKi/Shaders/TonemappingResources.glsl>
 
 #if defined(ANKI_COMPUTE_SHADER)
 layout(set = 0, binding = 6) writeonly uniform image2D u_outImg;
 layout(set = 0, binding = 7) writeonly uniform image2D u_tonemappedImg;
 
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 #else
 layout(location = 0) in Vec2 in_uv;
 layout(location = 0) out Vec3 out_color;
@@ -48,12 +47,12 @@ layout(location = 1) out Vec3 out_tonemappedColor;
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, FB_SIZE))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, kFramebufferSize))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(FB_SIZE);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kFramebufferSize);
 #else
 	const Vec2 uv = in_uv;
 #endif
@@ -80,8 +79,8 @@ void main()
 	const Vec3 mu = m1 / 5.0;
 	const Vec3 sigma = sqrt(m2 / 5.0 - mu * mu);
 
-	const Vec3 boxMin = mu - VARIANCE_CLIPPING_GAMMA * sigma;
-	const Vec3 boxMax = mu + VARIANCE_CLIPPING_GAMMA * sigma;
+	const Vec3 boxMin = mu - kVarianceClippingGamma * sigma;
+	const Vec3 boxMax = mu + kVarianceClippingGamma * sigma;
 #else
 	const Vec3 boxMin = min(crntCol, min(near0, min(near1, min(near2, near3))));
 	const Vec3 boxMax = max(crntCol, max(near0, max(near1, max(near2, near3))));
@@ -100,10 +99,10 @@ void main()
 	const F32 maxLum = 1.0;
 #endif
 
-	F32 diff = abs(lum0 - lum1) / max(lum0, max(lum1, maxLum + EPSILON));
+	F32 diff = abs(lum0 - lum1) / max(lum0, max(lum1, maxLum + kEpsilonf));
 	diff = 1.0 - diff;
 	diff = diff * diff;
-	const F32 feedback = mix(0.0, BLEND_FACTOR, diff);
+	const F32 feedback = mix(0.0, kBlendFactor, diff);
 
 	// Write result
 	Vec3 outColor = mix(historyCol, crntCol, feedback);

+ 4 - 5
AnKi/Shaders/Tonemap.glsl

@@ -11,15 +11,14 @@
 layout(set = 0, binding = 0) uniform sampler u_nearestAnyClampSampler;
 layout(set = 0, binding = 1) uniform ANKI_RP texture2D u_inputRt;
 
-const U32 TONEMAPPING_SET = 0u;
-const U32 TONEMAPPING_BINDING = 2u;
+const U32 kTonemappingBinding = 2u;
 #include <AnKi/Shaders/TonemappingResources.glsl>
 
 #if defined(ANKI_COMPUTE_SHADER)
 layout(set = 0, binding = 3) writeonly uniform image2D u_outImg;
 
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 #else
 layout(location = 0) in Vec2 in_uv;
 layout(location = 0) out Vec3 out_color;
@@ -34,7 +33,7 @@ layout(push_constant, std140) uniform b_pc
 void main()
 {
 #if defined(ANKI_COMPUTE_SHADER)
-	if(skipOutOfBoundsInvocations(WORKGROUP_SIZE, u_viewportSize))
+	if(skipOutOfBoundsInvocations(kWorkgroupSize, u_viewportSize))
 	{
 		return;
 	}

+ 19 - 20
AnKi/Shaders/TonemappingAverageLuminance.ankiprog

@@ -3,42 +3,41 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(INPUT_TEX_SIZE, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kInputTexSize, 0u);
 
 #pragma anki start comp
 #define LOG_AVG 0
 
 #include <AnKi/Shaders/TonemappingFunctions.glsl>
 
-const UVec2 WORKGROUP_SIZE = UVec2(32u, 16u);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(32u, 16u);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 // Align the tex size to workgroup size
-const UVec2 ALIGNED_INPUT_TEX_SIZE = WORKGROUP_SIZE * ((INPUT_TEX_SIZE + WORKGROUP_SIZE - 1u) / WORKGROUP_SIZE);
-const UVec2 PIXELS_PER_TILE = ALIGNED_INPUT_TEX_SIZE / WORKGROUP_SIZE;
+const UVec2 kAlignedInputTexSize = kWorkgroupSize * ((kInputTexSize + kWorkgroupSize - 1u) / kWorkgroupSize);
+const UVec2 kPixelsPerTile = kAlignedInputTexSize / kWorkgroupSize;
 
 layout(set = 0, binding = 0) uniform ANKI_RP texture2D u_tex;
 
 #define TONEMAPPING_RESOURCE_AS_WRITE_IMAGE 1
-#define TONEMAPPING_SET 0
-#define TONEMAPPING_BINDING 1
+const U32 kTonemappingBinding = 1u;
 #include <AnKi/Shaders/TonemappingResources.glsl>
 
-shared F32 s_avgLum[WORKGROUP_SIZE.x * WORKGROUP_SIZE.y];
+shared F32 s_avgLum[kWorkgroupSize.x * kWorkgroupSize.y];
 
 void main()
 {
 	// Gather the log-average luminance of a tile. It will miss some pixels but not too many
-	const U32 yStart = gl_LocalInvocationID.y * PIXELS_PER_TILE.y;
-	const U32 xStart = gl_LocalInvocationID.x * PIXELS_PER_TILE.x;
+	const U32 yStart = gl_LocalInvocationID.y * kPixelsPerTile.y;
+	const U32 xStart = gl_LocalInvocationID.x * kPixelsPerTile.x;
 
 	F32 avgLum = 0.0;
-	ANKI_UNROLL for(U32 y = 0u; y < PIXELS_PER_TILE.y; ++y)
+	ANKI_UNROLL for(U32 y = 0u; y < kPixelsPerTile.y; ++y)
 	{
-		ANKI_UNROLL for(U32 x = 0u; x < PIXELS_PER_TILE.x; ++x)
+		ANKI_UNROLL for(U32 x = 0u; x < kPixelsPerTile.x; ++x)
 		{
 			const UVec2 uv = UVec2(xStart, yStart) + UVec2(x, y);
-			if(uv.x >= INPUT_TEX_SIZE.x || uv.y >= INPUT_TEX_SIZE.y)
+			if(uv.x >= kInputTexSize.x || uv.y >= kInputTexSize.y)
 			{
 				continue;
 			}
@@ -46,7 +45,7 @@ void main()
 			const Vec3 color = texelFetch(u_tex, IVec2(uv), 0).rgb;
 			const F32 lum = computeLuminance(color);
 #if LOG_AVG
-			avgLum += log(max(EPSILON, lum));
+			avgLum += log(max(kEpsilonf, lum));
 #else
 			avgLum += lum;
 #endif
@@ -59,7 +58,7 @@ void main()
 	barrier();
 
 	// Gather the results into one
-	ANKI_LOOP for(U32 s = (WORKGROUP_SIZE.x * WORKGROUP_SIZE.y) / 2u; s > 0u; s >>= 1u)
+	ANKI_LOOP for(U32 s = (kWorkgroupSize.x * kWorkgroupSize.y) / 2u; s > 0u; s >>= 1u)
 	{
 		if(gl_LocalInvocationIndex < s)
 		{
@@ -79,23 +78,23 @@ void main()
 	ANKI_BRANCH if(gl_LocalInvocationIndex == 0u)
 	{
 #if LOG_AVG
-		const F32 crntLum = exp(s_avgLum[0] * (1.0 / F32(INPUT_TEX_SIZE.x * INPUT_TEX_SIZE.y)));
+		const F32 crntLum = exp(s_avgLum[0] * (1.0 / F32(kInputTexSize.x * kInputTexSize.y)));
 #else
-		const F32 crntLum = s_avgLum[0] * (1.0 / F32(INPUT_TEX_SIZE.x * INPUT_TEX_SIZE.y));
+		const F32 crntLum = s_avgLum[0] * (1.0 / F32(kInputTexSize.x * kInputTexSize.y));
 #endif
 
 #if 1
 		const F32 prevLum = readExposureAndAverageLuminance().y;
 
 		// Lerp between previous and new L value
-		const F32 INTERPOLATION_FACTOR = 0.05;
-		F32 finalAvgLum = mix(prevLum, crntLum, INTERPOLATION_FACTOR);
+		const F32 interpolationFactor = 0.05;
+		F32 finalAvgLum = mix(prevLum, crntLum, interpolationFactor);
 #else
 		F32 finalAvgLum = crntLum;
 #endif
 
 		// This is a workaround because sometimes the avg lum becomes nan
-		finalAvgLum = clamp(finalAvgLum, EPSILON, kMaxF32);
+		finalAvgLum = clamp(finalAvgLum, kEpsilonf, kMaxF32);
 
 		writeExposureAndAverageLuminance(computeExposure(finalAvgLum, 0.0), finalAvgLum);
 	}

+ 2 - 2
AnKi/Shaders/TonemappingFunctions.glsl

@@ -15,7 +15,7 @@ ANKI_RP F32 log10(ANKI_RP F32 x)
 
 ANKI_RP F32 computeLuminance(ANKI_RP Vec3 color)
 {
-	return max(dot(Vec3(0.30, 0.59, 0.11), color), EPSILON_RP);
+	return max(dot(Vec3(0.30, 0.59, 0.11), color), kEpsilonRp);
 }
 
 ANKI_RP F32 computeExposure(ANKI_RP F32 avgLum, ANKI_RP F32 threshold)
@@ -86,7 +86,7 @@ ANKI_RP Vec3 tonemap(ANKI_RP Vec3 color, ANKI_RP F32 exposure)
 ANKI_RP Vec3 invertTonemap(ANKI_RP Vec3 color, ANKI_RP F32 exposure)
 {
 	color = invertTonemapACESFilm(color);
-	color /= max(EPSILON, exposure);
+	color /= max(kEpsilonf, exposure);
 	return color;
 }
 

+ 2 - 2
AnKi/Shaders/TonemappingResources.glsl

@@ -14,9 +14,9 @@
 #endif
 
 #if TONEMAPPING_RESOURCE_AS_WRITE_IMAGE
-layout(set = 0, binding = TONEMAPPING_BINDING) ANKI_RP uniform coherent image2D u_tonemappingImage;
+layout(set = 0, binding = kTonemappingBinding) ANKI_RP uniform coherent image2D u_tonemappingImage;
 #else
-layout(set = 0, binding = TONEMAPPING_BINDING) ANKI_RP uniform readonly image2D u_tonemappingImage;
+layout(set = 0, binding = kTonemappingBinding) ANKI_RP uniform readonly image2D u_tonemappingImage;
 #endif
 
 #if TONEMAPPING_RESOURCE_AS_WRITE_IMAGE

+ 1 - 1
AnKi/Shaders/TraditionalDeferredShading.ankiprog

@@ -96,7 +96,7 @@ void main()
 	unpackGBufferNoVelocity(textureLod(u_msRt0, u_msSampler, uvToRead, 0.0),
 							textureLod(u_msRt1, u_msSampler, uvToRead, 0.0),
 							textureLod(u_msRt2, u_msSampler, uvToRead, 0.0), gbuffer);
-	gbuffer.m_subsurface = max(gbuffer.m_subsurface, SUBSURFACE_MIN * 8.0);
+	gbuffer.m_subsurface = max(gbuffer.m_subsurface, kSubsurfaceMin * 8.0);
 
 	const Vec4 worldPos4 = u_unis.m_invViewProjMat * Vec4(UV_TO_NDC(uvToWrite), depth, 1.0);
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;

+ 12 - 12
AnKi/Shaders/VolumetricFogAccumulation.ankiprog

@@ -3,9 +3,9 @@
 // Code licensed under the BSD License.
 // http://www.anki3d.org/LICENSE
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC3(VOLUME_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_U32(FINAL_Z_SPLIT, 3u);
-ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 4u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC3(kVolumeSize, 0u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kFinalZSplit, 3u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kZSplitCount, 4u);
 
 #pragma anki start comp
 
@@ -13,8 +13,8 @@ ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 4u);
 #include <AnKi/Shaders/Include/MiscRendererTypes.h>
 #include <AnKi/Shaders/Common.glsl>
 
-const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 0) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 1) uniform ANKI_RP texture3D u_lightVolume;
@@ -27,21 +27,21 @@ layout(push_constant, std140) uniform b_pc
 
 void main()
 {
-	if(any(greaterThanEqual(gl_GlobalInvocationID.xy, VOLUME_SIZE.xy)))
+	if(any(greaterThanEqual(gl_GlobalInvocationID.xy, kVolumeSize.xy)))
 	{
 		return;
 	}
 
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(VOLUME_SIZE.xy);
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(kVolumeSize.xy);
 
 	ANKI_RP Vec4 colorAndDensityFront = Vec4(0.0);
-	ANKI_LOOP for(U32 i = 0u; i < VOLUME_SIZE.z; ++i)
+	ANKI_LOOP for(U32 i = 0u; i < kVolumeSize.z; ++i)
 	{
 		const ANKI_RP F32 fi = F32(i);
 
 		// Compute the linear depth
-		const ANKI_RP F32 maxLinearDepth = F32(FINAL_Z_SPLIT + 1u) / F32(Z_SPLIT_COUNT);
-		const ANKI_RP F32 linearDepthFraction = maxLinearDepth / F32(VOLUME_SIZE.z);
+		const ANKI_RP F32 maxLinearDepth = F32(kFinalZSplit + 1u) / F32(kZSplitCount);
+		const ANKI_RP F32 linearDepthFraction = maxLinearDepth / F32(kVolumeSize.z);
 		const ANKI_RP F32 linearDepthNear = fi * linearDepthFraction;
 		const ANKI_RP F32 linearDepthFar = (fi + 1.0) * linearDepthFraction;
 
@@ -53,9 +53,9 @@ void main()
 		const ANKI_RP F32 layerThinkness = abs(zVSpaceNear - zVSpaceFar);
 
 		// Read the light value and the fog density from the fog volumes
-		const ANKI_RP F32 w = (fi + 0.5) / F32(VOLUME_SIZE.z);
+		const ANKI_RP F32 w = (fi + 0.5) / F32(kVolumeSize.z);
 		ANKI_RP Vec4 lightAndFogDensity = textureLod(u_lightVolume, u_linearAnyClampSampler, Vec3(uv, w), 0.0);
-		lightAndFogDensity.xyz *= u_unis.m_fogDiffuse / PI;
+		lightAndFogDensity.xyz *= u_unis.m_fogDiffuse / kPi;
 
 		// Scattering & absorption
 		const ANKI_RP F32 scattering = lightAndFogDensity.w * u_unis.m_fogScatteringCoeff * layerThinkness;

+ 21 - 21
AnKi/Shaders/VolumetricLightingAccumulation.ankiprog

@@ -7,17 +7,17 @@
 
 #pragma anki mutator ENABLE_SHADOWS 0 1
 
-ANKI_SPECIALIZATION_CONSTANT_UVEC3(VOLUME_SIZE, 0u);
-ANKI_SPECIALIZATION_CONSTANT_UVEC2(TILE_COUNT, 3u);
-ANKI_SPECIALIZATION_CONSTANT_U32(Z_SPLIT_COUNT, 5u);
-ANKI_SPECIALIZATION_CONSTANT_U32(FINAL_Z_SPLIT, 6u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC3(kVolumeSize, 0u);
+ANKI_SPECIALIZATION_CONSTANT_UVEC2(kTileCount, 3u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kZSplitCount, 5u);
+ANKI_SPECIALIZATION_CONSTANT_U32(kFinalZSplit, 6u);
 
 #pragma anki start comp
 
-const F32 PHASE_FUNCTION_ANISOTROPY = 0.3;
+const F32 kPhaseFunctionAnisotropy = 0.3;
 
-const UVec3 WORKGROUP_SIZE = UVec3(8, 8, 8);
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = WORKGROUP_SIZE.z) in;
+const UVec3 kWorkgroupSize = UVec3(8, 8, 8);
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = kWorkgroupSize.z) in;
 
 layout(set = 0, binding = 0) uniform sampler u_linearAnyRepeatSampler;
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
@@ -53,8 +53,8 @@ Vec3 readRand()
 Vec3 worldPosInsideClusterAndZViewSpace(Vec3 relativePos, out F32 negativeZViewSpace, out Vec3 uvw)
 {
 	// Compute the linear depth
-	const F32 maxLinearDepth = F32(FINAL_Z_SPLIT + 1u) / F32(Z_SPLIT_COUNT);
-	const F32 linearDepthFraction = maxLinearDepth / F32(VOLUME_SIZE.z);
+	const F32 maxLinearDepth = F32(kFinalZSplit + 1u) / F32(kZSplitCount);
+	const F32 linearDepthFraction = maxLinearDepth / F32(kVolumeSize.z);
 	const F32 linearDepthNear = g_globalInvocationID.z * linearDepthFraction;
 	const F32 linearDepthFar = (g_globalInvocationID.z + 1.0) * linearDepthFraction;
 	const F32 linearDepth = mix(linearDepthNear, linearDepthFar, relativePos.z);
@@ -66,7 +66,7 @@ Vec3 worldPosInsideClusterAndZViewSpace(Vec3 relativePos, out F32 negativeZViewS
 	const F32 zViewSpace = -negativeZViewSpace;
 
 	// Get the position in view space
-	const Vec2 uv = mix(g_globalInvocationID.xy, g_globalInvocationID.xy + 1.0, relativePos.xy) / Vec2(VOLUME_SIZE.xy);
+	const Vec2 uv = mix(g_globalInvocationID.xy, g_globalInvocationID.xy + 1.0, relativePos.xy) / Vec2(kVolumeSize.xy);
 	uvw.xy = uv;
 	const Vec2 xyViewSpace = UV_TO_NDC(uv) * u_clusteredShading.m_matrices.m_unprojectionParameters.xy * zViewSpace;
 
@@ -105,7 +105,7 @@ Vec4 accumulateLightsAndFog(Cluster cluster, Vec3 worldPos, F32 negativeZViewSpa
 	const DirectionalLight dirLight = u_clusteredShading.m_directionalLight;
 	if(dirLight.m_active != 0u)
 	{
-		F32 factor = phaseFunction(viewDir, dirLight.m_direction, PHASE_FUNCTION_ANISOTROPY);
+		F32 factor = phaseFunction(viewDir, dirLight.m_direction, kPhaseFunctionAnisotropy);
 
 #if ENABLE_SHADOWS
 		if(dirLight.m_cascadeCount > 0u && negativeZViewSpace < dirLight.m_effectiveShadowDistance)
@@ -132,7 +132,7 @@ Vec4 accumulateLightsAndFog(Cluster cluster, Vec3 worldPos, F32 negativeZViewSpa
 		const Vec3 frag2Light = light.m_position - worldPos;
 		F32 factor = computeAttenuationFactor(light.m_squareRadiusOverOne, frag2Light);
 
-		factor *= phaseFunction(viewDir, normalize(worldPos - light.m_position), PHASE_FUNCTION_ANISOTROPY);
+		factor *= phaseFunction(viewDir, normalize(worldPos - light.m_position), kPhaseFunctionAnisotropy);
 
 #if ENABLE_SHADOWS
 		if(light.m_shadowAtlasTileScale >= 0.0)
@@ -158,7 +158,7 @@ Vec4 accumulateLightsAndFog(Cluster cluster, Vec3 worldPos, F32 negativeZViewSpa
 
 		factor *= computeSpotFactor(l, light.m_outerCos, light.m_innerCos, light.m_direction);
 
-		factor *= phaseFunction(viewDir, light.m_direction, PHASE_FUNCTION_ANISOTROPY);
+		factor *= phaseFunction(viewDir, light.m_direction, kPhaseFunctionAnisotropy);
 
 #if ENABLE_SHADOWS
 		if(light.m_shadowLayer != kMaxU32)
@@ -188,7 +188,7 @@ Vec4 accumulateLightsAndFog(Cluster cluster, Vec3 worldPos, F32 negativeZViewSpa
 		{
 			// Zero or more than one probes, do a slow path that blends them together
 
-			F32 totalBlendWeight = EPSILON;
+			F32 totalBlendWeight = kEpsilonf;
 			diffIndirect = Vec3(0.0);
 
 			// Loop probes
@@ -213,7 +213,7 @@ Vec4 accumulateLightsAndFog(Cluster cluster, Vec3 worldPos, F32 negativeZViewSpa
 			diffIndirect /= totalBlendWeight;
 		}
 
-		diffIndirect *= PI; // Irradiance is pre-divided with PI so fix it
+		diffIndirect *= kPi; // Irradiance is pre-divided with PI so fix it
 
 		color += diffIndirect;
 	}
@@ -254,7 +254,7 @@ Vec4 accumulateLightsAndFog(Cluster cluster, Vec3 worldPos, F32 negativeZViewSpa
 
 void main()
 {
-	if(any(greaterThanEqual(gl_GlobalInvocationID.xyz, VOLUME_SIZE)))
+	if(any(greaterThanEqual(gl_GlobalInvocationID.xyz, kVolumeSize)))
 	{
 		return;
 	}
@@ -265,12 +265,12 @@ void main()
 	const Vec3 worldPos = worldPosInsideClusterAndZViewSpace(readRand(), negativeZViewSpace, uvw);
 
 	// Get the cluster
-	const UVec2 tileIdxXY = UVec2(uvw.xy * Vec2(TILE_COUNT));
-	const U32 tileIdx = tileIdxXY.y * TILE_COUNT.x + tileIdxXY.x;
+	const UVec2 tileIdxXY = UVec2(uvw.xy * Vec2(kTileCount));
+	const U32 tileIdx = tileIdxXY.y * kTileCount.x + tileIdxXY.x;
 	Cluster cluster = u_clusters[tileIdx];
 
-	const U32 zSplitIdx = U32(uvw.z * F32(Z_SPLIT_COUNT));
-	const Cluster split = u_clusters[TILE_COUNT.x * TILE_COUNT.y + zSplitIdx];
+	const U32 zSplitIdx = U32(uvw.z * F32(kZSplitCount));
+	const Cluster split = u_clusters[kTileCount.x * kTileCount.y + zSplitIdx];
 
 	cluster.m_pointLightsMask |= split.m_pointLightsMask;
 	cluster.m_spotLightsMask |= split.m_spotLightsMask;
@@ -294,7 +294,7 @@ void main()
 		{
 			const F32 linearDepth = linearizeDepth(prevClipPos.z, u_clusteredShading.m_near, u_clusteredShading.m_far);
 			const Vec3 uvw =
-				Vec3(NDC_TO_UV(prevClipPos.xy), linearDepth * (F32(Z_SPLIT_COUNT) / F32(FINAL_Z_SPLIT + 1u)));
+				Vec3(NDC_TO_UV(prevClipPos.xy), linearDepth * (F32(kZSplitCount) / F32(kFinalZSplit + 1u)));
 			const Vec4 history = textureLod(u_prevVolume, u_linearAnyClampSampler, uvw, 0.0);
 			lightAndFog = mix(history, lightAndFog, 1.0 / 16.0);
 		}

+ 9 - 9
AnKi/Shaders/VrsSriGenerationCompute.ankiprog

@@ -19,13 +19,13 @@ layout(set = 0, binding = 0) uniform ANKI_RP texture2D u_inputTex;
 layout(set = 0, binding = 1) uniform sampler u_nearestClampSampler;
 
 #if SRI_TEXEL_DIMENSION == 8
-const UVec2 REGION_SIZE = UVec2(2u, 2u);
+const UVec2 kRegionSize = UVec2(2u, 2u);
 #else
-const UVec2 REGION_SIZE = UVec2(2u, 4u);
+const UVec2 kRegionSize = UVec2(2u, 4u);
 #endif
 
-const UVec2 WORKGROUP_SIZE = UVec2(SRI_TEXEL_DIMENSION) / REGION_SIZE;
-layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
+const UVec2 kWorkgroupSize = UVec2(SRI_TEXEL_DIMENSION) / kRegionSize;
+layout(local_size_x = kWorkgroupSize.x, local_size_y = kWorkgroupSize.y, local_size_z = 1) in;
 
 layout(set = 0, binding = 2) uniform writeonly uimage2D u_sriImg;
 
@@ -40,9 +40,9 @@ layout(push_constant, std430) uniform b_pc
 // Ideally, we'd be able to calculate the min/max/average using subgroup operations, but there's no guarantee
 // subgroupSize is large enough so we need shared memory as a fallback. We need gl_NumSubgroups entries, but it is not a
 // constant, so estimate it assuming a subgroupSize of at least 8.
-const U32 SHARED_MEMORY_ENTRIES = WORKGROUP_SIZE.x * WORKGROUP_SIZE.y / 8u;
-shared F32 s_averageLuma[SHARED_MEMORY_ENTRIES];
-shared Vec2 s_maxDerivative[SHARED_MEMORY_ENTRIES];
+const U32 kSharedMemoryEntries = kWorkgroupSize.x * kWorkgroupSize.y / 8u;
+shared F32 s_averageLuma[kSharedMemoryEntries];
+shared Vec2 s_maxDerivative[kSharedMemoryEntries];
 #endif
 
 F32 computeLuma(Vec3 color)
@@ -56,7 +56,7 @@ F32 computeLuma(Vec3 color)
 
 void main()
 {
-	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) * Vec2(REGION_SIZE) + 0.5) * u_oneOverViewportSize;
+	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) * Vec2(kRegionSize) + 0.5) * u_oneOverViewportSize;
 
 #if SRI_TEXEL_DIMENSION == 8
 	// Get luminance.
@@ -163,7 +163,7 @@ void main()
 #endif
 
 		// Determine shading rate.
-		const F32 avgLuma = averageLuma / F32(WORKGROUP_SIZE.x * WORKGROUP_SIZE.y);
+		const F32 avgLuma = averageLuma / F32(kWorkgroupSize.x * kWorkgroupSize.y);
 		const Vec2 lumaDiff = maxDerivative / avgLuma;
 		const F32 threshold1 = u_threshold;
 		const F32 threshold2 = threshold1 * 0.4;

+ 1 - 1
Sandbox/Main.cpp

@@ -412,7 +412,7 @@ Error MyApp::userMainLoop(Bool& quit, Second elapsedTime)
 		m_config.setRVrs(!m_config.getRVrs());
 	}
 
-	if(in.getEvent(InputEvent::WINDOW_CLOSED))
+	if(in.getEvent(InputEvent::kWindowClosed))
 	{
 		quit = true;
 	}