Panagiotis Christopoulos Charitos 4 years ago
parent
commit
c477782cbb

+ 1 - 1
AnKi/Resource/ShaderProgramResource.cpp

@@ -387,7 +387,7 @@ void ShaderProgramResource::initVariant(const ShaderProgramResourceVariantInitIn
 			inf.m_constValues.setArray((constValueCount) ? constValues.getBegin() : nullptr, constValueCount);
 			inf.m_constValues.setArray((constValueCount) ? constValues.getBegin() : nullptr, constValueCount);
 			ShaderPtr shader = getManager().getGrManager().newShader(inf);
 			ShaderPtr shader = getManager().getGrManager().newShader(inf);
 
 
-			if(false && (ANKI_OS_LINUX || ANKI_OS_WINDOWS))
+			if(true && (ANKI_OS_LINUX || ANKI_OS_WINDOWS))
 			{
 			{
 				MaliOfflineCompilerOut maliocOut;
 				MaliOfflineCompilerOut maliocOut;
 				const Error err =
 				const Error err =

+ 2 - 2
AnKi/Shaders/GBufferCommon.glsl

@@ -90,8 +90,8 @@ layout(location = 3) out Vec2 out_gbuffer3;
 
 
 // Write the data to RTs
 // Write the data to RTs
 #if defined(ANKI_FRAGMENT_SHADER) && ANKI_PASS == PASS_GB
 #if defined(ANKI_FRAGMENT_SHADER) && ANKI_PASS == PASS_GB
-void writeGBuffer(Vec3 diffColor, Vec3 normal, Vec3 specularColor, F32 roughness, F32 subsurface, Vec3 emission,
-				  F32 metallic, Vec2 velocity)
+void writeGBuffer(ANKI_RP Vec3 diffColor, ANKI_RP Vec3 normal, ANKI_RP Vec3 specularColor, ANKI_RP F32 roughness,
+				  ANKI_RP F32 subsurface, ANKI_RP Vec3 emission, ANKI_RP F32 metallic, Vec2 velocity)
 {
 {
 	GbufferInfo g;
 	GbufferInfo g;
 	g.m_diffuse = diffColor;
 	g.m_diffuse = diffColor;

+ 29 - 29
AnKi/Shaders/GBufferGeneric.ankiprog

@@ -45,36 +45,36 @@
 layout(set = 0, binding = 2) uniform sampler u_ankiGlobalSampler;
 layout(set = 0, binding = 2) uniform sampler u_ankiGlobalSampler;
 #if DIFFUSE_TEX == 1 && ANKI_PASS == PASS_GB
 #if DIFFUSE_TEX == 1 && ANKI_PASS == PASS_GB
 #	pragma anki reflect u_diffTex
 #	pragma anki reflect u_diffTex
-layout(set = 0, binding = 3) uniform texture2D u_diffTex;
+layout(set = 0, binding = 3) uniform ANKI_RP texture2D u_diffTex;
 #	define USING_DIFF_TEX 1
 #	define USING_DIFF_TEX 1
 #endif
 #endif
 #if SPECULAR_TEX == 1 && ANKI_PASS == PASS_GB
 #if SPECULAR_TEX == 1 && ANKI_PASS == PASS_GB
 #	pragma anki reflect u_specTex
 #	pragma anki reflect u_specTex
-layout(set = 0, binding = 4) uniform texture2D u_specTex;
+layout(set = 0, binding = 4) uniform ANKI_RP texture2D u_specTex;
 #	define USING_SPECULAR_TEX 1
 #	define USING_SPECULAR_TEX 1
 #endif
 #endif
 #if ROUGHNESS_TEX == 1 && ANKI_PASS == PASS_GB
 #if ROUGHNESS_TEX == 1 && ANKI_PASS == PASS_GB
 #	pragma anki reflect u_roughnessTex
 #	pragma anki reflect u_roughnessTex
-layout(set = 0, binding = 5) uniform texture2D u_roughnessTex;
+layout(set = 0, binding = 5) uniform ANKI_RP texture2D u_roughnessTex;
 #	define USING_ROUGHNESS_TEX 1
 #	define USING_ROUGHNESS_TEX 1
 #endif
 #endif
 #if NORMAL_TEX == 1 && ANKI_PASS == PASS_GB && ANKI_LOD < 2
 #if NORMAL_TEX == 1 && ANKI_PASS == PASS_GB && ANKI_LOD < 2
 #	pragma anki reflect u_normalTex
 #	pragma anki reflect u_normalTex
-layout(set = 0, binding = 6) uniform texture2D u_normalTex;
+layout(set = 0, binding = 6) uniform ANKI_RP texture2D u_normalTex;
 #	define USING_NORMAL_TEX 1
 #	define USING_NORMAL_TEX 1
 #endif
 #endif
 #if METAL_TEX == 1 && ANKI_PASS == PASS_GB
 #if METAL_TEX == 1 && ANKI_PASS == PASS_GB
 #	pragma anki reflect u_metallicTex
 #	pragma anki reflect u_metallicTex
-layout(set = 0, binding = 7) uniform texture2D u_metallicTex;
+layout(set = 0, binding = 7) uniform ANKI_RP texture2D u_metallicTex;
 #	define USING_METALLIC_TEX 1
 #	define USING_METALLIC_TEX 1
 #endif
 #endif
 #if REALLY_USING_PARALLAX
 #if REALLY_USING_PARALLAX
 #	pragma anki reflect u_heightTex
 #	pragma anki reflect u_heightTex
-layout(set = 0, binding = 8) uniform texture2D u_heightTex;
+layout(set = 0, binding = 8) uniform ANKI_RP texture2D u_heightTex;
 #endif
 #endif
 #if EMISSIVE_TEX == 1 && ANKI_PASS == PASS_GB
 #if EMISSIVE_TEX == 1 && ANKI_PASS == PASS_GB
 #	pragma anki reflect u_emissiveTex
 #	pragma anki reflect u_emissiveTex
-layout(set = 0, binding = 9) uniform texture2D u_emissiveTex;
+layout(set = 0, binding = 9) uniform ANKI_RP texture2D u_emissiveTex;
 #	define USING_EMISSIVE_TEX 1
 #	define USING_EMISSIVE_TEX 1
 #endif
 #endif
 
 
@@ -160,16 +160,16 @@ Vec3 g_position = in_position;
 #if ANKI_PASS == PASS_GB
 #if ANKI_PASS == PASS_GB
 Vec3 g_prevPosition = in_position;
 Vec3 g_prevPosition = in_position;
 Vec2 g_uv = in_uv;
 Vec2 g_uv = in_uv;
-Vec3 g_normal = in_normal;
-Vec4 g_tangent = in_tangent;
+ANKI_RP Vec3 g_normal = in_normal;
+ANKI_RP Vec4 g_tangent = in_tangent;
 #endif
 #endif
 
 
 // Perform skinning
 // Perform skinning
 #if ANKI_BONES
 #if ANKI_BONES
 void skinning()
 void skinning()
 {
 {
-	Mat4 skinMat = u_ankiBoneTransforms[in_boneIndices[0]] * in_boneWeights[0];
-	Mat4 prevSkinMat = u_ankiPrevFrameBoneTransforms[in_boneIndices[0]] * in_boneWeights[0];
+	ANKI_RP Mat4 skinMat = u_ankiBoneTransforms[in_boneIndices[0]] * in_boneWeights[0];
+	ANKI_RP Mat4 prevSkinMat = u_ankiPrevFrameBoneTransforms[in_boneIndices[0]] * in_boneWeights[0];
 	ANKI_UNROLL for(U32 i = 1u; i < 4u; ++i)
 	ANKI_UNROLL for(U32 i = 1u; i < 4u; ++i)
 	{
 	{
 		skinMat += u_ankiBoneTransforms[in_boneIndices[i]] * in_boneWeights[i];
 		skinMat += u_ankiBoneTransforms[in_boneIndices[i]] * in_boneWeights[i];
@@ -335,16 +335,16 @@ Vec2 computeTextureCoordParallax(texture2D heightMap, sampler sampl, Vec2 uv, F3
 
 
 // Do normal mapping
 // Do normal mapping
 #if ANKI_PASS == PASS_GB
 #if ANKI_PASS == PASS_GB
-Vec3 readNormalFromTexture(texture2D map, sampler sampl, highp Vec2 texCoords)
+ANKI_RP Vec3 readNormalFromTexture(ANKI_RP texture2D map, sampler sampl, highp Vec2 texCoords)
 {
 {
 	// First read the texture
 	// First read the texture
-	const Vec3 nAtTangentspace = normalize((texture(map, sampl, texCoords).rgb - 0.5) * 2.0);
+	const ANKI_RP Vec3 nAtTangentspace = normalize((texture(map, sampl, texCoords).rgb - 0.5) * 2.0);
 
 
-	const Vec3 n = normalize(in_normal);
-	const Vec3 t = normalize(in_tangent);
-	const Vec3 b = normalize(in_bitangent);
+	const ANKI_RP Vec3 n = normalize(in_normal);
+	const ANKI_RP Vec3 t = normalize(in_tangent);
+	const ANKI_RP Vec3 b = normalize(in_bitangent);
 
 
-	const Mat3 tbnMat = Mat3(t, b, n);
+	const ANKI_RP Mat3 tbnMat = Mat3(t, b, n);
 
 
 	return tbnMat * nAtTangentspace;
 	return tbnMat * nAtTangentspace;
 }
 }
@@ -361,39 +361,39 @@ void main()
 #	endif
 #	endif
 
 
 #	if defined(USING_DIFF_TEX)
 #	if defined(USING_DIFF_TEX)
-	const Vec3 diffColor = texture(u_diffTex, u_ankiGlobalSampler, uv).rgb;
+	const ANKI_RP Vec3 diffColor = texture(u_diffTex, u_ankiGlobalSampler, uv).rgb;
 #	else
 #	else
-	const Vec3 diffColor = u_ankiPerDraw.m_diffColor;
+	const ANKI_RP Vec3 diffColor = u_ankiPerDraw.m_diffColor;
 #	endif
 #	endif
 
 
 #	if defined(USING_SPECULAR_TEX)
 #	if defined(USING_SPECULAR_TEX)
-	const Vec3 specColor = texture(u_specTex, u_ankiGlobalSampler, uv).rgb;
+	const ANKI_RP Vec3 specColor = texture(u_specTex, u_ankiGlobalSampler, uv).rgb;
 #	else
 #	else
-	const Vec3 specColor = u_ankiPerDraw.m_specColor;
+	const ANKI_RP Vec3 specColor = u_ankiPerDraw.m_specColor;
 #	endif
 #	endif
 
 
 #	if defined(USING_ROUGHNESS_TEX)
 #	if defined(USING_ROUGHNESS_TEX)
-	const F32 roughness = texture(u_roughnessTex, u_ankiGlobalSampler, uv).g;
+	const ANKI_RP F32 roughness = texture(u_roughnessTex, u_ankiGlobalSampler, uv).g;
 #	else
 #	else
-	const F32 roughness = u_ankiPerDraw.m_roughness;
+	const ANKI_RP F32 roughness = u_ankiPerDraw.m_roughness;
 #	endif
 #	endif
 
 
 #	if defined(USING_METALLIC_TEX)
 #	if defined(USING_METALLIC_TEX)
-	const F32 metallic = texture(u_metallicTex, u_ankiGlobalSampler, uv).b;
+	const ANKI_RP F32 metallic = texture(u_metallicTex, u_ankiGlobalSampler, uv).b;
 #	else
 #	else
-	const F32 metallic = u_ankiPerDraw.m_metallic;
+	const ANKI_RP F32 metallic = u_ankiPerDraw.m_metallic;
 #	endif
 #	endif
 
 
 #	if defined(USING_NORMAL_TEX)
 #	if defined(USING_NORMAL_TEX)
-	const Vec3 normal = readNormalFromTexture(u_normalTex, u_ankiGlobalSampler, uv);
+	const ANKI_RP Vec3 normal = readNormalFromTexture(u_normalTex, u_ankiGlobalSampler, uv);
 #	else
 #	else
-	const Vec3 normal = normalize(in_normal);
+	const ANKI_RP Vec3 normal = normalize(in_normal);
 #	endif
 #	endif
 
 
 #	if defined(USING_EMISSIVE_TEX)
 #	if defined(USING_EMISSIVE_TEX)
-	const Vec3 emission = texture(u_emissiveTex, u_ankiGlobalSampler, uv).rgb;
+	const ANKI_RP Vec3 emission = texture(u_emissiveTex, u_ankiGlobalSampler, uv).rgb;
 #	else
 #	else
-	const Vec3 emission = u_ankiPerDraw.m_emission;
+	const ANKI_RP Vec3 emission = u_ankiPerDraw.m_emission;
 #	endif
 #	endif
 
 
 #	if ANKI_VELOCITY || ANKI_BONES
 #	if ANKI_VELOCITY || ANKI_BONES

+ 18 - 17
AnKi/Shaders/LightFunctions.glsl

@@ -175,7 +175,7 @@ U32 computeShadowSampleCount(const U32 COUNT, F32 zVSpace)
 	return sampleCount;
 	return sampleCount;
 }
 }
 
 
-F32 computeShadowFactorSpotLight(SpotLight light, Vec3 worldPos, texture2D spotMap, sampler spotMapSampler)
+ANKI_RP F32 computeShadowFactorSpotLight(SpotLight light, Vec3 worldPos, texture2D spotMap, sampler spotMapSampler)
 {
 {
 	const Vec4 texCoords4 = light.m_textureMatrix * Vec4(worldPos, 1.0);
 	const Vec4 texCoords4 = light.m_textureMatrix * Vec4(worldPos, 1.0);
 	const Vec3 texCoords3 = texCoords4.xyz / texCoords4.w;
 	const Vec3 texCoords3 = texCoords4.xyz / texCoords4.w;
@@ -186,21 +186,22 @@ F32 computeShadowFactorSpotLight(SpotLight light, Vec3 worldPos, texture2D spotM
 }
 }
 
 
 // Compute the shadow factor of point (omni) lights.
 // Compute the shadow factor of point (omni) lights.
-F32 computeShadowFactorPointLight(PointLight light, Vec3 frag2Light, texture2D shadowMap, sampler shadowMapSampler)
+ANKI_RP F32 computeShadowFactorPointLight(PointLight light, ANKI_RP Vec3 frag2Light, texture2D shadowMap,
+										  sampler shadowMapSampler)
 {
 {
-	const Vec3 dir = -frag2Light;
-	const Vec3 dirabs = abs(dir);
-	const F32 dist = max(dirabs.x, max(dirabs.y, dirabs.z));
+	const ANKI_RP Vec3 dir = -frag2Light;
+	const ANKI_RP Vec3 dirabs = abs(dir);
+	const ANKI_RP F32 dist = max(dirabs.x, max(dirabs.y, dirabs.z));
 
 
 	// 1) Project the dist to light's proj mat
 	// 1) Project the dist to light's proj mat
 	//
 	//
-	const F32 near = CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE;
-	const F32 far = light.m_radius;
-	const F32 g = near - far;
+	const ANKI_RP F32 near = CLUSTER_OBJECT_FRUSTUM_NEAR_PLANE;
+	const ANKI_RP F32 far = light.m_radius;
+	const ANKI_RP F32 g = near - far;
 
 
-	const F32 zVSpace = -dist;
-	const F32 w = -zVSpace;
-	F32 z = (far * zVSpace + far * near) / g;
+	const ANKI_RP F32 zVSpace = -dist;
+	const ANKI_RP F32 w = -zVSpace;
+	ANKI_RP F32 z = (far * zVSpace + far * near) / g;
 	z /= w;
 	z /= w;
 
 
 	// 2) Read shadow tex
 	// 2) Read shadow tex
@@ -221,14 +222,14 @@ F32 computeShadowFactorPointLight(PointLight light, Vec3 frag2Light, texture2D s
 
 
 	// 3) Compare
 	// 3) Compare
 	//
 	//
-	const F32 shadowFactor = evsmComputeShadowFactor(z, shadowMoments);
+	const ANKI_RP F32 shadowFactor = evsmComputeShadowFactor(z, shadowMoments);
 
 
 	return shadowFactor;
 	return shadowFactor;
 }
 }
 
 
 // Compute the shadow factor of a directional light
 // Compute the shadow factor of a directional light
-F32 computeShadowFactorDirLight(DirectionalLight light, U32 cascadeIdx, Vec3 worldPos, texture2D shadowMap,
-								sampler shadowMapSampler)
+ANKI_RP F32 computeShadowFactorDirLight(DirectionalLight light, U32 cascadeIdx, Vec3 worldPos, texture2D shadowMap,
+										sampler shadowMapSampler)
 {
 {
 #define ANKI_FAST_CASCADES_WORKAROUND 1 // Doesn't make sense but it's super fast
 #define ANKI_FAST_CASCADES_WORKAROUND 1 // Doesn't make sense but it's super fast
 
 
@@ -262,13 +263,13 @@ F32 computeShadowFactorDirLight(DirectionalLight light, U32 cascadeIdx, Vec3 wor
 }
 }
 
 
 // Compute the shadow factor of a directional light
 // Compute the shadow factor of a directional light
-F32 computeShadowFactorDirLight(Mat4 lightProjectionMat, Vec3 worldPos, texture2D shadowMap,
-								samplerShadow shadowMapSampler)
+ANKI_RP F32 computeShadowFactorDirLight(Mat4 lightProjectionMat, Vec3 worldPos, texture2D shadowMap,
+										samplerShadow shadowMapSampler)
 {
 {
 	const Vec4 texCoords4 = lightProjectionMat * Vec4(worldPos, 1.0);
 	const Vec4 texCoords4 = lightProjectionMat * Vec4(worldPos, 1.0);
 	const Vec3 texCoords3 = texCoords4.xyz / texCoords4.w;
 	const Vec3 texCoords3 = texCoords4.xyz / texCoords4.w;
 
 
-	const F32 shadowFactor = textureLod(shadowMap, shadowMapSampler, texCoords3, 0.0);
+	const ANKI_RP F32 shadowFactor = textureLod(shadowMap, shadowMapSampler, texCoords3, 0.0);
 	return shadowFactor;
 	return shadowFactor;
 }
 }
 
 

+ 4 - 4
AnKi/Shaders/LightShadingApplyFog.ankiprog

@@ -15,7 +15,7 @@ ANKI_SPECIALIZATION_CONSTANT_U32(FINAL_Z_SPLIT, 1u);
 #include <AnKi/Shaders/Functions.glsl>
 #include <AnKi/Shaders/Functions.glsl>
 
 
 layout(location = 0) in Vec2 in_uv;
 layout(location = 0) in Vec2 in_uv;
-layout(location = 0) out Vec4 out_color;
+layout(location = 0) out ANKI_RP Vec4 out_color;
 
 
 layout(set = 0, binding = 0) uniform sampler u_nearestAnyClampSampler;
 layout(set = 0, binding = 0) uniform sampler u_nearestAnyClampSampler;
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 1) uniform sampler u_linearAnyClampSampler;
@@ -42,9 +42,9 @@ void main()
 	uvw.xy = in_uv;
 	uvw.xy = in_uv;
 
 
 	// Read the volume
 	// Read the volume
-	const Vec4 fogVals = textureLod(u_fogVolume, u_linearAnyClampSampler, uvw, 0.0);
-	const Vec3 inScattering = fogVals.rgb;
-	const F32 transmittance = fogVals.a;
+	const ANKI_RP Vec4 fogVals = textureLod(u_fogVolume, u_linearAnyClampSampler, uvw, 0.0);
+	const ANKI_RP Vec3 inScattering = fogVals.rgb;
+	const ANKI_RP F32 transmittance = fogVals.a;
 
 
 	// Apply the fog
 	// Apply the fog
 	out_color = Vec4(inScattering, transmittance);
 	out_color = Vec4(inScattering, transmittance);

+ 2 - 2
AnKi/Shaders/MotionBlur.glsl

@@ -8,8 +8,8 @@
 #include <AnKi/Shaders/Common.glsl>
 #include <AnKi/Shaders/Common.glsl>
 
 
 // Perform motion blur.
 // Perform motion blur.
-Vec3 motionBlur(texture2D motionVectorsRt, sampler motionVectorsRtSampler, ANKI_RP texture2D toBlurRt,
-				Vec2 toBlurRtSize, sampler toBlurRtSampler, Vec2 uv, U32 maxSamples)
+ANKI_RP Vec3 motionBlur(texture2D motionVectorsRt, sampler motionVectorsRtSampler, ANKI_RP texture2D toBlurRt,
+						Vec2 toBlurRtSize, sampler toBlurRtSampler, Vec2 uv, U32 maxSamples)
 {
 {
 	// Compute velocity. Get the max velocity around the curent sample to avoid outlines. TAA's result and the motion
 	// Compute velocity. Get the max velocity around the curent sample to avoid outlines. TAA's result and the motion
 	// vectors RT do not quite overlap
 	// vectors RT do not quite overlap

+ 7 - 7
AnKi/Shaders/ShadowmapsResolve.ankiprog

@@ -19,7 +19,7 @@ ANKI_SPECIALIZATION_CONSTANT_U32(TILE_SIZE, 5u);
 const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
 const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
 layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
 layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
 
 
-layout(set = 0, binding = 5, rgba8) writeonly uniform image2D u_outImg;
+layout(set = 0, binding = 5, rgba8) writeonly uniform ANKI_RP image2D u_outImg;
 layout(set = 0, binding = 6) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 6) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 7) uniform texture2D u_depthRt;
 layout(set = 0, binding = 7) uniform texture2D u_depthRt;
 
 
@@ -45,17 +45,17 @@ void main()
 	// Layers
 	// Layers
 	U32 shadowCasterCountPerFragment = 0u;
 	U32 shadowCasterCountPerFragment = 0u;
 	const U32 maxShadowCastersPerFragment = 4u;
 	const U32 maxShadowCastersPerFragment = 4u;
-	F32 shadowFactors[maxShadowCastersPerFragment] = F32[](0.0, 0.0, 0.0, 0.0);
+	ANKI_RP F32 shadowFactors[maxShadowCastersPerFragment] = F32[](0.0, 0.0, 0.0, 0.0);
 
 
 	// Dir light
 	// Dir light
 	const DirectionalLight dirLight = u_clusteredShading.m_directionalLight;
 	const DirectionalLight dirLight = u_clusteredShading.m_directionalLight;
 	if(dirLight.m_active != 0u && dirLight.m_cascadeCount > 0u)
 	if(dirLight.m_active != 0u && dirLight.m_cascadeCount > 0u)
 	{
 	{
-		const F32 positiveZViewSpace =
+		const ANKI_RP F32 positiveZViewSpace =
 			testPlanePoint(u_clusteredShading.m_nearPlaneWSpace.xyz, u_clusteredShading.m_nearPlaneWSpace.w, worldPos)
 			testPlanePoint(u_clusteredShading.m_nearPlaneWSpace.xyz, u_clusteredShading.m_nearPlaneWSpace.w, worldPos)
 			+ u_clusteredShading.m_near;
 			+ u_clusteredShading.m_near;
 
 
-		F32 shadowFactor;
+		ANKI_RP F32 shadowFactor;
 		if(positiveZViewSpace < dirLight.m_effectiveShadowDistance)
 		if(positiveZViewSpace < dirLight.m_effectiveShadowDistance)
 		{
 		{
 			const U32 cascadeIdx =
 			const U32 cascadeIdx =
@@ -65,7 +65,7 @@ void main()
 			shadowFactor =
 			shadowFactor =
 				computeShadowFactorDirLight(dirLight, cascadeIdx, worldPos, u_shadowAtlasTex, u_linearAnyClampSampler);
 				computeShadowFactorDirLight(dirLight, cascadeIdx, worldPos, u_shadowAtlasTex, u_linearAnyClampSampler);
 
 
-			F32 distanceFadeFactor = saturate(positiveZViewSpace / dirLight.m_effectiveShadowDistance);
+			ANKI_RP F32 distanceFadeFactor = saturate(positiveZViewSpace / dirLight.m_effectiveShadowDistance);
 			distanceFadeFactor = pow(distanceFadeFactor, 8.0);
 			distanceFadeFactor = pow(distanceFadeFactor, 8.0);
 			shadowFactor += distanceFadeFactor;
 			shadowFactor += distanceFadeFactor;
 		}
 		}
@@ -89,7 +89,7 @@ void main()
 		{
 		{
 			const Vec3 frag2Light = light.m_position - worldPos;
 			const Vec3 frag2Light = light.m_position - worldPos;
 
 
-			const F32 shadowFactor =
+			const ANKI_RP F32 shadowFactor =
 				computeShadowFactorPointLight(light, frag2Light, u_shadowAtlasTex, u_linearAnyClampSampler);
 				computeShadowFactorPointLight(light, frag2Light, u_shadowAtlasTex, u_linearAnyClampSampler);
 			shadowFactors[min(maxShadowCastersPerFragment - 1u, shadowCasterCountPerFragment++)] = shadowFactor;
 			shadowFactors[min(maxShadowCastersPerFragment - 1u, shadowCasterCountPerFragment++)] = shadowFactor;
 		}
 		}
@@ -104,7 +104,7 @@ void main()
 
 
 		ANKI_BRANCH if(light.m_shadowLayer != MAX_U32)
 		ANKI_BRANCH if(light.m_shadowLayer != MAX_U32)
 		{
 		{
-			const F32 shadowFactor =
+			const ANKI_RP F32 shadowFactor =
 				computeShadowFactorSpotLight(light, worldPos, u_shadowAtlasTex, u_linearAnyClampSampler);
 				computeShadowFactorSpotLight(light, worldPos, u_shadowAtlasTex, u_linearAnyClampSampler);
 			shadowFactors[min(maxShadowCastersPerFragment - 1u, shadowCasterCountPerFragment++)] = shadowFactor;
 			shadowFactors[min(maxShadowCastersPerFragment - 1u, shadowCasterCountPerFragment++)] = shadowFactor;
 		}
 		}

+ 26 - 25
AnKi/Shaders/VolumetricFogAccumulation.ankiprog

@@ -16,17 +16,17 @@ const UVec2 WORKGROUP_SIZE = UVec2(8, 8);
 layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
 layout(local_size_x = WORKGROUP_SIZE.x, local_size_y = WORKGROUP_SIZE.y, local_size_z = 1) in;
 
 
 layout(set = 0, binding = 0) uniform sampler u_linearAnyClampSampler;
 layout(set = 0, binding = 0) uniform sampler u_linearAnyClampSampler;
-layout(set = 0, binding = 1) uniform texture3D u_lightVolume;
-layout(set = 0, binding = 2) writeonly uniform image3D u_fogVolume;
+layout(set = 0, binding = 1) uniform ANKI_RP texture3D u_lightVolume;
+layout(set = 0, binding = 2) writeonly uniform ANKI_RP image3D u_fogVolume;
 
 
-layout(push_constant, std430) uniform pc_
+layout(push_constant, std430) uniform b_pc
 {
 {
-	F32 u_fogScatteringCoeff;
-	F32 u_fogAbsorptionCoeff;
-	F32 u_density;
-	F32 u_near;
-	Vec3 u_fogDiffuse;
-	F32 u_far;
+	ANKI_RP F32 u_fogScatteringCoeff;
+	ANKI_RP F32 u_fogAbsorptionCoeff;
+	ANKI_RP F32 u_density;
+	ANKI_RP F32 u_near;
+	ANKI_RP Vec3 u_fogDiffuse;
+	ANKI_RP F32 u_far;
 };
 };
 
 
 void main()
 void main()
@@ -38,42 +38,43 @@ void main()
 
 
 	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(VOLUME_SIZE.xy);
 	const Vec2 uv = (Vec2(gl_GlobalInvocationID.xy) + 0.5) / Vec2(VOLUME_SIZE.xy);
 
 
-	Vec4 colorAndDensityFront = Vec4(0.0);
+	ANKI_RP Vec4 colorAndDensityFront = Vec4(0.0);
 	ANKI_LOOP for(U32 i = 0u; i < VOLUME_SIZE.z; ++i)
 	ANKI_LOOP for(U32 i = 0u; i < VOLUME_SIZE.z; ++i)
 	{
 	{
-		const F32 fi = F32(i);
+		const ANKI_RP F32 fi = F32(i);
 
 
 		// Compute the linear depth
 		// Compute the linear depth
-		const F32 maxLinearDepth = F32(FINAL_Z_SPLIT + 1u) / F32(Z_SPLIT_COUNT);
-		const F32 linearDepthFraction = maxLinearDepth / F32(VOLUME_SIZE.z);
-		const F32 linearDepthNear = fi * linearDepthFraction;
-		const F32 linearDepthFar = (fi + 1.0) * linearDepthFraction;
+		const ANKI_RP F32 maxLinearDepth = F32(FINAL_Z_SPLIT + 1u) / F32(Z_SPLIT_COUNT);
+		const ANKI_RP F32 linearDepthFraction = maxLinearDepth / F32(VOLUME_SIZE.z);
+		const ANKI_RP F32 linearDepthNear = fi * linearDepthFraction;
+		const ANKI_RP F32 linearDepthFar = (fi + 1.0) * linearDepthFraction;
 
 
 		// Compute the min and max Z in view space if this cluster fragment
 		// Compute the min and max Z in view space if this cluster fragment
-		const F32 zVSpaceNear = -linearDepthNear * (u_far - u_near) + u_near;
-		const F32 zVSpaceFar = -linearDepthFar * (u_far - u_near) + u_near;
+		const ANKI_RP F32 zVSpaceNear = -linearDepthNear * (u_far - u_near) + u_near;
+		const ANKI_RP F32 zVSpaceFar = -linearDepthFar * (u_far - u_near) + u_near;
 
 
 		// Compute the thikness of this fragment
 		// Compute the thikness of this fragment
-		const F32 layerThinkness = abs(zVSpaceNear - zVSpaceFar);
+		const ANKI_RP F32 layerThinkness = abs(zVSpaceNear - zVSpaceFar);
 
 
 		// Read the light value and the fog density from the fog volumes
 		// Read the light value and the fog density from the fog volumes
-		const F32 w = (fi + 0.5) / F32(VOLUME_SIZE.z);
-		Vec4 lightAndFogDensity = textureLod(u_lightVolume, u_linearAnyClampSampler, Vec3(uv, w), 0.0);
+		const ANKI_RP F32 w = (fi + 0.5) / F32(VOLUME_SIZE.z);
+		ANKI_RP Vec4 lightAndFogDensity = textureLod(u_lightVolume, u_linearAnyClampSampler, Vec3(uv, w), 0.0);
 		lightAndFogDensity.xyz *= u_fogDiffuse / PI;
 		lightAndFogDensity.xyz *= u_fogDiffuse / PI;
 		lightAndFogDensity.w += u_density; // Apply the default density
 		lightAndFogDensity.w += u_density; // Apply the default density
 
 
 		// Scattering & absorption
 		// Scattering & absorption
-		const F32 scattering = lightAndFogDensity.w * u_fogScatteringCoeff * layerThinkness;
-		const F32 absorption = lightAndFogDensity.w * u_fogAbsorptionCoeff * layerThinkness;
+		const ANKI_RP F32 scattering = lightAndFogDensity.w * u_fogScatteringCoeff * layerThinkness;
+		const ANKI_RP F32 absorption = lightAndFogDensity.w * u_fogAbsorptionCoeff * layerThinkness;
 
 
 		// Integrate
 		// Integrate
-		const Vec4 colorAndDensityBack = Vec4(lightAndFogDensity.xyz * scattering, scattering + absorption);
+		const ANKI_RP Vec4 colorAndDensityBack = Vec4(lightAndFogDensity.xyz * scattering, scattering + absorption);
 
 
-		const Vec3 l = colorAndDensityFront.rgb + saturate(exp(-colorAndDensityFront.a)) * colorAndDensityBack.rgb;
+		const ANKI_RP Vec3 l =
+			colorAndDensityFront.rgb + saturate(exp(-colorAndDensityFront.a)) * colorAndDensityBack.rgb;
 		colorAndDensityFront = Vec4(l.rgb, colorAndDensityFront.a + colorAndDensityBack.a);
 		colorAndDensityFront = Vec4(l.rgb, colorAndDensityFront.a + colorAndDensityBack.a);
 
 
 		// Write the value
 		// Write the value
-		const Vec4 valToWrite = Vec4(colorAndDensityFront.rgb, saturate(exp(-colorAndDensityFront.a)));
+		const ANKI_RP Vec4 valToWrite = Vec4(colorAndDensityFront.rgb, saturate(exp(-colorAndDensityFront.a)));
 		imageStore(u_fogVolume, IVec3(UVec3(gl_GlobalInvocationID.xy, i)), valToWrite);
 		imageStore(u_fogVolume, IVec3(UVec3(gl_GlobalInvocationID.xy, i)), valToWrite);
 	}
 	}
 }
 }