Browse Source

More refactoring and renaming

Panagiotis Christopoulos Charitos 1 year ago
parent
commit
1e9f47bbf0
100 changed files with 620 additions and 619 deletions
  1. 2 2
      AnKi/Gr/CommandBuffer.h
  2. 11 11
      AnKi/Gr/Common.cpp
  3. 10 11
      AnKi/Gr/Common.h
  4. 1 1
      AnKi/Gr/D3D/D3DCommandBuffer.cpp
  5. 10 10
      AnKi/Gr/D3D/D3DDescriptor.cpp
  6. 4 4
      AnKi/Gr/D3D/D3DDescriptor.h
  7. 1 1
      AnKi/Gr/D3D/D3DGrManager.cpp
  8. 3 3
      AnKi/Gr/Vulkan/VkCommandBuffer.cpp
  9. 8 8
      AnKi/Gr/Vulkan/VkDescriptor.cpp
  10. 8 8
      AnKi/Gr/Vulkan/VkDescriptor.h
  11. 6 6
      AnKi/Gr/Vulkan/VkShaderProgram.cpp
  12. 1 1
      AnKi/Renderer/Bloom.cpp
  13. 12 12
      AnKi/Renderer/ClusterBinning.cpp
  14. 1 1
      AnKi/Renderer/Common.h
  15. 10 10
      AnKi/Renderer/Dbg.cpp
  16. 2 2
      AnKi/Renderer/DepthDownscale.cpp
  17. 1 1
      AnKi/Renderer/DownscaleBlur.cpp
  18. 1 1
      AnKi/Renderer/FinalComposite.cpp
  19. 1 1
      AnKi/Renderer/ForwardShading.cpp
  20. 1 1
      AnKi/Renderer/GBufferPost.cpp
  21. 5 5
      AnKi/Renderer/IndirectDiffuseProbes.cpp
  22. 1 1
      AnKi/Renderer/LensFlare.cpp
  23. 11 11
      AnKi/Renderer/LightShading.cpp
  24. 2 2
      AnKi/Renderer/MotionVectors.cpp
  25. 1 1
      AnKi/Renderer/ProbeReflections.cpp
  26. 22 22
      AnKi/Renderer/Renderer.cpp
  27. 1 1
      AnKi/Renderer/Renderer.h
  28. 13 13
      AnKi/Renderer/RtShadows.cpp
  29. 4 4
      AnKi/Renderer/Scale.cpp
  30. 1 1
      AnKi/Renderer/ShadowMapping.cpp
  31. 2 2
      AnKi/Renderer/ShadowmapsResolve.cpp
  32. 2 2
      AnKi/Renderer/Sky.cpp
  33. 4 4
      AnKi/Renderer/Ssao.cpp
  34. 2 2
      AnKi/Renderer/Ssr.cpp
  35. 11 11
      AnKi/Renderer/Utils/Drawer.cpp
  36. 34 34
      AnKi/Renderer/Utils/GpuVisibility.cpp
  37. 8 8
      AnKi/Renderer/Utils/HzbGenerator.cpp
  38. 12 12
      AnKi/Renderer/Utils/TraditionalDeferredShading.cpp
  39. 11 11
      AnKi/Renderer/VolumetricFog.cpp
  40. 17 17
      AnKi/Renderer/VolumetricLightingAccumulation.cpp
  41. 2 2
      AnKi/Renderer/VrsSriGeneration.cpp
  42. 15 15
      AnKi/Resource/MaterialResource.cpp
  43. 11 11
      AnKi/Resource/MaterialResource.h
  44. 1 1
      AnKi/Scene/Components/GlobalIlluminationProbeComponent.cpp
  45. 13 13
      AnKi/Scene/Components/ModelComponent.cpp
  46. 2 2
      AnKi/Scene/Components/ModelComponent.h
  47. 7 6
      AnKi/Scene/Components/ParticleEmitterComponent.cpp
  48. 1 1
      AnKi/Scene/Components/ParticleEmitterComponent.h
  49. 1 1
      AnKi/ShaderCompiler/Dxc.cpp
  50. 1 1
      AnKi/ShaderCompiler/Dxc.h
  51. 6 6
      AnKi/ShaderCompiler/ShaderCompiler.cpp
  52. 1 3
      AnKi/ShaderCompiler/ShaderParser.cpp
  53. 4 4
      AnKi/Shaders/Blit.ankiprog
  54. 3 3
      AnKi/Shaders/Bloom.ankiprog
  55. 4 4
      AnKi/Shaders/ClearTextureCompute.ankiprog
  56. 17 17
      AnKi/Shaders/ClusterBinning.ankiprog
  57. 3 3
      AnKi/Shaders/ClusterBinningSetup.ankiprog
  58. 1 1
      AnKi/Shaders/ClusteredShadingFunctions.hlsl
  59. 2 2
      AnKi/Shaders/Common.hlsl
  60. 4 4
      AnKi/Shaders/DbgBillboard.ankiprog
  61. 5 5
      AnKi/Shaders/DbgRenderables.ankiprog
  62. 3 3
      AnKi/Shaders/DepthDownscale.ankiprog
  63. 3 3
      AnKi/Shaders/DownscaleBlur.ankiprog
  64. 6 5
      AnKi/Shaders/FinalComposite.ankiprog
  65. 6 6
      AnKi/Shaders/ForwardShadingCommon.hlsl
  66. 7 7
      AnKi/Shaders/ForwardShadingFog.ankiprog
  67. 7 7
      AnKi/Shaders/ForwardShadingGenericTransparent.ankiprog
  68. 11 11
      AnKi/Shaders/ForwardShadingParticles.ankiprog
  69. 6 6
      AnKi/Shaders/Fsr.ankiprog
  70. 37 37
      AnKi/Shaders/GBufferGeneric.ankiprog
  71. 12 12
      AnKi/Shaders/GBufferGpuParticles.ankiprog
  72. 3 3
      AnKi/Shaders/GBufferPost.ankiprog
  73. 6 6
      AnKi/Shaders/GpuVisibilityAccelerationStructures.ankiprog
  74. 2 2
      AnKi/Shaders/GpuVisibilityNonRenderables.ankiprog
  75. 10 10
      AnKi/Shaders/GpuVisibilityStage1.ankiprog
  76. 8 8
      AnKi/Shaders/GpuVisibilityStage2And3.ankiprog
  77. 4 4
      AnKi/Shaders/HzbGenPyramid.ankiprog
  78. 5 5
      AnKi/Shaders/HzbMaxDepthProject.ankiprog
  79. 2 2
      AnKi/Shaders/Include/GpuSceneFunctions.h
  80. 3 3
      AnKi/Shaders/Include/GpuSceneTypes.h
  81. 5 5
      AnKi/Shaders/Include/GpuVisibilityTypes.h
  82. 4 4
      AnKi/Shaders/Include/MaterialTypes.h
  83. 9 9
      AnKi/Shaders/Include/MiscRendererTypes.h
  84. 2 2
      AnKi/Shaders/Include/TraditionalDeferredShadingTypes.h
  85. 5 4
      AnKi/Shaders/IrradianceDice.ankiprog
  86. 1 1
      AnKi/Shaders/LensFlareUpdateIndirectInfo.ankiprog
  87. 6 6
      AnKi/Shaders/LightShading.ankiprog
  88. 4 4
      AnKi/Shaders/LightShadingApplyFog.ankiprog
  89. 13 13
      AnKi/Shaders/LightShadingSkybox.ankiprog
  90. 4 4
      AnKi/Shaders/MaterialShadersCommon.hlsl
  91. 5 5
      AnKi/Shaders/MotionVectors.ankiprog
  92. 4 4
      AnKi/Shaders/RtShadows.ankiprog
  93. 5 5
      AnKi/Shaders/RtShadowsDenoise.ankiprog
  94. 6 6
      AnKi/Shaders/RtShadowsSbtBuild.ankiprog
  95. 1 1
      AnKi/Shaders/RtShadowsSvgfAtrous.ankiprog
  96. 1 1
      AnKi/Shaders/RtShadowsSvgfVariance.ankiprog
  97. 3 3
      AnKi/Shaders/ShadowMappingVetVisibility.ankiprog
  98. 12 12
      AnKi/Shaders/ShadowmapsResolve.ankiprog
  99. 6 6
      AnKi/Shaders/Sky.ankiprog
  100. 21 20
      AnKi/Shaders/Ssao.ankiprog

+ 2 - 2
AnKi/Gr/CommandBuffer.h

@@ -227,8 +227,8 @@ public:
 	/// Bind a buffer.
 	/// Bind a buffer.
 	void bindUav(U32 reg, U32 space, const BufferView& buffer, Format fmt = Format::kNone);
 	void bindUav(U32 reg, U32 space, const BufferView& buffer, Format fmt = Format::kNone);
 
 
-	/// Set push constants.
-	void setPushConstants(const void* data, U32 dataSize);
+	/// Set push constants (Vulkan) or root constants (D3D).
+	void setFastConstants(const void* data, U32 dataSize);
 
 
 	/// Bind a program.
 	/// Bind a program.
 	void bindShaderProgram(ShaderProgram* prog);
 	void bindShaderProgram(ShaderProgram* prog);

+ 11 - 11
AnKi/Gr/Common.cpp

@@ -128,23 +128,23 @@ Error ShaderReflection::linkShaderReflection(const ShaderReflection& a, const Sh
 	ShaderReflection c;
 	ShaderReflection c;
 
 
 	memcpy(&c.m_descriptor, &a.m_descriptor, sizeof(a.m_descriptor));
 	memcpy(&c.m_descriptor, &a.m_descriptor, sizeof(a.m_descriptor));
-	for(U32 set = 0; set < kMaxDescriptorSets; ++set)
+	for(U32 space = 0; space < kMaxRegisterSpaces; ++space)
 	{
 	{
-		for(U32 binding = 0; binding < b.m_descriptor.m_bindingCounts[set]; ++binding)
+		for(U32 binding = 0; binding < b.m_descriptor.m_bindingCounts[space]; ++binding)
 		{
 		{
 			// Search for the binding in a
 			// Search for the binding in a
-			const ShaderReflectionBinding& bbinding = b.m_descriptor.m_bindings[set][binding];
+			const ShaderReflectionBinding& bbinding = b.m_descriptor.m_bindings[space][binding];
 			Bool bindingFoundOnA = false;
 			Bool bindingFoundOnA = false;
-			for(U32 binding2 = 0; binding2 < a.m_descriptor.m_bindingCounts[set]; ++binding2)
+			for(U32 binding2 = 0; binding2 < a.m_descriptor.m_bindingCounts[space]; ++binding2)
 			{
 			{
-				const ShaderReflectionBinding& abinding = a.m_descriptor.m_bindings[set][binding2];
+				const ShaderReflectionBinding& abinding = a.m_descriptor.m_bindings[space][binding2];
 
 
 				if(abinding.m_registerBindingPoint == bbinding.m_registerBindingPoint
 				if(abinding.m_registerBindingPoint == bbinding.m_registerBindingPoint
 				   && descriptorTypeToHlslResourceType(abinding.m_type) == descriptorTypeToHlslResourceType(bbinding.m_type))
 				   && descriptorTypeToHlslResourceType(abinding.m_type) == descriptorTypeToHlslResourceType(bbinding.m_type))
 				{
 				{
 					if(abinding != bbinding)
 					if(abinding != bbinding)
 					{
 					{
-						ANKI_GR_LOGE("Can't link shader reflection because of different bindings. Set %u binding %u", set, binding);
+						ANKI_GR_LOGE("Can't link shader reflection because of different bindings. Space %u binding %u", space, binding);
 						return Error::kFunctionFailed;
 						return Error::kFunctionFailed;
 					}
 					}
 					bindingFoundOnA = true;
 					bindingFoundOnA = true;
@@ -154,18 +154,18 @@ Error ShaderReflection::linkShaderReflection(const ShaderReflection& a, const Sh
 
 
 			if(!bindingFoundOnA)
 			if(!bindingFoundOnA)
 			{
 			{
-				c.m_descriptor.m_bindings[set][c.m_descriptor.m_bindingCounts[set]++] = bbinding;
+				c.m_descriptor.m_bindings[space][c.m_descriptor.m_bindingCounts[space]++] = bbinding;
 			}
 			}
 		}
 		}
 	}
 	}
 
 
-	if(a.m_descriptor.m_pushConstantsSize != 0 && b.m_descriptor.m_pushConstantsSize != 0
-	   && a.m_descriptor.m_pushConstantsSize != b.m_descriptor.m_pushConstantsSize)
+	if(a.m_descriptor.m_fastConstantsSize != 0 && b.m_descriptor.m_fastConstantsSize != 0
+	   && a.m_descriptor.m_fastConstantsSize != b.m_descriptor.m_fastConstantsSize)
 	{
 	{
-		ANKI_GR_LOGE("Can't link shader reflection because push constant size doesn't match");
+		ANKI_GR_LOGE("Can't link shader reflection because fast constant size doesn't match");
 		return Error::kFunctionFailed;
 		return Error::kFunctionFailed;
 	}
 	}
-	c.m_descriptor.m_pushConstantsSize = max(a.m_descriptor.m_pushConstantsSize, b.m_descriptor.m_pushConstantsSize);
+	c.m_descriptor.m_fastConstantsSize = max(a.m_descriptor.m_fastConstantsSize, b.m_descriptor.m_fastConstantsSize);
 
 
 	c.m_descriptor.m_hasVkBindlessDescriptorSet = a.m_descriptor.m_hasVkBindlessDescriptorSet || b.m_descriptor.m_hasVkBindlessDescriptorSet;
 	c.m_descriptor.m_hasVkBindlessDescriptorSet = a.m_descriptor.m_hasVkBindlessDescriptorSet || b.m_descriptor.m_hasVkBindlessDescriptorSet;
 
 

+ 10 - 11
AnKi/Gr/Common.h

@@ -58,13 +58,12 @@ ANKI_DEFINE_SUBMODULE_UTIL_CONTAINERS(Gr, GrMemoryPool)
 
 
 // Some constants
 // Some constants
 constexpr U32 kMaxColorRenderTargets = 4;
 constexpr U32 kMaxColorRenderTargets = 4;
-constexpr U32 kMaxDescriptorSets = 3; ///< Groups that can be bound at the same time.
-constexpr U32 kMaxBindingsPerDescriptorSet = 32;
+constexpr U32 kMaxRegisterSpaces = 3; ///< Groups that can be bound at the same time.
+constexpr U32 kMaxBindingsPerRegisterSpace = 32;
 constexpr U32 kMaxFramesInFlight = 3; ///< Triple buffering.
 constexpr U32 kMaxFramesInFlight = 3; ///< Triple buffering.
 constexpr U32 kMaxGrObjectNameLength = 61;
 constexpr U32 kMaxGrObjectNameLength = 61;
 constexpr U32 kMaxBindlessTextures = 512;
 constexpr U32 kMaxBindlessTextures = 512;
-constexpr U32 kMaxBindlessReadonlyTextureBuffers = 512;
-constexpr U32 kMaxPushConstantSize = 128; ///< Thanks AMD!!
+constexpr U32 kMaxFastConstantsSize = 128; ///< Thanks AMD!!
 
 
 /// The number of commands in a command buffer that make it a small batch command buffer.
 /// The number of commands in a command buffer that make it a small batch command buffer.
 constexpr U32 kCommandBufferSmallBatchMaxCommands = 100;
 constexpr U32 kCommandBufferSmallBatchMaxCommands = 100;
@@ -162,8 +161,8 @@ public:
 	/// The max visible range of texture buffers inside the shaders.
 	/// The max visible range of texture buffers inside the shaders.
 	PtrSize m_textureBufferMaxRange = 0;
 	PtrSize m_textureBufferMaxRange = 0;
 
 
-	/// Max push constant size.
-	PtrSize m_pushConstantsSize = 128;
+	/// Max push/root constant size.
+	PtrSize m_fastConstantsSize = 128;
 
 
 	/// The max combined size of shared variables (with paddings) in compute shaders.
 	/// The max combined size of shared variables (with paddings) in compute shaders.
 	PtrSize m_computeSharedMemorySize = 16_KB;
 	PtrSize m_computeSharedMemorySize = 16_KB;
@@ -962,20 +961,20 @@ class ShaderReflectionDescriptorRelated
 {
 {
 public:
 public:
 	/// The D3D backend expects bindings inside a space need to be ordered by HLSL type and then by register.
 	/// The D3D backend expects bindings inside a space need to be ordered by HLSL type and then by register.
-	Array2d<ShaderReflectionBinding, kMaxDescriptorSets, kMaxBindingsPerDescriptorSet> m_bindings;
+	Array2d<ShaderReflectionBinding, kMaxRegisterSpaces, kMaxBindingsPerRegisterSpace> m_bindings;
 
 
-	Array<U8, kMaxDescriptorSets> m_bindingCounts = {};
+	Array<U8, kMaxRegisterSpaces> m_bindingCounts = {};
 
 
-	U32 m_pushConstantsSize = 0;
+	U32 m_fastConstantsSize = 0;
 
 
 	Bool m_hasVkBindlessDescriptorSet = false; ///< Filled by the shader compiler.
 	Bool m_hasVkBindlessDescriptorSet = false; ///< Filled by the shader compiler.
 	U8 m_vkBindlessDescriptorSet = kMaxU8; ///< Filled by the VK backend.
 	U8 m_vkBindlessDescriptorSet = kMaxU8; ///< Filled by the VK backend.
 
 
 	void validate() const
 	void validate() const
 	{
 	{
-		for(U32 set = 0; set < kMaxDescriptorSets; ++set)
+		for(U32 set = 0; set < kMaxRegisterSpaces; ++set)
 		{
 		{
-			for(U32 ibinding = 0; ibinding < kMaxBindingsPerDescriptorSet; ++ibinding)
+			for(U32 ibinding = 0; ibinding < kMaxBindingsPerRegisterSpace; ++ibinding)
 			{
 			{
 				const ShaderReflectionBinding& binding = m_bindings[set][ibinding];
 				const ShaderReflectionBinding& binding = m_bindings[set][ibinding];
 
 

+ 1 - 1
AnKi/Gr/D3D/D3DCommandBuffer.cpp

@@ -803,7 +803,7 @@ Bool CommandBuffer::isEmpty() const
 	return self.m_commandCount == 0;
 	return self.m_commandCount == 0;
 }
 }
 
 
-void CommandBuffer::setPushConstants(const void* data, U32 dataSize)
+void CommandBuffer::setFastConstants(const void* data, U32 dataSize)
 {
 {
 	ANKI_D3D_SELF(CommandBufferImpl);
 	ANKI_D3D_SELF(CommandBufferImpl);
 	self.m_descriptors.setRootConstants(data, dataSize);
 	self.m_descriptors.setRootConstants(data, dataSize);

+ 10 - 10
AnKi/Gr/D3D/D3DDescriptor.cpp

@@ -263,9 +263,9 @@ Error RootSignatureFactory::getOrCreateRootSignature(const ShaderReflection& ref
 	GrDynamicArray<D3D12_ROOT_PARAMETER1> rootParameters;
 	GrDynamicArray<D3D12_ROOT_PARAMETER1> rootParameters;
 
 
 	// Create the tables
 	// Create the tables
-	Array<GrDynamicArray<D3D12_DESCRIPTOR_RANGE1>, kMaxBindingsPerDescriptorSet * 2> tableRanges; // One per descriptor table
+	Array<GrDynamicArray<D3D12_DESCRIPTOR_RANGE1>, kMaxBindingsPerRegisterSpace * 2> tableRanges; // One per descriptor table
 	U32 tableRangesCount = 0;
 	U32 tableRangesCount = 0;
-	for(U32 space = 0; space < kMaxDescriptorSets; ++space)
+	for(U32 space = 0; space < kMaxRegisterSpaces; ++space)
 	{
 	{
 		if(refl.m_descriptor.m_bindingCounts[space] == 0)
 		if(refl.m_descriptor.m_bindingCounts[space] == 0)
 		{
 		{
@@ -339,13 +339,13 @@ Error RootSignatureFactory::getOrCreateRootSignature(const ShaderReflection& ref
 	}
 	}
 
 
 	// Root constants
 	// Root constants
-	if(refl.m_descriptor.m_pushConstantsSize)
+	if(refl.m_descriptor.m_fastConstantsSize)
 	{
 	{
 		D3D12_ROOT_PARAMETER1& rootParam = *rootParameters.emplaceBack();
 		D3D12_ROOT_PARAMETER1& rootParam = *rootParameters.emplaceBack();
 		rootParam = {};
 		rootParam = {};
 		rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
 		rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
-		ANKI_ASSERT((refl.m_descriptor.m_pushConstantsSize % 4) == 0);
-		rootParam.Constants.Num32BitValues = refl.m_descriptor.m_pushConstantsSize / 4;
+		ANKI_ASSERT((refl.m_descriptor.m_fastConstantsSize % 4) == 0);
+		rootParam.Constants.Num32BitValues = refl.m_descriptor.m_fastConstantsSize / 4;
 		rootParam.Constants.RegisterSpace = 3000;
 		rootParam.Constants.RegisterSpace = 3000;
 		rootParam.Constants.ShaderRegister = 0;
 		rootParam.Constants.ShaderRegister = 0;
 		rootParam.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
 		rootParam.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
@@ -377,7 +377,7 @@ Error RootSignatureFactory::getOrCreateRootSignature(const ShaderReflection& ref
 	signature->m_rootSignature = dxRootSig;
 	signature->m_rootSignature = dxRootSig;
 
 
 	U8 rootParameterIdx = 0;
 	U8 rootParameterIdx = 0;
-	for(U32 spaceIdx = 0; spaceIdx < kMaxDescriptorSets; ++spaceIdx)
+	for(U32 spaceIdx = 0; spaceIdx < kMaxRegisterSpaces; ++spaceIdx)
 	{
 	{
 		if(refl.m_descriptor.m_bindingCounts[spaceIdx] == 0)
 		if(refl.m_descriptor.m_bindingCounts[spaceIdx] == 0)
 		{
 		{
@@ -430,7 +430,7 @@ Error RootSignatureFactory::getOrCreateRootSignature(const ShaderReflection& ref
 		}
 		}
 	}
 	}
 
 
-	signature->m_rootConstantsSize = refl.m_descriptor.m_pushConstantsSize;
+	signature->m_rootConstantsSize = refl.m_descriptor.m_fastConstantsSize;
 	if(signature->m_rootConstantsSize)
 	if(signature->m_rootConstantsSize)
 	{
 	{
 		signature->m_rootConstantsParameterIdx = rootParameterIdx++;
 		signature->m_rootConstantsParameterIdx = rootParameterIdx++;
@@ -462,7 +462,7 @@ void DescriptorState::bindRootSignature(const RootSignature* rootSignature, Bool
 		return;
 		return;
 	}
 	}
 
 
-	for(U32 space = 0; space < kMaxDescriptorSets; ++space)
+	for(U32 space = 0; space < kMaxRegisterSpaces; ++space)
 	{
 	{
 		if(!rootSignature->m_spaces[space].isEmpty())
 		if(!rootSignature->m_spaces[space].isEmpty())
 		{
 		{
@@ -496,7 +496,7 @@ void DescriptorState::flush(ID3D12GraphicsCommandList& cmdList)
 	}
 	}
 
 
 	// Populate the heaps
 	// Populate the heaps
-	for(U32 spaceIdx = 0; spaceIdx < kMaxDescriptorSets; ++spaceIdx)
+	for(U32 spaceIdx = 0; spaceIdx < kMaxRegisterSpaces; ++spaceIdx)
 	{
 	{
 		const RootSignature::Space& rootSignatureSpace = m_rootSignature->m_spaces[spaceIdx];
 		const RootSignature::Space& rootSignatureSpace = m_rootSignature->m_spaces[spaceIdx];
 		if(rootSignatureSpace.isEmpty())
 		if(rootSignatureSpace.isEmpty())
@@ -718,7 +718,7 @@ void DescriptorState::flush(ID3D12GraphicsCommandList& cmdList)
 	}
 	}
 
 
 	// Bind root parameters
 	// Bind root parameters
-	for(U32 spaceIdx = 0; spaceIdx < kMaxDescriptorSets; ++spaceIdx)
+	for(U32 spaceIdx = 0; spaceIdx < kMaxRegisterSpaces; ++spaceIdx)
 	{
 	{
 		const RootSignature::Space& rootSignatureSpace = m_rootSignature->m_spaces[spaceIdx];
 		const RootSignature::Space& rootSignatureSpace = m_rootSignature->m_spaces[spaceIdx];
 		if(rootSignatureSpace.isEmpty())
 		if(rootSignatureSpace.isEmpty())

+ 4 - 4
AnKi/Gr/D3D/D3DDescriptor.h

@@ -289,7 +289,7 @@ private:
 
 
 	ID3D12RootSignature* m_rootSignature = nullptr;
 	ID3D12RootSignature* m_rootSignature = nullptr;
 
 
-	Array<Space, kMaxDescriptorSets> m_spaces;
+	Array<Space, kMaxRegisterSpaces> m_spaces;
 
 
 	U32 m_rootConstantsSize = kMaxU32;
 	U32 m_rootConstantsSize = kMaxU32;
 	U8 m_rootConstantsParameterIdx = kMaxU8;
 	U8 m_rootConstantsParameterIdx = kMaxU8;
@@ -415,7 +415,7 @@ public:
 
 
 	void setRootConstants(const void* data, U32 dataSize)
 	void setRootConstants(const void* data, U32 dataSize)
 	{
 	{
-		ANKI_ASSERT(data && dataSize && dataSize <= kMaxPushConstantSize);
+		ANKI_ASSERT(data && dataSize && dataSize <= kMaxFastConstantsSize);
 		memcpy(m_rootConsts.getBegin(), data, dataSize);
 		memcpy(m_rootConsts.getBegin(), data, dataSize);
 		m_rootConstSize = dataSize;
 		m_rootConstSize = dataSize;
 		m_rootConstsDirty = true;
 		m_rootConstsDirty = true;
@@ -482,9 +482,9 @@ private:
 	};
 	};
 
 
 	const RootSignature* m_rootSignature = nullptr;
 	const RootSignature* m_rootSignature = nullptr;
-	Array<Space, kMaxDescriptorSets> m_spaces;
+	Array<Space, kMaxRegisterSpaces> m_spaces;
 
 
-	Array<U8, kMaxPushConstantSize> m_rootConsts;
+	Array<U8, kMaxFastConstantsSize> m_rootConsts;
 	U32 m_rootConstSize = 0;
 	U32 m_rootConstSize = 0;
 
 
 	Bool m_rootSignatureNeedsRebinding = true;
 	Bool m_rootSignatureNeedsRebinding = true;

+ 1 - 1
AnKi/Gr/D3D/D3DGrManager.cpp

@@ -438,7 +438,7 @@ Error GrManagerImpl::initInternal(const GrManagerInitInfo& init)
 		m_capabilities.m_storageBufferMaxRange = 1 << D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP;
 		m_capabilities.m_storageBufferMaxRange = 1 << D3D12_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP;
 		m_capabilities.m_texelBufferBindOffsetAlignment = 32;
 		m_capabilities.m_texelBufferBindOffsetAlignment = 32;
 		m_capabilities.m_textureBufferMaxRange = kMaxU32; // ?
 		m_capabilities.m_textureBufferMaxRange = kMaxU32; // ?
-		m_capabilities.m_pushConstantsSize = kMaxPushConstantSize;
+		m_capabilities.m_fastConstantsSize = kMaxFastConstantsSize;
 		m_capabilities.m_computeSharedMemorySize = D3D12_CS_TGSM_REGISTER_COUNT * sizeof(F32);
 		m_capabilities.m_computeSharedMemorySize = D3D12_CS_TGSM_REGISTER_COUNT * sizeof(F32);
 		m_capabilities.m_accelerationStructureBuildScratchOffsetAlignment = 32; // ?
 		m_capabilities.m_accelerationStructureBuildScratchOffsetAlignment = 32; // ?
 		m_capabilities.m_sbtRecordAlignment = 32; // ?
 		m_capabilities.m_sbtRecordAlignment = 32; // ?

+ 3 - 3
AnKi/Gr/Vulkan/VkCommandBuffer.cpp

@@ -1081,15 +1081,15 @@ Bool CommandBuffer::isEmpty() const
 	return self.isEmpty();
 	return self.isEmpty();
 }
 }
 
 
-void CommandBuffer::setPushConstants(const void* data, U32 dataSize)
+void CommandBuffer::setFastConstants(const void* data, U32 dataSize)
 {
 {
 	ANKI_VK_SELF(CommandBufferImpl);
 	ANKI_VK_SELF(CommandBufferImpl);
 	ANKI_ASSERT(data && dataSize && dataSize % 16 == 0);
 	ANKI_ASSERT(data && dataSize && dataSize % 16 == 0);
-	ANKI_ASSERT(static_cast<const ShaderProgramImpl&>(self.getBoundProgram()).getReflection().m_descriptor.m_pushConstantsSize == dataSize
+	ANKI_ASSERT(static_cast<const ShaderProgramImpl&>(self.getBoundProgram()).getReflection().m_descriptor.m_fastConstantsSize == dataSize
 				&& "The bound program should have push constants equal to the \"dataSize\" parameter");
 				&& "The bound program should have push constants equal to the \"dataSize\" parameter");
 
 
 	self.commandCommon();
 	self.commandCommon();
-	self.m_descriptorState.setPushConstants(data, dataSize);
+	self.m_descriptorState.setFastConstants(data, dataSize);
 }
 }
 
 
 void CommandBuffer::setLineWidth(F32 width)
 void CommandBuffer::setLineWidth(F32 width)

+ 8 - 8
AnKi/Gr/Vulkan/VkDescriptor.cpp

@@ -346,7 +346,7 @@ Error PipelineLayoutFactory2::getOrCreateDescriptorSetLayout(ConstWeakArray<Shad
 	ANKI_END_PACKED_STRUCT
 	ANKI_END_PACKED_STRUCT
 
 
 	// Compute the hash for the layout
 	// Compute the hash for the layout
-	Array<DSBinding, kMaxBindingsPerDescriptorSet> bindings;
+	Array<DSBinding, kMaxBindingsPerRegisterSpace> bindings;
 	U64 hash;
 	U64 hash;
 
 
 	if(reflBindings.getSize())
 	if(reflBindings.getSize())
@@ -386,7 +386,7 @@ Error PipelineLayoutFactory2::getOrCreateDescriptorSetLayout(ConstWeakArray<Shad
 		layout = newInstance<DescriptorSetLayout>(GrMemoryPool::getSingleton());
 		layout = newInstance<DescriptorSetLayout>(GrMemoryPool::getSingleton());
 		m_dsLayouts.emplace(hash, layout);
 		m_dsLayouts.emplace(hash, layout);
 
 
-		Array<VkDescriptorSetLayoutBinding, kMaxBindingsPerDescriptorSet> vkBindings;
+		Array<VkDescriptorSetLayoutBinding, kMaxBindingsPerRegisterSpace> vkBindings;
 		VkDescriptorSetLayoutCreateInfo ci = {};
 		VkDescriptorSetLayoutCreateInfo ci = {};
 		ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
 		ci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
 
 
@@ -433,7 +433,7 @@ Error PipelineLayoutFactory2::getOrCreatePipelineLayout(const ShaderReflectionDe
 
 
 		// Find dset count
 		// Find dset count
 		layout->m_dsetCount = 0;
 		layout->m_dsetCount = 0;
-		for(U8 iset = 0; iset < kMaxDescriptorSets; ++iset)
+		for(U8 iset = 0; iset < kMaxRegisterSpaces; ++iset)
 		{
 		{
 			if(refl.m_bindingCounts[iset])
 			if(refl.m_bindingCounts[iset])
 			{
 			{
@@ -473,10 +473,10 @@ Error PipelineLayoutFactory2::getOrCreatePipelineLayout(const ShaderReflectionDe
 		ci.setLayoutCount = layout->m_dsetCount;
 		ci.setLayoutCount = layout->m_dsetCount;
 
 
 		VkPushConstantRange pushConstantRange;
 		VkPushConstantRange pushConstantRange;
-		if(refl.m_pushConstantsSize > 0)
+		if(refl.m_fastConstantsSize > 0)
 		{
 		{
 			pushConstantRange.offset = 0;
 			pushConstantRange.offset = 0;
-			pushConstantRange.size = refl.m_pushConstantsSize;
+			pushConstantRange.size = refl.m_fastConstantsSize;
 			pushConstantRange.stageFlags = VK_SHADER_STAGE_ALL;
 			pushConstantRange.stageFlags = VK_SHADER_STAGE_ALL;
 			ci.pushConstantRangeCount = 1;
 			ci.pushConstantRangeCount = 1;
 			ci.pPushConstantRanges = &pushConstantRange;
 			ci.pPushConstantRanges = &pushConstantRange;
@@ -495,7 +495,7 @@ void DescriptorState::flush(VkCommandBuffer cmdb, DescriptorAllocator& dalloc)
 	const ShaderReflectionDescriptorRelated& refl = m_pipelineLayout->getReflection();
 	const ShaderReflectionDescriptorRelated& refl = m_pipelineLayout->getReflection();
 
 
 	// Small opt to bind the high frequency sets as little as possible
 	// Small opt to bind the high frequency sets as little as possible
-	BitSet<kMaxDescriptorSets> dirtySets(false);
+	BitSet<kMaxRegisterSpaces> dirtySets(false);
 
 
 	for(U32 iset = 0; iset < m_pipelineLayout->m_dsetCount; ++iset)
 	for(U32 iset = 0; iset < m_pipelineLayout->m_dsetCount; ++iset)
 	{
 	{
@@ -608,9 +608,9 @@ void DescriptorState::flush(VkCommandBuffer cmdb, DescriptorAllocator& dalloc)
 	}
 	}
 
 
 	// Set push consts
 	// Set push consts
-	if(refl.m_pushConstantsSize)
+	if(refl.m_fastConstantsSize)
 	{
 	{
-		ANKI_ASSERT(refl.m_pushConstantsSize == m_pushConstSize && "Possibly forgot to set push constants");
+		ANKI_ASSERT(refl.m_fastConstantsSize == m_pushConstSize && "Possibly forgot to set push constants");
 
 
 		if(m_pushConstantsDirty)
 		if(m_pushConstantsDirty)
 		{
 		{

+ 8 - 8
AnKi/Gr/Vulkan/VkDescriptor.h

@@ -112,8 +112,8 @@ public:
 private:
 private:
 	VkPipelineLayout m_handle = VK_NULL_HANDLE;
 	VkPipelineLayout m_handle = VK_NULL_HANDLE;
 	ShaderReflectionDescriptorRelated m_refl;
 	ShaderReflectionDescriptorRelated m_refl;
-	Array<VkDescriptorSetLayout, kMaxDescriptorSets> m_dsetLayouts = {};
-	Array<U32, kMaxDescriptorSets> m_descriptorCounts = {};
+	Array<VkDescriptorSetLayout, kMaxRegisterSpaces> m_dsetLayouts = {};
+	Array<U32, kMaxRegisterSpaces> m_descriptorCounts = {};
 	U8 m_dsetCount = 0;
 	U8 m_dsetCount = 0;
 };
 };
 
 
@@ -162,7 +162,7 @@ public:
 		{
 		{
 			m_pipelineLayout = layout;
 			m_pipelineLayout = layout;
 			m_pipelineBindPoint = bindPoint;
 			m_pipelineBindPoint = bindPoint;
-			m_pushConstantsDirty = m_pushConstantsDirty || (m_pushConstSize != m_pipelineLayout->m_refl.m_pushConstantsSize);
+			m_pushConstantsDirty = m_pushConstantsDirty || (m_pushConstSize != m_pipelineLayout->m_refl.m_fastConstantsSize);
 
 
 			for(U32 iset = 0; iset < m_pipelineLayout->m_dsetCount; ++iset)
 			for(U32 iset = 0; iset < m_pipelineLayout->m_dsetCount; ++iset)
 			{
 			{
@@ -280,9 +280,9 @@ public:
 #endif
 #endif
 	}
 	}
 
 
-	void setPushConstants(const void* data, U32 dataSize)
+	void setFastConstants(const void* data, U32 dataSize)
 	{
 	{
-		ANKI_ASSERT(data && dataSize && dataSize <= kMaxPushConstantSize);
+		ANKI_ASSERT(data && dataSize && dataSize <= kMaxFastConstantsSize);
 		memcpy(m_pushConsts.getBegin(), data, dataSize);
 		memcpy(m_pushConsts.getBegin(), data, dataSize);
 		m_pushConstSize = dataSize;
 		m_pushConstSize = dataSize;
 		m_pushConstantsDirty = true;
 		m_pushConstantsDirty = true;
@@ -331,10 +331,10 @@ private:
 
 
 	const PipelineLayout2* m_pipelineLayout = nullptr;
 	const PipelineLayout2* m_pipelineLayout = nullptr;
 	VkPipelineBindPoint m_pipelineBindPoint = VK_PIPELINE_BIND_POINT_MAX_ENUM;
 	VkPipelineBindPoint m_pipelineBindPoint = VK_PIPELINE_BIND_POINT_MAX_ENUM;
-	Array<DescriptorSet, kMaxDescriptorSets> m_sets;
-	Array<VkDescriptorSet, kMaxDescriptorSets> m_vkDsets = {};
+	Array<DescriptorSet, kMaxRegisterSpaces> m_sets;
+	Array<VkDescriptorSet, kMaxRegisterSpaces> m_vkDsets = {};
 
 
-	Array<U8, kMaxPushConstantSize> m_pushConsts;
+	Array<U8, kMaxFastConstantsSize> m_pushConsts;
 	U32 m_pushConstSize = 0;
 	U32 m_pushConstSize = 0;
 	Bool m_pushConstantsDirty = true;
 	Bool m_pushConstantsDirty = true;
 
 

+ 6 - 6
AnKi/Gr/Vulkan/VkShaderProgram.cpp

@@ -455,7 +455,7 @@ void ShaderProgramImpl::rewriteSpirv(ShaderReflectionDescriptorRelated& refl, Gr
 	// Find a binding for the bindless DS
 	// Find a binding for the bindless DS
 	if(refl.m_hasVkBindlessDescriptorSet)
 	if(refl.m_hasVkBindlessDescriptorSet)
 	{
 	{
-		for(U8 iset = 0; iset < kMaxDescriptorSets; ++iset)
+		for(U8 iset = 0; iset < kMaxRegisterSpaces; ++iset)
 		{
 		{
 			if(refl.m_bindingCounts[iset] == 0)
 			if(refl.m_bindingCounts[iset] == 0)
 			{
 			{
@@ -468,7 +468,7 @@ void ShaderProgramImpl::rewriteSpirv(ShaderReflectionDescriptorRelated& refl, Gr
 	// Re-write all SPIRVs and compute the new bindings
 	// Re-write all SPIRVs and compute the new bindings
 	rewrittenSpirvs.resize(m_shaders.getSize());
 	rewrittenSpirvs.resize(m_shaders.getSize());
 	Bool hasBindless = false;
 	Bool hasBindless = false;
-	Array<U16, kMaxDescriptorSets> vkBindingCount = {};
+	Array<U16, kMaxRegisterSpaces> vkBindingCount = {};
 	for(U32 ishader = 0; ishader < m_shaders.getSize(); ++ishader)
 	for(U32 ishader = 0; ishader < m_shaders.getSize(); ++ishader)
 	{
 	{
 		ConstWeakArray<U32> inSpirv = static_cast<const ShaderImpl&>(*m_shaders[ishader]).m_spirvBin;
 		ConstWeakArray<U32> inSpirv = static_cast<const ShaderImpl&>(*m_shaders[ishader]).m_spirvBin;
@@ -480,14 +480,14 @@ void ShaderProgramImpl::rewriteSpirv(ShaderReflectionDescriptorRelated& refl, Gr
 		visitSpirv(WeakArray<U32>(outSpv), [&](U32 cmd, WeakArray<U32> instructions) {
 		visitSpirv(WeakArray<U32>(outSpv), [&](U32 cmd, WeakArray<U32> instructions) {
 			if(cmd == spv::OpDecorate && instructions[1] == spv::DecorationBinding
 			if(cmd == spv::OpDecorate && instructions[1] == spv::DecorationBinding
 			   && instructions[2] >= kDxcVkBindingShifts[0][HlslResourceType::kFirst]
 			   && instructions[2] >= kDxcVkBindingShifts[0][HlslResourceType::kFirst]
-			   && instructions[2] < kDxcVkBindingShifts[kMaxDescriptorSets - 1][HlslResourceType::kCount - 1])
+			   && instructions[2] < kDxcVkBindingShifts[kMaxRegisterSpaces - 1][HlslResourceType::kCount - 1])
 			{
 			{
 				const U32 binding = instructions[2];
 				const U32 binding = instructions[2];
 
 
 				// Look at the binding and derive a few things. See the DXC compilation on what they mean
 				// Look at the binding and derive a few things. See the DXC compilation on what they mean
-				U32 set = kMaxDescriptorSets;
+				U32 set = kMaxRegisterSpaces;
 				HlslResourceType hlslResourceType = HlslResourceType::kCount;
 				HlslResourceType hlslResourceType = HlslResourceType::kCount;
-				for(set = 0; set < kMaxDescriptorSets; ++set)
+				for(set = 0; set < kMaxRegisterSpaces; ++set)
 				{
 				{
 					for(HlslResourceType hlslResourceType_ : EnumIterable<HlslResourceType>())
 					for(HlslResourceType hlslResourceType_ : EnumIterable<HlslResourceType>())
 					{
 					{
@@ -504,7 +504,7 @@ void ShaderProgramImpl::rewriteSpirv(ShaderReflectionDescriptorRelated& refl, Gr
 					}
 					}
 				}
 				}
 
 
-				ANKI_ASSERT(set < kMaxDescriptorSets);
+				ANKI_ASSERT(set < kMaxRegisterSpaces);
 				ANKI_ASSERT(hlslResourceType < HlslResourceType::kCount);
 				ANKI_ASSERT(hlslResourceType < HlslResourceType::kCount);
 				const U32 registerBindingPoint = binding - kDxcVkBindingShifts[set][hlslResourceType];
 				const U32 registerBindingPoint = binding - kDxcVkBindingShifts[set][hlslResourceType];
 
 

+ 1 - 1
AnKi/Renderer/Bloom.cpp

@@ -116,7 +116,7 @@ void Bloom::populateRenderGraph(RenderingContext& ctx)
 			rgraphCtx.bindSrv(0, 0, getRenderer().getDownscaleBlur().getRt(), inputTexSubresource);
 			rgraphCtx.bindSrv(0, 0, getRenderer().getDownscaleBlur().getRt(), inputTexSubresource);
 
 
 			const Vec4 consts(g_bloomThresholdCVar.get(), g_bloomScaleCVar.get(), 0.0f, 0.0f);
 			const Vec4 consts(g_bloomThresholdCVar.get(), g_bloomScaleCVar.get(), 0.0f, 0.0f);
-			cmdb.setPushConstants(&consts, sizeof(consts));
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			rgraphCtx.bindUav(0, 0, getRenderer().getTonemapping().getRt());
 			rgraphCtx.bindUav(0, 0, getRenderer().getTonemapping().getRt());
 
 

+ 12 - 12
AnKi/Renderer/ClusterBinning.cpp

@@ -82,7 +82,7 @@ void ClusterBinning::populateRenderGraph(RenderingContext& ctx)
 			cmdb.bindShaderProgram(m_jobSetupGrProg.get());
 			cmdb.bindShaderProgram(m_jobSetupGrProg.get());
 
 
 			const UVec4 consts(getRenderer().getTileCounts().x() * getRenderer().getTileCounts().y());
 			const UVec4 consts(getRenderer().getTileCounts().x() * getRenderer().getTileCounts().y());
-			cmdb.setPushConstants(&consts, sizeof(consts));
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			for(GpuSceneNonRenderableObjectType type : EnumIterable<GpuSceneNonRenderableObjectType>())
 			for(GpuSceneNonRenderableObjectType type : EnumIterable<GpuSceneNonRenderableObjectType>())
 			{
 			{
@@ -161,7 +161,7 @@ void ClusterBinning::populateRenderGraph(RenderingContext& ctx)
 				cmdb.bindSrv(1, 0, BufferView(&GpuSceneBuffer::getSingleton().getBuffer(), objBufferOffset, objBufferRange));
 				cmdb.bindSrv(1, 0, BufferView(&GpuSceneBuffer::getSingleton().getBuffer(), objBufferOffset, objBufferRange));
 				cmdb.bindUav(0, 0, m_runCtx.m_clustersBuffer);
 				cmdb.bindUav(0, 0, m_runCtx.m_clustersBuffer);
 
 
-				struct ClusterBinningUniforms
+				struct ClusterBinningConstants
 				{
 				{
 					Vec3 m_cameraOrigin;
 					Vec3 m_cameraOrigin;
 					F32 m_zSplitCountOverFrustumLength;
 					F32 m_zSplitCountOverFrustumLength;
@@ -178,23 +178,23 @@ void ClusterBinning::populateRenderGraph(RenderingContext& ctx)
 					I32 m_padding2;
 					I32 m_padding2;
 
 
 					Mat4 m_invertedViewProjMat;
 					Mat4 m_invertedViewProjMat;
-				} unis;
+				} consts;
 
 
-				unis.m_cameraOrigin = ctx.m_matrices.m_cameraTransform.getTranslationPart().xyz();
-				unis.m_zSplitCountOverFrustumLength = F32(getRenderer().getZSplitCount()) / (ctx.m_cameraFar - ctx.m_cameraNear);
-				unis.m_renderingSize = Vec2(getRenderer().getInternalResolution());
-				unis.m_tileCountX = getRenderer().getTileCounts().x();
-				unis.m_tileCount = getRenderer().getTileCounts().x() * getRenderer().getTileCounts().y();
+				consts.m_cameraOrigin = ctx.m_matrices.m_cameraTransform.getTranslationPart().xyz();
+				consts.m_zSplitCountOverFrustumLength = F32(getRenderer().getZSplitCount()) / (ctx.m_cameraFar - ctx.m_cameraNear);
+				consts.m_renderingSize = Vec2(getRenderer().getInternalResolution());
+				consts.m_tileCountX = getRenderer().getTileCounts().x();
+				consts.m_tileCount = getRenderer().getTileCounts().x() * getRenderer().getTileCounts().y();
 
 
 				Plane nearPlane;
 				Plane nearPlane;
 				extractClipPlane(ctx.m_matrices.m_viewProjection, FrustumPlaneType::kNear, nearPlane);
 				extractClipPlane(ctx.m_matrices.m_viewProjection, FrustumPlaneType::kNear, nearPlane);
-				unis.m_nearPlaneWorld = Vec4(nearPlane.getNormal().xyz(), nearPlane.getOffset());
+				consts.m_nearPlaneWorld = Vec4(nearPlane.getNormal().xyz(), nearPlane.getOffset());
 
 
-				unis.m_zSplitCountMinusOne = getRenderer().getZSplitCount() - 1;
+				consts.m_zSplitCountMinusOne = getRenderer().getZSplitCount() - 1;
 
 
-				unis.m_invertedViewProjMat = ctx.m_matrices.m_invertedViewProjectionJitter;
+				consts.m_invertedViewProjMat = ctx.m_matrices.m_invertedViewProjectionJitter;
 
 
-				cmdb.setPushConstants(&unis, sizeof(unis));
+				cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 				cmdb.dispatchComputeIndirect(BufferView(indirectArgsBuff).setOffset(indirectArgsBuffOffset).setRange(sizeof(DispatchIndirectArgs)));
 				cmdb.dispatchComputeIndirect(BufferView(indirectArgsBuff).setOffset(indirectArgsBuffOffset).setRange(sizeof(DispatchIndirectArgs)));
 
 

+ 1 - 1
AnKi/Renderer/Common.h

@@ -87,7 +87,7 @@ public:
 
 
 	Array<Mat4, kMaxShadowCascades> m_dirLightTextureMatrices;
 	Array<Mat4, kMaxShadowCascades> m_dirLightTextureMatrices;
 
 
-	BufferView m_globalRenderingUniformsBuffer;
+	BufferView m_globalRenderingConstantsBuffer;
 
 
 	RenderingContext(StackMemoryPool* pool)
 	RenderingContext(StackMemoryPool* pool)
 		: m_renderGraphDescr(pool)
 		: m_renderGraphDescr(pool)

+ 10 - 10
AnKi/Renderer/Dbg.cpp

@@ -125,15 +125,15 @@ void Dbg::drawNonRenderable(GpuSceneNonRenderableObjectType type, U32 objCount,
 	m_nonRenderablesProg->getOrCreateVariant(variantInitInfo, variant);
 	m_nonRenderablesProg->getOrCreateVariant(variantInitInfo, variant);
 	cmdb.bindShaderProgram(&variant->getProgram());
 	cmdb.bindShaderProgram(&variant->getProgram());
 
 
-	class Uniforms
+	class Constants
 	{
 	{
 	public:
 	public:
 		Mat4 m_viewProjMat;
 		Mat4 m_viewProjMat;
 		Mat3x4 m_camTrf;
 		Mat3x4 m_camTrf;
-	} unis;
-	unis.m_viewProjMat = ctx.m_matrices.m_viewProjection;
-	unis.m_camTrf = ctx.m_matrices.m_cameraTransform;
-	cmdb.setPushConstants(&unis, sizeof(unis));
+	} consts;
+	consts.m_viewProjMat = ctx.m_matrices.m_viewProjection;
+	consts.m_camTrf = ctx.m_matrices.m_cameraTransform;
+	cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 	cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(type));
 	cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(type));
 	cmdb.bindSrv(2, 0, getRenderer().getPrimaryNonRenderableVisibility().getVisibleIndicesBuffer(type));
 	cmdb.bindSrv(2, 0, getRenderer().getPrimaryNonRenderableVisibility().getVisibleIndicesBuffer(type));
@@ -173,16 +173,16 @@ void Dbg::run(RenderPassWorkContext& rgraphCtx, const RenderingContext& ctx)
 		m_renderablesProg->getOrCreateVariant(variantInitInfo, variant);
 		m_renderablesProg->getOrCreateVariant(variantInitInfo, variant);
 		cmdb.bindShaderProgram(&variant->getProgram());
 		cmdb.bindShaderProgram(&variant->getProgram());
 
 
-		class Uniforms
+		class Constants
 		{
 		{
 		public:
 		public:
 			Vec4 m_color;
 			Vec4 m_color;
 			Mat4 m_viewProjMat;
 			Mat4 m_viewProjMat;
-		} unis;
-		unis.m_color = Vec4(1.0f, 0.0f, 1.0f, 1.0f);
-		unis.m_viewProjMat = ctx.m_matrices.m_viewProjection;
+		} consts;
+		consts.m_color = Vec4(1.0f, 0.0f, 1.0f, 1.0f);
+		consts.m_viewProjMat = ctx.m_matrices.m_viewProjection;
 
 
-		cmdb.setPushConstants(&unis, sizeof(unis));
+		cmdb.setFastConstants(&consts, sizeof(consts));
 		cmdb.bindVertexBuffer(0, BufferView(m_cubeVertsBuffer.get()), sizeof(Vec3));
 		cmdb.bindVertexBuffer(0, BufferView(m_cubeVertsBuffer.get()), sizeof(Vec3));
 		cmdb.setVertexAttribute(VertexAttributeSemantic::kPosition, 0, Format::kR32G32B32_Sfloat, 0);
 		cmdb.setVertexAttribute(VertexAttributeSemantic::kPosition, 0, Format::kR32G32B32_Sfloat, 0);
 		cmdb.bindIndexBuffer(BufferView(m_cubeIndicesBuffer.get()), IndexType::kU16);
 		cmdb.bindIndexBuffer(BufferView(m_cubeIndicesBuffer.get()), IndexType::kU16);

+ 2 - 2
AnKi/Renderer/DepthDownscale.cpp

@@ -108,12 +108,12 @@ void DepthDownscale::populateRenderGraph(RenderingContext& ctx)
 			varAU4(rectInfo) = initAU4(0, 0, getRenderer().getInternalResolution().x(), getRenderer().getInternalResolution().y());
 			varAU4(rectInfo) = initAU4(0, 0, getRenderer().getInternalResolution().x(), getRenderer().getInternalResolution().y());
 			SpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo, m_mipCount);
 			SpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo, m_mipCount);
 
 
-			DepthDownscaleUniforms pc;
+			DepthDownscaleConstants pc;
 			pc.m_threadgroupCount = numWorkGroupsAndMips[0];
 			pc.m_threadgroupCount = numWorkGroupsAndMips[0];
 			pc.m_mipmapCount = numWorkGroupsAndMips[1];
 			pc.m_mipmapCount = numWorkGroupsAndMips[1];
 			pc.m_srcTexSizeOverOne = 1.0f / Vec2(getRenderer().getInternalResolution());
 			pc.m_srcTexSizeOverOne = 1.0f / Vec2(getRenderer().getInternalResolution());
 
 
-			cmdb.setPushConstants(&pc, sizeof(pc));
+			cmdb.setFastConstants(&pc, sizeof(pc));
 
 
 			for(U32 mip = 0; mip < kMaxMipsSinglePassDownsamplerCanProduce; ++mip)
 			for(U32 mip = 0; mip < kMaxMipsSinglePassDownsamplerCanProduce; ++mip)
 			{
 			{

+ 1 - 1
AnKi/Renderer/DownscaleBlur.cpp

@@ -135,7 +135,7 @@ void DownscaleBlur::run(U32 passIdx, RenderPassWorkContext& rgraphCtx)
 	if(g_preferComputeCVar.get())
 	if(g_preferComputeCVar.get())
 	{
 	{
 		const Vec4 fbSize(F32(vpWidth), F32(vpHeight), 0.0f, 0.0f);
 		const Vec4 fbSize(F32(vpWidth), F32(vpHeight), 0.0f, 0.0f);
-		cmdb.setPushConstants(&fbSize, sizeof(fbSize));
+		cmdb.setFastConstants(&fbSize, sizeof(fbSize));
 
 
 		rgraphCtx.bindUav(1, 0, m_runCtx.m_rt, TextureSubresourceDesc::surface(passIdx, 0, 0));
 		rgraphCtx.bindUav(1, 0, m_runCtx.m_rt, TextureSubresourceDesc::surface(passIdx, 0, 0));
 
 

+ 1 - 1
AnKi/Renderer/FinalComposite.cpp

@@ -150,7 +150,7 @@ void FinalComposite::run(RenderPassWorkContext& rgraphCtx)
 		}
 		}
 
 
 		const UVec4 pc(g_motionBlurSamplesCVar.get(), floatBitsToUint(g_filmGrainStrengthCVar.get()), getRenderer().getFrameCount() & kMaxU32, 0);
 		const UVec4 pc(g_motionBlurSamplesCVar.get(), floatBitsToUint(g_filmGrainStrengthCVar.get()), getRenderer().getFrameCount() & kMaxU32, 0);
-		cmdb.setPushConstants(&pc, sizeof(pc));
+		cmdb.setFastConstants(&pc, sizeof(pc));
 	}
 	}
 	else
 	else
 	{
 	{

+ 1 - 1
AnKi/Renderer/ForwardShading.cpp

@@ -64,7 +64,7 @@ void ForwardShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgr
 						  DepthDownscale::kQuarterInternalResolution);
 						  DepthDownscale::kQuarterInternalResolution);
 		rgraphCtx.bindSrv(ANKI_MATERIAL_REGISTER_LIGHT_VOLUME, 0, getRenderer().getVolumetricLightingAccumulation().getRt());
 		rgraphCtx.bindSrv(ANKI_MATERIAL_REGISTER_LIGHT_VOLUME, 0, getRenderer().getVolumetricLightingAccumulation().getRt());
 
 
-		cmdb.bindConstantBuffer(ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_UNIFORMS, 0, ctx.m_globalRenderingUniformsBuffer);
+		cmdb.bindConstantBuffer(ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_CONSTANTS, 0, ctx.m_globalRenderingConstantsBuffer);
 
 
 		cmdb.bindSrv(ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS, 0,
 		cmdb.bindSrv(ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS, 0,
 					 getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 					 getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));

+ 1 - 1
AnKi/Renderer/GBufferPost.cpp

@@ -62,7 +62,7 @@ void GBufferPost::populateRenderGraph(RenderingContext& ctx)
 
 
 		cmdb.bindSampler(1, 0, getRenderer().getSamplers().m_trilinearRepeat.get());
 		cmdb.bindSampler(1, 0, getRenderer().getSamplers().m_trilinearRepeat.get());
 
 
-		cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingUniformsBuffer);
+		cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingConstantsBuffer);
 		cmdb.bindSrv(0, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kDecal));
 		cmdb.bindSrv(0, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kDecal));
 		cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getClustersBuffer());
 		cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getClustersBuffer());
 
 

+ 5 - 5
AnKi/Renderer/IndirectDiffuseProbes.cpp

@@ -421,7 +421,7 @@ void IndirectDiffuseProbes::populateRenderGraph(RenderingContext& rctx)
 					dsInfo.m_gbufferDepthRenderTarget = gbufferDepthRt;
 					dsInfo.m_gbufferDepthRenderTarget = gbufferDepthRt;
 					dsInfo.m_directionalLightShadowmapRenderTarget = shadowsRt;
 					dsInfo.m_directionalLightShadowmapRenderTarget = shadowsRt;
 					dsInfo.m_skyLutRenderTarget = (getRenderer().getSky().isEnabled()) ? getRenderer().getSky().getSkyLutRt() : RenderTargetHandle();
 					dsInfo.m_skyLutRenderTarget = (getRenderer().getSky().isEnabled()) ? getRenderer().getSky().getSkyLutRt() : RenderTargetHandle();
-					dsInfo.m_globalRendererConsts = rctx.m_globalRenderingUniformsBuffer;
+					dsInfo.m_globalRendererConsts = rctx.m_globalRenderingConstantsBuffer;
 					dsInfo.m_renderpassContext = &rgraphCtx;
 					dsInfo.m_renderpassContext = &rgraphCtx;
 
 
 					m_lightShading.m_deferred.drawLights(dsInfo);
 					m_lightShading.m_deferred.drawLights(dsInfo);
@@ -463,15 +463,15 @@ void IndirectDiffuseProbes::populateRenderGraph(RenderingContext& rctx)
 				public:
 				public:
 					IVec3 m_volumeTexel;
 					IVec3 m_volumeTexel;
 					I32 m_nextTexelOffsetInU;
 					I32 m_nextTexelOffsetInU;
-				} unis;
+				} consts;
 
 
 				U32 x, y, z;
 				U32 x, y, z;
 				unflatten3dArrayIndex(probeToRefresh->getCellCountsPerDimension().x(), probeToRefresh->getCellCountsPerDimension().y(),
 				unflatten3dArrayIndex(probeToRefresh->getCellCountsPerDimension().x(), probeToRefresh->getCellCountsPerDimension().y(),
 									  probeToRefresh->getCellCountsPerDimension().z(), cellIdx, x, y, z);
 									  probeToRefresh->getCellCountsPerDimension().z(), cellIdx, x, y, z);
-				unis.m_volumeTexel = IVec3(x, y, z);
+				consts.m_volumeTexel = IVec3(x, y, z);
 
 
-				unis.m_nextTexelOffsetInU = probeToRefresh->getCellCountsPerDimension().x();
-				cmdb.setPushConstants(&unis, sizeof(unis));
+				consts.m_nextTexelOffsetInU = probeToRefresh->getCellCountsPerDimension().x();
+				cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 				// Dispatch
 				// Dispatch
 				cmdb.dispatchCompute(1, 1, 1);
 				cmdb.dispatchCompute(1, 1, 1);

+ 1 - 1
AnKi/Renderer/LensFlare.cpp

@@ -72,7 +72,7 @@ void LensFlare::populateRenderGraph(RenderingContext& ctx)
 
 
 		cmdb.bindShaderProgram(m_updateIndirectBuffGrProg.get());
 		cmdb.bindShaderProgram(m_updateIndirectBuffGrProg.get());
 
 
-		cmdb.setPushConstants(&ctx.m_matrices.m_viewProjectionJitter, sizeof(ctx.m_matrices.m_viewProjectionJitter));
+		cmdb.setFastConstants(&ctx.m_matrices.m_viewProjectionJitter, sizeof(ctx.m_matrices.m_viewProjectionJitter));
 
 
 		// Write flare info
 		// Write flare info
 		Vec4* flarePositions = allocateAndBindSrvStructuredBuffer<Vec4>(cmdb, 0, 0, flareCount);
 		Vec4* flarePositions = allocateAndBindSrvStructuredBuffer<Vec4>(cmdb, 0, 0, flareCount);

+ 11 - 11
AnKi/Renderer/LightShading.cpp

@@ -108,7 +108,7 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 		cmdb.setDepthWrite(false);
 		cmdb.setDepthWrite(false);
 
 
 		// Bind all
 		// Bind all
-		cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingUniformsBuffer);
+		cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingConstantsBuffer);
 		cmdb.bindSrv(0, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		cmdb.bindSrv(0, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		cmdb.bindSrv(2, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kGlobalIlluminationProbe));
 		cmdb.bindSrv(2, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kGlobalIlluminationProbe));
@@ -145,7 +145,7 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 			cmdb.bindShaderProgram(m_skybox.m_grProgs[0].get());
 			cmdb.bindShaderProgram(m_skybox.m_grProgs[0].get());
 
 
 			const Vec4 color((sky) ? sky->getSolidColor() : Vec3(0.0f), 0.0);
 			const Vec4 color((sky) ? sky->getSolidColor() : Vec3(0.0f), 0.0);
-			cmdb.setPushConstants(&color, sizeof(color));
+			cmdb.setFastConstants(&color, sizeof(color));
 		}
 		}
 		else if(sky->getSkyboxType() == SkyboxType::kImage2D)
 		else if(sky->getSkyboxType() == SkyboxType::kImage2D)
 		{
 		{
@@ -171,7 +171,7 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 			pc.m_scale = sky->getImageScale();
 			pc.m_scale = sky->getImageScale();
 			pc.m_bias = sky->getImageBias();
 			pc.m_bias = sky->getImageBias();
 
 
-			cmdb.setPushConstants(&pc, sizeof(pc));
+			cmdb.setFastConstants(&pc, sizeof(pc));
 
 
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearRepeatAnisoResolutionScalingBias.get());
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearRepeatAnisoResolutionScalingBias.get());
 			cmdb.bindSrv(0, 0, TextureView(&sky->getImageResource().getTexture(), TextureSubresourceDesc::all()));
 			cmdb.bindSrv(0, 0, TextureView(&sky->getImageResource().getTexture(), TextureSubresourceDesc::all()));
@@ -182,7 +182,7 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 
 
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearClamp.get());
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearClamp.get());
 			rgraphCtx.bindSrv(0, 0, getRenderer().getSky().getSkyLutRt());
 			rgraphCtx.bindSrv(0, 0, getRenderer().getSky().getSkyLutRt());
-			cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingUniformsBuffer);
+			cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingConstantsBuffer);
 		}
 		}
 
 
 		drawQuad(cmdb);
 		drawQuad(cmdb);
@@ -202,20 +202,20 @@ void LightShading::run(const RenderingContext& ctx, RenderPassWorkContext& rgrap
 		rgraphCtx.bindSrv(0, 0, getRenderer().getGBuffer().getDepthRt());
 		rgraphCtx.bindSrv(0, 0, getRenderer().getGBuffer().getDepthRt());
 		rgraphCtx.bindSrv(1, 0, getRenderer().getVolumetricFog().getRt());
 		rgraphCtx.bindSrv(1, 0, getRenderer().getVolumetricFog().getRt());
 
 
-		class PushConsts
+		class Consts
 		{
 		{
 		public:
 		public:
 			F32 m_zSplitCount;
 			F32 m_zSplitCount;
 			F32 m_finalZSplit;
 			F32 m_finalZSplit;
 			F32 m_near;
 			F32 m_near;
 			F32 m_far;
 			F32 m_far;
-		} regs;
-		regs.m_zSplitCount = F32(getRenderer().getZSplitCount());
-		regs.m_finalZSplit = F32(getRenderer().getVolumetricFog().getFinalClusterInZ());
-		regs.m_near = ctx.m_cameraNear;
-		regs.m_far = ctx.m_cameraFar;
+		} consts;
+		consts.m_zSplitCount = F32(getRenderer().getZSplitCount());
+		consts.m_finalZSplit = F32(getRenderer().getVolumetricFog().getFinalClusterInZ());
+		consts.m_near = ctx.m_cameraNear;
+		consts.m_far = ctx.m_cameraFar;
 
 
-		cmdb.setPushConstants(&regs, sizeof(regs));
+		cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 		// finalPixelColor = pixelWithoutFog * transmitance + inScattering (see the shader)
 		// finalPixelColor = pixelWithoutFog * transmitance + inScattering (see the shader)
 		cmdb.setBlendFactors(0, BlendFactor::kOne, BlendFactor::kSrcAlpha);
 		cmdb.setBlendFactors(0, BlendFactor::kOne, BlendFactor::kSrcAlpha);

+ 2 - 2
AnKi/Renderer/MotionVectors.cpp

@@ -75,14 +75,14 @@ void MotionVectors::populateRenderGraph(RenderingContext& ctx)
 		rgraphCtx.bindSrv(0, 0, getRenderer().getGBuffer().getDepthRt());
 		rgraphCtx.bindSrv(0, 0, getRenderer().getGBuffer().getDepthRt());
 		rgraphCtx.bindSrv(1, 0, getRenderer().getGBuffer().getColorRt(3));
 		rgraphCtx.bindSrv(1, 0, getRenderer().getGBuffer().getColorRt(3));
 
 
-		class Uniforms
+		class Constants
 		{
 		{
 		public:
 		public:
 			Mat4 m_currentViewProjMat;
 			Mat4 m_currentViewProjMat;
 			Mat4 m_currentInvViewProjMat;
 			Mat4 m_currentInvViewProjMat;
 			Mat4 m_prevViewProjMat;
 			Mat4 m_prevViewProjMat;
 		} * pc;
 		} * pc;
-		pc = allocateAndBindConstants<Uniforms>(cmdb, 0, 0);
+		pc = allocateAndBindConstants<Constants>(cmdb, 0, 0);
 
 
 		pc->m_currentViewProjMat = ctx.m_matrices.m_viewProjection;
 		pc->m_currentViewProjMat = ctx.m_matrices.m_viewProjection;
 		pc->m_currentInvViewProjMat = ctx.m_matrices.m_invertedViewProjection;
 		pc->m_currentInvViewProjMat = ctx.m_matrices.m_invertedViewProjection;

+ 1 - 1
AnKi/Renderer/ProbeReflections.cpp

@@ -401,7 +401,7 @@ void ProbeReflections::populateRenderGraph(RenderingContext& rctx)
 					dsInfo.m_directionalLightShadowmapRenderTarget = shadowMapRt;
 					dsInfo.m_directionalLightShadowmapRenderTarget = shadowMapRt;
 				}
 				}
 				dsInfo.m_skyLutRenderTarget = (getRenderer().getSky().isEnabled()) ? getRenderer().getSky().getSkyLutRt() : RenderTargetHandle();
 				dsInfo.m_skyLutRenderTarget = (getRenderer().getSky().isEnabled()) ? getRenderer().getSky().getSkyLutRt() : RenderTargetHandle();
-				dsInfo.m_globalRendererConsts = rctx.m_globalRenderingUniformsBuffer;
+				dsInfo.m_globalRendererConsts = rctx.m_globalRenderingConstantsBuffer;
 				dsInfo.m_renderpassContext = &rgraphCtx;
 				dsInfo.m_renderpassContext = &rgraphCtx;
 
 
 				m_lightShading.m_deferred.drawLights(dsInfo);
 				m_lightShading.m_deferred.drawLights(dsInfo);

+ 22 - 22
AnKi/Renderer/Renderer.cpp

@@ -298,8 +298,8 @@ Error Renderer::populateRenderGraph(RenderingContext& ctx)
 	ctx.m_cameraFar = cam.getFar();
 	ctx.m_cameraFar = cam.getFar();
 
 
 	// Allocate global constants
 	// Allocate global constants
-	GlobalRendererUniforms* globalUnis;
-	ctx.m_globalRenderingUniformsBuffer = RebarTransientMemoryPool::getSingleton().allocateFrame(1, globalUnis);
+	GlobalRendererConstants* globalUnis;
+	ctx.m_globalRenderingConstantsBuffer = RebarTransientMemoryPool::getSingleton().allocateFrame(1, globalUnis);
 
 
 	// Import RTs first
 	// Import RTs first
 	m_downscaleBlur->importRenderTargets(ctx);
 	m_downscaleBlur->importRenderTargets(ctx);
@@ -353,39 +353,39 @@ Error Renderer::populateRenderGraph(RenderingContext& ctx)
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-void Renderer::writeGlobalRendererConstants(RenderingContext& ctx, GlobalRendererUniforms& unis)
+void Renderer::writeGlobalRendererConstants(RenderingContext& ctx, GlobalRendererConstants& consts)
 {
 {
 	ANKI_TRACE_SCOPED_EVENT(RWriteGlobalRendererConstants);
 	ANKI_TRACE_SCOPED_EVENT(RWriteGlobalRendererConstants);
 
 
-	unis.m_renderingSize = Vec2(F32(m_internalResolution.x()), F32(m_internalResolution.y()));
+	consts.m_renderingSize = Vec2(F32(m_internalResolution.x()), F32(m_internalResolution.y()));
 
 
-	unis.m_time = F32(HighRezTimer::getCurrentTime());
-	unis.m_frame = m_frameCount & kMaxU32;
+	consts.m_time = F32(HighRezTimer::getCurrentTime());
+	consts.m_frame = m_frameCount & kMaxU32;
 
 
 	Plane nearPlane;
 	Plane nearPlane;
 	extractClipPlane(ctx.m_matrices.m_viewProjection, FrustumPlaneType::kNear, nearPlane);
 	extractClipPlane(ctx.m_matrices.m_viewProjection, FrustumPlaneType::kNear, nearPlane);
-	unis.m_nearPlaneWSpace = Vec4(nearPlane.getNormal().xyz(), nearPlane.getOffset());
-	unis.m_near = ctx.m_cameraNear;
-	unis.m_far = ctx.m_cameraFar;
-	unis.m_cameraPosition = ctx.m_matrices.m_cameraTransform.getTranslationPart().xyz();
+	consts.m_nearPlaneWSpace = Vec4(nearPlane.getNormal().xyz(), nearPlane.getOffset());
+	consts.m_near = ctx.m_cameraNear;
+	consts.m_far = ctx.m_cameraFar;
+	consts.m_cameraPosition = ctx.m_matrices.m_cameraTransform.getTranslationPart().xyz();
 
 
-	unis.m_tileCounts = m_tileCounts;
-	unis.m_zSplitCount = m_zSplitCount;
-	unis.m_zSplitCountOverFrustumLength = F32(m_zSplitCount) / (ctx.m_cameraFar - ctx.m_cameraNear);
-	unis.m_zSplitMagic.x() = (ctx.m_cameraNear - ctx.m_cameraFar) / (ctx.m_cameraNear * F32(m_zSplitCount));
-	unis.m_zSplitMagic.y() = ctx.m_cameraFar / (ctx.m_cameraNear * F32(m_zSplitCount));
-	unis.m_lightVolumeLastZSplit = min(g_volumetricLightingAccumulationFinalZSplitCVar.get() - 1, m_zSplitCount);
+	consts.m_tileCounts = m_tileCounts;
+	consts.m_zSplitCount = m_zSplitCount;
+	consts.m_zSplitCountOverFrustumLength = F32(m_zSplitCount) / (ctx.m_cameraFar - ctx.m_cameraNear);
+	consts.m_zSplitMagic.x() = (ctx.m_cameraNear - ctx.m_cameraFar) / (ctx.m_cameraNear * F32(m_zSplitCount));
+	consts.m_zSplitMagic.y() = ctx.m_cameraFar / (ctx.m_cameraNear * F32(m_zSplitCount));
+	consts.m_lightVolumeLastZSplit = min(g_volumetricLightingAccumulationFinalZSplitCVar.get() - 1, m_zSplitCount);
 
 
-	unis.m_reflectionProbesMipCount = F32(m_probeReflections->getReflectionTextureMipmapCount());
+	consts.m_reflectionProbesMipCount = F32(m_probeReflections->getReflectionTextureMipmapCount());
 
 
-	unis.m_matrices = ctx.m_matrices;
-	unis.m_previousMatrices = ctx.m_prevMatrices;
+	consts.m_matrices = ctx.m_matrices;
+	consts.m_previousMatrices = ctx.m_prevMatrices;
 
 
 	// Directional light
 	// Directional light
 	const LightComponent* dirLight = SceneGraph::getSingleton().getDirectionalLight();
 	const LightComponent* dirLight = SceneGraph::getSingleton().getDirectionalLight();
 	if(dirLight)
 	if(dirLight)
 	{
 	{
-		DirectionalLight& out = unis.m_directionalLight;
+		DirectionalLight& out = consts.m_directionalLight;
 		const U32 shadowCascadeCount = (dirLight->getShadowEnabled()) ? g_shadowCascadeCountCVar.get() : 0;
 		const U32 shadowCascadeCount = (dirLight->getShadowEnabled()) ? g_shadowCascadeCountCVar.get() : 0;
 
 
 		out.m_diffuseColor = dirLight->getDiffuseColor().xyz();
 		out.m_diffuseColor = dirLight->getDiffuseColor().xyz();
@@ -404,7 +404,7 @@ void Renderer::writeGlobalRendererConstants(RenderingContext& ctx, GlobalRendere
 	}
 	}
 	else
 	else
 	{
 	{
-		unis.m_directionalLight.m_shadowCascadeCount_31bit_active_1bit = 0;
+		consts.m_directionalLight.m_shadowCascadeCount_31bit_active_1bit = 0;
 	}
 	}
 }
 }
 
 
@@ -561,7 +561,7 @@ TexturePtr Renderer::createAndClearRenderTarget(const TextureInitInfo& inf, Text
 
 
 					cmdb->bindShaderProgram(&variant->getProgram());
 					cmdb->bindShaderProgram(&variant->getProgram());
 
 
-					cmdb->setPushConstants(&clearVal.m_colorf[0], sizeof(clearVal.m_colorf));
+					cmdb->setFastConstants(&clearVal.m_colorf[0], sizeof(clearVal.m_colorf));
 
 
 					const TextureView view(tex.get(), TextureSubresourceDesc::surface(mip, face, layer));
 					const TextureView view(tex.get(), TextureSubresourceDesc::surface(mip, face, layer));
 
 

+ 1 - 1
AnKi/Renderer/Renderer.h

@@ -243,7 +243,7 @@ private:
 	void updatePipelineStats();
 	void updatePipelineStats();
 #endif
 #endif
 
 
-	void writeGlobalRendererConstants(RenderingContext& ctx, GlobalRendererUniforms& unis);
+	void writeGlobalRendererConstants(RenderingContext& ctx, GlobalRendererConstants& consts);
 };
 };
 /// @}
 /// @}
 
 

+ 13 - 13
AnKi/Renderer/RtShadows.cpp

@@ -266,13 +266,13 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 			cmdb.bindSrv(3, 0, BufferView(&m_rtLibraryGrProg->getShaderGroupHandlesGpuBuffer()));
 			cmdb.bindSrv(3, 0, BufferView(&m_rtLibraryGrProg->getShaderGroupHandlesGpuBuffer()));
 			cmdb.bindUav(0, 0, sbtBuffer);
 			cmdb.bindUav(0, 0, sbtBuffer);
 
 
-			RtShadowsSbtBuildUniforms unis = {};
+			RtShadowsSbtBuildConstants consts = {};
 			ANKI_ASSERT(m_sbtRecordSize % 4 == 0);
 			ANKI_ASSERT(m_sbtRecordSize % 4 == 0);
-			unis.m_sbtRecordDwordSize = m_sbtRecordSize / 4;
+			consts.m_sbtRecordDwordSize = m_sbtRecordSize / 4;
 			const U32 shaderHandleSize = GrManager::getSingleton().getDeviceCapabilities().m_shaderGroupHandleSize;
 			const U32 shaderHandleSize = GrManager::getSingleton().getDeviceCapabilities().m_shaderGroupHandleSize;
 			ANKI_ASSERT(shaderHandleSize % 4 == 0);
 			ANKI_ASSERT(shaderHandleSize % 4 == 0);
-			unis.m_shaderHandleDwordSize = shaderHandleSize / 4;
-			cmdb.setPushConstants(&unis, sizeof(unis));
+			consts.m_shaderHandleDwordSize = shaderHandleSize / 4;
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			cmdb.dispatchComputeIndirect(sbtBuildIndirectArgsBuffer);
 			cmdb.dispatchComputeIndirect(sbtBuildIndirectArgsBuffer);
 		});
 		});
@@ -303,12 +303,12 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 
 
 			// Allocate, set and bind global uniforms
 			// Allocate, set and bind global uniforms
 			{
 			{
-				MaterialGlobalUniforms* globalUniforms;
-				const RebarAllocation globalUniformsToken = RebarTransientMemoryPool::getSingleton().allocateFrame(1, globalUniforms);
+				MaterialGlobalConstants* globalConstants;
+				const RebarAllocation globalConstantsToken = RebarTransientMemoryPool::getSingleton().allocateFrame(1, globalConstants);
 
 
-				memset(globalUniforms, 0, sizeof(*globalUniforms)); // Don't care for now
+				memset(globalConstants, 0, sizeof(*globalConstants)); // Don't care for now
 
 
-				cmdb.bindConstantBuffer(ANKI_MATERIAL_REGISTER_GLOBAL_UNIFORMS, 0, globalUniformsToken);
+				cmdb.bindConstantBuffer(ANKI_MATERIAL_REGISTER_GLOBAL_CONSTANTS, 0, globalConstantsToken);
 			}
 			}
 
 
 			// More globals
 			// More globals
@@ -323,7 +323,7 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 		Format::k##fmt);
 		Format::k##fmt);
 #include <AnKi/Shaders/Include/UnifiedGeometryTypes.def.h>
 #include <AnKi/Shaders/Include/UnifiedGeometryTypes.def.h>
 
 
-			cmdb.bindConstantBuffer(0, 2, ctx.m_globalRenderingUniformsBuffer);
+			cmdb.bindConstantBuffer(0, 2, ctx.m_globalRenderingConstantsBuffer);
 
 
 			cmdb.bindSampler(0, 2, getRenderer().getSamplers().m_trilinearRepeat.get());
 			cmdb.bindSampler(0, 2, getRenderer().getSamplers().m_trilinearRepeat.get());
 
 
@@ -407,7 +407,7 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 			rgraphCtx.bindUav(1, 0, m_runCtx.m_varianceRts[1]);
 			rgraphCtx.bindUav(1, 0, m_runCtx.m_varianceRts[1]);
 
 
 			const Mat4& invProjMat = ctx.m_matrices.m_projectionJitter.getInverse();
 			const Mat4& invProjMat = ctx.m_matrices.m_projectionJitter.getInverse();
-			cmdb.setPushConstants(&invProjMat, sizeof(invProjMat));
+			cmdb.setFastConstants(&invProjMat, sizeof(invProjMat));
 
 
 			dispatchPPCompute(cmdb, 8, 8, getRenderer().getInternalResolution().x() / 2, getRenderer().getInternalResolution().y() / 2);
 			dispatchPPCompute(cmdb, 8, 8, getRenderer().getInternalResolution().x() / 2, getRenderer().getInternalResolution().y() / 2);
 		});
 		});
@@ -472,7 +472,7 @@ void RtShadows::populateRenderGraph(RenderingContext& ctx)
 				}
 				}
 
 
 				const Mat4& invProjMat = ctx.m_matrices.m_projectionJitter.getInverse();
 				const Mat4& invProjMat = ctx.m_matrices.m_projectionJitter.getInverse();
-				cmdb.setPushConstants(&invProjMat, sizeof(invProjMat));
+				cmdb.setFastConstants(&invProjMat, sizeof(invProjMat));
 
 
 				dispatchPPCompute(cmdb, 8, 8, getRenderer().getInternalResolution().x() / 2, getRenderer().getInternalResolution().y() / 2);
 				dispatchPPCompute(cmdb, 8, 8, getRenderer().getInternalResolution().x() / 2, getRenderer().getInternalResolution().y() / 2);
 			});
 			});
@@ -523,12 +523,12 @@ void RtShadows::runDenoise(const RenderingContext& ctx, RenderPassWorkContext& r
 
 
 	rgraphCtx.bindUav(0, 0, (horizontal) ? m_runCtx.m_intermediateShadowsRts[1] : m_runCtx.m_historyRt);
 	rgraphCtx.bindUav(0, 0, (horizontal) ? m_runCtx.m_intermediateShadowsRts[1] : m_runCtx.m_historyRt);
 
 
-	RtShadowsDenoiseUniforms consts;
+	RtShadowsDenoiseConstants consts;
 	consts.m_invViewProjMat = ctx.m_matrices.m_invertedViewProjectionJitter;
 	consts.m_invViewProjMat = ctx.m_matrices.m_invertedViewProjectionJitter;
 	consts.m_time = F32(GlobalFrameIndex::getSingleton().m_value % 0xFFFFu);
 	consts.m_time = F32(GlobalFrameIndex::getSingleton().m_value % 0xFFFFu);
 	consts.m_minSampleCount = 8;
 	consts.m_minSampleCount = 8;
 	consts.m_maxSampleCount = 32;
 	consts.m_maxSampleCount = 32;
-	cmdb.setPushConstants(&consts, sizeof(consts));
+	cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 	dispatchPPCompute(cmdb, 8, 8, getRenderer().getInternalResolution().x() / 2, getRenderer().getInternalResolution().y() / 2);
 	dispatchPPCompute(cmdb, 8, 8, getRenderer().getInternalResolution().x() / 2, getRenderer().getInternalResolution().y() / 2);
 }
 }

+ 4 - 4
AnKi/Renderer/Scale.cpp

@@ -326,7 +326,7 @@ void Scale::runFsrOrBilinearScaling(RenderPassWorkContext& rgraphCtx)
 
 
 		pc.m_viewportSize = getRenderer().getPostProcessResolution();
 		pc.m_viewportSize = getRenderer().getPostProcessResolution();
 
 
-		cmdb.setPushConstants(&pc, sizeof(pc));
+		cmdb.setFastConstants(&pc, sizeof(pc));
 	}
 	}
 	else if(preferCompute)
 	else if(preferCompute)
 	{
 	{
@@ -339,7 +339,7 @@ void Scale::runFsrOrBilinearScaling(RenderPassWorkContext& rgraphCtx)
 		pc.m_viewportSize = Vec2(getRenderer().getPostProcessResolution());
 		pc.m_viewportSize = Vec2(getRenderer().getPostProcessResolution());
 		pc.m_viewportSizeU = getRenderer().getPostProcessResolution();
 		pc.m_viewportSizeU = getRenderer().getPostProcessResolution();
 
 
-		cmdb.setPushConstants(&pc, sizeof(pc));
+		cmdb.setFastConstants(&pc, sizeof(pc));
 	}
 	}
 
 
 	if(preferCompute)
 	if(preferCompute)
@@ -389,7 +389,7 @@ void Scale::runRcasSharpening(RenderPassWorkContext& rgraphCtx)
 
 
 	pc.m_viewportSize = getRenderer().getPostProcessResolution();
 	pc.m_viewportSize = getRenderer().getPostProcessResolution();
 
 
-	cmdb.setPushConstants(&pc, sizeof(pc));
+	cmdb.setFastConstants(&pc, sizeof(pc));
 
 
 	if(preferCompute)
 	if(preferCompute)
 	{
 	{
@@ -449,7 +449,7 @@ void Scale::runTonemapping(RenderPassWorkContext& rgraphCtx)
 		} pc;
 		} pc;
 		pc.m_viewportSizeOverOne = 1.0f / Vec2(getRenderer().getPostProcessResolution());
 		pc.m_viewportSizeOverOne = 1.0f / Vec2(getRenderer().getPostProcessResolution());
 		pc.m_viewportSize = getRenderer().getPostProcessResolution();
 		pc.m_viewportSize = getRenderer().getPostProcessResolution();
-		cmdb.setPushConstants(&pc, sizeof(pc));
+		cmdb.setFastConstants(&pc, sizeof(pc));
 		rgraphCtx.bindUav(1, 0, outRt);
 		rgraphCtx.bindUav(1, 0, outRt);
 
 
 		dispatchPPCompute(cmdb, 8, 8, getRenderer().getPostProcessResolution().x(), getRenderer().getPostProcessResolution().y());
 		dispatchPPCompute(cmdb, 8, 8, getRenderer().getPostProcessResolution().x(), getRenderer().getPostProcessResolution().y());

+ 1 - 1
AnKi/Renderer/ShadowMapping.cpp

@@ -554,7 +554,7 @@ BufferView ShadowMapping::createVetVisibilityPass(CString passName, const LightC
 		cmdb.bindShaderProgram(m_vetVisibilityGrProg.get());
 		cmdb.bindShaderProgram(m_vetVisibilityGrProg.get());
 
 
 		const UVec4 lightIndex(lightc.getGpuSceneLightAllocation().getIndex());
 		const UVec4 lightIndex(lightc.getGpuSceneLightAllocation().getIndex());
-		cmdb.setPushConstants(&lightIndex, sizeof(lightIndex));
+		cmdb.setFastConstants(&lightIndex, sizeof(lightIndex));
 
 
 		cmdb.bindSrv(0, 0, hashBuff);
 		cmdb.bindSrv(0, 0, hashBuff);
 		cmdb.bindUav(0, 0, mdiBuff.isValid() ? mdiBuff : BufferView(&getRenderer().getDummyBuffer()).setRange(sizeof(U32)));
 		cmdb.bindUav(0, 0, mdiBuff.isValid() ? mdiBuff : BufferView(&getRenderer().getDummyBuffer()).setRange(sizeof(U32)));

+ 2 - 2
AnKi/Renderer/ShadowmapsResolve.cpp

@@ -111,7 +111,7 @@ void ShadowmapsResolve::run(RenderPassWorkContext& rgraphCtx, RenderingContext&
 
 
 	cmdb.bindShaderProgram(m_grProg.get());
 	cmdb.bindShaderProgram(m_grProg.get());
 
 
-	cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingUniformsBuffer);
+	cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingConstantsBuffer);
 	cmdb.bindSrv(0, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 	cmdb.bindSrv(0, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 	cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 	cmdb.bindSrv(1, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 	rgraphCtx.bindSrv(2, 0, getRenderer().getShadowMapping().getShadowmapRt());
 	rgraphCtx.bindSrv(2, 0, getRenderer().getShadowMapping().getShadowmapRt());
@@ -139,7 +139,7 @@ void ShadowmapsResolve::run(RenderPassWorkContext& rgraphCtx, RenderingContext&
 	if(g_preferComputeCVar.get() || g_shadowMappingPcfCVar.get())
 	if(g_preferComputeCVar.get() || g_shadowMappingPcfCVar.get())
 	{
 	{
 		const Vec4 consts(F32(m_rtDescr.m_width), F32(m_rtDescr.m_height), 0.0f, 0.0f);
 		const Vec4 consts(F32(m_rtDescr.m_width), F32(m_rtDescr.m_height), 0.0f, 0.0f);
-		cmdb.setPushConstants(&consts, sizeof(consts));
+		cmdb.setFastConstants(&consts, sizeof(consts));
 	}
 	}
 
 
 	if(g_preferComputeCVar.get())
 	if(g_preferComputeCVar.get())

+ 2 - 2
AnKi/Renderer/Sky.cpp

@@ -161,7 +161,7 @@ void Sky::populateRenderGraph(RenderingContext& ctx)
 			rgraphCtx.bindSrv(1, 0, multipleScatteringLutRt);
 			rgraphCtx.bindSrv(1, 0, multipleScatteringLutRt);
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearClamp.get());
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearClamp.get());
 			rgraphCtx.bindUav(0, 0, m_runCtx.m_skyLutRt);
 			rgraphCtx.bindUav(0, 0, m_runCtx.m_skyLutRt);
-			cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingUniformsBuffer);
+			cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingConstantsBuffer);
 
 
 			dispatchPPCompute(cmdb, 8, 8, kSkyLutSize.x(), kSkyLutSize.y());
 			dispatchPPCompute(cmdb, 8, 8, kSkyLutSize.x(), kSkyLutSize.y());
 		});
 		});
@@ -181,7 +181,7 @@ void Sky::populateRenderGraph(RenderingContext& ctx)
 			cmdb.bindShaderProgram(m_computeSunColorGrProg.get());
 			cmdb.bindShaderProgram(m_computeSunColorGrProg.get());
 
 
 			rgraphCtx.bindSrv(0, 0, transmittanceLutRt);
 			rgraphCtx.bindSrv(0, 0, transmittanceLutRt);
-			cmdb.bindUav(0, 0, ctx.m_globalRenderingUniformsBuffer);
+			cmdb.bindUav(0, 0, ctx.m_globalRenderingConstantsBuffer);
 
 
 			cmdb.dispatchCompute(1, 1, 1);
 			cmdb.dispatchCompute(1, 1, 1);
 		});
 		});

+ 4 - 4
AnKi/Renderer/Ssao.cpp

@@ -139,7 +139,7 @@ void Ssao::populateRenderGraph(RenderingContext& ctx)
 
 
 			const UVec2 rez = (g_ssaoQuarterRez.get()) ? getRenderer().getInternalResolution() / 2u : getRenderer().getInternalResolution();
 			const UVec2 rez = (g_ssaoQuarterRez.get()) ? getRenderer().getInternalResolution() / 2u : getRenderer().getInternalResolution();
 
 
-			SsaoUniforms consts;
+			SsaoConstants consts;
 			consts.m_radius = g_ssaoRadiusCVar.get();
 			consts.m_radius = g_ssaoRadiusCVar.get();
 			consts.m_sampleCount = g_ssaoSampleCountCVar.get();
 			consts.m_sampleCount = g_ssaoSampleCountCVar.get();
 			consts.m_viewportSizef = Vec2(rez);
 			consts.m_viewportSizef = Vec2(rez);
@@ -151,7 +151,7 @@ void Ssao::populateRenderGraph(RenderingContext& ctx)
 			consts.m_frameCount = getRenderer().getFrameCount() % kMaxU32;
 			consts.m_frameCount = getRenderer().getFrameCount() % kMaxU32;
 			consts.m_ssaoPower = g_ssaoPower.get();
 			consts.m_ssaoPower = g_ssaoPower.get();
 			consts.m_viewMat = ctx.m_matrices.m_view;
 			consts.m_viewMat = ctx.m_matrices.m_view;
-			cmdb.setPushConstants(&consts, sizeof(consts));
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			if(g_preferComputeCVar.get())
 			if(g_preferComputeCVar.get())
 			{
 			{
@@ -199,10 +199,10 @@ void Ssao::populateRenderGraph(RenderingContext& ctx)
 
 
 			const UVec2 rez = (g_ssaoQuarterRez.get()) ? getRenderer().getInternalResolution() / 2u : getRenderer().getInternalResolution();
 			const UVec2 rez = (g_ssaoQuarterRez.get()) ? getRenderer().getInternalResolution() / 2u : getRenderer().getInternalResolution();
 
 
-			SsaoSpatialDenoiseUniforms consts;
+			SsaoSpatialDenoiseConstants consts;
 			computeLinearizeDepthOptimal(ctx.m_cameraNear, ctx.m_cameraFar, consts.m_linearizeDepthParams.x(), consts.m_linearizeDepthParams.y());
 			computeLinearizeDepthOptimal(ctx.m_cameraNear, ctx.m_cameraFar, consts.m_linearizeDepthParams.x(), consts.m_linearizeDepthParams.y());
 			consts.m_viewToWorldMat = ctx.m_matrices.m_cameraTransform;
 			consts.m_viewToWorldMat = ctx.m_matrices.m_cameraTransform;
-			cmdb.setPushConstants(&consts, sizeof(consts));
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			if(g_preferComputeCVar.get())
 			if(g_preferComputeCVar.get())
 			{
 			{

+ 2 - 2
AnKi/Renderer/Ssr.cpp

@@ -115,7 +115,7 @@ void Ssr::populateRenderGraph(RenderingContext& ctx)
 
 
 		cmdb.bindShaderProgram(m_ssrGrProg.get());
 		cmdb.bindShaderProgram(m_ssrGrProg.get());
 
 
-		SsrUniforms consts = {};
+		SsrConstants consts = {};
 		consts.m_viewportSizef = Vec2(rez);
 		consts.m_viewportSizef = Vec2(rez);
 		consts.m_frameCount = getRenderer().getFrameCount() % kMaxU32;
 		consts.m_frameCount = getRenderer().getFrameCount() % kMaxU32;
 		consts.m_maxIterations = g_ssrMaxIterationsCVar.get();
 		consts.m_maxIterations = g_ssrMaxIterationsCVar.get();
@@ -126,7 +126,7 @@ void Ssr::populateRenderGraph(RenderingContext& ctx)
 		consts.m_unprojectionParameters = ctx.m_matrices.m_unprojectionParameters;
 		consts.m_unprojectionParameters = ctx.m_matrices.m_unprojectionParameters;
 		consts.m_prevViewProjMatMulInvViewProjMat = ctx.m_prevMatrices.m_viewProjection * ctx.m_matrices.m_viewProjectionJitter.getInverse();
 		consts.m_prevViewProjMatMulInvViewProjMat = ctx.m_prevMatrices.m_viewProjection * ctx.m_matrices.m_viewProjectionJitter.getInverse();
 		consts.m_normalMat = Mat3x4(Vec3(0.0f), ctx.m_matrices.m_view.getRotationPart());
 		consts.m_normalMat = Mat3x4(Vec3(0.0f), ctx.m_matrices.m_view.getRotationPart());
-		*allocateAndBindConstants<SsrUniforms>(cmdb, 0, 0) = consts;
+		*allocateAndBindConstants<SsrConstants>(cmdb, 0, 0) = consts;
 
 
 		cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearClamp.get());
 		cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_trilinearClamp.get());
 		rgraphCtx.bindSrv(0, 0, getRenderer().getGBuffer().getColorRt(1));
 		rgraphCtx.bindSrv(0, 0, getRenderer().getGBuffer().getColorRt(1));

+ 11 - 11
AnKi/Renderer/Utils/Drawer.cpp

@@ -31,20 +31,20 @@ void RenderableDrawer::setState(const RenderableDrawerArguments& args, CommandBu
 {
 {
 	// Allocate, set and bind global uniforms
 	// Allocate, set and bind global uniforms
 	{
 	{
-		MaterialGlobalUniforms* globalUniforms;
-		const RebarAllocation globalUniformsToken = RebarTransientMemoryPool::getSingleton().allocateFrame(1, globalUniforms);
+		MaterialGlobalConstants* globalConstants;
+		const RebarAllocation globalConstantsToken = RebarTransientMemoryPool::getSingleton().allocateFrame(1, globalConstants);
 
 
-		globalUniforms->m_viewProjectionMatrix = args.m_viewProjectionMatrix;
-		globalUniforms->m_previousViewProjectionMatrix = args.m_previousViewProjectionMatrix;
-		static_assert(sizeof(globalUniforms->m_viewTransform) == sizeof(args.m_viewMatrix));
-		memcpy(&globalUniforms->m_viewTransform, &args.m_viewMatrix, sizeof(args.m_viewMatrix));
-		static_assert(sizeof(globalUniforms->m_cameraTransform) == sizeof(args.m_cameraTransform));
-		memcpy(&globalUniforms->m_cameraTransform, &args.m_cameraTransform, sizeof(args.m_cameraTransform));
+		globalConstants->m_viewProjectionMatrix = args.m_viewProjectionMatrix;
+		globalConstants->m_previousViewProjectionMatrix = args.m_previousViewProjectionMatrix;
+		static_assert(sizeof(globalConstants->m_viewTransform) == sizeof(args.m_viewMatrix));
+		memcpy(&globalConstants->m_viewTransform, &args.m_viewMatrix, sizeof(args.m_viewMatrix));
+		static_assert(sizeof(globalConstants->m_cameraTransform) == sizeof(args.m_cameraTransform));
+		memcpy(&globalConstants->m_cameraTransform, &args.m_cameraTransform, sizeof(args.m_cameraTransform));
 
 
 		ANKI_ASSERT(args.m_viewport != UVec4(0u));
 		ANKI_ASSERT(args.m_viewport != UVec4(0u));
-		globalUniforms->m_viewport = Vec4(args.m_viewport);
+		globalConstants->m_viewport = Vec4(args.m_viewport);
 
 
-		cmdb.bindConstantBuffer(ANKI_MATERIAL_REGISTER_GLOBAL_UNIFORMS, 0, globalUniformsToken);
+		cmdb.bindConstantBuffer(ANKI_MATERIAL_REGISTER_GLOBAL_CONSTANTS, 0, globalConstantsToken);
 	}
 	}
 
 
 	// More globals
 	// More globals
@@ -124,7 +124,7 @@ void RenderableDrawer::drawMdi(const RenderableDrawerArguments& args, CommandBuf
 		if(bMeshlets && meshShaderHwSupport)
 		if(bMeshlets && meshShaderHwSupport)
 		{
 		{
 			const UVec4 consts(bucketIdx);
 			const UVec4 consts(bucketIdx);
-			cmdb.setPushConstants(&consts, sizeof(consts));
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			cmdb.drawMeshTasksIndirect(BufferView(args.m_mesh.m_dispatchMeshIndirectArgsBuffer)
 			cmdb.drawMeshTasksIndirect(BufferView(args.m_mesh.m_dispatchMeshIndirectArgsBuffer)
 										   .incrementOffset(sizeof(DispatchIndirectArgs) * bucketIdx)
 										   .incrementOffset(sizeof(DispatchIndirectArgs) * bucketIdx)

+ 34 - 34
AnKi/Renderer/Utils/GpuVisibility.cpp

@@ -666,24 +666,24 @@ void GpuVisibility::populateRenderGraphInternal(Bool distanceBased, BaseGpuVisib
 
 
 			if(frustumTestData)
 			if(frustumTestData)
 			{
 			{
-				FrustumGpuVisibilityUniforms* unis = allocateAndBindConstants<FrustumGpuVisibilityUniforms>(cmdb, 0, 0);
+				FrustumGpuVisibilityConsts* consts = allocateAndBindConstants<FrustumGpuVisibilityConsts>(cmdb, 0, 0);
 
 
 				Array<Plane, 6> planes;
 				Array<Plane, 6> planes;
 				extractClipPlanes(frustumTestData->m_viewProjMat, planes);
 				extractClipPlanes(frustumTestData->m_viewProjMat, planes);
 				for(U32 i = 0; i < 6; ++i)
 				for(U32 i = 0; i < 6; ++i)
 				{
 				{
-					unis->m_clipPlanes[i] = Vec4(planes[i].getNormal().xyz(), planes[i].getOffset());
+					consts->m_clipPlanes[i] = Vec4(planes[i].getNormal().xyz(), planes[i].getOffset());
 				}
 				}
 
 
 				ANKI_ASSERT(kMaxLodCount == 3);
 				ANKI_ASSERT(kMaxLodCount == 3);
-				unis->m_maxLodDistances[0] = lodDistances[0];
-				unis->m_maxLodDistances[1] = lodDistances[1];
-				unis->m_maxLodDistances[2] = kMaxF32;
-				unis->m_maxLodDistances[3] = kMaxF32;
+				consts->m_maxLodDistances[0] = lodDistances[0];
+				consts->m_maxLodDistances[1] = lodDistances[1];
+				consts->m_maxLodDistances[2] = kMaxF32;
+				consts->m_maxLodDistances[3] = kMaxF32;
 
 
-				unis->m_lodReferencePoint = lodReferencePoint;
-				unis->m_viewProjectionMat = frustumTestData->m_viewProjMat;
-				unis->m_finalRenderTargetSize = Vec2(frustumTestData->m_finalRenderTargetSize);
+				consts->m_lodReferencePoint = lodReferencePoint;
+				consts->m_viewProjectionMat = frustumTestData->m_viewProjMat;
+				consts->m_finalRenderTargetSize = Vec2(frustumTestData->m_finalRenderTargetSize);
 
 
 				if(frustumTestData->m_hzbRt.isValid())
 				if(frustumTestData->m_hzbRt.isValid())
 				{
 				{
@@ -693,18 +693,18 @@ void GpuVisibility::populateRenderGraphInternal(Bool distanceBased, BaseGpuVisib
 			}
 			}
 			else
 			else
 			{
 			{
-				DistanceGpuVisibilityUniforms unis;
-				unis.m_pointOfTest = distTestData->m_pointOfTest;
-				unis.m_testRadius = distTestData->m_testRadius;
+				DistanceGpuVisibilityConstants consts;
+				consts.m_pointOfTest = distTestData->m_pointOfTest;
+				consts.m_testRadius = distTestData->m_testRadius;
 
 
-				unis.m_maxLodDistances[0] = lodDistances[0];
-				unis.m_maxLodDistances[1] = lodDistances[1];
-				unis.m_maxLodDistances[2] = kMaxF32;
-				unis.m_maxLodDistances[3] = kMaxF32;
+				consts.m_maxLodDistances[0] = lodDistances[0];
+				consts.m_maxLodDistances[1] = lodDistances[1];
+				consts.m_maxLodDistances[2] = kMaxF32;
+				consts.m_maxLodDistances[3] = kMaxF32;
 
 
-				unis.m_lodReferencePoint = lodReferencePoint;
+				consts.m_lodReferencePoint = lodReferencePoint;
 
 
-				cmdb.setPushConstants(&unis, sizeof(unis));
+				cmdb.setFastConstants(&consts, sizeof(consts));
 			}
 			}
 
 
 			dispatchPPCompute(cmdb, 64, 1, aabbCount, 1);
 			dispatchPPCompute(cmdb, 64, 1, aabbCount, 1);
@@ -798,12 +798,12 @@ void GpuVisibility::populateRenderGraphInternal(Bool distanceBased, BaseGpuVisib
 
 
 				if(!passthrough)
 				if(!passthrough)
 				{
 				{
-					GpuVisibilityMeshletUniforms consts;
+					GpuVisibilityMeshletConstants consts;
 					consts.m_viewProjectionMatrix = frustumTestData->m_viewProjMat;
 					consts.m_viewProjectionMatrix = frustumTestData->m_viewProjMat;
 					consts.m_cameraPos = lodReferencePoint;
 					consts.m_cameraPos = lodReferencePoint;
 					consts.m_viewportSizef = Vec2(frustumTestData->m_finalRenderTargetSize);
 					consts.m_viewportSizef = Vec2(frustumTestData->m_finalRenderTargetSize);
 
 
-					cmdb.setPushConstants(&consts, sizeof(consts));
+					cmdb.setFastConstants(&consts, sizeof(consts));
 				}
 				}
 
 
 				cmdb.dispatchComputeIndirect(
 				cmdb.dispatchComputeIndirect(
@@ -875,11 +875,11 @@ void GpuVisibility::populateRenderGraphStage3(FrustumGpuVisibilityInput& in, Gpu
 
 
 		cmdb.bindUav(3, 0, m_outOfMemoryReadbackBuffer);
 		cmdb.bindUav(3, 0, m_outOfMemoryReadbackBuffer);
 
 
-		GpuVisibilityMeshletUniforms consts;
+		GpuVisibilityMeshletConstants consts;
 		consts.m_viewProjectionMatrix = in.m_viewProjectionMatrix;
 		consts.m_viewProjectionMatrix = in.m_viewProjectionMatrix;
 		consts.m_cameraPos = in.m_lodReferencePoint;
 		consts.m_cameraPos = in.m_lodReferencePoint;
 		consts.m_viewportSizef = Vec2(in.m_viewportSize);
 		consts.m_viewportSizef = Vec2(in.m_viewportSize);
-		cmdb.setPushConstants(&consts, sizeof(consts));
+		cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 		cmdb.dispatchComputeIndirect(BufferView(stage1And2Mem.m_gpuVisIndirectDispatchArgs)
 		cmdb.dispatchComputeIndirect(BufferView(stage1And2Mem.m_gpuVisIndirectDispatchArgs)
 										 .incrementOffset(sizeof(DispatchIndirectArgs) * U32(GpuVisibilityIndirectDispatches::k3rdStageMeshlets))
 										 .incrementOffset(sizeof(DispatchIndirectArgs) * U32(GpuVisibilityIndirectDispatches::k3rdStageMeshlets))
@@ -1041,14 +1041,14 @@ void GpuVisibilityNonRenderables::populateRenderGraph(GpuVisibilityNonRenderable
 		}
 		}
 		cmdb.bindSrv(0, 0, objBuffer);
 		cmdb.bindSrv(0, 0, objBuffer);
 
 
-		GpuVisibilityNonRenderableUniforms unis;
+		GpuVisibilityNonRenderableConstants consts;
 		Array<Plane, 6> planes;
 		Array<Plane, 6> planes;
 		extractClipPlanes(viewProjectionMat, planes);
 		extractClipPlanes(viewProjectionMat, planes);
 		for(U32 i = 0; i < 6; ++i)
 		for(U32 i = 0; i < 6; ++i)
 		{
 		{
-			unis.m_clipPlanes[i] = Vec4(planes[i].getNormal().xyz(), planes[i].getOffset());
+			consts.m_clipPlanes[i] = Vec4(planes[i].getNormal().xyz(), planes[i].getOffset());
 		}
 		}
-		cmdb.setPushConstants(&unis, sizeof(unis));
+		cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 		rgraph.bindUav(0, 0, visibleIndicesBuffHandle);
 		rgraph.bindUav(0, 0, visibleIndicesBuffHandle);
 		cmdb.bindUav(1, 0, BufferView(counterBuffer.get(), counterBufferOffset, sizeof(U32) * kCountersPerDispatch));
 		cmdb.bindUav(1, 0, BufferView(counterBuffer.get(), counterBufferOffset, sizeof(U32) * kCountersPerDispatch));
@@ -1113,24 +1113,24 @@ void GpuVisibilityAccelerationStructures::pupulateRenderGraph(GpuVisibilityAccel
 
 
 			cmdb.bindShaderProgram(m_visibilityGrProg.get());
 			cmdb.bindShaderProgram(m_visibilityGrProg.get());
 
 
-			GpuVisibilityAccelerationStructuresUniforms unis;
+			GpuVisibilityAccelerationStructuresConstants consts;
 			Array<Plane, 6> planes;
 			Array<Plane, 6> planes;
 			extractClipPlanes(viewProjMat, planes);
 			extractClipPlanes(viewProjMat, planes);
 			for(U32 i = 0; i < 6; ++i)
 			for(U32 i = 0; i < 6; ++i)
 			{
 			{
-				unis.m_clipPlanes[i] = Vec4(planes[i].getNormal().xyz(), planes[i].getOffset());
+				consts.m_clipPlanes[i] = Vec4(planes[i].getNormal().xyz(), planes[i].getOffset());
 			}
 			}
 
 
-			unis.m_pointOfTest = pointOfTest;
-			unis.m_testRadius = testRadius;
+			consts.m_pointOfTest = pointOfTest;
+			consts.m_testRadius = testRadius;
 
 
 			ANKI_ASSERT(kMaxLodCount == 3);
 			ANKI_ASSERT(kMaxLodCount == 3);
-			unis.m_maxLodDistances[0] = lodDistances[0];
-			unis.m_maxLodDistances[1] = lodDistances[1];
-			unis.m_maxLodDistances[2] = kMaxF32;
-			unis.m_maxLodDistances[3] = kMaxF32;
+			consts.m_maxLodDistances[0] = lodDistances[0];
+			consts.m_maxLodDistances[1] = lodDistances[1];
+			consts.m_maxLodDistances[2] = kMaxF32;
+			consts.m_maxLodDistances[3] = kMaxF32;
 
 
-			cmdb.setPushConstants(&unis, sizeof(unis));
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			cmdb.bindSrv(0, 0, GpuSceneArrays::RenderableBoundingVolumeRt::getSingleton().getBufferView());
 			cmdb.bindSrv(0, 0, GpuSceneArrays::RenderableBoundingVolumeRt::getSingleton().getBufferView());
 			cmdb.bindSrv(1, 0, GpuSceneArrays::Renderable::getSingleton().getBufferView());
 			cmdb.bindSrv(1, 0, GpuSceneArrays::Renderable::getSingleton().getBufferView());

+ 8 - 8
AnKi/Renderer/Utils/HzbGenerator.cpp

@@ -120,7 +120,7 @@ void HzbGenerator::populateRenderGraphInternal(ConstWeakArray<DispatchInput> dis
 			varAU4(rectInfo) = initAU4(0, 0, in.m_dstHzbRtSize.x() * 2, in.m_dstHzbRtSize.y() * 2);
 			varAU4(rectInfo) = initAU4(0, 0, in.m_dstHzbRtSize.x() * 2, in.m_dstHzbRtSize.y() * 2);
 			SpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo, mipsToCompute);
 			SpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo, mipsToCompute);
 
 
-			struct Uniforms
+			struct Constants
 			{
 			{
 				Vec2 m_invSrcTexSize;
 				Vec2 m_invSrcTexSize;
 				U32 m_threadGroupCount;
 				U32 m_threadGroupCount;
@@ -131,7 +131,7 @@ void HzbGenerator::populateRenderGraphInternal(ConstWeakArray<DispatchInput> dis
 			pc.m_threadGroupCount = numWorkGroupsAndMips[0];
 			pc.m_threadGroupCount = numWorkGroupsAndMips[0];
 			pc.m_mipmapCount = numWorkGroupsAndMips[1];
 			pc.m_mipmapCount = numWorkGroupsAndMips[1];
 
 
-			cmdb.setPushConstants(&pc, sizeof(pc));
+			cmdb.setFastConstants(&pc, sizeof(pc));
 
 
 			for(U32 mip = 0; mip < kMaxMipsSinglePassDownsamplerCanProduce; ++mip)
 			for(U32 mip = 0; mip < kMaxMipsSinglePassDownsamplerCanProduce; ++mip)
 			{
 			{
@@ -271,7 +271,7 @@ void HzbGenerator::populateRenderGraphDirectionalLight(const HzbDirectionalLight
 
 
 			rgraphCtx.bindSrv(0, 0, maxDepthRt);
 			rgraphCtx.bindSrv(0, 0, maxDepthRt);
 
 
-			struct Uniforms
+			struct Constants
 			{
 			{
 				Mat4 m_reprojectionMat;
 				Mat4 m_reprojectionMat;
 
 
@@ -279,13 +279,13 @@ void HzbGenerator::populateRenderGraphDirectionalLight(const HzbDirectionalLight
 				F32 m_cascadeMaxDepth;
 				F32 m_cascadeMaxDepth;
 				F32 m_padding0;
 				F32 m_padding0;
 				F32 m_padding1;
 				F32 m_padding1;
-			} unis;
+			} consts;
 
 
-			unis.m_reprojectionMat = lightViewProjMat * invViewProjMat;
-			unis.m_cascadeMinDepth = cascadeMinDepth;
-			unis.m_cascadeMaxDepth = cascadeMaxDepth;
+			consts.m_reprojectionMat = lightViewProjMat * invViewProjMat;
+			consts.m_cascadeMinDepth = cascadeMinDepth;
+			consts.m_cascadeMaxDepth = cascadeMaxDepth;
 
 
-			cmdb.setPushConstants(&unis, sizeof(unis));
+			cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 			cmdb.bindIndexBuffer(BufferView(m_boxIndexBuffer.get()), IndexType::kU16);
 			cmdb.bindIndexBuffer(BufferView(m_boxIndexBuffer.get()), IndexType::kU16);
 
 

+ 12 - 12
AnKi/Renderer/Utils/TraditionalDeferredShading.cpp

@@ -62,15 +62,15 @@ void TraditionalDeferredLightShading::drawLights(TraditionalDeferredLightShading
 		cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());
 		cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());
 		rgraphCtx.bindSrv(0, 0, info.m_gbufferDepthRenderTarget, info.m_gbufferDepthRenderTargetSubresource);
 		rgraphCtx.bindSrv(0, 0, info.m_gbufferDepthRenderTarget, info.m_gbufferDepthRenderTargetSubresource);
 
 
-		TraditionalDeferredSkyboxUniforms unis = {};
-		unis.m_invertedViewProjectionMat = info.m_invViewProjectionMatrix;
-		unis.m_cameraPos = info.m_cameraPosWSpace.xyz();
-		unis.m_scale = skyc->getImageScale();
-		unis.m_bias = skyc->getImageBias();
+		TraditionalDeferredSkyboxConstants consts = {};
+		consts.m_invertedViewProjectionMat = info.m_invViewProjectionMatrix;
+		consts.m_cameraPos = info.m_cameraPosWSpace.xyz();
+		consts.m_scale = skyc->getImageScale();
+		consts.m_bias = skyc->getImageBias();
 
 
 		if(skyc->getSkyboxType() == SkyboxType::kSolidColor)
 		if(skyc->getSkyboxType() == SkyboxType::kSolidColor)
 		{
 		{
-			unis.m_solidColor = skyc->getSolidColor();
+			consts.m_solidColor = skyc->getSolidColor();
 		}
 		}
 		else if(skyc->getSkyboxType() == SkyboxType::kImage2D)
 		else if(skyc->getSkyboxType() == SkyboxType::kImage2D)
 		{
 		{
@@ -85,22 +85,22 @@ void TraditionalDeferredLightShading::drawLights(TraditionalDeferredLightShading
 
 
 		cmdb.bindConstantBuffer(0, 0, info.m_globalRendererConsts);
 		cmdb.bindConstantBuffer(0, 0, info.m_globalRendererConsts);
 
 
-		cmdb.setPushConstants(&unis, sizeof(unis));
+		cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 		drawQuad(cmdb);
 		drawQuad(cmdb);
 	}
 	}
 
 
 	// Light shading
 	// Light shading
 	{
 	{
-		TraditionalDeferredShadingUniforms* unis = allocateAndBindConstants<TraditionalDeferredShadingUniforms>(cmdb, 0, 0);
+		TraditionalDeferredShadingConstants* consts = allocateAndBindConstants<TraditionalDeferredShadingConstants>(cmdb, 0, 0);
 
 
-		unis->m_invViewProjMat = info.m_invViewProjectionMatrix;
-		unis->m_cameraPos = info.m_cameraPosWSpace.xyz();
+		consts->m_invViewProjMat = info.m_invViewProjectionMatrix;
+		consts->m_cameraPos = info.m_cameraPosWSpace.xyz();
 
 
 		if(dirLightc)
 		if(dirLightc)
 		{
 		{
-			unis->m_dirLight.m_effectiveShadowDistance = info.m_effectiveShadowDistance;
-			unis->m_dirLight.m_lightMatrix = info.m_dirLightMatrix;
+			consts->m_dirLight.m_effectiveShadowDistance = info.m_effectiveShadowDistance;
+			consts->m_dirLight.m_lightMatrix = info.m_dirLightMatrix;
 		}
 		}
 
 
 		cmdb.bindSrv(0, 0, info.m_visibleLightsBuffer);
 		cmdb.bindSrv(0, 0, info.m_visibleLightsBuffer);

+ 11 - 11
AnKi/Renderer/VolumetricFog.cpp

@@ -65,17 +65,17 @@ void VolumetricFog::populateRenderGraph(RenderingContext& ctx)
 
 
 		const SkyboxComponent* sky = SceneGraph::getSingleton().getSkybox();
 		const SkyboxComponent* sky = SceneGraph::getSingleton().getSkybox();
 
 
-		VolumetricFogUniforms regs;
-		regs.m_fogDiffuse = (sky) ? sky->getFogDiffuseColor() : Vec3(0.0f);
-		regs.m_fogScatteringCoeff = (sky) ? sky->getFogScatteringCoefficient() : 0.0f;
-		regs.m_fogAbsorptionCoeff = (sky) ? sky->getFogAbsorptionCoefficient() : 0.0f;
-		regs.m_near = ctx.m_cameraNear;
-		regs.m_far = ctx.m_cameraFar;
-		regs.m_zSplitCountf = F32(getRenderer().getZSplitCount());
-		regs.m_volumeSize = UVec3(m_volumeSize);
-		regs.m_maxZSplitsToProcessf = F32(m_finalZSplit + 1);
-
-		cmdb.setPushConstants(&regs, sizeof(regs));
+		VolumetricFogConstants consts;
+		consts.m_fogDiffuse = (sky) ? sky->getFogDiffuseColor() : Vec3(0.0f);
+		consts.m_fogScatteringCoeff = (sky) ? sky->getFogScatteringCoefficient() : 0.0f;
+		consts.m_fogAbsorptionCoeff = (sky) ? sky->getFogAbsorptionCoefficient() : 0.0f;
+		consts.m_near = ctx.m_cameraNear;
+		consts.m_far = ctx.m_cameraFar;
+		consts.m_zSplitCountf = F32(getRenderer().getZSplitCount());
+		consts.m_volumeSize = UVec3(m_volumeSize);
+		consts.m_maxZSplitsToProcessf = F32(m_finalZSplit + 1);
+
+		cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 		dispatchPPCompute(cmdb, 8, 8, m_volumeSize[0], m_volumeSize[1]);
 		dispatchPPCompute(cmdb, 8, 8, m_volumeSize[0], m_volumeSize[1]);
 	});
 	});

+ 17 - 17
AnKi/Renderer/VolumetricLightingAccumulation.cpp

@@ -105,7 +105,7 @@ void VolumetricLightingAccumulation::populateRenderGraph(RenderingContext& ctx)
 
 
 		rgraphCtx.bindSrv(1, 0, m_runCtx.m_rts[0]);
 		rgraphCtx.bindSrv(1, 0, m_runCtx.m_rts[0]);
 
 
-		cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingUniformsBuffer);
+		cmdb.bindConstantBuffer(0, 0, ctx.m_globalRenderingConstantsBuffer);
 		cmdb.bindSrv(2, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		cmdb.bindSrv(2, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		cmdb.bindSrv(3, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		cmdb.bindSrv(3, 0, getRenderer().getClusterBinning().getPackedObjectsBuffer(GpuSceneNonRenderableObjectType::kLight));
 		rgraphCtx.bindSrv(4, 0, getRenderer().getShadowMapping().getShadowmapRt());
 		rgraphCtx.bindSrv(4, 0, getRenderer().getShadowMapping().getShadowmapRt());
@@ -115,34 +115,34 @@ void VolumetricLightingAccumulation::populateRenderGraph(RenderingContext& ctx)
 
 
 		const SkyboxComponent* sky = SceneGraph::getSingleton().getSkybox();
 		const SkyboxComponent* sky = SceneGraph::getSingleton().getSkybox();
 
 
-		VolumetricLightingUniforms unis;
+		VolumetricLightingConstants consts;
 		if(!sky)
 		if(!sky)
 		{
 		{
-			unis.m_minHeight = 0.0f;
-			unis.m_oneOverMaxMinusMinHeight = 0.0f;
-			unis.m_densityAtMinHeight = 0.0f;
-			unis.m_densityAtMaxHeight = 0.0f;
+			consts.m_minHeight = 0.0f;
+			consts.m_oneOverMaxMinusMinHeight = 0.0f;
+			consts.m_densityAtMinHeight = 0.0f;
+			consts.m_densityAtMaxHeight = 0.0f;
 		}
 		}
 		else if(sky->getHeightOfMaxFogDensity() > sky->getHeightOfMaxFogDensity())
 		else if(sky->getHeightOfMaxFogDensity() > sky->getHeightOfMaxFogDensity())
 		{
 		{
-			unis.m_minHeight = sky->getHeightOfMinFogDensity();
-			unis.m_oneOverMaxMinusMinHeight = 1.0f / (sky->getHeightOfMaxFogDensity() - unis.m_minHeight + kEpsilonf);
-			unis.m_densityAtMinHeight = sky->getMinFogDensity();
-			unis.m_densityAtMaxHeight = sky->getMaxFogDensity();
+			consts.m_minHeight = sky->getHeightOfMinFogDensity();
+			consts.m_oneOverMaxMinusMinHeight = 1.0f / (sky->getHeightOfMaxFogDensity() - consts.m_minHeight + kEpsilonf);
+			consts.m_densityAtMinHeight = sky->getMinFogDensity();
+			consts.m_densityAtMaxHeight = sky->getMaxFogDensity();
 		}
 		}
 		else
 		else
 		{
 		{
-			unis.m_minHeight = sky->getHeightOfMaxFogDensity();
-			unis.m_oneOverMaxMinusMinHeight = 1.0f / (sky->getHeightOfMinFogDensity() - unis.m_minHeight + kEpsilonf);
-			unis.m_densityAtMinHeight = sky->getMaxFogDensity();
-			unis.m_densityAtMaxHeight = sky->getMinFogDensity();
+			consts.m_minHeight = sky->getHeightOfMaxFogDensity();
+			consts.m_oneOverMaxMinusMinHeight = 1.0f / (sky->getHeightOfMinFogDensity() - consts.m_minHeight + kEpsilonf);
+			consts.m_densityAtMinHeight = sky->getMaxFogDensity();
+			consts.m_densityAtMaxHeight = sky->getMinFogDensity();
 		}
 		}
-		unis.m_volumeSize = UVec3(m_volumeSize);
+		consts.m_volumeSize = UVec3(m_volumeSize);
 
 
 		const U32 finalZSplit = min(getRenderer().getZSplitCount() - 1, g_volumetricLightingAccumulationFinalZSplitCVar.get());
 		const U32 finalZSplit = min(getRenderer().getZSplitCount() - 1, g_volumetricLightingAccumulationFinalZSplitCVar.get());
-		unis.m_maxZSplitsToProcessf = F32(finalZSplit + 1);
+		consts.m_maxZSplitsToProcessf = F32(finalZSplit + 1);
 
 
-		cmdb.setPushConstants(&unis, sizeof(unis));
+		cmdb.setFastConstants(&consts, sizeof(consts));
 
 
 		dispatchPPCompute(cmdb, 8, 8, 8, m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]);
 		dispatchPPCompute(cmdb, 8, 8, 8, m_volumeSize[0], m_volumeSize[1], m_volumeSize[2]);
 	});
 	});

+ 2 - 2
AnKi/Renderer/VrsSriGeneration.cpp

@@ -144,7 +144,7 @@ void VrsSriGeneration::populateRenderGraph(RenderingContext& ctx)
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());
 			rgraphCtx.bindUav(0, 0, m_runCtx.m_rt);
 			rgraphCtx.bindUav(0, 0, m_runCtx.m_rt);
 			const Vec4 pc(1.0f / Vec2(getRenderer().getInternalResolution()), g_vrsThresholdCVar.get(), 0.0f);
 			const Vec4 pc(1.0f / Vec2(getRenderer().getInternalResolution()), g_vrsThresholdCVar.get(), 0.0f);
-			cmdb.setPushConstants(&pc, sizeof(pc));
+			cmdb.setFastConstants(&pc, sizeof(pc));
 
 
 			const U32 fakeWorkgroupSizeXorY = m_sriTexelDimension;
 			const U32 fakeWorkgroupSizeXorY = m_sriTexelDimension;
 			dispatchPPCompute(cmdb, fakeWorkgroupSizeXorY, fakeWorkgroupSizeXorY, getRenderer().getInternalResolution().x(),
 			dispatchPPCompute(cmdb, fakeWorkgroupSizeXorY, fakeWorkgroupSizeXorY, getRenderer().getInternalResolution().x(),
@@ -171,7 +171,7 @@ void VrsSriGeneration::populateRenderGraph(RenderingContext& ctx)
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());
 			rgraphCtx.bindUav(0, 0, m_runCtx.m_downscaledRt);
 			rgraphCtx.bindUav(0, 0, m_runCtx.m_downscaledRt);
 			const Vec4 pc(1.0f / Vec2(rezDownscaled), 0.0f, 0.0f);
 			const Vec4 pc(1.0f / Vec2(rezDownscaled), 0.0f, 0.0f);
-			cmdb.setPushConstants(&pc, sizeof(pc));
+			cmdb.setFastConstants(&pc, sizeof(pc));
 
 
 			dispatchPPCompute(cmdb, 8, 8, rezDownscaled.x(), rezDownscaled.y());
 			dispatchPPCompute(cmdb, 8, 8, rezDownscaled.x(), rezDownscaled.y());
 		});
 		});

+ 15 - 15
AnKi/Resource/MaterialResource.cpp

@@ -85,7 +85,7 @@ MaterialResource::MaterialResource()
 
 
 MaterialResource::~MaterialResource()
 MaterialResource::~MaterialResource()
 {
 {
-	ResourceMemoryPool::getSingleton().free(m_prefilledLocalUniforms);
+	ResourceMemoryPool::getSingleton().free(m_prefilledLocalConstants);
 }
 }
 
 
 const MaterialVariable* MaterialResource::tryFindVariableInternal(CString name) const
 const MaterialVariable* MaterialResource::tryFindVariableInternal(CString name) const
@@ -149,7 +149,7 @@ Error MaterialResource::load(const ResourceFilename& filename, Bool async)
 		m_vars = std::move(newVars);
 		m_vars = std::move(newVars);
 	}
 	}
 
 
-	prefillLocalUniforms();
+	prefillLocalConstants();
 
 
 	return Error::kNone;
 	return Error::kNone;
 }
 }
@@ -375,30 +375,30 @@ Error MaterialResource::createVars()
 	const ShaderBinary& binary = m_prog->getBinary();
 	const ShaderBinary& binary = m_prog->getBinary();
 
 
 	// Find struct
 	// Find struct
-	const ShaderBinaryStruct* localUniformsStruct = nullptr;
+	const ShaderBinaryStruct* localConstantsStruct = nullptr;
 	for(const ShaderBinaryStruct& strct : binary.m_structs)
 	for(const ShaderBinaryStruct& strct : binary.m_structs)
 	{
 	{
-		if(CString(strct.m_name.getBegin()) == "AnKiLocalUniforms")
+		if(CString(strct.m_name.getBegin()) == "AnKiLocalConstants")
 		{
 		{
-			localUniformsStruct = &strct;
+			localConstantsStruct = &strct;
 			break;
 			break;
 		}
 		}
 	}
 	}
 
 
 	// Create vars
 	// Create vars
-	for(U32 i = 0; localUniformsStruct && i < localUniformsStruct->m_members.getSize(); ++i)
+	for(U32 i = 0; localConstantsStruct && i < localConstantsStruct->m_members.getSize(); ++i)
 	{
 	{
-		const ShaderBinaryStructMember& member = localUniformsStruct->m_members[i];
+		const ShaderBinaryStructMember& member = localConstantsStruct->m_members[i];
 		const CString memberName = member.m_name.getBegin();
 		const CString memberName = member.m_name.getBegin();
 
 
 		MaterialVariable& var = *m_vars.emplaceBack();
 		MaterialVariable& var = *m_vars.emplaceBack();
 		zeroMemory(var);
 		zeroMemory(var);
 		var.m_name = memberName;
 		var.m_name = memberName;
 		var.m_dataType = member.m_type;
 		var.m_dataType = member.m_type;
-		var.m_offsetInLocalUniforms = member.m_offset;
+		var.m_offsetInLocalConstants = member.m_offset;
 	}
 	}
 
 
-	m_localUniformsSize = (localUniformsStruct) ? localUniformsStruct->m_size : 0;
+	m_localConstantsSize = (localConstantsStruct) ? localConstantsStruct->m_size : 0;
 
 
 	return Error::kNone;
 	return Error::kNone;
 }
 }
@@ -476,15 +476,15 @@ Error MaterialResource::parseInput(XmlElement inputEl, Bool async, BitSet<128>&
 	return Error::kNone;
 	return Error::kNone;
 }
 }
 
 
-void MaterialResource::prefillLocalUniforms()
+void MaterialResource::prefillLocalConstants()
 {
 {
-	if(m_localUniformsSize == 0)
+	if(m_localConstantsSize == 0)
 	{
 	{
 		return;
 		return;
 	}
 	}
 
 
-	m_prefilledLocalUniforms = ResourceMemoryPool::getSingleton().allocate(m_localUniformsSize, 1);
-	memset(m_prefilledLocalUniforms, 0, m_localUniformsSize);
+	m_prefilledLocalConstants = ResourceMemoryPool::getSingleton().allocate(m_localConstantsSize, 1);
+	memset(m_prefilledLocalConstants, 0, m_localConstantsSize);
 
 
 	for(const MaterialVariable& var : m_vars)
 	for(const MaterialVariable& var : m_vars)
 	{
 	{
@@ -492,8 +492,8 @@ void MaterialResource::prefillLocalUniforms()
 		{
 		{
 #define ANKI_SVDT_MACRO(type, baseType, rowCount, columnCount, isIntagralType) \
 #define ANKI_SVDT_MACRO(type, baseType, rowCount, columnCount, isIntagralType) \
 	case ShaderVariableDataType::k##type: \
 	case ShaderVariableDataType::k##type: \
-		ANKI_ASSERT(var.m_offsetInLocalUniforms + sizeof(type) <= m_localUniformsSize); \
-		memcpy(static_cast<U8*>(m_prefilledLocalUniforms) + var.m_offsetInLocalUniforms, &var.m_##type, sizeof(type)); \
+		ANKI_ASSERT(var.m_offsetInLocalConstants + sizeof(type) <= m_localConstantsSize); \
+		memcpy(static_cast<U8*>(m_prefilledLocalConstants) + var.m_offsetInLocalConstants, &var.m_##type, sizeof(type)); \
 		break;
 		break;
 #include <AnKi/Gr/ShaderVariableDataType.def.h>
 #include <AnKi/Gr/ShaderVariableDataType.def.h>
 #undef ANKI_SVDT_MACRO
 #undef ANKI_SVDT_MACRO

+ 11 - 11
AnKi/Resource/MaterialResource.h

@@ -56,7 +56,7 @@ public:
 	MaterialVariable& operator=(MaterialVariable&& b)
 	MaterialVariable& operator=(MaterialVariable&& b)
 	{
 	{
 		m_name = std::move(b.m_name);
 		m_name = std::move(b.m_name);
-		m_offsetInLocalUniforms = b.m_offsetInLocalUniforms;
+		m_offsetInLocalConstants = b.m_offsetInLocalConstants;
 		m_dataType = b.m_dataType;
 		m_dataType = b.m_dataType;
 		m_Mat4 = b.m_Mat4;
 		m_Mat4 = b.m_Mat4;
 		m_image = std::move(b.m_image);
 		m_image = std::move(b.m_image);
@@ -77,15 +77,15 @@ public:
 		return m_dataType;
 		return m_dataType;
 	}
 	}
 
 
-	U32 getOffsetInLocalUniforms() const
+	U32 getOffsetInLocalConstants() const
 	{
 	{
-		ANKI_ASSERT(m_offsetInLocalUniforms != kMaxU32);
-		return m_offsetInLocalUniforms;
+		ANKI_ASSERT(m_offsetInLocalConstants != kMaxU32);
+		return m_offsetInLocalConstants;
 	}
 	}
 
 
 protected:
 protected:
 	ResourceString m_name;
 	ResourceString m_name;
-	U32 m_offsetInLocalUniforms = kMaxU32;
+	U32 m_offsetInLocalConstants = kMaxU32;
 	ShaderVariableDataType m_dataType = ShaderVariableDataType::kNone;
 	ShaderVariableDataType m_dataType = ShaderVariableDataType::kNone;
 
 
 	/// Values
 	/// Values
@@ -175,7 +175,7 @@ private:
 ///		</shaderProgram>
 ///		</shaderProgram>
 ///
 ///
 ///		[<inputs>
 ///		[<inputs>
-///			<input name="name in AnKiMaterialUniforms struct" value="value(s)"/>
+///			<input name="name in AnKiLocalConstants struct" value="value(s)"/>
 ///		</inputs>]
 ///		</inputs>]
 ///	</material>
 ///	</material>
 /// @endcode
 /// @endcode
@@ -214,9 +214,9 @@ public:
 	const MaterialVariant& getOrCreateVariant(const RenderingKey& key) const;
 	const MaterialVariant& getOrCreateVariant(const RenderingKey& key) const;
 
 
 	/// Get a buffer with prefilled uniforms.
 	/// Get a buffer with prefilled uniforms.
-	ConstWeakArray<U8> getPrefilledLocalUniforms() const
+	ConstWeakArray<U8> getPrefilledLocalConstants() const
 	{
 	{
-		return ConstWeakArray<U8>(static_cast<const U8*>(m_prefilledLocalUniforms), m_localUniformsSize);
+		return ConstWeakArray<U8>(static_cast<const U8*>(m_prefilledLocalConstants), m_localConstantsSize);
 	}
 	}
 
 
 private:
 private:
@@ -245,8 +245,8 @@ private:
 
 
 	ResourceDynamicArray<MaterialVariable> m_vars;
 	ResourceDynamicArray<MaterialVariable> m_vars;
 
 
-	void* m_prefilledLocalUniforms = nullptr;
-	U32 m_localUniformsSize = 0;
+	void* m_prefilledLocalConstants = nullptr;
+	U32 m_localConstantsSize = 0;
 
 
 	U32 m_presentBuildinMutatorMask = 0;
 	U32 m_presentBuildinMutatorMask = 0;
 
 
@@ -259,7 +259,7 @@ private:
 	Error parseInput(XmlElement inputEl, Bool async, BitSet<128>& varsSet);
 	Error parseInput(XmlElement inputEl, Bool async, BitSet<128>& varsSet);
 	Error findBuiltinMutators();
 	Error findBuiltinMutators();
 	Error createVars();
 	Error createVars();
-	void prefillLocalUniforms();
+	void prefillLocalConstants();
 
 
 	const MaterialVariable* tryFindVariableInternal(CString name) const;
 	const MaterialVariable* tryFindVariableInternal(CString name) const;
 
 

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

@@ -76,7 +76,7 @@ Error GlobalIlluminationProbeComponent::update(SceneComponentUpdateInfo& info, B
 		cmdb->bindUav(0, 0, TextureView(m_volTex.get(), TextureSubresourceDesc::all()));
 		cmdb->bindUav(0, 0, TextureView(m_volTex.get(), TextureSubresourceDesc::all()));
 
 
 		const Vec4 clearColor(0.0f);
 		const Vec4 clearColor(0.0f);
-		cmdb->setPushConstants(&clearColor, sizeof(clearColor));
+		cmdb->setFastConstants(&clearColor, sizeof(clearColor));
 
 
 		UVec3 wgSize;
 		UVec3 wgSize;
 		wgSize.x() = (8 - 1 + m_volTex->getWidth()) / 8;
 		wgSize.x() = (8 - 1 + m_volTex->getWidth()) / 8;

+ 13 - 13
AnKi/Scene/Components/ModelComponent.cpp

@@ -27,7 +27,7 @@ ModelComponent::~ModelComponent()
 
 
 void ModelComponent::freeGpuScene()
 void ModelComponent::freeGpuScene()
 {
 {
-	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneUniforms);
+	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneConstants);
 
 
 	for(PatchInfo& patch : m_patchInfos)
 	for(PatchInfo& patch : m_patchInfos)
 	{
 	{
@@ -69,12 +69,12 @@ void ModelComponent::loadModelResource(CString filename)
 	U32 uniformsSize = 0;
 	U32 uniformsSize = 0;
 	for(U32 i = 0; i < modelPatchCount; ++i)
 	for(U32 i = 0; i < modelPatchCount; ++i)
 	{
 	{
-		const U32 size = U32(m_model->getModelPatches()[i].getMaterial()->getPrefilledLocalUniforms().getSizeInBytes());
+		const U32 size = U32(m_model->getModelPatches()[i].getMaterial()->getPrefilledLocalConstants().getSizeInBytes());
 		ANKI_ASSERT((size % 4) == 0);
 		ANKI_ASSERT((size % 4) == 0);
 		uniformsSize += size;
 		uniformsSize += size;
 	}
 	}
 
 
-	m_gpuSceneUniforms = GpuSceneBuffer::getSingleton().allocate(uniformsSize, 4);
+	m_gpuSceneConstants = GpuSceneBuffer::getSingleton().allocate(uniformsSize, 4);
 	uniformsSize = 0;
 	uniformsSize = 0;
 
 
 	// Init the patches
 	// Init the patches
@@ -87,8 +87,8 @@ void ModelComponent::loadModelResource(CString filename)
 		m_castsShadow = m_castsShadow || in.getMaterial()->castsShadow();
 		m_castsShadow = m_castsShadow || in.getMaterial()->castsShadow();
 		m_presentRenderingTechniques |= in.getMaterial()->getRenderingTechniques();
 		m_presentRenderingTechniques |= in.getMaterial()->getRenderingTechniques();
 
 
-		out.m_gpuSceneUniformsOffset = m_gpuSceneUniforms.getOffset() + uniformsSize;
-		uniformsSize += U32(in.getMaterial()->getPrefilledLocalUniforms().getSizeInBytes());
+		out.m_gpuSceneConstantsOffset = m_gpuSceneConstants.getOffset() + uniformsSize;
+		uniformsSize += U32(in.getMaterial()->getPrefilledLocalConstants().getSizeInBytes());
 
 
 		out.m_gpuSceneMeshLods.allocate();
 		out.m_gpuSceneMeshLods.allocate();
 		out.m_gpuSceneRenderable.allocate();
 		out.m_gpuSceneRenderable.allocate();
@@ -206,7 +206,7 @@ Error ModelComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 			// Upload the GpuSceneRenderable
 			// Upload the GpuSceneRenderable
 			GpuSceneRenderable gpuRenderable = {};
 			GpuSceneRenderable gpuRenderable = {};
 			gpuRenderable.m_worldTransformsIndex = m_gpuSceneTransforms.getIndex() * 2;
 			gpuRenderable.m_worldTransformsIndex = m_gpuSceneTransforms.getIndex() * 2;
-			gpuRenderable.m_uniformsOffset = m_patchInfos[i].m_gpuSceneUniformsOffset;
+			gpuRenderable.m_constantsOffset = m_patchInfos[i].m_gpuSceneConstantsOffset;
 			gpuRenderable.m_meshLodsIndex = m_patchInfos[i].m_gpuSceneMeshLods.getIndex() * kMaxLodCount;
 			gpuRenderable.m_meshLodsIndex = m_patchInfos[i].m_gpuSceneMeshLods.getIndex() * kMaxLodCount;
 			gpuRenderable.m_boneTransformsOffset = (hasSkin) ? m_skinComponent->getBoneTransformsGpuSceneOffset() : 0;
 			gpuRenderable.m_boneTransformsOffset = (hasSkin) ? m_skinComponent->getBoneTransformsGpuSceneOffset() : 0;
 			gpuRenderable.m_particleEmitterIndex = kMaxU32;
 			gpuRenderable.m_particleEmitterIndex = kMaxU32;
@@ -221,21 +221,21 @@ Error ModelComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 		}
 		}
 
 
 		// Upload the uniforms
 		// Upload the uniforms
-		DynamicArray<U32, MemoryPoolPtrWrapper<StackMemoryPool>> allUniforms(info.m_framePool);
-		allUniforms.resize(m_gpuSceneUniforms.getAllocatedSize() / 4);
+		DynamicArray<U32, MemoryPoolPtrWrapper<StackMemoryPool>> allConstants(info.m_framePool);
+		allConstants.resize(m_gpuSceneConstants.getAllocatedSize() / 4);
 		U32 count = 0;
 		U32 count = 0;
 		for(U32 i = 0; i < modelPatchCount; ++i)
 		for(U32 i = 0; i < modelPatchCount; ++i)
 		{
 		{
 			const ModelPatch& patch = m_model->getModelPatches()[i];
 			const ModelPatch& patch = m_model->getModelPatches()[i];
 			const MaterialResource& mtl = *patch.getMaterial();
 			const MaterialResource& mtl = *patch.getMaterial();
-			memcpy(&allUniforms[count], mtl.getPrefilledLocalUniforms().getBegin(), mtl.getPrefilledLocalUniforms().getSizeInBytes());
+			memcpy(&allConstants[count], mtl.getPrefilledLocalConstants().getBegin(), mtl.getPrefilledLocalConstants().getSizeInBytes());
 
 
-			count += U32(mtl.getPrefilledLocalUniforms().getSizeInBytes() / 4);
+			count += U32(mtl.getPrefilledLocalConstants().getSizeInBytes() / 4);
 		}
 		}
 
 
-		ANKI_ASSERT(count * 4 == m_gpuSceneUniforms.getAllocatedSize());
-		GpuSceneMicroPatcher::getSingleton().newCopy(*info.m_framePool, m_gpuSceneUniforms.getOffset(), m_gpuSceneUniforms.getAllocatedSize(),
-													 &allUniforms[0]);
+		ANKI_ASSERT(count * 4 == m_gpuSceneConstants.getAllocatedSize());
+		GpuSceneMicroPatcher::getSingleton().newCopy(*info.m_framePool, m_gpuSceneConstants.getOffset(), m_gpuSceneConstants.getAllocatedSize(),
+													 &allConstants[0]);
 	}
 	}
 
 
 	// Upload transforms
 	// Upload transforms

+ 2 - 2
AnKi/Scene/Components/ModelComponent.h

@@ -48,7 +48,7 @@ private:
 	class PatchInfo
 	class PatchInfo
 	{
 	{
 	public:
 	public:
-		U32 m_gpuSceneUniformsOffset = kMaxU32;
+		U32 m_gpuSceneConstantsOffset = kMaxU32;
 
 
 		GpuSceneArrays::MeshLod::Allocation m_gpuSceneMeshLods;
 		GpuSceneArrays::MeshLod::Allocation m_gpuSceneMeshLods;
 		GpuSceneArrays::Renderable::Allocation m_gpuSceneRenderable;
 		GpuSceneArrays::Renderable::Allocation m_gpuSceneRenderable;
@@ -66,7 +66,7 @@ private:
 	ModelResourcePtr m_model;
 	ModelResourcePtr m_model;
 
 
 	// GPU scene part 1
 	// GPU scene part 1
-	GpuSceneBufferAllocation m_gpuSceneUniforms;
+	GpuSceneBufferAllocation m_gpuSceneConstants;
 	GpuSceneArrays::Transform::Allocation m_gpuSceneTransforms;
 	GpuSceneArrays::Transform::Allocation m_gpuSceneTransforms;
 
 
 	// Other stuff
 	// Other stuff

+ 7 - 6
AnKi/Scene/Components/ParticleEmitterComponent.cpp

@@ -272,7 +272,7 @@ void ParticleEmitterComponent::loadParticleEmitterResource(CString filename)
 	GpuSceneBuffer::getSingleton().deferredFree(m_gpuScenePositions);
 	GpuSceneBuffer::getSingleton().deferredFree(m_gpuScenePositions);
 	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneScales);
 	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneScales);
 	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneAlphas);
 	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneAlphas);
-	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneUniforms);
+	GpuSceneBuffer::getSingleton().deferredFree(m_gpuSceneConstants);
 
 
 	for(RenderStateBucketIndex& idx : m_renderStateBuckets)
 	for(RenderStateBucketIndex& idx : m_renderStateBuckets)
 	{
 	{
@@ -304,8 +304,8 @@ void ParticleEmitterComponent::loadParticleEmitterResource(CString filename)
 	m_gpuScenePositions = GpuSceneBuffer::getSingleton().allocate(sizeof(Vec3) * m_props.m_maxNumOfParticles, alignof(F32));
 	m_gpuScenePositions = GpuSceneBuffer::getSingleton().allocate(sizeof(Vec3) * m_props.m_maxNumOfParticles, alignof(F32));
 	m_gpuSceneAlphas = GpuSceneBuffer::getSingleton().allocate(sizeof(F32) * m_props.m_maxNumOfParticles, alignof(F32));
 	m_gpuSceneAlphas = GpuSceneBuffer::getSingleton().allocate(sizeof(F32) * m_props.m_maxNumOfParticles, alignof(F32));
 	m_gpuSceneScales = GpuSceneBuffer::getSingleton().allocate(sizeof(F32) * m_props.m_maxNumOfParticles, alignof(F32));
 	m_gpuSceneScales = GpuSceneBuffer::getSingleton().allocate(sizeof(F32) * m_props.m_maxNumOfParticles, alignof(F32));
-	m_gpuSceneUniforms =
-		GpuSceneBuffer::getSingleton().allocate(m_particleEmitterResource->getMaterial()->getPrefilledLocalUniforms().getSizeInBytes(), alignof(U32));
+	m_gpuSceneConstants = GpuSceneBuffer::getSingleton().allocate(
+		m_particleEmitterResource->getMaterial()->getPrefilledLocalConstants().getSizeInBytes(), alignof(U32));
 
 
 	// Allocate buckets
 	// Allocate buckets
 	for(RenderingTechnique t :
 	for(RenderingTechnique t :
@@ -374,8 +374,9 @@ Error ParticleEmitterComponent::update(SceneComponentUpdateInfo& info, Bool& upd
 		m_gpuSceneParticleEmitter.uploadToGpuScene(particles);
 		m_gpuSceneParticleEmitter.uploadToGpuScene(particles);
 
 
 		// Upload uniforms
 		// Upload uniforms
-		patcher.newCopy(*info.m_framePool, m_gpuSceneUniforms, m_particleEmitterResource->getMaterial()->getPrefilledLocalUniforms().getSizeInBytes(),
-						m_particleEmitterResource->getMaterial()->getPrefilledLocalUniforms().getBegin());
+		patcher.newCopy(*info.m_framePool, m_gpuSceneConstants,
+						m_particleEmitterResource->getMaterial()->getPrefilledLocalConstants().getSizeInBytes(),
+						m_particleEmitterResource->getMaterial()->getPrefilledLocalConstants().getBegin());
 
 
 		// Upload mesh LODs
 		// Upload mesh LODs
 		GpuSceneMeshLod meshLod = {};
 		GpuSceneMeshLod meshLod = {};
@@ -398,7 +399,7 @@ Error ParticleEmitterComponent::update(SceneComponentUpdateInfo& info, Bool& upd
 		// Upload the GpuSceneRenderable
 		// Upload the GpuSceneRenderable
 		GpuSceneRenderable renderable = {};
 		GpuSceneRenderable renderable = {};
 		renderable.m_boneTransformsOffset = 0;
 		renderable.m_boneTransformsOffset = 0;
-		renderable.m_uniformsOffset = m_gpuSceneUniforms.getOffset();
+		renderable.m_constantsOffset = m_gpuSceneConstants.getOffset();
 		renderable.m_meshLodsIndex = m_gpuSceneMeshLods.getIndex() * kMaxLodCount;
 		renderable.m_meshLodsIndex = m_gpuSceneMeshLods.getIndex() * kMaxLodCount;
 		renderable.m_particleEmitterIndex = m_gpuSceneParticleEmitter.getIndex();
 		renderable.m_particleEmitterIndex = m_gpuSceneParticleEmitter.getIndex();
 		renderable.m_worldTransformsIndex = 0;
 		renderable.m_worldTransformsIndex = 0;

+ 1 - 1
AnKi/Scene/Components/ParticleEmitterComponent.h

@@ -65,7 +65,7 @@ private:
 	GpuSceneBufferAllocation m_gpuScenePositions;
 	GpuSceneBufferAllocation m_gpuScenePositions;
 	GpuSceneBufferAllocation m_gpuSceneAlphas;
 	GpuSceneBufferAllocation m_gpuSceneAlphas;
 	GpuSceneBufferAllocation m_gpuSceneScales;
 	GpuSceneBufferAllocation m_gpuSceneScales;
-	GpuSceneBufferAllocation m_gpuSceneUniforms;
+	GpuSceneBufferAllocation m_gpuSceneConstants;
 	GpuSceneArrays::ParticleEmitter::Allocation m_gpuSceneParticleEmitter;
 	GpuSceneArrays::ParticleEmitter::Allocation m_gpuSceneParticleEmitter;
 	GpuSceneArrays::Renderable::Allocation m_gpuSceneRenderable;
 	GpuSceneArrays::Renderable::Allocation m_gpuSceneRenderable;
 	GpuSceneArrays::MeshLod::Allocation m_gpuSceneMeshLods;
 	GpuSceneArrays::MeshLod::Allocation m_gpuSceneMeshLods;

+ 1 - 1
AnKi/ShaderCompiler/Dxc.cpp

@@ -112,7 +112,7 @@ static Error compileHlsl(CString src, ShaderType shaderType, Bool compileWith16b
 		// dxcArgs.emplaceBack("-fvk-support-nonzero-base-instance"); // Match DX12's behavior, SV_INSTANCEID starts from zero
 		// dxcArgs.emplaceBack("-fvk-support-nonzero-base-instance"); // Match DX12's behavior, SV_INSTANCEID starts from zero
 
 
 		// Shift the bindings in order to identify the registers when doing reflection
 		// Shift the bindings in order to identify the registers when doing reflection
-		for(U32 ds = 0; ds < kMaxDescriptorSets; ++ds)
+		for(U32 ds = 0; ds < kMaxRegisterSpaces; ++ds)
 		{
 		{
 			dxcArgs.emplaceBack("-fvk-b-shift");
 			dxcArgs.emplaceBack("-fvk-b-shift");
 			dxcArgs.emplaceBack(ShaderCompilerString().sprintf("%u", kDxcVkBindingShifts[ds][HlslResourceType::kCbv]));
 			dxcArgs.emplaceBack(ShaderCompilerString().sprintf("%u", kDxcVkBindingShifts[ds][HlslResourceType::kCbv]));

+ 1 - 1
AnKi/ShaderCompiler/Dxc.h

@@ -14,7 +14,7 @@ namespace anki {
 /// @addtogroup shader_compiler
 /// @addtogroup shader_compiler
 /// @{
 /// @{
 
 
-inline constexpr Array2d<U32, kMaxDescriptorSets, U32(HlslResourceType::kCount)> kDxcVkBindingShifts = {
+inline constexpr Array2d<U32, kMaxRegisterSpaces, U32(HlslResourceType::kCount)> kDxcVkBindingShifts = {
 	{{1000, 2000, 3000, 4000}, {5000, 6000, 7000, 8000}, {9000, 10000, 11000, 12000}}};
 	{{1000, 2000, 3000, 4000}, {5000, 6000, 7000, 8000}, {9000, 10000, 11000, 12000}}};
 
 
 // !!!!WARNING!!!! Need to change HLSL if you change the value bellow
 // !!!!WARNING!!!! Need to change HLSL if you change the value bellow

+ 6 - 6
AnKi/ShaderCompiler/ShaderCompiler.cpp

@@ -124,7 +124,7 @@ Error doReflectionSpirv(ConstWeakArray<U8> spirv, ShaderType type, ShaderReflect
 
 
 			const U32 set = spvc.get_decoration(id, spv::Decoration::DecorationDescriptorSet);
 			const U32 set = spvc.get_decoration(id, spv::Decoration::DecorationDescriptorSet);
 			const U32 binding = spvc.get_decoration(id, spv::Decoration::DecorationBinding);
 			const U32 binding = spvc.get_decoration(id, spv::Decoration::DecorationBinding);
-			if(set >= kMaxDescriptorSets && set != kDxcVkBindlessRegisterSpace)
+			if(set >= kMaxRegisterSpaces && set != kDxcVkBindlessRegisterSpace)
 			{
 			{
 				errorStr.sprintf("Exceeded set for: %s", r.name.c_str());
 				errorStr.sprintf("Exceeded set for: %s", r.name.c_str());
 				return Error::kUserData;
 				return Error::kUserData;
@@ -249,7 +249,7 @@ Error doReflectionSpirv(ConstWeakArray<U8> spirv, ShaderType type, ShaderReflect
 		return err;
 		return err;
 	}
 	}
 
 
-	for(U32 i = 0; i < kMaxDescriptorSets; ++i)
+	for(U32 i = 0; i < kMaxRegisterSpaces; ++i)
 	{
 	{
 		std::sort(refl.m_descriptor.m_bindings[i].getBegin(), refl.m_descriptor.m_bindings[i].getBegin() + refl.m_descriptor.m_bindingCounts[i]);
 		std::sort(refl.m_descriptor.m_bindings[i].getBegin(), refl.m_descriptor.m_bindings[i].getBegin() + refl.m_descriptor.m_bindingCounts[i]);
 	}
 	}
@@ -270,13 +270,13 @@ Error doReflectionSpirv(ConstWeakArray<U8> spirv, ShaderType type, ShaderReflect
 	if(rsrc.push_constant_buffers.size() == 1)
 	if(rsrc.push_constant_buffers.size() == 1)
 	{
 	{
 		const U32 blockSize = U32(spvc.get_declared_struct_size(spvc.get_type(rsrc.push_constant_buffers[0].base_type_id)));
 		const U32 blockSize = U32(spvc.get_declared_struct_size(spvc.get_type(rsrc.push_constant_buffers[0].base_type_id)));
-		if(blockSize == 0 || (blockSize % 16) != 0 || blockSize > kMaxU8)
+		if(blockSize == 0 || (blockSize % 16) != 0 || blockSize > kMaxFastConstantsSize)
 		{
 		{
 			errorStr.sprintf("Incorrect push constants size");
 			errorStr.sprintf("Incorrect push constants size");
 			return Error::kUserData;
 			return Error::kUserData;
 		}
 		}
 
 
-		refl.m_descriptor.m_pushConstantsSize = blockSize;
+		refl.m_descriptor.m_fastConstantsSize = blockSize;
 	}
 	}
 
 
 	// Attribs
 	// Attribs
@@ -477,7 +477,7 @@ Error doReflectionDxil(ConstWeakArray<U8> dxil, ShaderType type, ShaderReflectio
 						(isLib) ? funcReflections[ifunc]->GetConstantBufferByName(bindDesc.Name) : dxRefl->GetConstantBufferByName(bindDesc.Name);
 						(isLib) ? funcReflections[ifunc]->GetConstantBufferByName(bindDesc.Name) : dxRefl->GetConstantBufferByName(bindDesc.Name);
 					D3D12_SHADER_BUFFER_DESC desc;
 					D3D12_SHADER_BUFFER_DESC desc;
 					ANKI_REFL_CHECK(cbuffer->GetDesc(&desc));
 					ANKI_REFL_CHECK(cbuffer->GetDesc(&desc));
-					refl.m_descriptor.m_pushConstantsSize = desc.Size;
+					refl.m_descriptor.m_fastConstantsSize = desc.Size;
 
 
 					continue;
 					continue;
 				}
 				}
@@ -566,7 +566,7 @@ Error doReflectionDxil(ConstWeakArray<U8> dxil, ShaderType type, ShaderReflectio
 		}
 		}
 	}
 	}
 
 
-	for(U32 i = 0; i < kMaxDescriptorSets; ++i)
+	for(U32 i = 0; i < kMaxRegisterSpaces; ++i)
 	{
 	{
 		std::sort(refl.m_descriptor.m_bindings[i].getBegin(), refl.m_descriptor.m_bindings[i].getBegin() + refl.m_descriptor.m_bindingCounts[i]);
 		std::sort(refl.m_descriptor.m_bindings[i].getBegin(), refl.m_descriptor.m_bindings[i].getBegin() + refl.m_descriptor.m_bindingCounts[i]);
 	}
 	}

+ 1 - 3
AnKi/ShaderCompiler/ShaderParser.cpp

@@ -871,9 +871,7 @@ void ShaderParser::generateAnkiShaderHeader(ShaderType shaderType, ShaderCompile
 {
 {
 	header.destroy();
 	header.destroy();
 
 
-	header += ShaderCompilerString().sprintf("#define kMaxBindlessTextures %uu\n"
-											 "#define kMaxBindlessReadonlyTextureBuffers %uu\n",
-											 kMaxBindlessTextures, kMaxBindlessReadonlyTextureBuffers);
+	header += ShaderCompilerString().sprintf("#define kMaxBindlessTextures %uu\n", kMaxBindlessTextures);
 
 
 	for(ShaderType type : EnumIterable<ShaderType>())
 	for(ShaderType type : EnumIterable<ShaderType>())
 	{
 	{

+ 4 - 4
AnKi/Shaders/Blit.ankiprog

@@ -20,12 +20,12 @@ Texture2D<RVec4> g_inputTex : register(t0);
 #	if USE_COMPUTE
 #	if USE_COMPUTE
 RWTexture2D<RVec4> g_storageTex : register(u0);
 RWTexture2D<RVec4> g_storageTex : register(u0);
 
 
-struct Uniforms
+struct Consts
 {
 {
 	Vec2 m_viewportSize;
 	Vec2 m_viewportSize;
 	UVec2 m_viewportSizeU;
 	UVec2 m_viewportSizeU;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Consts, g_consts)
 #	endif
 #	endif
 
 
 #	if USE_COMPUTE
 #	if USE_COMPUTE
@@ -35,12 +35,12 @@ RVec3 main(VertOut input) : SV_TARGET0
 #	endif
 #	endif
 {
 {
 #	if USE_COMPUTE
 #	if USE_COMPUTE
-	if(skipOutOfBoundsInvocations(UVec2(8, 8), g_unis.m_viewportSizeU, svDispatchThreadId.xy))
+	if(skipOutOfBoundsInvocations(UVec2(8, 8), g_consts.m_viewportSizeU, svDispatchThreadId.xy))
 	{
 	{
 		return;
 		return;
 	}
 	}
 
 
-	const Vec2 uv = (Vec2(svDispatchThreadId.xy) + 0.5) / g_unis.m_viewportSize;
+	const Vec2 uv = (Vec2(svDispatchThreadId.xy) + 0.5) / g_consts.m_viewportSize;
 #	else
 #	else
 	const Vec2 uv = input.m_uv;
 	const Vec2 uv = input.m_uv;
 #	endif
 #	endif

+ 3 - 3
AnKi/Shaders/Bloom.ankiprog

@@ -14,14 +14,14 @@ Texture2D<RVec4> g_inTex : register(t0);
 #	define TONEMAPPING_REGISTER u0
 #	define TONEMAPPING_REGISTER u0
 #	include <AnKi/Shaders/TonemappingResources.hlsl>
 #	include <AnKi/Shaders/TonemappingResources.hlsl>
 
 
-struct Uniforms
+struct Consts
 {
 {
 	RF32 m_threshold;
 	RF32 m_threshold;
 	F32 m_scale;
 	F32 m_scale;
 	F32 m_padding0;
 	F32 m_padding0;
 	F32 m_padding1;
 	F32 m_padding1;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Consts, g_consts)
 
 
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
 #		define THREADGROUP_SIZE_X 8
 #		define THREADGROUP_SIZE_X 8
@@ -51,7 +51,7 @@ RVec3 main(VertOut input) : SV_TARGET0
 	color += g_inTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, IVec2(-1, +1)).rgb * weight;
 	color += g_inTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, IVec2(-1, +1)).rgb * weight;
 	color += g_inTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, IVec2(+1, -1)).rgb * weight;
 	color += g_inTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, IVec2(+1, -1)).rgb * weight;
 
 
-	color = tonemap(color, readExposureAndAverageLuminance().y, g_unis.m_threshold) * g_unis.m_scale;
+	color = tonemap(color, readExposureAndAverageLuminance().y, g_consts.m_threshold) * g_consts.m_scale;
 
 
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
 	g_storageTex[svDispatchThreadId] = RVec4(color, 0.0);
 	g_storageTex[svDispatchThreadId] = RVec4(color, 0.0);

+ 4 - 4
AnKi/Shaders/ClearTextureCompute.ankiprog

@@ -11,7 +11,7 @@
 #pragma anki technique_start comp
 #pragma anki technique_start comp
 #include <AnKi/Shaders/Common.hlsl>
 #include <AnKi/Shaders/Common.hlsl>
 
 
-struct Uniforms
+struct Consts
 {
 {
 #if COMPONENT_TYPE == 0
 #if COMPONENT_TYPE == 0
 	Vec4 m_clearColor;
 	Vec4 m_clearColor;
@@ -20,7 +20,7 @@ struct Uniforms
 #endif
 #endif
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Consts, g_consts)
 
 
 #if TEXTURE_DIMENSIONS == 2
 #if TEXTURE_DIMENSIONS == 2
 #	if COMPONENT_TYPE == 0
 #	if COMPONENT_TYPE == 0
@@ -47,7 +47,7 @@ RWTexture3D<UVec4> g_storageTex : register(u0);
 		return;
 		return;
 	}
 	}
 
 
-	g_storageTex[svDispatchThreadId.xy] = g_unis.m_clearColor;
+	g_storageTex[svDispatchThreadId.xy] = g_consts.m_clearColor;
 #else
 #else
 	UVec3 texSize;
 	UVec3 texSize;
 	g_storageTex.GetDimensions(texSize.x, texSize.y, texSize.z);
 	g_storageTex.GetDimensions(texSize.x, texSize.y, texSize.z);
@@ -57,7 +57,7 @@ RWTexture3D<UVec4> g_storageTex : register(u0);
 		return;
 		return;
 	}
 	}
 
 
-	g_storageTex[svDispatchThreadId] = g_unis.m_clearColor;
+	g_storageTex[svDispatchThreadId] = g_consts.m_clearColor;
 #endif
 #endif
 }
 }
 
 

+ 17 - 17
AnKi/Shaders/ClusterBinning.ankiprog

@@ -26,7 +26,7 @@ typedef GpuSceneGlobalIlluminationProbe GpuSceneType;
 #	error See file
 #	error See file
 #endif
 #endif
 
 
-struct ClusterBinningUniforms
+struct ClusterBinningConstants
 {
 {
 	Vec3 m_cameraOrigin;
 	Vec3 m_cameraOrigin;
 	F32 m_zSplitCountOverFrustumLength;
 	F32 m_zSplitCountOverFrustumLength;
@@ -44,7 +44,7 @@ struct ClusterBinningUniforms
 
 
 	Mat4 m_invertedViewProjMat;
 	Mat4 m_invertedViewProjMat;
 };
 };
-ANKI_PUSH_CONSTANTS(ClusterBinningUniforms, g_unis)
+ANKI_FAST_CONSTANTS(ClusterBinningConstants, g_consts)
 
 
 StructuredBuffer<U32> g_visibleObjectIds : register(t0); // 1st index is the count and then the indices to the g_objects
 StructuredBuffer<U32> g_visibleObjectIds : register(t0); // 1st index is the count and then the indices to the g_objects
 StructuredBuffer<GpuSceneType> g_objects : register(t1);
 StructuredBuffer<GpuSceneType> g_objects : register(t1);
@@ -62,25 +62,25 @@ constexpr UVec2 kSampleLocations[kSampleCount] = {LOCATION(1, -3), LOCATION(-1,
 
 
 [numthreads(THREADGROUP_SIZE, 1, 1)] void main(UVec2 svDispatchThreadId : SV_DISPATCHTHREADID)
 [numthreads(THREADGROUP_SIZE, 1, 1)] void main(UVec2 svDispatchThreadId : SV_DISPATCHTHREADID)
 {
 {
-	const U32 dispatchThreadIdX = min(svDispatchThreadId.x, g_unis.m_tileCount * kSampleCount);
+	const U32 dispatchThreadIdX = min(svDispatchThreadId.x, g_consts.m_tileCount * kSampleCount);
 	const U32 tileIdx = dispatchThreadIdX / kSampleCount;
 	const U32 tileIdx = dispatchThreadIdX / kSampleCount;
 	const U32 sampleIdx = dispatchThreadIdX % kSampleCount;
 	const U32 sampleIdx = dispatchThreadIdX % kSampleCount;
 	const U32 visibleObjectIdx = svDispatchThreadId.y;
 	const U32 visibleObjectIdx = svDispatchThreadId.y;
 	ANKI_ASSERT(visibleObjectIdx < kMaxVisibleClusteredObjects[OBJECT_TYPE]);
 	ANKI_ASSERT(visibleObjectIdx < kMaxVisibleClusteredObjects[OBJECT_TYPE]);
 
 
-	const UVec2 tileXY = UVec2(tileIdx % g_unis.m_tileCountX, tileIdx / g_unis.m_tileCountX);
+	const UVec2 tileXY = UVec2(tileIdx % g_consts.m_tileCountX, tileIdx / g_consts.m_tileCountX);
 
 
 	// This is a pixel in one of the main framebuffers of the renderer, eg the gbuffer's framebuffers
 	// This is a pixel in one of the main framebuffers of the renderer, eg the gbuffer's framebuffers
 	const UVec2 pixel = tileXY * kClusteredShadingTileSize + kSampleLocations[sampleIdx];
 	const UVec2 pixel = tileXY * kClusteredShadingTileSize + kSampleLocations[sampleIdx];
-	const Vec2 uv = Vec2(pixel) / g_unis.m_renderingSize;
+	const Vec2 uv = Vec2(pixel) / g_consts.m_renderingSize;
 	const Vec2 ndc = uvToNdc(uv);
 	const Vec2 ndc = uvToNdc(uv);
 
 
 	// Unproject the sample in world space
 	// Unproject the sample in world space
-	const Vec4 farWorldPos4 = mul(g_unis.m_invertedViewProjMat, Vec4(ndc, 1.0, 1.0));
+	const Vec4 farWorldPos4 = mul(g_consts.m_invertedViewProjMat, Vec4(ndc, 1.0, 1.0));
 	const Vec3 farWorldPos = farWorldPos4.xyz / farWorldPos4.w;
 	const Vec3 farWorldPos = farWorldPos4.xyz / farWorldPos4.w;
 
 
 	// Create the ray that will test the clusterer objects
 	// Create the ray that will test the clusterer objects
-	const Vec3 rayOrigin = g_unis.m_cameraOrigin;
+	const Vec3 rayOrigin = g_consts.m_cameraOrigin;
 	const Vec3 rayDir = normalize(farWorldPos - rayOrigin);
 	const Vec3 rayDir = normalize(farWorldPos - rayOrigin);
 
 
 	// Do collision
 	// Do collision
@@ -181,8 +181,8 @@ constexpr UVec2 kSampleLocations[kSampleCount] = {LOCATION(1, -3), LOCATION(-1,
 		// Compute and set the Z splits
 		// Compute and set the Z splits
 		const Vec3 hitpointA = rayDir * t0 + rayOrigin;
 		const Vec3 hitpointA = rayDir * t0 + rayOrigin;
 		const Vec3 hitpointB = rayDir * t1 + rayOrigin;
 		const Vec3 hitpointB = rayDir * t1 + rayOrigin;
-		const F32 distFromNearPlaneA = testPlanePoint(g_unis.m_nearPlaneWorld.xyz, g_unis.m_nearPlaneWorld.w, hitpointA);
-		const F32 distFromNearPlaneB = testPlanePoint(g_unis.m_nearPlaneWorld.xyz, g_unis.m_nearPlaneWorld.w, hitpointB);
+		const F32 distFromNearPlaneA = testPlanePoint(g_consts.m_nearPlaneWorld.xyz, g_consts.m_nearPlaneWorld.w, hitpointA);
+		const F32 distFromNearPlaneB = testPlanePoint(g_consts.m_nearPlaneWorld.xyz, g_consts.m_nearPlaneWorld.w, hitpointB);
 
 
 		F32 minDistFromNearPlane;
 		F32 minDistFromNearPlane;
 		F32 maxDistFromNearPlane;
 		F32 maxDistFromNearPlane;
@@ -197,27 +197,27 @@ constexpr UVec2 kSampleLocations[kSampleCount] = {LOCATION(1, -3), LOCATION(-1,
 			maxDistFromNearPlane = distFromNearPlaneA;
 			maxDistFromNearPlane = distFromNearPlaneA;
 		}
 		}
 
 
-		const I32 startZSplit = max(I32(minDistFromNearPlane * g_unis.m_zSplitCountOverFrustumLength), 0);
-		const I32 endZSplit = clamp(I32(maxDistFromNearPlane * g_unis.m_zSplitCountOverFrustumLength), 0, g_unis.m_zSplitCountMinusOne);
+		const I32 startZSplit = max(I32(minDistFromNearPlane * g_consts.m_zSplitCountOverFrustumLength), 0);
+		const I32 endZSplit = clamp(I32(maxDistFromNearPlane * g_consts.m_zSplitCountOverFrustumLength), 0, g_consts.m_zSplitCountMinusOne);
 		for(I32 i = startZSplit; i <= endZSplit; ++i)
 		for(I32 i = startZSplit; i <= endZSplit; ++i)
 		{
 		{
 #if OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_LIGHT
 #if OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_LIGHT
 			if((U32)obj.m_flags & (U32)GpuSceneLightFlag::kPointLight)
 			if((U32)obj.m_flags & (U32)GpuSceneLightFlag::kPointLight)
 			{
 			{
-				InterlockedOr(g_clusters[g_unis.m_tileCount + i].m_pointLightsMask[maskArrayIdx], mask);
+				InterlockedOr(g_clusters[g_consts.m_tileCount + i].m_pointLightsMask[maskArrayIdx], mask);
 			}
 			}
 			else
 			else
 			{
 			{
-				InterlockedOr(g_clusters[g_unis.m_tileCount + i].m_spotLightsMask[maskArrayIdx], mask);
+				InterlockedOr(g_clusters[g_consts.m_tileCount + i].m_spotLightsMask[maskArrayIdx], mask);
 			}
 			}
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_DECAL
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_DECAL
-			InterlockedOr(g_clusters[g_unis.m_tileCount + i].m_decalsMask[maskArrayIdx], mask);
+			InterlockedOr(g_clusters[g_consts.m_tileCount + i].m_decalsMask[maskArrayIdx], mask);
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_FOG_DENSITY_VOLUME
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_FOG_DENSITY_VOLUME
-			InterlockedOr(g_clusters[g_unis.m_tileCount + i].m_fogDensityVolumesMask, mask);
+			InterlockedOr(g_clusters[g_consts.m_tileCount + i].m_fogDensityVolumesMask, mask);
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_REFLECTION_PROBE
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_REFLECTION_PROBE
-			InterlockedOr(g_clusters[g_unis.m_tileCount + i].m_reflectionProbesMask, mask);
+			InterlockedOr(g_clusters[g_consts.m_tileCount + i].m_reflectionProbesMask, mask);
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE
 #elif OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_GLOBAL_ILLUMINATION_PROBE
-			InterlockedOr(g_clusters[g_unis.m_tileCount + i].m_giProbesMask, mask);
+			InterlockedOr(g_clusters[g_consts.m_tileCount + i].m_giProbesMask, mask);
 #else
 #else
 #	error See file
 #	error See file
 #endif
 #endif

+ 3 - 3
AnKi/Shaders/ClusterBinningSetup.ankiprog

@@ -16,14 +16,14 @@ StructuredBuffer<U32> g_visibleIndices[(U32)GpuSceneNonRenderableObjectType::kCo
 // binning dispatches and the rest GpuSceneNonRenderableObjectType::kCount for the packing dispatches
 // binning dispatches and the rest GpuSceneNonRenderableObjectType::kCount for the packing dispatches
 RWStructuredBuffer<DispatchIndirectArgs> g_indirectArgs : register(u0);
 RWStructuredBuffer<DispatchIndirectArgs> g_indirectArgs : register(u0);
 
 
-struct Uniforms
+struct Constants
 {
 {
 	U32 m_tileCount;
 	U32 m_tileCount;
 	U32 m_padding1;
 	U32 m_padding1;
 	U32 m_padding2;
 	U32 m_padding2;
 	U32 m_padding3;
 	U32 m_padding3;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 constexpr U32 kSampleCount = 8;
 constexpr U32 kSampleCount = 8;
 constexpr U32 kClusterBinningThreadgroupSize = 64;
 constexpr U32 kClusterBinningThreadgroupSize = 64;
@@ -41,7 +41,7 @@ constexpr U32 kPackVisiblesThreadgroupSize = 64;
 		const U32 objCount = min(kMaxVisibleClusteredObjects[(U32)type], g_visibleIndices[(U32)type][0]);
 		const U32 objCount = min(kMaxVisibleClusteredObjects[(U32)type], g_visibleIndices[(U32)type][0]);
 
 
 		DispatchIndirectArgs args;
 		DispatchIndirectArgs args;
-		args.m_threadGroupCountX = (g_unis.m_tileCount * kSampleCount + kClusterBinningThreadgroupSize - 1) / kClusterBinningThreadgroupSize;
+		args.m_threadGroupCountX = (g_consts.m_tileCount * kSampleCount + kClusterBinningThreadgroupSize - 1) / kClusterBinningThreadgroupSize;
 		args.m_threadGroupCountY = objCount;
 		args.m_threadGroupCountY = objCount;
 		args.m_threadGroupCountZ = 1;
 		args.m_threadGroupCountZ = 1;
 
 

+ 1 - 1
AnKi/Shaders/ClusteredShadingFunctions.hlsl

@@ -97,7 +97,7 @@ Cluster mergeClusters(Cluster tileCluster, Cluster zCluster)
 }
 }
 
 
 /// Get the final cluster after ORing and ANDing the masks.
 /// Get the final cluster after ORing and ANDing the masks.
-Cluster getClusterFragCoord(StructuredBuffer<Cluster> clusters, GlobalRendererUniforms consts, Vec3 fragCoord)
+Cluster getClusterFragCoord(StructuredBuffer<Cluster> clusters, GlobalRendererConstants consts, Vec3 fragCoord)
 {
 {
 	const Cluster tileCluster = clusters[computeTileClusterIndexFragCoord(fragCoord.xy, consts.m_tileCounts.x)];
 	const Cluster tileCluster = clusters[computeTileClusterIndexFragCoord(fragCoord.xy, consts.m_tileCounts.x)];
 	const Cluster zCluster = clusters[computeZSplitClusterIndex(fragCoord.z, consts.m_zSplitCount, consts.m_zSplitMagic.x, consts.m_zSplitMagic.y)
 	const Cluster zCluster = clusters[computeZSplitClusterIndex(fragCoord.z, consts.m_zSplitCount, consts.m_zSplitMagic.x, consts.m_zSplitMagic.y)

+ 2 - 2
AnKi/Shaders/Common.hlsl

@@ -14,9 +14,9 @@
 #endif
 #endif
 
 
 #if ANKI_GR_BACKEND_VULKAN
 #if ANKI_GR_BACKEND_VULKAN
-#	define ANKI_PUSH_CONSTANTS(type, var) [[vk::push_constant]] ConstantBuffer<type> var;
+#	define ANKI_FAST_CONSTANTS(type, var) [[vk::push_constant]] ConstantBuffer<type> var;
 #else
 #else
-#	define ANKI_PUSH_CONSTANTS(type, var) ConstantBuffer<type> var : register(b0, space3000);
+#	define ANKI_FAST_CONSTANTS(type, var) ConstantBuffer<type> var : register(b0, space3000);
 #endif
 #endif
 
 
 #if ANKI_GR_BACKEND_VULKAN
 #if ANKI_GR_BACKEND_VULKAN

+ 4 - 4
AnKi/Shaders/DbgBillboard.ankiprog

@@ -13,13 +13,13 @@
 constexpr F32 kAlpha = 1.0f;
 constexpr F32 kAlpha = 1.0f;
 constexpr F32 kBillboardScale = 0.25f;
 constexpr F32 kBillboardScale = 0.25f;
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Mat4 m_viewProjMat;
 	Mat4 m_viewProjMat;
 	Mat3x4 m_camTrf;
 	Mat3x4 m_camTrf;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 #if OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_LIGHT
 #if OBJECT_TYPE == ANKI_GPU_SCENE_NON_RENDERABLE_OBJECT_TYPE_LIGHT
 typedef LightUnion ClusteredType;
 typedef LightUnion ClusteredType;
@@ -85,9 +85,9 @@ VertOut main(VertIn input)
 #endif
 #endif
 
 
 		// Rotate towards the camera and apply translation
 		// Rotate towards the camera and apply translation
-		const Vec3 worldPos = mul(g_unis.m_camTrf, Vec4((output.m_uv * 2.0 - 1.0) * kBillboardScale, 0.0, 0.0)) + localPos;
+		const Vec3 worldPos = mul(g_consts.m_camTrf, Vec4((output.m_uv * 2.0 - 1.0) * kBillboardScale, 0.0, 0.0)) + localPos;
 
 
-		output.m_svPosition = mul(g_unis.m_viewProjMat, Vec4(worldPos, 1.0));
+		output.m_svPosition = mul(g_consts.m_viewProjMat, Vec4(worldPos, 1.0));
 	}
 	}
 	else
 	else
 	{
 	{

+ 5 - 5
AnKi/Shaders/DbgRenderables.ankiprog

@@ -8,13 +8,13 @@
 #include <AnKi/Shaders/Common.hlsl>
 #include <AnKi/Shaders/Common.hlsl>
 #include <AnKi/Shaders/Include/GpuSceneTypes.h>
 #include <AnKi/Shaders/Include/GpuSceneTypes.h>
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Vec4 m_color;
 	Vec4 m_color;
 	Mat4 m_viewProjMat;
 	Mat4 m_viewProjMat;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 StructuredBuffer<GpuSceneRenderableBoundingVolume> g_renderableBoundingVolumes : register(t1);
 StructuredBuffer<GpuSceneRenderableBoundingVolume> g_renderableBoundingVolumes : register(t1);
 StructuredBuffer<U32> g_visibleRenderableBoundingVolumeIndices : register(t2);
 StructuredBuffer<U32> g_visibleRenderableBoundingVolumeIndices : register(t2);
@@ -42,7 +42,7 @@ VertOut main(VertIn input)
 		const GpuSceneRenderableBoundingVolume bvol = g_renderableBoundingVolumes[g_visibleRenderableBoundingVolumeIndices[input.m_svInstanceId + 1]];
 		const GpuSceneRenderableBoundingVolume bvol = g_renderableBoundingVolumes[g_visibleRenderableBoundingVolumeIndices[input.m_svInstanceId + 1]];
 		const Vec3 boxCenter = (bvol.m_aabbMin + bvol.m_aabbMax) * 0.5f;
 		const Vec3 boxCenter = (bvol.m_aabbMin + bvol.m_aabbMax) * 0.5f;
 		Vec3 localPos = input.m_position * (bvol.m_aabbMax - boxCenter) + boxCenter;
 		Vec3 localPos = input.m_position * (bvol.m_aabbMax - boxCenter) + boxCenter;
-		output.m_svPosition = mul(g_unis.m_viewProjMat, Vec4(localPos, 1.0));
+		output.m_svPosition = mul(g_consts.m_viewProjMat, Vec4(localPos, 1.0));
 	}
 	}
 	else
 	else
 	{
 	{
@@ -76,11 +76,11 @@ Vec4 main(VertOut input) : SV_TARGET0
 	const Bool depthTestFailed = input.m_svPosition.z >= depthRef;
 	const Bool depthTestFailed = input.m_svPosition.z >= depthRef;
 	if(depthTestFailed)
 	if(depthTestFailed)
 	{
 	{
-		return g_unis.m_color * 0.5;
+		return g_consts.m_color * 0.5;
 	}
 	}
 #endif
 #endif
 
 
 	// Write the color
 	// Write the color
-	return g_unis.m_color;
+	return g_consts.m_color;
 }
 }
 #pragma anki technique_end frag
 #pragma anki technique_end frag

+ 3 - 3
AnKi/Shaders/DepthDownscale.ankiprog

@@ -9,7 +9,7 @@
 #include <AnKi/Shaders/Common.hlsl>
 #include <AnKi/Shaders/Common.hlsl>
 #include <AnKi/Shaders/Include/MiscRendererTypes.h>
 #include <AnKi/Shaders/Include/MiscRendererTypes.h>
 
 
-ANKI_PUSH_CONSTANTS(DepthDownscaleUniforms, g_unis)
+ANKI_FAST_CONSTANTS(DepthDownscaleConstants, g_consts)
 
 
 globallycoherent RWStructuredBuffer<U32> g_spdCounter : register(u0);
 globallycoherent RWStructuredBuffer<U32> g_spdCounter : register(u0);
 RWTexture2D<Vec4> g_dstStorageTextures[kMaxMipsSinglePassDownsamplerCanProduce] : register(u1);
 RWTexture2D<Vec4> g_dstStorageTextures[kMaxMipsSinglePassDownsamplerCanProduce] : register(u1);
@@ -28,7 +28,7 @@ groupshared AF1 s_spdIntermediateR[16][16];
 AF4 SpdLoadSourceImage(AU2 p, AU1 slice)
 AF4 SpdLoadSourceImage(AU2 p, AU1 slice)
 {
 {
 	ANKI_MAYBE_UNUSED(slice);
 	ANKI_MAYBE_UNUSED(slice);
-	const AF2 textureCoord = Vec2(p) * g_unis.m_srcTexSizeOverOne + g_unis.m_srcTexSizeOverOne;
+	const AF2 textureCoord = Vec2(p) * g_consts.m_srcTexSizeOverOne + g_consts.m_srcTexSizeOverOne;
 	return AF4(g_srcTex.SampleLevel(u_linearAnyClampSampler, textureCoord, 0.0).r, 0.0, 0.0, 0.0);
 	return AF4(g_srcTex.SampleLevel(u_linearAnyClampSampler, textureCoord, 0.0).r, 0.0, 0.0, 0.0);
 }
 }
 
 
@@ -89,7 +89,7 @@ AF4 SpdReduce4(AF4 v0, AF4 v1, AF4 v2, AF4 v3)
 {
 {
 	const U32 slice = 0u;
 	const U32 slice = 0u;
 	const UVec2 offset = UVec2(0, 0);
 	const UVec2 offset = UVec2(0, 0);
-	SpdDownsample(AU2(svGroupId.xy), AU1(svGroupIndex), AU1(g_unis.m_mipmapCount), AU1(g_unis.m_threadgroupCount), slice, offset);
+	SpdDownsample(AU2(svGroupId.xy), AU1(svGroupIndex), AU1(g_consts.m_mipmapCount), AU1(g_consts.m_threadgroupCount), slice, offset);
 }
 }
 
 
 #pragma anki technique_end comp
 #pragma anki technique_end comp

+ 3 - 3
AnKi/Shaders/DownscaleBlur.ankiprog

@@ -14,12 +14,12 @@ Texture2D<RVec3> g_tex : register(t0);
 #	define TONEMAPPING_REGISTER u0
 #	define TONEMAPPING_REGISTER u0
 #	include <AnKi/Shaders/TonemappingResources.hlsl>
 #	include <AnKi/Shaders/TonemappingResources.hlsl>
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Vec2 m_fbSize;
 	Vec2 m_fbSize;
 	UVec2 m_padding;
 	UVec2 m_padding;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
 RWTexture2D<RVec4> g_storageTex : register(u1);
 RWTexture2D<RVec4> g_storageTex : register(u1);
@@ -32,7 +32,7 @@ RVec3 main(VertOut input) : SV_TARGET0
 #	endif
 #	endif
 {
 {
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
-	const Vec2 uv = (Vec2(svDispatchThreadId) + 0.5) / g_unis.m_fbSize;
+	const Vec2 uv = (Vec2(svDispatchThreadId) + 0.5) / g_consts.m_fbSize;
 #	else
 #	else
 	const Vec2 uv = input.m_uv;
 	const Vec2 uv = input.m_uv;
 #	endif
 #	endif

+ 6 - 5
AnKi/Shaders/FinalComposite.ankiprog

@@ -28,14 +28,14 @@ Texture2D g_depthRt : register(t4);
 Texture2D<RVec4> g_dbgOutlineRt : register(t5);
 Texture2D<RVec4> g_dbgOutlineRt : register(t5);
 #endif
 #endif
 
 
-struct Uniforms
+struct Constants
 {
 {
 	U32 m_motionBlurSamples;
 	U32 m_motionBlurSamples;
 	F32 m_filmGrainStrength;
 	F32 m_filmGrainStrength;
 	U32 m_frameCount;
 	U32 m_frameCount;
 	U32 m_padding;
 	U32 m_padding;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 RVec3 colorGrading(RVec3 color)
 RVec3 colorGrading(RVec3 color)
 {
 {
@@ -55,9 +55,10 @@ RVec3 main(VertOut input) : SV_TARGET0
 	const Vec2 uv = input.m_uv;
 	const Vec2 uv = input.m_uv;
 	RVec3 outColor;
 	RVec3 outColor;
 
 
-	if(g_unis.m_motionBlurSamples > 0u)
+	if(g_consts.m_motionBlurSamples > 0u)
 	{
 	{
-		outColor = motionBlur(g_motionVectorsRt, g_nearestAnyClampSampler, g_lightShadingRt, g_linearAnyClampSampler, uv, g_unis.m_motionBlurSamples);
+		outColor =
+			motionBlur(g_motionVectorsRt, g_nearestAnyClampSampler, g_lightShadingRt, g_linearAnyClampSampler, uv, g_consts.m_motionBlurSamples);
 	}
 	}
 	else
 	else
 	{
 	{
@@ -73,7 +74,7 @@ RVec3 main(VertOut input) : SV_TARGET0
 
 
 #if FILM_GRAIN
 #if FILM_GRAIN
 	const F32 dt = 1.0;
 	const F32 dt = 1.0;
-	outColor = filmGrain<F32>(outColor, uv, g_unis.m_filmGrainStrength, F32(g_unis.m_frameCount % 0xFFFFu) * dt);
+	outColor = filmGrain<F32>(outColor, uv, g_consts.m_filmGrainStrength, F32(g_consts.m_frameCount % 0xFFFFu) * dt);
 #endif
 #endif
 
 
 #if DBG_ENABLED
 #if DBG_ENABLED

+ 6 - 6
AnKi/Shaders/ForwardShadingCommon.hlsl

@@ -45,7 +45,7 @@ Vec3 computeLightColorHigh(Vec3 diffCol, Vec3 worldPos, Vec4 svPosition)
 	Vec3 outColor = Vec3(0.0, 0.0, 0.0);
 	Vec3 outColor = Vec3(0.0, 0.0, 0.0);
 
 
 	// Find the cluster and then the light counts
 	// Find the cluster and then the light counts
-	Cluster cluster = getClusterFragCoord(g_clusters, g_globalRendererUniforms, svPosition.xyz);
+	Cluster cluster = getClusterFragCoord(g_clusters, g_globalRendererConstants, svPosition.xyz);
 
 
 	// Point lights
 	// Point lights
 	U32 idx = 0;
 	U32 idx = 0;
@@ -98,9 +98,9 @@ RVec3 computeLightColorLow(RVec3 diffCol, RVec3 worldPos, Vec4 svPosition)
 {
 {
 	ANKI_MAYBE_UNUSED(worldPos);
 	ANKI_MAYBE_UNUSED(worldPos);
 
 
-	const Vec2 uv = svPosition.xy / g_globalRendererUniforms.m_renderingSize;
-	const F32 linearDepth = linearizeDepth(svPosition.z, g_globalRendererUniforms.m_near, g_globalRendererUniforms.m_far);
-	const F32 w = linearDepth * (F32(g_globalRendererUniforms.m_zSplitCount) / F32(g_globalRendererUniforms.m_lightVolumeLastZSplit + 1u));
+	const Vec2 uv = svPosition.xy / g_globalRendererConstants.m_renderingSize;
+	const F32 linearDepth = linearizeDepth(svPosition.z, g_globalRendererConstants.m_near, g_globalRendererConstants.m_far);
+	const F32 w = linearDepth * (F32(g_globalRendererConstants.m_zSplitCount) / F32(g_globalRendererConstants.m_lightVolumeLastZSplit + 1u));
 	const Vec3 uvw = Vec3(uv, w);
 	const Vec3 uvw = Vec3(uv, w);
 
 
 	const RVec3 light = g_lightVol.SampleLevel(g_linearAnyClampSampler, uvw, 0.0).rgb;
 	const RVec3 light = g_lightVol.SampleLevel(g_linearAnyClampSampler, uvw, 0.0).rgb;
@@ -114,13 +114,13 @@ void particleAlpha(RVec4 color, RVec4 scaleColor, RVec4 biasColor, out FragOut o
 
 
 void fog(RVec3 color, RF32 fogAlphaScale, RF32 fogDistanceOfMaxThikness, F32 zVSpace, Vec2 svPosition, out FragOut output)
 void fog(RVec3 color, RF32 fogAlphaScale, RF32 fogDistanceOfMaxThikness, F32 zVSpace, Vec2 svPosition, out FragOut output)
 {
 {
-	const Vec2 screenSize = 1.0 / g_globalRendererUniforms.m_renderingSize;
+	const Vec2 screenSize = 1.0 / g_globalRendererConstants.m_renderingSize;
 
 
 	const Vec2 texCoords = svPosition * screenSize;
 	const Vec2 texCoords = svPosition * screenSize;
 	const F32 depth = g_gbufferDepthTex.Sample(g_linearAnyClampSampler, texCoords, 0.0).r;
 	const F32 depth = g_gbufferDepthTex.Sample(g_linearAnyClampSampler, texCoords, 0.0).r;
 	F32 zFeatherFactor;
 	F32 zFeatherFactor;
 
 
-	const Vec4 fragPosVspace4 = mul(g_globalRendererUniforms.m_matrices.m_invertedProjectionJitter, Vec4(Vec3(uvToNdc(texCoords), depth), 1.0));
+	const Vec4 fragPosVspace4 = mul(g_globalRendererConstants.m_matrices.m_invertedProjectionJitter, Vec4(Vec3(uvToNdc(texCoords), depth), 1.0));
 	const F32 sceneZVspace = fragPosVspace4.z / fragPosVspace4.w;
 	const F32 sceneZVspace = fragPosVspace4.z / fragPosVspace4.w;
 
 
 	const F32 diff = max(0.0, zVSpace - sceneZVspace);
 	const F32 diff = max(0.0, zVSpace - sceneZVspace);

+ 7 - 7
AnKi/Shaders/ForwardShadingFog.ankiprog

@@ -6,7 +6,7 @@
 #include <AnKi/Shaders/ForwardShadingCommon.hlsl>
 #include <AnKi/Shaders/ForwardShadingCommon.hlsl>
 #include <AnKi/Shaders/Functions.hlsl>
 #include <AnKi/Shaders/Functions.hlsl>
 
 
-#pragma anki struct AnKiLocalUniforms
+#pragma anki struct AnKiLocalConstants
 #pragma anki member RVec3 m_fogColor
 #pragma anki member RVec3 m_fogColor
 #pragma anki member RF32 m_fogAlphaScale
 #pragma anki member RF32 m_fogAlphaScale
 #pragma anki member RF32 m_fogDistanceOfMaxThikness
 #pragma anki member RF32 m_fogDistanceOfMaxThikness
@@ -22,7 +22,7 @@ struct VertOut
 {
 {
 	Vec4 m_svPosition : SV_POSITION;
 	Vec4 m_svPosition : SV_POSITION;
 	F32 m_zVSpace : ZVSPACE;
 	F32 m_zVSpace : ZVSPACE;
-	nointerpolation U32 m_uniformsOffset : UNIFORMS;
+	nointerpolation U32 m_constantsOffset : CONSTANTS_OFFSET;
 };
 };
 
 
 #pragma anki technique_start vert Forward
 #pragma anki technique_start vert Forward
@@ -37,12 +37,12 @@ VertOut main(VertIn input)
 	const UnpackedMeshVertex vertex = loadVertex(mesh, input.m_svVertexId, false);
 	const UnpackedMeshVertex vertex = loadVertex(mesh, input.m_svVertexId, false);
 
 
 	const Vec3 worldPos = mul(worldTransform, Vec4(vertex.m_position, 1.0));
 	const Vec3 worldPos = mul(worldTransform, Vec4(vertex.m_position, 1.0));
-	output.m_svPosition = mul(g_globalUniforms.m_viewProjectionMatrix, Vec4(worldPos, 1.0));
+	output.m_svPosition = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(worldPos, 1.0));
 
 
-	const Vec3 viewPos = mul(g_globalUniforms.m_viewTransform, Vec4(worldPos, 1.0));
+	const Vec3 viewPos = mul(g_globalConstants.m_viewTransform, Vec4(worldPos, 1.0));
 	output.m_zVSpace = viewPos.z;
 	output.m_zVSpace = viewPos.z;
 
 
-	output.m_uniformsOffset = renderable.m_uniformsOffset;
+	output.m_constantsOffset = renderable.m_constantsOffset;
 
 
 	return output;
 	return output;
 }
 }
@@ -54,9 +54,9 @@ VertOut main(VertIn input)
 FragOut main(VertOut input)
 FragOut main(VertOut input)
 {
 {
 	FragOut output = (FragOut)0;
 	FragOut output = (FragOut)0;
-	const AnKiLocalUniforms localUniforms = loadAnKiLocalUniforms(g_gpuScene, input.m_uniformsOffset);
+	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, input.m_constantsOffset);
 
 
-	fog(localUniforms.m_fogColor, localUniforms.m_fogAlphaScale, localUniforms.m_fogDistanceOfMaxThikness, input.m_svPosition, input.m_zVSpace,
+	fog(localConstants.m_fogColor, localConstants.m_fogAlphaScale, localConstants.m_fogDistanceOfMaxThikness, input.m_svPosition, input.m_zVSpace,
 		output);
 		output);
 
 
 	return output;
 	return output;

+ 7 - 7
AnKi/Shaders/ForwardShadingGenericTransparent.ankiprog

@@ -8,7 +8,7 @@
 
 
 #include <AnKi/Shaders/ForwardShadingCommon.hlsl>
 #include <AnKi/Shaders/ForwardShadingCommon.hlsl>
 
 
-#pragma anki struct AnKiLocalUniforms
+#pragma anki struct AnKiLocalConstants
 #pragma anki member U32 m_texture
 #pragma anki member U32 m_texture
 #pragma anki member RVec4 m_colorScale
 #pragma anki member RVec4 m_colorScale
 #pragma anki member RVec4 m_colorBias
 #pragma anki member RVec4 m_colorBias
@@ -25,7 +25,7 @@ struct VertOut
 	Vec2 m_uv : TEXCOORD;
 	Vec2 m_uv : TEXCOORD;
 	Vec3 m_worldPosition : WORLD_POSITION;
 	Vec3 m_worldPosition : WORLD_POSITION;
 	Vec4 m_svPosition : SV_POSITION;
 	Vec4 m_svPosition : SV_POSITION;
-	nointerpolation U32 m_uniformsOffset : UNIFORMS_OFFSET;
+	nointerpolation U32 m_constantsOffset : CONSTANTS_OFFSET;
 };
 };
 
 
 #pragma anki technique_start vert Forward
 #pragma anki technique_start vert Forward
@@ -41,10 +41,10 @@ VertOut main(VertIn input)
 
 
 	output.m_worldPosition = mul(worldTransform, Vec4(vertex.m_position, 1.0));
 	output.m_worldPosition = mul(worldTransform, Vec4(vertex.m_position, 1.0));
 
 
-	output.m_svPosition = mul(g_globalUniforms.m_viewProjectionMatrix, Vec4(output.m_worldPosition, 1.0));
+	output.m_svPosition = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(output.m_worldPosition, 1.0));
 
 
 	output.m_uv = vertex.m_uv;
 	output.m_uv = vertex.m_uv;
-	output.m_uniformsOffset = renderable.m_uniformsOffset;
+	output.m_constantsOffset = renderable.m_constantsOffset;
 
 
 	return output;
 	return output;
 }
 }
@@ -57,19 +57,19 @@ FragOut main(VertOut input)
 	ANKI_MAYBE_UNUSED(input);
 	ANKI_MAYBE_UNUSED(input);
 	FragOut output;
 	FragOut output;
 
 
-	const AnKiLocalUniforms localUniforms = loadAnKiLocalUniforms(g_gpuScene, WaveReadLaneFirst(input.m_uniformsOffset));
+	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, WaveReadLaneFirst(input.m_constantsOffset));
 
 
 	output.m_color = RVec4(1.0, 1.0, 1.0, 1.0);
 	output.m_color = RVec4(1.0, 1.0, 1.0, 1.0);
 
 
 #if TEXTURE == 1
 #if TEXTURE == 1
-	output.m_color = getBindlessTexture2DRVec4(localUniforms.m_texture).Sample(g_globalSampler, input.m_uv);
+	output.m_color = getBindlessTexture2DRVec4(localConstants.m_texture).Sample(g_globalSampler, input.m_uv);
 #endif
 #endif
 
 
 #if LIGHT == 1
 #if LIGHT == 1
 	output.m_color.rgb = computeLightColorLow(output.m_color.rgb, input.m_worldPosition, input.m_svPosition);
 	output.m_color.rgb = computeLightColorLow(output.m_color.rgb, input.m_worldPosition, input.m_svPosition);
 #endif
 #endif
 
 
-	output.m_color = output.m_color * localUniforms.m_colorScale + localUniforms.m_colorBias;
+	output.m_color = output.m_color * localConstants.m_colorScale + localConstants.m_colorBias;
 
 
 	return output;
 	return output;
 }
 }

+ 11 - 11
AnKi/Shaders/ForwardShadingParticles.ankiprog

@@ -16,14 +16,14 @@ struct VertIn
 
 
 struct VertOut
 struct VertOut
 {
 {
-	nointerpolation U32 m_uniformsOffset : UNIS_OFFSET;
+	nointerpolation U32 m_constantsOffset : UNIS_OFFSET;
 	nointerpolation RF32 m_alpha : ALPHA;
 	nointerpolation RF32 m_alpha : ALPHA;
 	Vec2 m_uv : TEXCOORD;
 	Vec2 m_uv : TEXCOORD;
 	Vec3 m_worldPos : WORLD_POS;
 	Vec3 m_worldPos : WORLD_POS;
 	Vec4 m_svPosition : SV_POSITION;
 	Vec4 m_svPosition : SV_POSITION;
 };
 };
 
 
-#pragma anki struct AnKiLocalUniforms
+#pragma anki struct AnKiLocalConstants
 #pragma anki member F32 m_animationPeriod
 #pragma anki member F32 m_animationPeriod
 #pragma anki member Vec4 m_colorScale
 #pragma anki member Vec4 m_colorScale
 #pragma anki member Vec4 m_colorBias
 #pragma anki member Vec4 m_colorBias
@@ -57,12 +57,12 @@ VertOut main(VertIn input)
 		+ meshLod.m_positionTranslation;
 		+ meshLod.m_positionTranslation;
 
 
 	// Apply the particle scale, rotate the mesh to face the camera (billboard) and finally apply the particle position
 	// Apply the particle scale, rotate the mesh to face the camera (billboard) and finally apply the particle position
-	output.m_worldPos = mul(g_globalUniforms.m_cameraTransform, Vec4(localPos * particleScale, 0.0)) + particlePos;
+	output.m_worldPos = mul(g_globalConstants.m_cameraTransform, Vec4(localPos * particleScale, 0.0)) + particlePos;
 
 
-	output.m_svPosition = mul(g_globalUniforms.m_viewProjectionMatrix, Vec4(output.m_worldPos, 1.0));
+	output.m_svPosition = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(output.m_worldPos, 1.0));
 
 
 	output.m_alpha = particleAlpha;
 	output.m_alpha = particleAlpha;
-	output.m_uniformsOffset = instance.m_uniformsOffset;
+	output.m_constantsOffset = instance.m_constantsOffset;
 
 
 	return output;
 	return output;
 }
 }
@@ -73,22 +73,22 @@ VertOut main(VertIn input)
 FragOut main(VertOut input)
 FragOut main(VertOut input)
 {
 {
 	FragOut output = (FragOut)0;
 	FragOut output = (FragOut)0;
-	const AnKiLocalUniforms localUniforms = loadAnKiLocalUniforms(g_gpuScene, WaveReadLaneFirst(input.m_uniformsOffset));
+	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, WaveReadLaneFirst(input.m_constantsOffset));
 
 
 #if ANIMATED_TEXTURE == 1
 #if ANIMATED_TEXTURE == 1
-	RVec4 texCol = readAnimatedTextureRgba(getBindlessTexture2DArrayRVec4(localUniforms.m_diffuseMap), g_globalSampler,
-										   localUniforms.m_animationPeriod, input.m_uv, g_globalRendererUniforms.m_time);
+	RVec4 texCol = readAnimatedTextureRgba(getBindlessTexture2DArrayRVec4(localConstants.m_diffuseMap), g_globalSampler,
+										   localConstants.m_animationPeriod, input.m_uv, g_globalRendererConstants.m_time);
 #else
 #else
-	RVec4 texCol = getBindlessTexture2DRVec4(localUniforms.m_diffuseMap).Sample(g_globalSampler, input.m_uv);
+	RVec4 texCol = getBindlessTexture2DRVec4(localConstants.m_diffuseMap).Sample(g_globalSampler, input.m_uv);
 #endif
 #endif
 
 
 #if LIGHT
 #if LIGHT
 	texCol.rgb = computeLightColorLow(texCol.rgb, input.m_worldPos, input.m_svPosition);
 	texCol.rgb = computeLightColorLow(texCol.rgb, input.m_worldPos, input.m_svPosition);
 #endif
 #endif
 
 
-	RVec4 colScale = localUniforms.m_colorScale;
+	RVec4 colScale = localConstants.m_colorScale;
 	colScale.a *= input.m_alpha;
 	colScale.a *= input.m_alpha;
-	particleAlpha(texCol, colScale, localUniforms.m_colorBias, output);
+	particleAlpha(texCol, colScale, localConstants.m_colorBias, output);
 
 
 	return output;
 	return output;
 }
 }

+ 6 - 6
AnKi/Shaders/Fsr.ankiprog

@@ -18,7 +18,7 @@ Texture2D<Vec4> g_tex : register(t0);
 RWTexture2D<Vec4> g_storageTex : register(u0);
 RWTexture2D<Vec4> g_storageTex : register(u0);
 #	endif
 #	endif
 
 
-struct Uniforms
+struct Constants
 {
 {
 	UVec4 m_fsrConsts0;
 	UVec4 m_fsrConsts0;
 	UVec4 m_fsrConsts1;
 	UVec4 m_fsrConsts1;
@@ -28,7 +28,7 @@ struct Uniforms
 	UVec2 m_padding;
 	UVec2 m_padding;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 // FSR begin
 // FSR begin
 #	define A_GPU 1
 #	define A_GPU 1
@@ -85,7 +85,7 @@ Vec3 main(VertOut input) : SV_TARGET0
 #	endif
 #	endif
 {
 {
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
-	if(any(svDispatchThreadId >= g_unis.m_viewportSize))
+	if(any(svDispatchThreadId >= g_consts.m_viewportSize))
 	{
 	{
 		return;
 		return;
 	}
 	}
@@ -97,11 +97,11 @@ Vec3 main(VertOut input) : SV_TARGET0
 
 
 	HVec3 color;
 	HVec3 color;
 #	if SHARPEN
 #	if SHARPEN
-	FsrRcasH(color.r, color.g, color.b, uv, g_unis.m_fsrConsts0);
+	FsrRcasH(color.r, color.g, color.b, uv, g_consts.m_fsrConsts0);
 #	elif FSR_QUALITY == 0
 #	elif FSR_QUALITY == 0
-	FsrEasuL(color, uv, g_unis.m_fsrConsts0, g_unis.m_fsrConsts1, g_unis.m_fsrConsts2, g_unis.m_fsrConsts3);
+	FsrEasuL(color, uv, g_consts.m_fsrConsts0, g_consts.m_fsrConsts1, g_consts.m_fsrConsts2, g_consts.m_fsrConsts3);
 #	else
 #	else
-	FsrEasuH(color, uv, g_unis.m_fsrConsts0, g_unis.m_fsrConsts1, g_unis.m_fsrConsts2, g_unis.m_fsrConsts3);
+	FsrEasuH(color, uv, g_consts.m_fsrConsts0, g_consts.m_fsrConsts1, g_consts.m_fsrConsts2, g_consts.m_fsrConsts3);
 #	endif
 #	endif
 
 
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER

+ 37 - 37
AnKi/Shaders/GBufferGeneric.ankiprog

@@ -67,7 +67,7 @@
 #define PRIMITIVE_NO_SAMPLING_POINTS_CULLING 1
 #define PRIMITIVE_NO_SAMPLING_POINTS_CULLING 1
 #define PRIMITIVE_ANY_CULLING (PRIMITIVE_BACKFACE_CULLING || PRIMITIVE_NO_SAMPLING_POINTS_CULLING)
 #define PRIMITIVE_ANY_CULLING (PRIMITIVE_BACKFACE_CULLING || PRIMITIVE_NO_SAMPLING_POINTS_CULLING)
 
 
-#pragma anki struct AnKiLocalUniforms
+#pragma anki struct AnKiLocalConstants
 
 
 #pragma anki member U32 m_diffuseTex
 #pragma anki member U32 m_diffuseTex
 #pragma anki member U32 m_normalTex
 #pragma anki member U32 m_normalTex
@@ -117,7 +117,7 @@ struct VertOut
 	nointerpolation U32 m_meshletIndex : MESHLET_INDEX;
 	nointerpolation U32 m_meshletIndex : MESHLET_INDEX;
 #endif
 #endif
 
 
-	nointerpolation U32 m_uniformsOffset : UNIS_OFFSET;
+	nointerpolation U32 m_constantsOffset : UNIS_OFFSET;
 };
 };
 
 
 struct MeshPerVertOut
 struct MeshPerVertOut
@@ -144,7 +144,7 @@ struct MeshPerVertOut
 
 
 struct MeshPerPrimitiveOut
 struct MeshPerPrimitiveOut
 {
 {
-	U32 m_uniformsOffset : UNIS_OFFSET;
+	U32 m_constantsOffset : UNIS_OFFSET;
 
 
 #if VISUALIZE_MESHLETS
 #if VISUALIZE_MESHLETS
 	U32 m_meshletIndex : MESHLET_INDEX;
 	U32 m_meshletIndex : MESHLET_INDEX;
@@ -217,7 +217,7 @@ void velocity(Mat3x4 worldTransform, Mat3x4 prevWorldTransform, Vec3 prevLocalPo
 #	endif
 #	endif
 
 
 	Vec4 v4 = Vec4(mul(trf, Vec4(prevLocalPos, 1.0)), 1.0);
 	Vec4 v4 = Vec4(mul(trf, Vec4(prevLocalPos, 1.0)), 1.0);
-	v4 = mul(g_globalUniforms.m_previousViewProjectionMatrix, v4);
+	v4 = mul(g_globalConstants.m_previousViewProjectionMatrix, v4);
 
 
 	prevClipXyw = v4.xyw;
 	prevClipXyw = v4.xyw;
 	crntClipXyw = svPosition.xyw;
 	crntClipXyw = svPosition.xyw;
@@ -254,7 +254,7 @@ VertOut main(VertIn input)
 
 
 	UnpackedMeshVertex vert = loadVertex(meshlet, localIdx, ANKI_BONES);
 	UnpackedMeshVertex vert = loadVertex(meshlet, localIdx, ANKI_BONES);
 
 
-	const U32 uniformsOffset = instance.m_uniformsOffset;
+	const U32 constantsOffset = instance.m_constantsOffset;
 	const U32 worldTransformsIndex = instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit >> 7u;
 	const U32 worldTransformsIndex = instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit >> 7u;
 	const U32 boneTransformsOffset = instance.m_boneTransformsOffsetOrParticleEmitterIndex;
 	const U32 boneTransformsOffset = instance.m_boneTransformsOffsetOrParticleEmitterIndex;
 
 
@@ -267,7 +267,7 @@ VertOut main(VertIn input)
 	const GpuSceneMeshLod mesh = g_meshLods[instance.m_meshLodIndex];
 	const GpuSceneMeshLod mesh = g_meshLods[instance.m_meshLodIndex];
 	UnpackedMeshVertex vert = loadVertex(mesh, input.m_svVertexId, ANKI_BONES);
 	UnpackedMeshVertex vert = loadVertex(mesh, input.m_svVertexId, ANKI_BONES);
 
 
-	const U32 uniformsOffset = instance.m_uniformsOffset;
+	const U32 constantsOffset = instance.m_constantsOffset;
 	const U32 worldTransformsIndex = instance.m_worldTransformsIndex;
 	const U32 worldTransformsIndex = instance.m_worldTransformsIndex;
 	const U32 boneTransformsOffset = instance.m_boneTransformsOffsetOrParticleEmitterIndex;
 	const U32 boneTransformsOffset = instance.m_boneTransformsOffsetOrParticleEmitterIndex;
 #	endif // SW_MESHLETS
 #	endif // SW_MESHLETS
@@ -282,7 +282,7 @@ VertOut main(VertIn input)
 #	endif
 #	endif
 	Vec3 prevPos = vert.m_position;
 	Vec3 prevPos = vert.m_position;
 	ANKI_MAYBE_UNUSED(prevPos);
 	ANKI_MAYBE_UNUSED(prevPos);
-	output.m_uniformsOffset = uniformsOffset;
+	output.m_constantsOffset = constantsOffset;
 
 
 	// Do stuff
 	// Do stuff
 #	if ANKI_BONES
 #	if ANKI_BONES
@@ -290,7 +290,7 @@ VertOut main(VertIn input)
 #	endif
 #	endif
 
 
 	const Vec3 worldPos = mul(worldTransform, Vec4(vert.m_position, 1.0));
 	const Vec3 worldPos = mul(worldTransform, Vec4(vert.m_position, 1.0));
-	output.m_svPosition = mul(g_globalUniforms.m_viewProjectionMatrix, Vec4(worldPos, 1.0));
+	output.m_svPosition = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(worldPos, 1.0));
 
 
 #	if NORMAL_MAPPING
 #	if NORMAL_MAPPING
 	output.m_worldPos = worldPos;
 	output.m_worldPos = worldPos;
@@ -323,10 +323,10 @@ constexpr int g_trick = 0; // Trick the formatter
 main(U32 svGroupId : SV_GROUPID, U32 svGroupIndex : SV_GROUPINDEX, out vertices MeshPerVertOut verts[kMaxVerticesPerMeshlet],
 main(U32 svGroupId : SV_GROUPID, U32 svGroupIndex : SV_GROUPINDEX, out vertices MeshPerVertOut verts[kMaxVerticesPerMeshlet],
 	 out primitives MeshPerPrimitiveOut primitives[kMaxPrimitivesPerMeshlet], out indices UVec3 indices[kMaxPrimitivesPerMeshlet])
 	 out primitives MeshPerPrimitiveOut primitives[kMaxPrimitivesPerMeshlet], out indices UVec3 indices[kMaxPrimitivesPerMeshlet])
 {
 {
-	const U32 instanceIdx = g_firstMeshlet[g_pushConsts.m_bucketIndex] + svGroupId;
+	const U32 instanceIdx = g_firstMeshlet[g_consts.m_bucketIndex] + svGroupId;
 
 
 	const GpuSceneMeshletInstance instance = g_meshletInstances[instanceIdx];
 	const GpuSceneMeshletInstance instance = g_meshletInstances[instanceIdx];
-	const U32 uniformsOffset = instance.m_uniformsOffset;
+	const U32 constantsOffset = instance.m_constantsOffset;
 	const U32 worldTransformsIndex = instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit >> 7u;
 	const U32 worldTransformsIndex = instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit >> 7u;
 	const U32 boneTransformsOffset = instance.m_boneTransformsOffsetOrParticleEmitterIndex;
 	const U32 boneTransformsOffset = instance.m_boneTransformsOffsetOrParticleEmitterIndex;
 	ANKI_MAYBE_UNUSED(boneTransformsOffset);
 	ANKI_MAYBE_UNUSED(boneTransformsOffset);
@@ -365,9 +365,9 @@ main(U32 svGroupId : SV_GROUPID, U32 svGroupIndex : SV_GROUPINDEX, out vertices
 #	endif
 #	endif
 
 
 			const Vec3 worldPos = mul(worldTransform, Vec4(vert.m_position, 1.0));
 			const Vec3 worldPos = mul(worldTransform, Vec4(vert.m_position, 1.0));
-			output.m_svPosition = mul(g_globalUniforms.m_viewProjectionMatrix, Vec4(worldPos, 1.0f));
+			output.m_svPosition = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(worldPos, 1.0f));
 #	if PRIMITIVE_ANY_CULLING
 #	if PRIMITIVE_ANY_CULLING
-			s_windowCoords[idx] = ndcToUv(output.m_svPosition.xy / output.m_svPosition.w) * g_globalUniforms.m_viewport.zw;
+			s_windowCoords[idx] = ndcToUv(output.m_svPosition.xy / output.m_svPosition.w) * g_globalConstants.m_viewport.zw;
 			s_clipW[idx] = output.m_svPosition.w;
 			s_clipW[idx] = output.m_svPosition.w;
 #	endif
 #	endif
 
 
@@ -431,7 +431,7 @@ main(U32 svGroupId : SV_GROUPID, U32 svGroupIndex : SV_GROUPINDEX, out vertices
 			primitives[idx].m_cullPrimitive = cull;
 			primitives[idx].m_cullPrimitive = cull;
 #	endif
 #	endif
 
 
-			primitives[idx].m_uniformsOffset = uniformsOffset;
+			primitives[idx].m_constantsOffset = constantsOffset;
 #	if VISUALIZE_MESHLETS
 #	if VISUALIZE_MESHLETS
 			primitives[idx].m_meshletIndex = relativeMeshletIdx;
 			primitives[idx].m_meshletIndex = relativeMeshletIdx;
 #	endif
 #	endif
@@ -468,14 +468,14 @@ void main(
 )
 )
 {
 {
 #		if ANKI_TECHNIQUE_ShadowsMeshShaders
 #		if ANKI_TECHNIQUE_ShadowsMeshShaders
-	const U32 uniformsOffset = primInput.m_uniformsOffset;
+	const U32 constantsOffset = primInput.m_constantsOffset;
 #		else
 #		else
-	const U32 uniformsOffset = vertInput.m_uniformsOffset;
+	const U32 constantsOffset = vertInput.m_constantsOffset;
 #		endif
 #		endif
 
 
-	const AnKiLocalUniforms localUniforms = loadAnKiLocalUniforms(g_gpuScene, uniformsOffset);
-	const RVec4 diffColorA = BINDLESS(localUniforms.m_diffuseTex).Sample(g_globalSampler, vertInput.m_uv);
-	if(diffColorA.a * localUniforms.m_diffuseScale.a < 0.5f)
+	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, constantsOffset);
+	const RVec4 diffColorA = BINDLESS(localConstants.m_diffuseTex).Sample(g_globalSampler, vertInput.m_uv);
+	if(diffColorA.a * localConstants.m_diffuseScale.a < 0.5f)
 	{
 	{
 		discard;
 		discard;
 	}
 	}
@@ -492,12 +492,12 @@ FragOut main(
 )
 )
 {
 {
 #		if ANKI_TECHNIQUE_GBufferMeshShaders
 #		if ANKI_TECHNIQUE_GBufferMeshShaders
-	const U32 uniformsOffset = primInput.m_uniformsOffset;
+	const U32 constantsOffset = primInput.m_constantsOffset;
 #		else
 #		else
-	const U32 uniformsOffset = vertInput.m_uniformsOffset;
+	const U32 constantsOffset = vertInput.m_constantsOffset;
 #		endif
 #		endif
 
 
-	const AnKiLocalUniforms localUniforms = loadAnKiLocalUniforms(g_gpuScene, uniformsOffset);
+	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, constantsOffset);
 
 
 #		if REALLY_USING_PARALLAX
 #		if REALLY_USING_PARALLAX
 	// TODO
 	// TODO
@@ -508,7 +508,7 @@ FragOut main(
 	ANKI_MAYBE_UNUSED(uv);
 	ANKI_MAYBE_UNUSED(uv);
 
 
 #		if DIFFUSE_TEX
 #		if DIFFUSE_TEX
-	const RVec4 diffColorA = BINDLESS(localUniforms.m_diffuseTex).Sample(g_globalSampler, uv) * localUniforms.m_diffuseScale;
+	const RVec4 diffColorA = BINDLESS(localConstants.m_diffuseTex).Sample(g_globalSampler, uv) * localConstants.m_diffuseScale;
 	const RVec3 diffColor = diffColorA.rgb;
 	const RVec3 diffColor = diffColorA.rgb;
 #			if REALLY_ALPHA_TEST
 #			if REALLY_ALPHA_TEST
 	if(diffColorA.a < 0.5f)
 	if(diffColorA.a < 0.5f)
@@ -517,36 +517,36 @@ FragOut main(
 	}
 	}
 #			endif
 #			endif
 #		else
 #		else
-	const RVec3 diffColor = localUniforms.m_diffuseScale;
+	const RVec3 diffColor = localConstants.m_diffuseScale;
 #		endif
 #		endif
 
 
 #		if SPECULAR_TEX
 #		if SPECULAR_TEX
-	const RVec3 specColor = BINDLESS(localUniforms.m_specularTex).Sample(g_globalSampler, uv).rgb * localUniforms.m_specularScale;
+	const RVec3 specColor = BINDLESS(localConstants.m_specularTex).Sample(g_globalSampler, uv).rgb * localConstants.m_specularScale;
 #		else
 #		else
-	const RVec3 specColor = localUniforms.m_specularScale;
+	const RVec3 specColor = localConstants.m_specularScale;
 #		endif
 #		endif
 
 
 #		if ROUGHNESS_METALNESS_TEX
 #		if ROUGHNESS_METALNESS_TEX
-	const RVec3 comp = BINDLESS(localUniforms.m_roughnessMetalnessTex).Sample(g_globalSampler, uv).rgb;
-	const RF32 roughness = comp.g * localUniforms.m_roughnessScale;
-	const RF32 metallic = comp.b * localUniforms.m_metalnessScale;
+	const RVec3 comp = BINDLESS(localConstants.m_roughnessMetalnessTex).Sample(g_globalSampler, uv).rgb;
+	const RF32 roughness = comp.g * localConstants.m_roughnessScale;
+	const RF32 metallic = comp.b * localConstants.m_metalnessScale;
 #		else
 #		else
-	const RF32 roughness = localUniforms.m_roughnessScale;
-	const RF32 metallic = localUniforms.m_metalnessScale;
+	const RF32 roughness = localConstants.m_roughnessScale;
+	const RF32 metallic = localConstants.m_metalnessScale;
 #		endif
 #		endif
 
 
 #		if NORMAL_TEX
 #		if NORMAL_TEX
-	const RVec3 nAtTangentspace = normalize((BINDLESS(localUniforms.m_normalTex).Sample(g_globalSampler, uv).rgb - 0.5) * 2.0);
-	const Vec3 viewDir = normalize(g_globalUniforms.m_cameraTransform.getTranslationPart() - vertInput.m_worldPos);
+	const RVec3 nAtTangentspace = normalize((BINDLESS(localConstants.m_normalTex).Sample(g_globalSampler, uv).rgb - 0.5) * 2.0);
+	const Vec3 viewDir = normalize(g_globalConstants.m_cameraTransform.getTranslationPart() - vertInput.m_worldPos);
 	const RVec3 normal = perturbNormal(nAtTangentspace, viewDir, uv, normalize(vertInput.m_normal));
 	const RVec3 normal = perturbNormal(nAtTangentspace, viewDir, uv, normalize(vertInput.m_normal));
 #		else
 #		else
 	const RVec3 normal = normalize(vertInput.m_normal);
 	const RVec3 normal = normalize(vertInput.m_normal);
 #		endif
 #		endif
 
 
 #		if EMISSIVE_TEX
 #		if EMISSIVE_TEX
-	const RVec3 emission = BINDLESS(localUniforms.m_emissiveTex).Sample(g_globalSampler, uv).rgb * localUniforms.m_emissionScale;
+	const RVec3 emission = BINDLESS(localConstants.m_emissiveTex).Sample(g_globalSampler, uv).rgb * localConstants.m_emissionScale;
 #		else
 #		else
-	const RVec3 emission = localUniforms.m_emissionScale;
+	const RVec3 emission = localConstants.m_emissionScale;
 #		endif
 #		endif
 
 
 #		if ANKI_VELOCITY || ANKI_BONES
 #		if ANKI_VELOCITY || ANKI_BONES
@@ -564,7 +564,7 @@ FragOut main(
 	g.m_normal = normal;
 	g.m_normal = normal;
 	g.m_f0 = specColor;
 	g.m_f0 = specColor;
 	g.m_roughness = roughness;
 	g.m_roughness = roughness;
-	g.m_subsurface = localUniforms.m_subsurface;
+	g.m_subsurface = localConstants.m_subsurface;
 	g.m_emission = emission;
 	g.m_emission = emission;
 	g.m_metallic = metallic;
 	g.m_metallic = metallic;
 	g.m_velocity = velocity;
 	g.m_velocity = velocity;
@@ -636,9 +636,9 @@ FragOut main(
 
 
 	const Vec2 uv = vert0.m_uv * bary.x + vert1.m_uv * bary.y + vert2.m_uv * bary.z;
 	const Vec2 uv = vert0.m_uv * bary.x + vert1.m_uv * bary.y + vert2.m_uv * bary.z;
 
 
-	const AnKiLocalUniforms localUniforms = loadAnKiLocalUniforms(g_gpuScene, g_gpuSceneRenderable.m_uniformsOffset);
+	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, g_gpuSceneRenderable.m_constantsOffset);
 	const RVec4 diffColorA =
 	const RVec4 diffColorA =
-		getBindlessTexture2DRVec4(localUniforms.m_diffuseTex).SampleLevel(g_globalSampler, uv, 0.0) * localUniforms.m_diffuseScale;
+		getBindlessTexture2DRVec4(localConstants.m_diffuseTex).SampleLevel(g_globalSampler, uv, 0.0) * localConstants.m_diffuseScale;
 
 
 	if(diffColorA.a < 1.0)
 	if(diffColorA.a < 1.0)
 	{
 	{

+ 12 - 12
AnKi/Shaders/GBufferGpuParticles.ankiprog

@@ -5,7 +5,7 @@
 
 
 #include <AnKi/Shaders/MaterialShadersCommon.hlsl>
 #include <AnKi/Shaders/MaterialShadersCommon.hlsl>
 
 
-#pragma anki struct AnKiLocalUniforms
+#pragma anki struct AnKiLocalConstants
 #pragma anki member RVec3 m_diffColor
 #pragma anki member RVec3 m_diffColor
 #pragma anki member RF32 m_roughness
 #pragma anki member RF32 m_roughness
 #pragma anki member RVec3 m_specColor
 #pragma anki member RVec3 m_specColor
@@ -24,7 +24,7 @@ struct VertOut
 {
 {
 	nointerpolation Vec2 m_velocity : VELOCITY;
 	nointerpolation Vec2 m_velocity : VELOCITY;
 	nointerpolation RF32 m_lifeFactor : LIFE_FACTOR;
 	nointerpolation RF32 m_lifeFactor : LIFE_FACTOR;
-	nointerpolation U32 m_uniformsOffset : UNIFORMS_OFFSET;
+	nointerpolation U32 m_constantsOffset : CONSTANTS_OFFSET;
 	Vec4 m_svPosition : SV_POSITION;
 	Vec4 m_svPosition : SV_POSITION;
 };
 };
 
 
@@ -60,8 +60,8 @@ VertOut main(VertIn input)
 	const F32 startingLife = g_gpuScene.Load<F32>(offset);
 	const F32 startingLife = g_gpuScene.Load<F32>(offset);
 
 
 	// Position
 	// Position
-	const Vec4 clipPos = mul(g_globalUniforms.m_viewProjectionMatrix, Vec4(pos, 1.0));
-	const Vec4 prevClipPos = mul(g_globalUniforms.m_viewProjectionMatrix, Vec4(prevPos, 1.0));
+	const Vec4 clipPos = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(pos, 1.0));
+	const Vec4 prevClipPos = mul(g_globalConstants.m_viewProjectionMatrix, Vec4(prevPos, 1.0));
 
 
 	output.m_svPosition = clipPos;
 	output.m_svPosition = clipPos;
 
 
@@ -72,7 +72,7 @@ VertOut main(VertIn input)
 
 
 	// Misc
 	// Misc
 	output.m_lifeFactor = saturate(1.0 - (life / startingLife));
 	output.m_lifeFactor = saturate(1.0 - (life / startingLife));
-	output.m_uniformsOffset = renderable.m_uniformsOffset;
+	output.m_constantsOffset = renderable.m_constantsOffset;
 
 
 	return output;
 	return output;
 }
 }
@@ -84,19 +84,19 @@ VertOut main(VertIn input)
 FragOut main(VertOut input)
 FragOut main(VertOut input)
 {
 {
 	FragOut output;
 	FragOut output;
-	const AnKiLocalUniforms localUniforms = loadAnKiLocalUniforms(g_gpuScene, input.m_uniformsOffset);
+	const AnKiLocalConstants localConstants = loadAnKiLocalConstants(g_gpuScene, input.m_constantsOffset);
 
 
 	GbufferInfo g;
 	GbufferInfo g;
-	g.m_diffuse = localUniforms.m_diffColor;
+	g.m_diffuse = localConstants.m_diffColor;
 
 
-	const Mat3x4 camTrf = g_globalUniforms.m_cameraTransform;
+	const Mat3x4 camTrf = g_globalConstants.m_cameraTransform;
 	g.m_normal = normalize(Vec3(camTrf.m_row0[2], camTrf.m_row1[2], camTrf.m_row2[2]));
 	g.m_normal = normalize(Vec3(camTrf.m_row0[2], camTrf.m_row1[2], camTrf.m_row2[2]));
 
 
-	g.m_f0 = localUniforms.m_specColor;
-	g.m_roughness = localUniforms.m_roughness;
+	g.m_f0 = localConstants.m_specColor;
+	g.m_roughness = localConstants.m_roughness;
 	g.m_subsurface = 0.0;
 	g.m_subsurface = 0.0;
-	g.m_emission = lerp(localUniforms.m_initialEmission, localUniforms.m_finalEmission, input.m_lifeFactor);
-	g.m_metallic = localUniforms.m_metallic;
+	g.m_emission = lerp(localConstants.m_initialEmission, localConstants.m_finalEmission, input.m_lifeFactor);
+	g.m_metallic = localConstants.m_metallic;
 	g.m_velocity = input.m_velocity;
 	g.m_velocity = input.m_velocity;
 	packGBuffer(g, output.m_color0, output.m_color1, output.m_color2, output.m_color3);
 	packGBuffer(g, output.m_color0, output.m_color1, output.m_color2, output.m_color3);
 	return output;
 	return output;

+ 3 - 3
AnKi/Shaders/GBufferPost.ankiprog

@@ -18,7 +18,7 @@ SamplerState g_nearestAnyClampSampler : register(s0);
 Texture2D g_depthTex : register(t0);
 Texture2D g_depthTex : register(t0);
 SamplerState g_trilinearRepeatSampler : register(s1);
 SamplerState g_trilinearRepeatSampler : register(s1);
 
 
-ConstantBuffer<GlobalRendererUniforms> g_globalUniforms : register(b0);
+ConstantBuffer<GlobalRendererConstants> g_globalConstants : register(b0);
 StructuredBuffer<Decal> g_decals : register(t1);
 StructuredBuffer<Decal> g_decals : register(t1);
 StructuredBuffer<Cluster> g_clusters : register(t2);
 StructuredBuffer<Cluster> g_clusters : register(t2);
 
 
@@ -45,11 +45,11 @@ FragOut main(VertOut input)
 	// Get worldPos
 	// Get worldPos
 	const F32 depth = g_depthTex.SampleLevel(g_nearestAnyClampSampler, uv, 0.0).r;
 	const F32 depth = g_depthTex.SampleLevel(g_nearestAnyClampSampler, uv, 0.0).r;
 	const Vec2 ndc = uvToNdc(uv);
 	const Vec2 ndc = uvToNdc(uv);
-	const Vec4 worldPos4 = mul(g_globalUniforms.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
+	const Vec4 worldPos4 = mul(g_globalConstants.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 
 	// Get the cluster
 	// Get the cluster
-	Cluster cluster = getClusterFragCoord(g_clusters, g_globalUniforms, Vec3(input.m_svPosition.xy, depth));
+	Cluster cluster = getClusterFragCoord(g_clusters, g_globalConstants, Vec3(input.m_svPosition.xy, depth));
 
 
 	// Make the decalsMask uniform across the wave because we are accessing bindless textures later on
 	// Make the decalsMask uniform across the wave because we are accessing bindless textures later on
 	U32 decalsMask = cluster.m_decalsMask[0];
 	U32 decalsMask = cluster.m_decalsMask[0];

+ 6 - 6
AnKi/Shaders/GpuVisibilityAccelerationStructures.ankiprog

@@ -23,7 +23,7 @@ globallycoherent RWStructuredBuffer<U32> g_counterBuffer : register(u2); // 2 co
 
 
 RWStructuredBuffer<DispatchIndirectArgs> g_nextDispatchIndirectArgs : register(u3);
 RWStructuredBuffer<DispatchIndirectArgs> g_nextDispatchIndirectArgs : register(u3);
 
 
-ANKI_PUSH_CONSTANTS(GpuVisibilityAccelerationStructuresUniforms, g_unis)
+ANKI_FAST_CONSTANTS(GpuVisibilityAccelerationStructuresConstants, g_consts)
 
 
 #define NUMTHREADS 64
 #define NUMTHREADS 64
 
 
@@ -44,7 +44,7 @@ ANKI_PUSH_CONSTANTS(GpuVisibilityAccelerationStructuresUniforms, g_unis)
 		bvolume = g_renderableBoundingVolumes[bvolumeIdx];
 		bvolume = g_renderableBoundingVolumes[bvolumeIdx];
 
 
 		sphereCenter = (bvolume.m_aabbMin + bvolume.m_aabbMax) * 0.5f;
 		sphereCenter = (bvolume.m_aabbMin + bvolume.m_aabbMax) * 0.5f;
-		visible = testSphereSphereCollision(sphereCenter, bvolume.m_sphereRadius, g_unis.m_pointOfTest, g_unis.m_testRadius);
+		visible = testSphereSphereCollision(sphereCenter, bvolume.m_sphereRadius, g_consts.m_pointOfTest, g_consts.m_testRadius);
 	}
 	}
 
 
 	// All good, write the instance
 	// All good, write the instance
@@ -52,16 +52,16 @@ ANKI_PUSH_CONSTANTS(GpuVisibilityAccelerationStructuresUniforms, g_unis)
 	{
 	{
 		// LOD selection
 		// LOD selection
 		U32 lod;
 		U32 lod;
-		const Bool insideCameraFrustum = frustumTest(g_unis.m_clipPlanes, sphereCenter, bvolume.m_sphereRadius);
+		const Bool insideCameraFrustum = frustumTest(g_consts.m_clipPlanes, sphereCenter, bvolume.m_sphereRadius);
 		if(insideCameraFrustum)
 		if(insideCameraFrustum)
 		{
 		{
 			// Visible by the camera, need to match the camera LODs
 			// Visible by the camera, need to match the camera LODs
-			const F32 distFromLodPoint = length(sphereCenter - g_unis.m_pointOfTest) - bvolume.m_sphereRadius;
-			if(distFromLodPoint < g_unis.m_maxLodDistances[0])
+			const F32 distFromLodPoint = length(sphereCenter - g_consts.m_pointOfTest) - bvolume.m_sphereRadius;
+			if(distFromLodPoint < g_consts.m_maxLodDistances[0])
 			{
 			{
 				lod = 0u;
 				lod = 0u;
 			}
 			}
-			else if(distFromLodPoint < g_unis.m_maxLodDistances[1])
+			else if(distFromLodPoint < g_consts.m_maxLodDistances[1])
 			{
 			{
 				lod = 1u;
 				lod = 1u;
 			}
 			}

+ 2 - 2
AnKi/Shaders/GpuVisibilityNonRenderables.ankiprog

@@ -32,7 +32,7 @@ typedef GpuSceneGlobalIlluminationProbe ObjectType;
 StructuredBuffer<ObjectType> g_objects : register(t0);
 StructuredBuffer<ObjectType> g_objects : register(t0);
 RWStructuredBuffer<U32> g_visibleIndices : register(u0); // 1st element is the count. What follows is indices
 RWStructuredBuffer<U32> g_visibleIndices : register(u0); // 1st element is the count. What follows is indices
 
 
-ANKI_PUSH_CONSTANTS(GpuVisibilityNonRenderableUniforms, g_unis)
+ANKI_FAST_CONSTANTS(GpuVisibilityNonRenderableConstants, g_consts)
 
 
 constexpr U32 kVisibleObjCounterIdx = 1;
 constexpr U32 kVisibleObjCounterIdx = 1;
 constexpr U32 kThreadgroupCounterIdx = 0;
 constexpr U32 kThreadgroupCounterIdx = 0;
@@ -96,7 +96,7 @@ Vec4 getSphere(GpuSceneGlobalIlluminationProbe l)
 	if(!skip)
 	if(!skip)
 	{
 	{
 		const Vec4 sphere = getSphere(g_objects[svDispatchThreadId]);
 		const Vec4 sphere = getSphere(g_objects[svDispatchThreadId]);
-		skip = !frustumTest(g_unis.m_clipPlanes, sphere.xyz, sphere.w);
+		skip = !frustumTest(g_consts.m_clipPlanes, sphere.xyz, sphere.w);
 	}
 	}
 
 
 	// Add the object
 	// Add the object

+ 10 - 10
AnKi/Shaders/GpuVisibilityStage1.ankiprog

@@ -60,9 +60,9 @@ RWStructuredBuffer<GpuVisibilityHash> g_hash : register(u8);
 #endif
 #endif
 
 
 #if DISTANCE_TEST == 0
 #if DISTANCE_TEST == 0
-ConstantBuffer<FrustumGpuVisibilityUniforms> g_unis : register(b0);
+ConstantBuffer<FrustumGpuVisibilityConsts> g_consts : register(b0);
 #else
 #else
-ANKI_PUSH_CONSTANTS(DistanceGpuVisibilityUniforms, g_unis)
+ANKI_FAST_CONSTANTS(DistanceGpuVisibilityConstants, g_consts)
 #endif
 #endif
 
 
 #if HZB_TEST
 #if HZB_TEST
@@ -78,7 +78,7 @@ Bool isVisible(GpuSceneRenderableBoundingVolume bvolume)
 #if DISTANCE_TEST == 0
 #if DISTANCE_TEST == 0
 	// Frustum test
 	// Frustum test
 	//
 	//
-	if(!frustumTest(g_unis.m_clipPlanes, sphereCenter, sphereRadius))
+	if(!frustumTest(g_consts.m_clipPlanes, sphereCenter, sphereRadius))
 	{
 	{
 		return false;
 		return false;
 	}
 	}
@@ -87,7 +87,7 @@ Bool isVisible(GpuSceneRenderableBoundingVolume bvolume)
 	//
 	//
 	Vec2 minNdc, maxNdc;
 	Vec2 minNdc, maxNdc;
 	F32 aabbMinDepth;
 	F32 aabbMinDepth;
-	projectAabb(bvolume.m_aabbMin, bvolume.m_aabbMax, g_unis.m_viewProjectionMat, minNdc, maxNdc, aabbMinDepth);
+	projectAabb(bvolume.m_aabbMin, bvolume.m_aabbMax, g_consts.m_viewProjectionMat, minNdc, maxNdc, aabbMinDepth);
 
 
 	if(any(minNdc > 1.0f) || any(maxNdc < -1.0f))
 	if(any(minNdc > 1.0f) || any(maxNdc < -1.0f))
 	{
 	{
@@ -95,8 +95,8 @@ Bool isVisible(GpuSceneRenderableBoundingVolume bvolume)
 		return false;
 		return false;
 	}
 	}
 
 
-	const Vec2 windowCoordsMin = ndcToUv(minNdc) * g_unis.m_finalRenderTargetSize;
-	const Vec2 windowCoordsMax = ndcToUv(maxNdc) * g_unis.m_finalRenderTargetSize;
+	const Vec2 windowCoordsMin = ndcToUv(minNdc) * g_consts.m_finalRenderTargetSize;
+	const Vec2 windowCoordsMax = ndcToUv(maxNdc) * g_consts.m_finalRenderTargetSize;
 	if(any(round(windowCoordsMin) == round(windowCoordsMax)))
 	if(any(round(windowCoordsMin) == round(windowCoordsMax)))
 	{
 	{
 		// Doesn't touch the sampling points
 		// Doesn't touch the sampling points
@@ -113,7 +113,7 @@ Bool isVisible(GpuSceneRenderableBoundingVolume bvolume)
 #	endif // HZB_TEST
 #	endif // HZB_TEST
 
 
 #else // DISTANCE_TEST == 1
 #else // DISTANCE_TEST == 1
-	if(!testSphereSphereCollision(sphereCenter, sphereRadius, g_unis.m_pointOfTest, g_unis.m_testRadius))
+	if(!testSphereSphereCollision(sphereCenter, sphereRadius, g_consts.m_pointOfTest, g_consts.m_testRadius))
 	{
 	{
 		return false;
 		return false;
 	}
 	}
@@ -158,14 +158,14 @@ Bool isVisible(GpuSceneRenderableBoundingVolume bvolume)
 		//
 		//
 		const Vec3 sphereCenter = (bvolume.m_aabbMin + bvolume.m_aabbMax) * 0.5f;
 		const Vec3 sphereCenter = (bvolume.m_aabbMin + bvolume.m_aabbMax) * 0.5f;
 		const F32 sphereRadius = bvolume.m_sphereRadius;
 		const F32 sphereRadius = bvolume.m_sphereRadius;
-		const F32 distFromLodPoint = length(sphereCenter - g_unis.m_lodReferencePoint) - sphereRadius;
+		const F32 distFromLodPoint = length(sphereCenter - g_consts.m_lodReferencePoint) - sphereRadius;
 
 
 		U32 lod;
 		U32 lod;
-		if(distFromLodPoint < g_unis.m_maxLodDistances[0])
+		if(distFromLodPoint < g_consts.m_maxLodDistances[0])
 		{
 		{
 			lod = 0u;
 			lod = 0u;
 		}
 		}
-		else if(distFromLodPoint < g_unis.m_maxLodDistances[1])
+		else if(distFromLodPoint < g_consts.m_maxLodDistances[1])
 		{
 		{
 			lod = 1u;
 			lod = 1u;
 		}
 		}

+ 8 - 8
AnKi/Shaders/GpuVisibilityStage2And3.ankiprog

@@ -95,7 +95,7 @@ RWStructuredBuffer<U32> g_outOfMemoryBuffer : register(u4);
 
 
 		UVec4 instanceVertex;
 		UVec4 instanceVertex;
 		instanceVertex.x = renderable.m_worldTransformsIndex;
 		instanceVertex.x = renderable.m_worldTransformsIndex;
-		instanceVertex.y = renderable.m_uniformsOffset;
+		instanceVertex.y = renderable.m_constantsOffset;
 		instanceVertex.z = meshLodIndex;
 		instanceVertex.z = meshLodIndex;
 		instanceVertex.w = renderable.m_boneTransformsOffset;
 		instanceVertex.w = renderable.m_boneTransformsOffset;
 		SBUFF(g_instanceRateRenderables, instanceIndex) = instanceVertex;
 		SBUFF(g_instanceRateRenderables, instanceIndex) = instanceVertex;
@@ -114,7 +114,7 @@ RWStructuredBuffer<U32> g_outOfMemoryBuffer : register(u4);
 
 
 		UVec4 instanceVertex;
 		UVec4 instanceVertex;
 		instanceVertex.x = renderable.m_worldTransformsIndex;
 		instanceVertex.x = renderable.m_worldTransformsIndex;
-		instanceVertex.y = renderable.m_uniformsOffset;
+		instanceVertex.y = renderable.m_constantsOffset;
 		instanceVertex.z = meshLodIndex;
 		instanceVertex.z = meshLodIndex;
 		instanceVertex.w = renderable.m_particleEmitterIndex;
 		instanceVertex.w = renderable.m_particleEmitterIndex;
 		SBUFF(g_instanceRateRenderables, instanceIndex) = instanceVertex;
 		SBUFF(g_instanceRateRenderables, instanceIndex) = instanceVertex;
@@ -164,7 +164,7 @@ RWStructuredBuffer<GpuVisibilityVisibleMeshletDesc> g_meshletsFailedHzb : regist
 RWStructuredBuffer<DispatchIndirectArgs> g_gpuVisIndirectDispatchArgs : register(u5);
 RWStructuredBuffer<DispatchIndirectArgs> g_gpuVisIndirectDispatchArgs : register(u5);
 #endif
 #endif
 
 
-ANKI_PUSH_CONSTANTS(GpuVisibilityMeshletUniforms, g_unis)
+ANKI_FAST_CONSTANTS(GpuVisibilityMeshletConstants, g_consts)
 
 
 Bool cullMeshlet(GpuSceneRenderable renderable, const MeshletBoundingVolume meshletBoundingVol, out Bool meshletCulledByHzb)
 Bool cullMeshlet(GpuSceneRenderable renderable, const MeshletBoundingVolume meshletBoundingVol, out Bool meshletCulledByHzb)
 {
 {
@@ -175,14 +175,14 @@ Bool cullMeshlet(GpuSceneRenderable renderable, const MeshletBoundingVolume mesh
 
 
 #	if MESHLET_BACKFACE_CULLING
 #	if MESHLET_BACKFACE_CULLING
 	const Vec4 coneDirAndAng = unpackSnorm4x8(meshletBoundingVol.m_coneDirection_R8G8B8_Snorm_cosHalfAngle_R8_Snorm);
 	const Vec4 coneDirAndAng = unpackSnorm4x8(meshletBoundingVol.m_coneDirection_R8G8B8_Snorm_cosHalfAngle_R8_Snorm);
-	if(cullBackfaceMeshlet(coneDirAndAng.xyz, coneDirAndAng.w, meshletBoundingVol.m_coneApex, worldTransform, g_unis.m_cameraPos))
+	if(cullBackfaceMeshlet(coneDirAndAng.xyz, coneDirAndAng.w, meshletBoundingVol.m_coneApex, worldTransform, g_consts.m_cameraPos))
 	{
 	{
 		return true;
 		return true;
 	}
 	}
 #	endif
 #	endif
 
 
 	const Mat4 wordTransform4 = {worldTransform.m_row0, worldTransform.m_row1, worldTransform.m_row2, Vec4(0.0f, 0.0f, 0.0f, 1.0f)};
 	const Mat4 wordTransform4 = {worldTransform.m_row0, worldTransform.m_row1, worldTransform.m_row2, Vec4(0.0f, 0.0f, 0.0f, 1.0f)};
-	const Mat4 mvp = mul(g_unis.m_viewProjectionMatrix, wordTransform4);
+	const Mat4 mvp = mul(g_consts.m_viewProjectionMatrix, wordTransform4);
 
 
 	Vec2 minNdc, maxNdc;
 	Vec2 minNdc, maxNdc;
 	F32 aabbMinDepth;
 	F32 aabbMinDepth;
@@ -198,8 +198,8 @@ Bool cullMeshlet(GpuSceneRenderable renderable, const MeshletBoundingVolume mesh
 
 
 #	if MESHLET_NO_SAMPLING_POINT_CULLING
 #	if MESHLET_NO_SAMPLING_POINT_CULLING
 	// Sampling points test
 	// Sampling points test
-	const Vec2 windowCoordsMin = ndcToUv(minNdc) * g_unis.m_viewportSizef;
-	const Vec2 windowCoordsMax = ndcToUv(maxNdc) * g_unis.m_viewportSizef;
+	const Vec2 windowCoordsMin = ndcToUv(minNdc) * g_consts.m_viewportSizef;
+	const Vec2 windowCoordsMax = ndcToUv(maxNdc) * g_consts.m_viewportSizef;
 	if(any(round(windowCoordsMin) == round(windowCoordsMax)))
 	if(any(round(windowCoordsMin) == round(windowCoordsMax)))
 	{
 	{
 		return true;
 		return true;
@@ -264,7 +264,7 @@ Bool cullMeshlet(GpuSceneRenderable renderable, const MeshletBoundingVolume mesh
 			GpuSceneMeshletInstance instance;
 			GpuSceneMeshletInstance instance;
 			instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit = renderable.m_worldTransformsIndex << 7u;
 			instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit = renderable.m_worldTransformsIndex << 7u;
 			instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit |= meshletBoundingVol.m_primitiveCount;
 			instance.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit |= meshletBoundingVol.m_primitiveCount;
-			instance.m_uniformsOffset = renderable.m_uniformsOffset;
+			instance.m_constantsOffset = renderable.m_constantsOffset;
 			instance.m_boneTransformsOffsetOrParticleEmitterIndex = renderable.m_boneTransformsOffset;
 			instance.m_boneTransformsOffsetOrParticleEmitterIndex = renderable.m_boneTransformsOffset;
 			instance.m_meshletGeometryDescriptorIndex = meshLod.m_firstMeshletGeometryDescriptor + meshletIdx;
 			instance.m_meshletGeometryDescriptorIndex = meshLod.m_firstMeshletGeometryDescriptor + meshletIdx;
 
 

+ 4 - 4
AnKi/Shaders/HzbGenPyramid.ankiprog

@@ -9,13 +9,13 @@
 #pragma anki technique_start comp
 #pragma anki technique_start comp
 #include <AnKi/Shaders/Common.hlsl>
 #include <AnKi/Shaders/Common.hlsl>
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Vec2 m_invSrcTexSize;
 	Vec2 m_invSrcTexSize;
 	U32 m_threadGroupCount;
 	U32 m_threadGroupCount;
 	U32 m_mipmapCount;
 	U32 m_mipmapCount;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 globallycoherent RWStructuredBuffer<U32> g_spdCounter : register(u0);
 globallycoherent RWStructuredBuffer<U32> g_spdCounter : register(u0);
 globallycoherent RWTexture2D<Vec4> g_dstStorageTextures[kMaxMipsSinglePassDownsamplerCanProduce] : register(u1);
 globallycoherent RWTexture2D<Vec4> g_dstStorageTextures[kMaxMipsSinglePassDownsamplerCanProduce] : register(u1);
@@ -38,7 +38,7 @@ groupshared AF1 s_spdIntermediateR[16][16];
 AF4 SpdLoadSourceImage(AU2 p, AU1 slice)
 AF4 SpdLoadSourceImage(AU2 p, AU1 slice)
 {
 {
 	ANKI_MAYBE_UNUSED(slice);
 	ANKI_MAYBE_UNUSED(slice);
-	const AF2 uv = p * g_unis.m_invSrcTexSize + g_unis.m_invSrcTexSize;
+	const AF2 uv = p * g_consts.m_invSrcTexSize + g_consts.m_invSrcTexSize;
 
 
 #if MIN_MAX_SAMPLER
 #if MIN_MAX_SAMPLER
 	const F32 f = g_srcTex.SampleLevel(g_minMaxAnyClampSampler, uv, 0.0).r;
 	const F32 f = g_srcTex.SampleLevel(g_minMaxAnyClampSampler, uv, 0.0).r;
@@ -111,7 +111,7 @@ AF4 SpdReduce4(AF4 v0, AF4 v1, AF4 v2, AF4 v3)
 {
 {
 	const U32 slice = 0u;
 	const U32 slice = 0u;
 	const UVec2 offset = UVec2(0, 0);
 	const UVec2 offset = UVec2(0, 0);
-	SpdDownsample(AU2(svGroupId.xy), AU1(svGroupIndex), AU1(g_unis.m_mipmapCount), AU1(g_unis.m_threadGroupCount), slice, offset);
+	SpdDownsample(AU2(svGroupId.xy), AU1(svGroupIndex), AU1(g_consts.m_mipmapCount), AU1(g_consts.m_threadGroupCount), slice, offset);
 }
 }
 
 
 #pragma anki technique_end comp
 #pragma anki technique_end comp

+ 5 - 5
AnKi/Shaders/HzbMaxDepthProject.ankiprog

@@ -11,7 +11,7 @@
 
 
 Texture2D<Vec4> g_maxDepthRt : register(t0);
 Texture2D<Vec4> g_maxDepthRt : register(t0);
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Mat4 m_reprojectionMat;
 	Mat4 m_reprojectionMat;
 
 
@@ -20,7 +20,7 @@ struct Uniforms
 	F32 m_padding0;
 	F32 m_padding0;
 	F32 m_padding1;
 	F32 m_padding1;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 Vec4 main(U32 svVertexId : SV_VERTEXID, U32 svInstanceId : SV_INSTANCEID) : SV_POSITION
 Vec4 main(U32 svVertexId : SV_VERTEXID, U32 svInstanceId : SV_INSTANCEID) : SV_POSITION
 {
 {
@@ -30,8 +30,8 @@ Vec4 main(U32 svVertexId : SV_VERTEXID, U32 svInstanceId : SV_INSTANCEID) : SV_P
 	const U32 tileX = svInstanceId % maxDepthRtSize.x;
 	const U32 tileX = svInstanceId % maxDepthRtSize.x;
 	const U32 tileY = svInstanceId / maxDepthRtSize.x;
 	const U32 tileY = svInstanceId / maxDepthRtSize.x;
 
 
-	const F32 maxDepth = min(g_maxDepthRt[UVec2(tileX, tileY)].x, g_unis.m_cascadeMaxDepth);
-	const F32 minDepth = g_unis.m_cascadeMinDepth;
+	const F32 maxDepth = min(g_maxDepthRt[UVec2(tileX, tileY)].x, g_consts.m_cascadeMaxDepth);
+	const F32 minDepth = g_consts.m_cascadeMinDepth;
 
 
 	if(maxDepth <= minDepth)
 	if(maxDepth <= minDepth)
 	{
 	{
@@ -63,7 +63,7 @@ Vec4 main(U32 svVertexId : SV_VERTEXID, U32 svInstanceId : SV_INSTANCEID) : SV_P
 	ndc.xy = uvToNdc(saturate(ndc.xy));
 	ndc.xy = uvToNdc(saturate(ndc.xy));
 
 
 	// Unproject and project
 	// Unproject and project
-	return mul(g_unis.m_reprojectionMat, Vec4(ndc, 1.0));
+	return mul(g_consts.m_reprojectionMat, Vec4(ndc, 1.0));
 }
 }
 
 
 #pragma anki technique_end vert
 #pragma anki technique_end vert

+ 2 - 2
AnKi/Shaders/Include/GpuSceneFunctions.h

@@ -13,7 +13,7 @@ inline GpuSceneRenderableInstance unpackGpuSceneRenderableVertex(UVec4 x)
 {
 {
 	GpuSceneRenderableInstance o;
 	GpuSceneRenderableInstance o;
 	o.m_worldTransformsIndex = x[0];
 	o.m_worldTransformsIndex = x[0];
-	o.m_uniformsOffset = x[1];
+	o.m_constantsOffset = x[1];
 	o.m_meshLodIndex = x[2];
 	o.m_meshLodIndex = x[2];
 	o.m_boneTransformsOffsetOrParticleEmitterIndex = x[3];
 	o.m_boneTransformsOffsetOrParticleEmitterIndex = x[3];
 	return o;
 	return o;
@@ -23,7 +23,7 @@ inline GpuSceneMeshletInstance unpackGpuSceneMeshletInstance(UVec4 x)
 {
 {
 	GpuSceneMeshletInstance o;
 	GpuSceneMeshletInstance o;
 	o.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit = x[0];
 	o.m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit = x[0];
-	o.m_uniformsOffset = x[1];
+	o.m_constantsOffset = x[1];
 	o.m_meshletGeometryDescriptorIndex = x[2];
 	o.m_meshletGeometryDescriptorIndex = x[2];
 	o.m_boneTransformsOffsetOrParticleEmitterIndex = x[3];
 	o.m_boneTransformsOffsetOrParticleEmitterIndex = x[3];
 	return o;
 	return o;

+ 3 - 3
AnKi/Shaders/Include/GpuSceneTypes.h

@@ -20,7 +20,7 @@ constexpr F32 kSomeFarDistance = 100000.0f;
 struct GpuSceneRenderable
 struct GpuSceneRenderable
 {
 {
 	U32 m_worldTransformsIndex; ///< First index points to the crnt transform and the 2nd to the previous.
 	U32 m_worldTransformsIndex; ///< First index points to the crnt transform and the 2nd to the previous.
-	U32 m_uniformsOffset;
+	U32 m_constantsOffset;
 	U32 m_meshLodsIndex; ///< Points to the array of GpuSceneMeshLod. kMaxLodCount are reserved for each renderable.
 	U32 m_meshLodsIndex; ///< Points to the array of GpuSceneMeshLod. kMaxLodCount are reserved for each renderable.
 	U32 m_boneTransformsOffset; ///< Array of Mat3x4 or 0 if its not a skin.
 	U32 m_boneTransformsOffset; ///< Array of Mat3x4 or 0 if its not a skin.
 	U32 m_particleEmitterIndex; ///< Index to the GpuSceneParticleEmitter array or kMaxU32 if it's not an emitter.
 	U32 m_particleEmitterIndex; ///< Index to the GpuSceneParticleEmitter array or kMaxU32 if it's not an emitter.
@@ -32,7 +32,7 @@ struct GpuSceneRenderable
 struct GpuSceneRenderableInstance
 struct GpuSceneRenderableInstance
 {
 {
 	U32 m_worldTransformsIndex;
 	U32 m_worldTransformsIndex;
-	U32 m_uniformsOffset;
+	U32 m_constantsOffset;
 	U32 m_meshLodIndex; ///< Points to a single GpuSceneMeshLod in the mesh lods.
 	U32 m_meshLodIndex; ///< Points to a single GpuSceneMeshLod in the mesh lods.
 	U32 m_boneTransformsOffsetOrParticleEmitterIndex;
 	U32 m_boneTransformsOffsetOrParticleEmitterIndex;
 };
 };
@@ -42,7 +42,7 @@ static_assert(sizeof(GpuSceneRenderableInstance) == sizeof(UVec4));
 struct GpuSceneMeshletInstance
 struct GpuSceneMeshletInstance
 {
 {
 	U32 m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit;
 	U32 m_worldTransformsIndex_25bit_meshletPrimitiveCount_7bit;
-	U32 m_uniformsOffset;
+	U32 m_constantsOffset;
 	U32 m_meshletGeometryDescriptorIndex; ///< Index in the UGB.
 	U32 m_meshletGeometryDescriptorIndex; ///< Index in the UGB.
 	U32 m_boneTransformsOffsetOrParticleEmitterIndex;
 	U32 m_boneTransformsOffsetOrParticleEmitterIndex;
 };
 };

+ 5 - 5
AnKi/Shaders/Include/GpuVisibilityTypes.h

@@ -9,7 +9,7 @@
 
 
 ANKI_BEGIN_NAMESPACE
 ANKI_BEGIN_NAMESPACE
 
 
-struct FrustumGpuVisibilityUniforms
+struct FrustumGpuVisibilityConsts
 {
 {
 	Vec4 m_clipPlanes[6u];
 	Vec4 m_clipPlanes[6u];
 
 
@@ -23,7 +23,7 @@ struct FrustumGpuVisibilityUniforms
 	Vec2 m_finalRenderTargetSize;
 	Vec2 m_finalRenderTargetSize;
 };
 };
 
 
-struct DistanceGpuVisibilityUniforms
+struct DistanceGpuVisibilityConstants
 {
 {
 	Vec3 m_pointOfTest;
 	Vec3 m_pointOfTest;
 	F32 m_testRadius;
 	F32 m_testRadius;
@@ -34,12 +34,12 @@ struct DistanceGpuVisibilityUniforms
 	F32 m_padding3;
 	F32 m_padding3;
 };
 };
 
 
-struct GpuVisibilityNonRenderableUniforms
+struct GpuVisibilityNonRenderableConstants
 {
 {
 	Vec4 m_clipPlanes[6u];
 	Vec4 m_clipPlanes[6u];
 };
 };
 
 
-struct GpuVisibilityAccelerationStructuresUniforms
+struct GpuVisibilityAccelerationStructuresConstants
 {
 {
 	Vec4 m_clipPlanes[6u];
 	Vec4 m_clipPlanes[6u];
 
 
@@ -66,7 +66,7 @@ struct GpuVisibilityVisibleMeshletDesc
 	U32 m_lod_2bit_meshletIndex_30bit;
 	U32 m_lod_2bit_meshletIndex_30bit;
 };
 };
 
 
-struct GpuVisibilityMeshletUniforms
+struct GpuVisibilityMeshletConstants
 {
 {
 	Mat4 m_viewProjectionMatrix;
 	Mat4 m_viewProjectionMatrix;
 
 

+ 4 - 4
AnKi/Shaders/Include/MaterialTypes.h

@@ -10,7 +10,7 @@
 ANKI_BEGIN_NAMESPACE
 ANKI_BEGIN_NAMESPACE
 
 
 /// Common data for all materials.
 /// Common data for all materials.
-struct MaterialGlobalUniforms
+struct MaterialGlobalConstants
 {
 {
 	Mat4 m_viewProjectionMatrix;
 	Mat4 m_viewProjectionMatrix;
 	Mat4 m_previousViewProjectionMatrix;
 	Mat4 m_previousViewProjectionMatrix;
@@ -19,10 +19,10 @@ struct MaterialGlobalUniforms
 
 
 	Vec4 m_viewport;
 	Vec4 m_viewport;
 };
 };
-static_assert(sizeof(MaterialGlobalUniforms) == 15 * sizeof(Vec4));
+static_assert(sizeof(MaterialGlobalConstants) == 15 * sizeof(Vec4));
 
 
 #define ANKI_MATERIAL_REGISTER_TILINEAR_REPEAT_SAMPLER 0
 #define ANKI_MATERIAL_REGISTER_TILINEAR_REPEAT_SAMPLER 0
-#define ANKI_MATERIAL_REGISTER_GLOBAL_UNIFORMS 0
+#define ANKI_MATERIAL_REGISTER_GLOBAL_CONSTANTS 0
 #define ANKI_MATERIAL_REGISTER_GPU_SCENE 0
 #define ANKI_MATERIAL_REGISTER_GPU_SCENE 0
 
 
 #define ANKI_MATERIAL_REGISTER_MESHLET_BOUNDING_VOLUMES 1 ///< Points to the unified geom buffer
 #define ANKI_MATERIAL_REGISTER_MESHLET_BOUNDING_VOLUMES 1 ///< Points to the unified geom buffer
@@ -40,7 +40,7 @@ static_assert(sizeof(MaterialGlobalUniforms) == 15 * sizeof(Vec4));
 #define ANKI_MATERIAL_REGISTER_SHADOW_SAMPLER 3
 #define ANKI_MATERIAL_REGISTER_SHADOW_SAMPLER 3
 #define ANKI_MATERIAL_REGISTER_SCENE_DEPTH 9
 #define ANKI_MATERIAL_REGISTER_SCENE_DEPTH 9
 #define ANKI_MATERIAL_REGISTER_LIGHT_VOLUME 10
 #define ANKI_MATERIAL_REGISTER_LIGHT_VOLUME 10
-#define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_UNIFORMS 1
+#define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_CONSTANTS 1
 #define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS 11
 #define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS 11
 #define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_SPOT_LIGHTS 12
 #define ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_SPOT_LIGHTS 12
 #define ANKI_MATERIAL_REGISTER_SHADOW_ATLAS 13
 #define ANKI_MATERIAL_REGISTER_SHADOW_ATLAS 13

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

@@ -59,7 +59,7 @@ struct CommonMatrices
 };
 };
 
 
 /// Common constants for all passes.
 /// Common constants for all passes.
-struct GlobalRendererUniforms
+struct GlobalRendererConstants
 {
 {
 	Vec2 m_renderingSize;
 	Vec2 m_renderingSize;
 	F32 m_time;
 	F32 m_time;
@@ -89,7 +89,7 @@ struct GlobalRendererUniforms
 };
 };
 
 
 // RT shadows
 // RT shadows
-struct RtShadowsDenoiseUniforms
+struct RtShadowsDenoiseConstants
 {
 {
 	Mat4 m_invViewProjMat;
 	Mat4 m_invViewProjMat;
 
 
@@ -99,7 +99,7 @@ struct RtShadowsDenoiseUniforms
 	F32 m_padding2;
 	F32 m_padding2;
 };
 };
 
 
-struct RtShadowsSbtBuildUniforms
+struct RtShadowsSbtBuildConstants
 {
 {
 	U32 m_shaderHandleDwordSize;
 	U32 m_shaderHandleDwordSize;
 	U32 m_sbtRecordDwordSize;
 	U32 m_sbtRecordDwordSize;
@@ -116,7 +116,7 @@ struct LensFlareSprite
 };
 };
 
 
 // Depth downscale
 // Depth downscale
-struct DepthDownscaleUniforms
+struct DepthDownscaleConstants
 {
 {
 	Vec2 m_srcTexSizeOverOne;
 	Vec2 m_srcTexSizeOverOne;
 	U32 m_threadgroupCount;
 	U32 m_threadgroupCount;
@@ -124,7 +124,7 @@ struct DepthDownscaleUniforms
 };
 };
 
 
 // Screen space reflections uniforms
 // Screen space reflections uniforms
-struct SsrUniforms
+struct SsrConstants
 {
 {
 	Vec2 m_viewportSizef;
 	Vec2 m_viewportSizef;
 	U32 m_frameCount;
 	U32 m_frameCount;
@@ -143,7 +143,7 @@ struct SsrUniforms
 };
 };
 
 
 // Vol fog
 // Vol fog
-struct VolumetricFogUniforms
+struct VolumetricFogConstants
 {
 {
 	RVec3 m_fogDiffuse;
 	RVec3 m_fogDiffuse;
 	RF32 m_fogScatteringCoeff;
 	RF32 m_fogScatteringCoeff;
@@ -158,7 +158,7 @@ struct VolumetricFogUniforms
 };
 };
 
 
 // Vol lighting
 // Vol lighting
-struct VolumetricLightingUniforms
+struct VolumetricLightingConstants
 {
 {
 	RF32 m_densityAtMinHeight;
 	RF32 m_densityAtMinHeight;
 	RF32 m_densityAtMaxHeight;
 	RF32 m_densityAtMaxHeight;
@@ -170,7 +170,7 @@ struct VolumetricLightingUniforms
 };
 };
 
 
 // SSAO
 // SSAO
-struct SsaoUniforms
+struct SsaoConstants
 {
 {
 	RF32 m_radius; ///< In meters.
 	RF32 m_radius; ///< In meters.
 	U32 m_sampleCount;
 	U32 m_sampleCount;
@@ -190,7 +190,7 @@ struct SsaoUniforms
 	Mat3x4 m_viewMat;
 	Mat3x4 m_viewMat;
 };
 };
 
 
-struct SsaoSpatialDenoiseUniforms
+struct SsaoSpatialDenoiseConstants
 {
 {
 	Mat3x4 m_viewToWorldMat;
 	Mat3x4 m_viewToWorldMat;
 
 

+ 2 - 2
AnKi/Shaders/Include/TraditionalDeferredShadingTypes.h

@@ -17,7 +17,7 @@ struct TraditionalDeferredShadingDirectionalLight
 	Mat4 m_lightMatrix;
 	Mat4 m_lightMatrix;
 };
 };
 
 
-struct TraditionalDeferredShadingUniforms
+struct TraditionalDeferredShadingConstants
 {
 {
 	// Use these to get the correct face UVs
 	// Use these to get the correct face UVs
 	Vec2 m_inputTexUvScale;
 	Vec2 m_inputTexUvScale;
@@ -31,7 +31,7 @@ struct TraditionalDeferredShadingUniforms
 	TraditionalDeferredShadingDirectionalLight m_dirLight;
 	TraditionalDeferredShadingDirectionalLight m_dirLight;
 };
 };
 
 
-struct TraditionalDeferredSkyboxUniforms
+struct TraditionalDeferredSkyboxConstants
 {
 {
 	RVec3 m_solidColor;
 	RVec3 m_solidColor;
 	F32 m_padding1;
 	F32 m_padding1;

+ 5 - 4
AnKi/Shaders/IrradianceDice.ankiprog

@@ -29,13 +29,13 @@ TextureCube<Vec4> g_gbufferTex[3u] : register(t1);
 #if STORE_LOCATION == 0
 #if STORE_LOCATION == 0
 RWTexture3D<Vec4> g_irradianceVolume : register(u0);
 RWTexture3D<Vec4> g_irradianceVolume : register(u0);
 
 
-struct Uniforms
+struct Constants
 {
 {
 	IVec3 m_volumeTexel;
 	IVec3 m_volumeTexel;
 	I32 m_nextTexelOffsetInU;
 	I32 m_nextTexelOffsetInU;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 #else
 #else
 struct BufferOut
 struct BufferOut
 {
 {
@@ -197,13 +197,14 @@ RVec3 sampleLightShadingTexture(const U32 face, UVec3 svGroupThreadId)
 
 
 		const UVec3 subvolumeSize = UVec3(volumeSize.x / 6u, volumeSize.y, volumeSize.z);
 		const UVec3 subvolumeSize = UVec3(volumeSize.x / 6u, volumeSize.y, volumeSize.z);
 		const U32 cellIdx =
 		const U32 cellIdx =
-			g_unis.m_volumeTexel.z * subvolumeSize.x * subvolumeSize.y + g_unis.m_volumeTexel.y * subvolumeSize.x + g_unis.m_volumeTexel.x;
+			g_consts.m_volumeTexel.z * subvolumeSize.x * subvolumeSize.y + g_consts.m_volumeTexel.y * subvolumeSize.x + g_consts.m_volumeTexel.x;
 		const RF32 headmapFactor = F32(cellIdx) / F32(subvolumeSize.x * subvolumeSize.y * subvolumeSize.z);
 		const RF32 headmapFactor = F32(cellIdx) / F32(subvolumeSize.x * subvolumeSize.y * subvolumeSize.z);
 		const RVec3 toStoreValue = heatmap(headmapFactor);
 		const RVec3 toStoreValue = heatmap(headmapFactor);
 #endif
 #endif
 
 
 #if STORE_LOCATION == 0
 #if STORE_LOCATION == 0
-		const UVec3 storeUvw = UVec3(g_unis.m_volumeTexel.x + I32(f) * g_unis.m_nextTexelOffsetInU, g_unis.m_volumeTexel.y, g_unis.m_volumeTexel.z);
+		const UVec3 storeUvw =
+			UVec3(g_consts.m_volumeTexel.x + I32(f) * g_consts.m_nextTexelOffsetInU, g_consts.m_volumeTexel.y, g_consts.m_volumeTexel.z);
 		g_irradianceVolume[storeUvw] = Vec4(toStoreValue, 0.0);
 		g_irradianceVolume[storeUvw] = Vec4(toStoreValue, 0.0);
 #else
 #else
 		g_irradianceDisceResults[0].m_val[f] = toStoreValue.xyzx;
 		g_irradianceDisceResults[0].m_val[f] = toStoreValue.xyzx;

+ 1 - 1
AnKi/Shaders/LensFlareUpdateIndirectInfo.ankiprog

@@ -8,7 +8,7 @@
 
 
 #define THREAD_COUNT_SQRT 8
 #define THREAD_COUNT_SQRT 8
 
 
-ANKI_PUSH_CONSTANTS(Mat4, g_mvp)
+ANKI_FAST_CONSTANTS(Mat4, g_mvp)
 StructuredBuffer<Vec4> g_flarePositions : register(t0);
 StructuredBuffer<Vec4> g_flarePositions : register(t0);
 RWStructuredBuffer<DrawIndirectArgs> g_indirectInfo : register(u0);
 RWStructuredBuffer<DrawIndirectArgs> g_indirectInfo : register(u0);
 SamplerState g_nearestAnyClampSampler : register(s0);
 SamplerState g_nearestAnyClampSampler : register(s0);

+ 6 - 6
AnKi/Shaders/LightShading.ankiprog

@@ -14,7 +14,7 @@
 #include <AnKi/Shaders/RtShadows.hlsl>
 #include <AnKi/Shaders/RtShadows.hlsl>
 #include <AnKi/Shaders/ClusteredShadingFunctions.hlsl>
 #include <AnKi/Shaders/ClusteredShadingFunctions.hlsl>
 
 
-ConstantBuffer<GlobalRendererUniforms> g_globalUniforms : register(b0);
+ConstantBuffer<GlobalRendererConstants> g_globalConstants : register(b0);
 StructuredBuffer<PointLight> g_pointLights : register(t0);
 StructuredBuffer<PointLight> g_pointLights : register(t0);
 StructuredBuffer<SpotLight> g_spotLights : register(t1);
 StructuredBuffer<SpotLight> g_spotLights : register(t1);
 StructuredBuffer<GlobalIlluminationProbe> g_giProbes : register(t2);
 StructuredBuffer<GlobalIlluminationProbe> g_giProbes : register(t2);
@@ -54,13 +54,13 @@ RVec3 main(VertOut input) : SV_TARGET0
 	}
 	}
 
 
 	// Get world position
 	// Get world position
-	const Vec4 worldPos4 = mul(g_globalUniforms.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
+	const Vec4 worldPos4 = mul(g_globalConstants.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 
-	const RVec3 viewDir = normalize(g_globalUniforms.m_cameraPosition - worldPos);
+	const RVec3 viewDir = normalize(g_globalConstants.m_cameraPosition - worldPos);
 
 
 	// Get the cluster
 	// Get the cluster
-	Cluster cluster = getClusterFragCoord(g_clusters, g_globalUniforms, Vec3(input.m_svPosition.xy, depth));
+	Cluster cluster = getClusterFragCoord(g_clusters, g_globalConstants, Vec3(input.m_svPosition.xy, depth));
 
 
 	// return clusterHeatmap(cluster, 1u << (U32)GpuSceneNonRenderableObjectType::kLight, 3);
 	// return clusterHeatmap(cluster, 1u << (U32)GpuSceneNonRenderableObjectType::kLight, 3);
 
 
@@ -133,7 +133,7 @@ RVec3 main(VertOut input) : SV_TARGET0
 		[branch] if(ssr.w < 0.9f)
 		[branch] if(ssr.w < 0.9f)
 		{
 		{
 			const Vec3 reflDir = reflect(-viewDir, gbuffer.m_normal);
 			const Vec3 reflDir = reflect(-viewDir, gbuffer.m_normal);
-			const RF32 reflLod = (g_globalUniforms.m_reflectionProbesMipCount - 1.0f) * gbuffer.m_roughness;
+			const RF32 reflLod = (g_globalConstants.m_reflectionProbesMipCount - 1.0f) * gbuffer.m_roughness;
 			RVec3 probeColor = 0.0f;
 			RVec3 probeColor = 0.0f;
 
 
 			const U32 oneProbe = WaveActiveAllTrue(countbits(cluster.m_reflectionProbesMask) == 1);
 			const U32 oneProbe = WaveActiveAllTrue(countbits(cluster.m_reflectionProbesMask) == 1);
@@ -191,7 +191,7 @@ RVec3 main(VertOut input) : SV_TARGET0
 	U32 resolvedSmIdx = 0u;
 	U32 resolvedSmIdx = 0u;
 
 
 	// Dir light
 	// Dir light
-	const DirectionalLight dirLight = g_globalUniforms.m_directionalLight;
+	const DirectionalLight dirLight = g_globalConstants.m_directionalLight;
 	if(dirLight.m_shadowCascadeCount_31bit_active_1bit & 1u)
 	if(dirLight.m_shadowCascadeCount_31bit_active_1bit & 1u)
 	{
 	{
 		RF32 shadowFactor;
 		RF32 shadowFactor;

+ 4 - 4
AnKi/Shaders/LightShadingApplyFog.ankiprog

@@ -16,14 +16,14 @@ SamplerState g_linearAnyClampSampler : register(s1);
 Texture2D g_depthRt : register(t0);
 Texture2D g_depthRt : register(t0);
 Texture3D<RVec4> g_fogVolume : register(t1);
 Texture3D<RVec4> g_fogVolume : register(t1);
 
 
-struct Uniforms
+struct Constants
 {
 {
 	F32 m_zSplitCount;
 	F32 m_zSplitCount;
 	F32 m_finalZSplit;
 	F32 m_finalZSplit;
 	F32 m_near;
 	F32 m_near;
 	F32 m_far;
 	F32 m_far;
 };
 };
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 RVec4 main(VertOut input) : SV_TARGET0
 RVec4 main(VertOut input) : SV_TARGET0
 {
 {
@@ -32,8 +32,8 @@ RVec4 main(VertOut input) : SV_TARGET0
 
 
 	// Compute W coordinate
 	// Compute W coordinate
 	const F32 depth = g_depthRt.SampleLevel(g_nearestAnyClampSampler, uv, 0.0).r;
 	const F32 depth = g_depthRt.SampleLevel(g_nearestAnyClampSampler, uv, 0.0).r;
-	const F32 linearDepth = linearizeDepth(depth, g_unis.m_near, g_unis.m_far);
-	uvw.z = linearDepth * (g_unis.m_zSplitCount / (g_unis.m_finalZSplit + 1.0f));
+	const F32 linearDepth = linearizeDepth(depth, g_consts.m_near, g_consts.m_far);
+	uvw.z = linearDepth * (g_consts.m_zSplitCount / (g_consts.m_finalZSplit + 1.0f));
 
 
 	// Compute UV coordinates
 	// Compute UV coordinates
 	uvw.xy = uv;
 	uvw.xy = uv;

+ 13 - 13
AnKi/Shaders/LightShadingSkybox.ankiprog

@@ -19,18 +19,18 @@
 #include <AnKi/Shaders/Sky.hlsl>
 #include <AnKi/Shaders/Sky.hlsl>
 
 
 #if METHOD == 0
 #if METHOD == 0
-struct Uniforms
+struct Constants
 {
 {
 	RVec3 m_solidColor;
 	RVec3 m_solidColor;
 	F32 m_padding;
 	F32 m_padding;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 #elif METHOD == 1
 #elif METHOD == 1
 SamplerState g_trilinearAnySampler : register(s0);
 SamplerState g_trilinearAnySampler : register(s0);
 Texture2D<RVec4> g_envMapTex : register(t0);
 Texture2D<RVec4> g_envMapTex : register(t0);
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Mat4 m_invertedViewProjectionJitterMat;
 	Mat4 m_invertedViewProjectionJitterMat;
 
 
@@ -44,11 +44,11 @@ struct Uniforms
 	F32 m_padding2;
 	F32 m_padding2;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 #else
 #else
 SamplerState g_linearAnyClampSampler : register(s0);
 SamplerState g_linearAnyClampSampler : register(s0);
 Texture2D<Vec4> g_skyLut : register(t0);
 Texture2D<Vec4> g_skyLut : register(t0);
-ConstantBuffer<GlobalRendererUniforms> g_unis : register(b0);
+ConstantBuffer<GlobalRendererConstants> g_consts : register(b0);
 #endif
 #endif
 
 
 RVec3 main(VertOut input) : SV_TARGET0
 RVec3 main(VertOut input) : SV_TARGET0
@@ -56,14 +56,14 @@ RVec3 main(VertOut input) : SV_TARGET0
 	const Vec2 uv = input.m_uv;
 	const Vec2 uv = input.m_uv;
 #if METHOD == 0
 #if METHOD == 0
 	ANKI_MAYBE_UNUSED(uv);
 	ANKI_MAYBE_UNUSED(uv);
-	return g_unis.m_solidColor;
+	return g_consts.m_solidColor;
 #elif METHOD == 1
 #elif METHOD == 1
 	const F32 depth = 1.0;
 	const F32 depth = 1.0;
 	const Vec2 ndc = uvToNdc(uv);
 	const Vec2 ndc = uvToNdc(uv);
-	const Vec4 worldPos4 = mul(g_unis.m_invertedViewProjectionJitterMat, Vec4(ndc, depth, 1.0));
+	const Vec4 worldPos4 = mul(g_consts.m_invertedViewProjectionJitterMat, Vec4(ndc, depth, 1.0));
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 
-	const Vec3 eyeToFrag = normalize(worldPos - g_unis.m_cameraPos);
+	const Vec3 eyeToFrag = normalize(worldPos - g_consts.m_cameraPos);
 
 
 	const Vec2 uv3 = equirectangularMapping(eyeToFrag);
 	const Vec2 uv3 = equirectangularMapping(eyeToFrag);
 
 
@@ -75,17 +75,17 @@ RVec3 main(VertOut input) : SV_TARGET0
 
 
 	const F32 bias = (maxD > 0.9) ? -100.0f : 0.0f;
 	const F32 bias = (maxD > 0.9) ? -100.0f : 0.0f;
 
 
-	return g_envMapTex.SampleBias(g_trilinearAnySampler, uv3, bias).rgb * g_unis.m_scale + g_unis.m_bias;
+	return g_envMapTex.SampleBias(g_trilinearAnySampler, uv3, bias).rgb * g_consts.m_scale + g_consts.m_bias;
 #else
 #else
 	const F32 depth = 1.0;
 	const F32 depth = 1.0;
 	const Vec2 ndc = uvToNdc(uv);
 	const Vec2 ndc = uvToNdc(uv);
-	const Vec4 worldPos4 = mul(g_unis.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
+	const Vec4 worldPos4 = mul(g_consts.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 
-	const Vec3 eyeToFrag = normalize(worldPos - g_unis.m_cameraPosition);
+	const Vec3 eyeToFrag = normalize(worldPos - g_consts.m_cameraPosition);
 
 
-	return computeSkyColor(g_skyLut, g_linearAnyClampSampler, eyeToFrag, -g_unis.m_directionalLight.m_direction, g_unis.m_directionalLight.m_power,
-						   true);
+	return computeSkyColor(g_skyLut, g_linearAnyClampSampler, eyeToFrag, -g_consts.m_directionalLight.m_direction,
+						   g_consts.m_directionalLight.m_power, true);
 #endif
 #endif
 }
 }
 
 

+ 4 - 4
AnKi/Shaders/MaterialShadersCommon.hlsl

@@ -17,7 +17,7 @@
 #define ANKI_REG(type, binding) _ANKI_REG(type, binding)
 #define ANKI_REG(type, binding) _ANKI_REG(type, binding)
 
 
 SamplerState g_globalSampler : register(ANKI_REG(s, ANKI_MATERIAL_REGISTER_TILINEAR_REPEAT_SAMPLER));
 SamplerState g_globalSampler : register(ANKI_REG(s, ANKI_MATERIAL_REGISTER_TILINEAR_REPEAT_SAMPLER));
-ConstantBuffer<MaterialGlobalUniforms> g_globalUniforms : register(ANKI_REG(b, ANKI_MATERIAL_REGISTER_GLOBAL_UNIFORMS));
+ConstantBuffer<MaterialGlobalConstants> g_globalConstants : register(ANKI_REG(b, ANKI_MATERIAL_REGISTER_GLOBAL_CONSTANTS));
 ByteAddressBuffer g_gpuScene : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_GPU_SCENE));
 ByteAddressBuffer g_gpuScene : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_GPU_SCENE));
 
 
 // Unified geom:
 // Unified geom:
@@ -35,12 +35,12 @@ SamplerState g_nearestClampSampler : register(ANKI_REG(s, ANKI_MATERIAL_REGISTER
 StructuredBuffer<U32> g_firstMeshlet : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_FIRST_MESHLET));
 StructuredBuffer<U32> g_firstMeshlet : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_FIRST_MESHLET));
 
 
 #if ANKI_MESH_SHADER
 #if ANKI_MESH_SHADER
-struct PushConsts
+struct Consts
 {
 {
 	UVec3 m_padding;
 	UVec3 m_padding;
 	U32 m_bucketIndex;
 	U32 m_bucketIndex;
 };
 };
-ANKI_PUSH_CONSTANTS(PushConsts, g_pushConsts)
+ANKI_FAST_CONSTANTS(Consts, g_consts)
 #endif
 #endif
 
 
 // FW shading specific
 // FW shading specific
@@ -52,7 +52,7 @@ Texture2D g_gbufferDepthTex : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_SCENE_
 Texture3D<RVec4> g_lightVol : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_LIGHT_VOLUME));
 Texture3D<RVec4> g_lightVol : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_LIGHT_VOLUME));
 SamplerComparisonState g_shadowSampler : register(ANKI_REG(s, ANKI_MATERIAL_REGISTER_SHADOW_SAMPLER));
 SamplerComparisonState g_shadowSampler : register(ANKI_REG(s, ANKI_MATERIAL_REGISTER_SHADOW_SAMPLER));
 
 
-ConstantBuffer<GlobalRendererUniforms> g_globalRendererUniforms : register(ANKI_REG(b, ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_UNIFORMS));
+ConstantBuffer<GlobalRendererConstants> g_globalRendererConstants : register(ANKI_REG(b, ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_CONSTANTS));
 StructuredBuffer<Cluster> g_clusters : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_CLUSTERS));
 StructuredBuffer<Cluster> g_clusters : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_CLUSTERS));
 StructuredBuffer<PointLight> g_pointLights : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS));
 StructuredBuffer<PointLight> g_pointLights : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_POINT_LIGHTS));
 StructuredBuffer<SpotLight> g_spotLights : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_SPOT_LIGHTS));
 StructuredBuffer<SpotLight> g_spotLights : register(ANKI_REG(t, ANKI_MATERIAL_REGISTER_CLUSTER_SHADING_SPOT_LIGHTS));

+ 5 - 5
AnKi/Shaders/MotionVectors.ankiprog

@@ -16,14 +16,14 @@ SamplerState g_nearesetAnyClampSampler : register(s0);
 Texture2D g_currentDepthTex : register(t0);
 Texture2D g_currentDepthTex : register(t0);
 Texture2D g_velocityTex : register(t1);
 Texture2D g_velocityTex : register(t1);
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Mat4 m_currentViewProjMat;
 	Mat4 m_currentViewProjMat;
 	Mat4 m_currentInvViewProjMat;
 	Mat4 m_currentInvViewProjMat;
 	Mat4 m_prevViewProjMat;
 	Mat4 m_prevViewProjMat;
 };
 };
 
 
-ConstantBuffer<Uniforms> g_unis : register(b0);
+ConstantBuffer<Constants> g_consts : register(b0);
 
 
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
 RWTexture2D<Vec2> g_motionVectorsStorageTex : register(u0);
 RWTexture2D<Vec2> g_motionVectorsStorageTex : register(u0);
@@ -60,13 +60,13 @@ FragOut main(VertOut input)
 		// Don't use a reprojection matrix or other kind of optimizations. Due to numerical precision it produces slightly off result. Big enough to
 		// Don't use a reprojection matrix or other kind of optimizations. Due to numerical precision it produces slightly off result. Big enough to
 		// create slight visual issues. Do it the hard way.
 		// create slight visual issues. Do it the hard way.
 		const F32 depth = g_currentDepthTex.SampleLevel(g_nearesetAnyClampSampler, uv, 0.0).r;
 		const F32 depth = g_currentDepthTex.SampleLevel(g_nearesetAnyClampSampler, uv, 0.0).r;
-		const Vec4 v4 = mul(g_unis.m_currentInvViewProjMat, Vec4(uvToNdc(uv), depth, 1.0));
+		const Vec4 v4 = mul(g_consts.m_currentInvViewProjMat, Vec4(uvToNdc(uv), depth, 1.0));
 		const Vec3 worldPos = v4.xyz / v4.w;
 		const Vec3 worldPos = v4.xyz / v4.w;
 
 
-		Vec4 clipPos = mul(g_unis.m_currentViewProjMat, Vec4(worldPos, 1.0));
+		Vec4 clipPos = mul(g_consts.m_currentViewProjMat, Vec4(worldPos, 1.0));
 		clipPos.xy /= clipPos.w;
 		clipPos.xy /= clipPos.w;
 
 
-		Vec4 prevClipPos = mul(g_unis.m_prevViewProjMat, Vec4(worldPos, 1.0));
+		Vec4 prevClipPos = mul(g_consts.m_prevViewProjMat, Vec4(worldPos, 1.0));
 		prevClipPos.xy /= prevClipPos.w;
 		prevClipPos.xy /= prevClipPos.w;
 
 
 		const Vec2 diff = (prevClipPos.xy - clipPos.xy) * 0.5f; // aka uvToNdc(prevClipPos.xy) - uvToNdc(clipPos.xy)
 		const Vec2 diff = (prevClipPos.xy - clipPos.xy) * 0.5f; // aka uvToNdc(prevClipPos.xy) - uvToNdc(clipPos.xy)

+ 4 - 4
AnKi/Shaders/RtShadows.ankiprog

@@ -15,7 +15,7 @@
 
 
 #define SPACE space2
 #define SPACE space2
 
 
-ConstantBuffer<GlobalRendererUniforms> g_globalRendererUniforms : register(b0, SPACE);
+ConstantBuffer<GlobalRendererConstants> g_globalRendererConstants : register(b0, SPACE);
 
 
 SamplerState g_trilinearRepeatSampler : register(s0, SPACE);
 SamplerState g_trilinearRepeatSampler : register(s0, SPACE);
 
 
@@ -53,7 +53,7 @@ F32 trace(const Vec3 rayOrigin, const Vec3 rayDir, F32 tMax)
 
 
 Vec3 genRandomDirection(U32 rayIdx, Vec2 uv)
 Vec3 genRandomDirection(U32 rayIdx, Vec2 uv)
 {
 {
-	const U32 frameIdx = g_globalRendererUniforms.m_frame * RAYS_PER_PIXEL + rayIdx;
+	const U32 frameIdx = g_globalRendererConstants.m_frame * RAYS_PER_PIXEL + rayIdx;
 
 
 	Vec2 noiseTexSize;
 	Vec2 noiseTexSize;
 	g_blueNoiseTex.GetDimensions(noiseTexSize.x, noiseTexSize.y);
 	g_blueNoiseTex.GetDimensions(noiseTexSize.x, noiseTexSize.y);
@@ -71,7 +71,7 @@ Vec3 genRandomDirection(U32 rayIdx, Vec2 uv)
 	const Vec2 uv = (Vec2(DispatchRaysIndex().xy) + 0.5) / Vec2(DispatchRaysDimensions().xy);
 	const Vec2 uv = (Vec2(DispatchRaysIndex().xy) + 0.5) / Vec2(DispatchRaysDimensions().xy);
 	const Vec2 ndc = uvToNdc(uv);
 	const Vec2 ndc = uvToNdc(uv);
 	const F32 depth = g_depthRt.SampleLevel(g_linearAnyClampSampler, uv, 0.0).r;
 	const F32 depth = g_depthRt.SampleLevel(g_linearAnyClampSampler, uv, 0.0).r;
-	const Vec4 worldPos4 = mul(g_globalRendererUniforms.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
+	const Vec4 worldPos4 = mul(g_globalRendererConstants.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 
 	if(depth == 1.0)
 	if(depth == 1.0)
@@ -86,7 +86,7 @@ Vec3 genRandomDirection(U32 rayIdx, Vec2 uv)
 
 
 	// Dir light
 	// Dir light
 	F32 shadowFactor = 0.0f;
 	F32 shadowFactor = 0.0f;
-	const DirectionalLight dirLight = g_globalRendererUniforms.m_directionalLight;
+	const DirectionalLight dirLight = g_globalRendererConstants.m_directionalLight;
 	for(U32 i = 0; i < RAYS_PER_PIXEL; ++i)
 	for(U32 i = 0; i < RAYS_PER_PIXEL; ++i)
 	{
 	{
 		const Vec3 dirLightPos = worldPos + -dirLight.m_direction * 10.0 + genRandomDirection(i, uv);
 		const Vec3 dirLightPos = worldPos + -dirLight.m_direction * 10.0 + genRandomDirection(i, uv);

+ 5 - 5
AnKi/Shaders/RtShadowsDenoise.ankiprog

@@ -20,11 +20,11 @@ Texture2D<Vec4> g_momentsTex : register(t3);
 Texture2D<Vec4> g_historyLengthTex : register(t4);
 Texture2D<Vec4> g_historyLengthTex : register(t4);
 RWTexture2D<Vec4> g_storageTex : register(u0);
 RWTexture2D<Vec4> g_storageTex : register(u0);
 
 
-ANKI_PUSH_CONSTANTS(RtShadowsDenoiseUniforms, g_unis)
+ANKI_FAST_CONSTANTS(RtShadowsDenoiseConstants, g_consts)
 
 
 Vec3 unproject(Vec2 ndc, F32 depth)
 Vec3 unproject(Vec2 ndc, F32 depth)
 {
 {
-	const Vec4 worldPos4 = mul(g_unis.m_invViewProjMat, Vec4(ndc, depth, 1.0));
+	const Vec4 worldPos4 = mul(g_consts.m_invViewProjMat, Vec4(ndc, depth, 1.0));
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	return worldPos;
 	return worldPos;
 }
 }
@@ -82,12 +82,12 @@ F32 computeVarianceCenter(Vec2 uv)
 	if(historyLength < 2.0)
 	if(historyLength < 2.0)
 	{
 	{
 		// Worst case
 		// Worst case
-		sampleCount = g_unis.m_maxSampleCount;
+		sampleCount = g_consts.m_maxSampleCount;
 	}
 	}
 	else if(historyLength > 4.0 && varianceCenter < 0.0001)
 	else if(historyLength > 4.0 && varianceCenter < 0.0001)
 	{
 	{
 		// Best case
 		// Best case
-		sampleCount = g_unis.m_minSampleCount;
+		sampleCount = g_consts.m_minSampleCount;
 	}
 	}
 	else
 	else
 	{
 	{
@@ -96,7 +96,7 @@ F32 computeVarianceCenter(Vec2 uv)
 		F32 blur = varianceCenter * 100.0;
 		F32 blur = varianceCenter * 100.0;
 		blur = min(1.0, blur);
 		blur = min(1.0, blur);
 
 
-		const F32 sampleCountf = lerp(F32(g_unis.m_minSampleCount), F32(g_unis.m_maxSampleCount), blur);
+		const F32 sampleCountf = lerp(F32(g_consts.m_minSampleCount), F32(g_consts.m_maxSampleCount), blur);
 
 
 		sampleCount = U32(sampleCountf);
 		sampleCount = U32(sampleCountf);
 	}
 	}

+ 6 - 6
AnKi/Shaders/RtShadowsSbtBuild.ankiprog

@@ -17,7 +17,7 @@ StructuredBuffer<U32> g_shaderHandles : register(t3);
 
 
 RWStructuredBuffer<U32> g_sbtBuffer : register(u0);
 RWStructuredBuffer<U32> g_sbtBuffer : register(u0);
 
 
-ANKI_PUSH_CONSTANTS(RtShadowsSbtBuildUniforms, g_unis)
+ANKI_FAST_CONSTANTS(RtShadowsSbtBuildConstants, g_consts)
 
 
 #define NUMTHREADS 64
 #define NUMTHREADS 64
 
 
@@ -31,19 +31,19 @@ ANKI_PUSH_CONSTANTS(RtShadowsSbtBuildUniforms, g_unis)
 
 
 	const GpuSceneRenderable renderable = g_renderables[g_visibleRenderableIndices[svDispatchThreadId + 1]];
 	const GpuSceneRenderable renderable = g_renderables[g_visibleRenderableIndices[svDispatchThreadId + 1]];
 
 
-	U32 sbtDwordOffset = g_unis.m_sbtRecordDwordSize * 2; // Skip raygen and miss shaders which are first
-	sbtDwordOffset += g_unis.m_sbtRecordDwordSize * svDispatchThreadId;
+	U32 sbtDwordOffset = g_consts.m_sbtRecordDwordSize * 2; // Skip raygen and miss shaders which are first
+	sbtDwordOffset += g_consts.m_sbtRecordDwordSize * svDispatchThreadId;
 
 
 	// Copy the handle
 	// Copy the handle
-	for(U32 i = 0; i < g_unis.m_shaderHandleDwordSize; ++i)
+	for(U32 i = 0; i < g_consts.m_shaderHandleDwordSize; ++i)
 	{
 	{
-		g_sbtBuffer[sbtDwordOffset] = g_shaderHandles[renderable.m_rtShadowsShaderHandleIndex * g_unis.m_shaderHandleDwordSize + i];
+		g_sbtBuffer[sbtDwordOffset] = g_shaderHandles[renderable.m_rtShadowsShaderHandleIndex * g_consts.m_shaderHandleDwordSize + i];
 		++sbtDwordOffset;
 		++sbtDwordOffset;
 	}
 	}
 
 
 	// Copy the GpuSceneRenderableInstance
 	// Copy the GpuSceneRenderableInstance
 	g_sbtBuffer[sbtDwordOffset++] = renderable.m_worldTransformsIndex;
 	g_sbtBuffer[sbtDwordOffset++] = renderable.m_worldTransformsIndex;
-	g_sbtBuffer[sbtDwordOffset++] = renderable.m_uniformsOffset;
+	g_sbtBuffer[sbtDwordOffset++] = renderable.m_constantsOffset;
 	g_sbtBuffer[sbtDwordOffset++] = renderable.m_meshLodsIndex;
 	g_sbtBuffer[sbtDwordOffset++] = renderable.m_meshLodsIndex;
 	g_sbtBuffer[sbtDwordOffset] = 0;
 	g_sbtBuffer[sbtDwordOffset] = 0;
 }
 }

+ 1 - 1
AnKi/Shaders/RtShadowsSvgfAtrous.ankiprog

@@ -21,7 +21,7 @@ RWTexture2D<UVec4> g_shadowStorageTex : register(u0);
 RWTexture2D<Vec4> g_varianceStorageTex : register(u1);
 RWTexture2D<Vec4> g_varianceStorageTex : register(u1);
 #endif
 #endif
 
 
-ANKI_PUSH_CONSTANTS(Mat4, g_invProjMat)
+ANKI_FAST_CONSTANTS(Mat4, g_invProjMat)
 
 
 constexpr I32 kConvolutionRadius = 2;
 constexpr I32 kConvolutionRadius = 2;
 constexpr F32 kKernelWeights[kConvolutionRadius + 1] = {1.0, 2.0 / 3.0, 1.0 / 6.0};
 constexpr F32 kKernelWeights[kConvolutionRadius + 1] = {1.0, 2.0 / 3.0, 1.0 / 6.0};

+ 1 - 1
AnKi/Shaders/RtShadowsSvgfVariance.ankiprog

@@ -18,7 +18,7 @@ Texture2D<Vec4> g_depthTex : register(t3);
 RWTexture2D<Vec4> g_shadowUav : register(u0);
 RWTexture2D<Vec4> g_shadowUav : register(u0);
 RWTexture2D<Vec4> g_varianceUav : register(u1);
 RWTexture2D<Vec4> g_varianceUav : register(u1);
 
 
-ANKI_PUSH_CONSTANTS(Mat4, g_invProjMat)
+ANKI_FAST_CONSTANTS(Mat4, g_invProjMat)
 
 
 constexpr I32 kConvolutionRadius = 1;
 constexpr I32 kConvolutionRadius = 1;
 
 

+ 3 - 3
AnKi/Shaders/ShadowMappingVetVisibility.ankiprog

@@ -19,7 +19,7 @@ RWStructuredBuffer<DrawIndirectArgs> g_clearTileIndirectArgs : register(u3);
 RWStructuredBuffer<DispatchIndirectArgs> g_dispatchMeshIndirectArgs : register(u4);
 RWStructuredBuffer<DispatchIndirectArgs> g_dispatchMeshIndirectArgs : register(u4);
 RWStructuredBuffer<DrawIndirectArgs> g_drawIndirectArgs : register(u5);
 RWStructuredBuffer<DrawIndirectArgs> g_drawIndirectArgs : register(u5);
 
 
-struct Uniforms
+struct Constants
 {
 {
 	U32 m_lightIndex;
 	U32 m_lightIndex;
 	U32 m_padding0;
 	U32 m_padding0;
@@ -27,7 +27,7 @@ struct Uniforms
 	U32 m_padding2;
 	U32 m_padding2;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 groupshared U32 s_renderLight;
 groupshared U32 s_renderLight;
 
 
@@ -35,7 +35,7 @@ groupshared U32 s_renderLight;
 {
 {
 	if(svGroupIndex == 0)
 	if(svGroupIndex == 0)
 	{
 	{
-		const GpuSceneLight light = g_lights[g_unis.m_lightIndex];
+		const GpuSceneLight light = g_lights[g_consts.m_lightIndex];
 		const U32 crntHash = g_lightHashes[light.m_visibleRenderablesHashIndex].m_hash;
 		const U32 crntHash = g_lightHashes[light.m_visibleRenderablesHashIndex].m_hash;
 		s_renderLight = crntHash != g_hash[0].m_renderablesHash || g_hash[0].m_containsDeformable == 1;
 		s_renderLight = crntHash != g_hash[0].m_renderablesHash || g_hash[0].m_containsDeformable == 1;
 
 

+ 12 - 12
AnKi/Shaders/ShadowmapsResolve.ankiprog

@@ -12,7 +12,7 @@
 
 
 #	define DEBUG_CASCADES 0
 #	define DEBUG_CASCADES 0
 
 
-ConstantBuffer<GlobalRendererUniforms> g_globalUniforms : register(b0);
+ConstantBuffer<GlobalRendererConstants> g_globalConstants : register(b0);
 StructuredBuffer<PointLight> g_pointLights : register(t0);
 StructuredBuffer<PointLight> g_pointLights : register(t0);
 StructuredBuffer<SpotLight> g_spotLights : register(t1);
 StructuredBuffer<SpotLight> g_spotLights : register(t1);
 Texture2D<Vec4> g_shadowAtlasTex : register(t2);
 Texture2D<Vec4> g_shadowAtlasTex : register(t2);
@@ -32,14 +32,14 @@ Texture2D<Vec4> g_dirLightResolvedShadowsTex : register(t6);
 RWTexture2D<RVec4> g_storageTex : register(u0);
 RWTexture2D<RVec4> g_storageTex : register(u0);
 #	endif
 #	endif
 
 
-struct Uniforms
+struct Constants
 {
 {
 	Vec2 m_framebufferSize;
 	Vec2 m_framebufferSize;
 	F32 m_padding0;
 	F32 m_padding0;
 	F32 m_padding1;
 	F32 m_padding1;
 };
 };
 
 
-ANKI_PUSH_CONSTANTS(Uniforms, g_unis)
+ANKI_FAST_CONSTANTS(Constants, g_consts)
 
 
 Vec3 computeDebugShadowCascadeColor(U32 cascade)
 Vec3 computeDebugShadowCascadeColor(U32 cascade)
 {
 {
@@ -68,8 +68,8 @@ RVec4 main(VertOut input) : SV_TARGET0
 #	endif
 #	endif
 {
 {
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
-	svDispatchThreadId = min(svDispatchThreadId, UVec2(g_unis.m_framebufferSize - 1.0f)); // Just to be sure
-	const Vec2 uv = (Vec2(svDispatchThreadId) + 0.5) / g_unis.m_framebufferSize;
+	svDispatchThreadId = min(svDispatchThreadId, UVec2(g_consts.m_framebufferSize - 1.0f)); // Just to be sure
+	const Vec2 uv = (Vec2(svDispatchThreadId) + 0.5) / g_consts.m_framebufferSize;
 #	else
 #	else
 	const Vec2 uv = input.m_uv;
 	const Vec2 uv = input.m_uv;
 #	endif
 #	endif
@@ -79,21 +79,21 @@ RVec4 main(VertOut input) : SV_TARGET0
 	Vec2 noiseTexSize;
 	Vec2 noiseTexSize;
 	g_noiseTex.GetDimensions(noiseTexSize.x, noiseTexSize.y);
 	g_noiseTex.GetDimensions(noiseTexSize.x, noiseTexSize.y);
 
 
-	const Vec2 noiseUv = g_unis.m_framebufferSize / noiseTexSize * uv;
+	const Vec2 noiseUv = g_consts.m_framebufferSize / noiseTexSize * uv;
 	RVec3 noise = g_noiseTex.SampleLevel(g_trilinearRepeatSampler, noiseUv, 0.0).rgb;
 	RVec3 noise = g_noiseTex.SampleLevel(g_trilinearRepeatSampler, noiseUv, 0.0).rgb;
-	noise = animateBlueNoise(noise, g_globalUniforms.m_frame % 16u);
+	noise = animateBlueNoise(noise, g_globalConstants.m_frame % 16u);
 	const RF32 randFactor = noise.x;
 	const RF32 randFactor = noise.x;
 #	endif
 #	endif
 
 
 	// World position
 	// World position
 	const Vec2 ndc = uvToNdc(uv);
 	const Vec2 ndc = uvToNdc(uv);
 	const F32 depth = g_depthRt.SampleLevel(g_linearAnyClampSampler, uv, 0.0).r;
 	const F32 depth = g_depthRt.SampleLevel(g_linearAnyClampSampler, uv, 0.0).r;
-	const Vec4 worldPos4 = mul(g_globalUniforms.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
+	const Vec4 worldPos4 = mul(g_globalConstants.m_matrices.m_invertedViewProjectionJitter, Vec4(ndc, depth, 1.0));
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 	const Vec3 worldPos = worldPos4.xyz / worldPos4.w;
 
 
 	// Cluster
 	// Cluster
-	const Vec2 fragCoord = uv * g_globalUniforms.m_renderingSize;
-	Cluster cluster = getClusterFragCoord(g_clusters, g_globalUniforms, Vec3(fragCoord, depth));
+	const Vec2 fragCoord = uv * g_globalConstants.m_renderingSize;
+	Cluster cluster = getClusterFragCoord(g_clusters, g_globalConstants, Vec3(fragCoord, depth));
 
 
 	// Layers
 	// Layers
 	U32 shadowCasterCountPerFragment = 0u;
 	U32 shadowCasterCountPerFragment = 0u;
@@ -105,13 +105,13 @@ RVec4 main(VertOut input) : SV_TARGET0
 	shadowFactors[0] = g_dirLightResolvedShadowsTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0f).x;
 	shadowFactors[0] = g_dirLightResolvedShadowsTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0f).x;
 	++shadowCasterCountPerFragment;
 	++shadowCasterCountPerFragment;
 #	else
 #	else
-	const DirectionalLight dirLight = g_globalUniforms.m_directionalLight;
+	const DirectionalLight dirLight = g_globalConstants.m_directionalLight;
 	if(dirLight.m_shadowCascadeCount_31bit_active_1bit != 0u)
 	if(dirLight.m_shadowCascadeCount_31bit_active_1bit != 0u)
 	{
 	{
 		const U32 shadowCascadeCount = dirLight.m_shadowCascadeCount_31bit_active_1bit >> 1u;
 		const U32 shadowCascadeCount = dirLight.m_shadowCascadeCount_31bit_active_1bit >> 1u;
 
 
 		const RF32 positiveZViewSpace =
 		const RF32 positiveZViewSpace =
-			testPlanePoint(g_globalUniforms.m_nearPlaneWSpace.xyz, g_globalUniforms.m_nearPlaneWSpace.w, worldPos) + g_globalUniforms.m_near;
+			testPlanePoint(g_globalConstants.m_nearPlaneWSpace.xyz, g_globalConstants.m_nearPlaneWSpace.w, worldPos) + g_globalConstants.m_near;
 
 
 		const F32 lastCascadeDistance = dirLight.m_shadowCascadeDistances[shadowCascadeCount - 1u];
 		const F32 lastCascadeDistance = dirLight.m_shadowCascadeDistances[shadowCascadeCount - 1u];
 		RF32 shadowFactor;
 		RF32 shadowFactor;

+ 6 - 6
AnKi/Shaders/Sky.ankiprog

@@ -329,7 +329,7 @@ Texture2D<Vec4> g_tLutTex : register(t0);
 Texture2D<Vec4> g_mLutTex : register(t1);
 Texture2D<Vec4> g_mLutTex : register(t1);
 SamplerState g_linearAnyClampSampler : register(s0);
 SamplerState g_linearAnyClampSampler : register(s0);
 RWTexture2D<Vec4> g_skyLutStorageTex : register(u0);
 RWTexture2D<Vec4> g_skyLutStorageTex : register(u0);
-ConstantBuffer<GlobalRendererUniforms> g_globalUniforms : register(b0);
+ConstantBuffer<GlobalRendererConstants> g_globalConstants : register(b0);
 
 
 Vec3 raymarchScattering(Vec3 pos, Vec3 rayDir, Vec3 dirToSun, F32 tMax, F32 numSteps)
 Vec3 raymarchScattering(Vec3 pos, Vec3 rayDir, Vec3 dirToSun, F32 tMax, F32 numSteps)
 {
 {
@@ -402,7 +402,7 @@ Vec3 raymarchScattering(Vec3 pos, Vec3 rayDir, Vec3 dirToSun, F32 tMax, F32 numS
 	const F32 cosAltitude = cos(altitudeAngle);
 	const F32 cosAltitude = cos(altitudeAngle);
 	const Vec3 rayDir = Vec3(cosAltitude * sin(azimuthAngle), sin(altitudeAngle), -cosAltitude * cos(azimuthAngle));
 	const Vec3 rayDir = Vec3(cosAltitude * sin(azimuthAngle), sin(altitudeAngle), -cosAltitude * cos(azimuthAngle));
 
 
-	const F32 sunAltitude = (0.5f * kPi) - acos(dot(-g_globalUniforms.m_directionalLight.m_direction, up));
+	const F32 sunAltitude = (0.5f * kPi) - acos(dot(-g_globalConstants.m_directionalLight.m_direction, up));
 	const Vec3 dirToSun = Vec3(0.0f, sin(sunAltitude), -cos(sunAltitude));
 	const Vec3 dirToSun = Vec3(0.0f, sin(sunAltitude), -cos(sunAltitude));
 
 
 	const F32 atmoDist = rayIntersectSphere(kViewPos, rayDir, kAtmosphereRadiusMM);
 	const F32 atmoDist = rayIntersectSphere(kViewPos, rayDir, kAtmosphereRadiusMM);
@@ -424,14 +424,14 @@ Vec3 raymarchScattering(Vec3 pos, Vec3 rayDir, Vec3 dirToSun, F32 tMax, F32 numS
 #include <AnKi/Shaders/TonemappingFunctions.hlsl>
 #include <AnKi/Shaders/TonemappingFunctions.hlsl>
 
 
 Texture2D<Vec4> g_tLutTex : register(t0);
 Texture2D<Vec4> g_tLutTex : register(t0);
-globallycoherent RWStructuredBuffer<GlobalRendererUniforms> g_globalUniforms : register(u0);
+globallycoherent RWStructuredBuffer<GlobalRendererConstants> g_globalConstants : register(u0);
 
 
 [numthreads(1, 1, 1)] void main(UVec2 svDispatchThreadId : SV_DISPATCHTHREADID)
 [numthreads(1, 1, 1)] void main(UVec2 svDispatchThreadId : SV_DISPATCHTHREADID)
 {
 {
-	const Vec3 sunTransmittance = getValFromTLut(g_tLutTex, kViewPos, -g_globalUniforms[0].m_directionalLight.m_direction);
-	const F32 sunPower = g_globalUniforms[0].m_directionalLight.m_power;
+	const Vec3 sunTransmittance = getValFromTLut(g_tLutTex, kViewPos, -g_globalConstants[0].m_directionalLight.m_direction);
+	const F32 sunPower = g_globalConstants[0].m_directionalLight.m_power;
 
 
-	g_globalUniforms[0].m_directionalLight.m_diffuseColor = Vec4(sunPower * sunTransmittance, 0.0f);
+	g_globalConstants[0].m_directionalLight.m_diffuseColor = Vec4(sunPower * sunTransmittance, 0.0f);
 }
 }
 
 
 #pragma anki technique_end comp ComputeSunColor
 #pragma anki technique_end comp ComputeSunColor

+ 21 - 20
AnKi/Shaders/Ssao.ankiprog

@@ -30,22 +30,23 @@ SamplerState g_linearAnyClampSampler : register(s1);
 RWTexture2D<RVec4> g_bentNormalsAndSsaoStorageTex : register(u0);
 RWTexture2D<RVec4> g_bentNormalsAndSsaoStorageTex : register(u0);
 #	endif
 #	endif
 
 
-ANKI_PUSH_CONSTANTS(SsaoUniforms, g_unis)
+ANKI_FAST_CONSTANTS(SsaoConstants, g_consts)
 
 
 Vec3 unproject(Vec2 ndc)
 Vec3 unproject(Vec2 ndc)
 {
 {
 	const F32 d = g_depthTex.SampleLevel(g_linearAnyClampSampler, ndcToUv(ndc), 0.0).r;
 	const F32 d = g_depthTex.SampleLevel(g_linearAnyClampSampler, ndcToUv(ndc), 0.0).r;
-	return cheapPerspectiveUnprojection(g_unis.m_unprojectionParameters, ndc, d);
+	return cheapPerspectiveUnprojection(g_consts.m_unprojectionParameters, ndc, d);
 }
 }
 
 
 Vec4 project(Vec4 p)
 Vec4 project(Vec4 p)
 {
 {
-	return cheapPerspectiveProjection(g_unis.m_projectionMat00, g_unis.m_projectionMat11, g_unis.m_projectionMat22, g_unis.m_projectionMat23, p);
+	return cheapPerspectiveProjection(g_consts.m_projectionMat00, g_consts.m_projectionMat11, g_consts.m_projectionMat22, g_consts.m_projectionMat23,
+									  p);
 }
 }
 
 
 RF32 computeFalloff(RF32 len)
 RF32 computeFalloff(RF32 len)
 {
 {
-	return sqrt(1.0f - min(1.0f, len / g_unis.m_radius));
+	return sqrt(1.0f - min(1.0f, len / g_consts.m_radius));
 }
 }
 
 
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
@@ -55,7 +56,7 @@ RVec4 main(VertOut input) : SV_TARGET0
 #	endif
 #	endif
 {
 {
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER
-	const Vec2 uv = (Vec2(svDispatchThreadId) + 0.5) / g_unis.m_viewportSizef;
+	const Vec2 uv = (Vec2(svDispatchThreadId) + 0.5) / g_consts.m_viewportSizef;
 #	else
 #	else
 	const UVec2 svDispatchThreadId = input.m_svPosition;
 	const UVec2 svDispatchThreadId = input.m_svPosition;
 	ANKI_MAYBE_UNUSED(svDispatchThreadId);
 	ANKI_MAYBE_UNUSED(svDispatchThreadId);
@@ -64,23 +65,23 @@ RVec4 main(VertOut input) : SV_TARGET0
 
 
 	const Vec2 ndc = uvToNdc(uv);
 	const Vec2 ndc = uvToNdc(uv);
 	const F32 depth = g_depthTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0).r;
 	const F32 depth = g_depthTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0).r;
-	const Vec3 Pc = cheapPerspectiveUnprojection(g_unis.m_unprojectionParameters, ndc, depth);
+	const Vec3 Pc = cheapPerspectiveUnprojection(g_consts.m_unprojectionParameters, ndc, depth);
 	const RVec3 V = normalize(-Pc); // View vector
 	const RVec3 V = normalize(-Pc); // View vector
 
 
 	// Get noise
 	// Get noise
 #	if 0
 #	if 0
 	Vec2 noiseTexSize;
 	Vec2 noiseTexSize;
 	g_noiseTex.GetDimensions(noiseTexSize.x, noiseTexSize.y);
 	g_noiseTex.GetDimensions(noiseTexSize.x, noiseTexSize.y);
-	const RVec2 noiseUv = Vec2(g_unis.m_viewportSizef) / noiseTexSize * uv;
-	const RVec2 noise2 = animateBlueNoise(g_noiseTex.SampleLevel(g_trilinearRepeatSampler, noiseUv, 0.0).xyz, g_unis.m_frameCount).yx;
+	const RVec2 noiseUv = Vec2(g_consts.m_viewportSizef) / noiseTexSize * uv;
+	const RVec2 noise2 = animateBlueNoise(g_noiseTex.SampleLevel(g_trilinearRepeatSampler, noiseUv, 0.0).xyz, g_consts.m_frameCount).yx;
 #	else
 #	else
-	const RVec2 noise2 = spatioTemporalNoise(svDispatchThreadId, g_unis.m_frameCount);
+	const RVec2 noise2 = spatioTemporalNoise(svDispatchThreadId, g_consts.m_frameCount);
 #	endif
 #	endif
 
 
 	// Rand slice direction
 	// Rand slice direction
 	const RF32 randAng = noise2.x * kPi;
 	const RF32 randAng = noise2.x * kPi;
 #	if 0
 #	if 0
-	const RF32 aspect = g_unis.m_viewportSizef.x / g_unis.m_viewportSizef.y;
+	const RF32 aspect = g_consts.m_viewportSizef.x / g_consts.m_viewportSizef.y;
 	const RVec2 dir2d = normalize(Vec2(cos(randAng), sin(randAng)) * Vec2(1.0f, aspect));
 	const RVec2 dir2d = normalize(Vec2(cos(randAng), sin(randAng)) * Vec2(1.0f, aspect));
 #	else
 #	else
 	const RVec2 dir2d = Vec2(cos(randAng), sin(randAng));
 	const RVec2 dir2d = Vec2(cos(randAng), sin(randAng));
@@ -88,7 +89,7 @@ RVec4 main(VertOut input) : SV_TARGET0
 
 
 	// Project the view normal to the slice
 	// Project the view normal to the slice
 	const Vec3 worldNormal = unpackNormalFromGBuffer(g_gbufferRt2.SampleLevel(g_linearAnyClampSampler, uv, 0.0));
 	const Vec3 worldNormal = unpackNormalFromGBuffer(g_gbufferRt2.SampleLevel(g_linearAnyClampSampler, uv, 0.0));
-	const RVec3 viewNormal = mul(g_unis.m_viewMat, Vec4(worldNormal, 0.0));
+	const RVec3 viewNormal = mul(g_consts.m_viewMat, Vec4(worldNormal, 0.0));
 
 
 	const RVec3 directionVec = RVec3(dir2d, 0.0f);
 	const RVec3 directionVec = RVec3(dir2d, 0.0f);
 	const RVec3 orthoDirectionVec = directionVec - (dot(directionVec, V) * V);
 	const RVec3 orthoDirectionVec = directionVec - (dot(directionVec, V) * V);
@@ -100,13 +101,13 @@ RVec4 main(VertOut input) : SV_TARGET0
 	const RF32 n = -signNorm * fastAcos(cosNorm);
 	const RF32 n = -signNorm * fastAcos(cosNorm);
 
 
 	// Find the projected radius
 	// Find the projected radius
-	const Vec3 sphereLimit = Pc + Vec3(g_unis.m_radius, 0.0, 0.0);
+	const Vec3 sphereLimit = Pc + Vec3(g_consts.m_radius, 0.0, 0.0);
 	const Vec4 projSphereLimit = project(Vec4(sphereLimit, 1.0));
 	const Vec4 projSphereLimit = project(Vec4(sphereLimit, 1.0));
 	const Vec2 projSphereLimit2 = projSphereLimit.xy / projSphereLimit.w;
 	const Vec2 projSphereLimit2 = projSphereLimit.xy / projSphereLimit.w;
 	const RF32 projRadius = length(projSphereLimit2 - ndc);
 	const RF32 projRadius = length(projSphereLimit2 - ndc);
 
 
 	// Compute the inner integral (Slide 54)
 	// Compute the inner integral (Slide 54)
-	const U32 stepCount = max(1u, g_unis.m_sampleCount / 2u);
+	const U32 stepCount = max(1u, g_consts.m_sampleCount / 2u);
 
 
 	const RF32 lowHorizonCos1 = cos(n - kPi / 2.0f);
 	const RF32 lowHorizonCos1 = cos(n - kPi / 2.0f);
 	const RF32 lowHorizonCos2 = cos(n + kPi / 2.0f);
 	const RF32 lowHorizonCos2 = cos(n + kPi / 2.0f);
@@ -146,7 +147,7 @@ RVec4 main(VertOut input) : SV_TARGET0
 	Vd *= projectedNormalVecLength;
 	Vd *= projectedNormalVecLength;
 
 
 	// Apply power
 	// Apply power
-	Vd = pow(Vd, g_unis.m_ssaoPower);
+	Vd = pow(Vd, g_consts.m_ssaoPower);
 
 
 	// Compute bent normal: see "Algorithm 2 Extension that computes bent normals b."
 	// Compute bent normal: see "Algorithm 2 Extension that computes bent normals b."
 	const RF32 t0 =
 	const RF32 t0 =
@@ -180,7 +181,7 @@ Texture2D<Vec4> g_depthTex : register(t1);
 RWTexture2D<RVec4> g_bentNormalsAndSsaoStorageTex : register(u0);
 RWTexture2D<RVec4> g_bentNormalsAndSsaoStorageTex : register(u0);
 #	endif
 #	endif
 
 
-ANKI_PUSH_CONSTANTS(SsaoSpatialDenoiseUniforms, g_unis)
+ANKI_FAST_CONSTANTS(SsaoSpatialDenoiseConstants, g_consts)
 
 
 F32 computeWeight(F32 depth, F32 refDepth)
 F32 computeWeight(F32 depth, F32 refDepth)
 {
 {
@@ -190,8 +191,8 @@ F32 computeWeight(F32 depth, F32 refDepth)
 
 
 void sampleTex(Vec2 uv, IVec2 offset, F32 refDepth, inout RF32 ssao, inout RVec3 bentNormal, inout F32 weight)
 void sampleTex(Vec2 uv, IVec2 offset, F32 refDepth, inout RF32 ssao, inout RVec3 bentNormal, inout F32 weight)
 {
 {
-	const F32 linearDepth = linearizeDepthOptimal(g_depthTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, offset).x, g_unis.m_linearizeDepthParams.x,
-												  g_unis.m_linearizeDepthParams.y);
+	const F32 linearDepth = linearizeDepthOptimal(g_depthTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, offset).x,
+												  g_consts.m_linearizeDepthParams.x, g_consts.m_linearizeDepthParams.y);
 	const RVec4 bentNormalAndSsao = g_bentNormalsAndSsaoTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, offset);
 	const RVec4 bentNormalAndSsao = g_bentNormalsAndSsaoTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0, offset);
 	const F32 w = computeWeight(refDepth, linearDepth);
 	const F32 w = computeWeight(refDepth, linearDepth);
 	ssao += bentNormalAndSsao.w * w;
 	ssao += bentNormalAndSsao.w * w;
@@ -219,8 +220,8 @@ RVec4 main(VertOut input) : SV_TARGET0
 	const RVec4 refBentNormalAndSsao = g_bentNormalsAndSsaoTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0);
 	const RVec4 refBentNormalAndSsao = g_bentNormalsAndSsaoTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0);
 	RF32 ssao = refBentNormalAndSsao.w;
 	RF32 ssao = refBentNormalAndSsao.w;
 	RVec3 bentNormal = refBentNormalAndSsao.xyz;
 	RVec3 bentNormal = refBentNormalAndSsao.xyz;
-	const F32 refDepth = linearizeDepthOptimal(g_depthTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0).x, g_unis.m_linearizeDepthParams.x,
-											   g_unis.m_linearizeDepthParams.y);
+	const F32 refDepth = linearizeDepthOptimal(g_depthTex.SampleLevel(g_linearAnyClampSampler, uv, 0.0).x, g_consts.m_linearizeDepthParams.x,
+											   g_consts.m_linearizeDepthParams.y);
 	F32 weight = computeWeight(0.0f, 0.0f); // Highest weight that this function can give
 	F32 weight = computeWeight(0.0f, 0.0f); // Highest weight that this function can give
 
 
 	// Sample taps
 	// Sample taps
@@ -249,7 +250,7 @@ RVec4 main(VertOut input) : SV_TARGET0
 
 
 	bentNormal /= weight;
 	bentNormal /= weight;
 	bentNormal = normalize(bentNormal);
 	bentNormal = normalize(bentNormal);
-	bentNormal = mul(g_unis.m_viewToWorldMat, Vec4(bentNormal, 0.0f));
+	bentNormal = mul(g_consts.m_viewToWorldMat, Vec4(bentNormal, 0.0f));
 
 
 	// Write value
 	// Write value
 #	if ANKI_COMPUTE_SHADER
 #	if ANKI_COMPUTE_SHADER

Some files were not shown because too many files changed in this diff