Browse Source

Workaround some AMDVLK crashes

Panagiotis Christopoulos Charitos 7 years ago
parent
commit
ceef4635ce

+ 1 - 1
programs/FinalComposite.ankiprog

@@ -69,7 +69,7 @@ void main()
 	out_color = textureLod(u_isRt, uv, 0.0).rgb;
 	out_color = textureLod(u_isRt, uv, 0.0).rgb;
 #endif
 #endif
 
 
-	out_color = tonemap(out_color, readFirstInvocationARB(u_exposureThreshold0));
+	out_color = tonemap(out_color, UNIFORM(u_exposureThreshold0));
 
 
 #if BLOOM_ENABLED
 #if BLOOM_ENABLED
 	vec3 bloom = textureLod(u_ppsBloomLfRt, uv, 0.0).rgb;
 	vec3 bloom = textureLod(u_ppsBloomLfRt, uv, 0.0).rgb;

+ 4 - 4
programs/VolumetricFog.ankiprog

@@ -49,10 +49,10 @@ layout(std140, ANKI_UBO_BINDING(0, 3), row_major) uniform ubo0_
 	mat4 u_prevViewProjMatMulInvViewProjMat2; // TODO Light common ubo has that. Maybe remove it
 	mat4 u_prevViewProjMatMulInvViewProjMat2; // TODO Light common ubo has that. Maybe remove it
 };
 };
 
 
-#define u_linearize readFirstInvocationARB(u_linearizeNoiseTexOffsetLayer.xy)
-#define u_noiseYOffset readFirstInvocationARB(u_linearizeNoiseTexOffsetLayer.z)
-#define u_noiseLayer readFirstInvocationARB(u_linearizeNoiseTexOffsetLayer.w)
-#define u_fogParticleColor readFirstInvocationARB(u_fogParticleColorPad1.rgb)
+#define u_linearize UNIFORM(u_linearizeNoiseTexOffsetLayer.xy)
+#define u_noiseYOffset UNIFORM(u_linearizeNoiseTexOffsetLayer.z)
+#define u_noiseLayer UNIFORM(u_linearizeNoiseTexOffsetLayer.w)
+#define u_fogParticleColor UNIFORM(u_fogParticleColorPad1.rgb)
 
 
 layout(location = 0) out vec3 out_color;
 layout(location = 0) out vec3 out_color;
 
 

+ 7 - 7
shaders/ClusterLightCommon.glsl

@@ -81,14 +81,14 @@ layout(ANKI_UBO_BINDING(LIGHT_SET, LIGHT_UBO_BINDING), std140, row_major) unifor
 	LightingUniforms u_lightingUniforms;
 	LightingUniforms u_lightingUniforms;
 };
 };
 
 
-#	define u_near readFirstInvocationARB(u_lightingUniforms.rendererSizeTimeNear.w)
-#	define u_far readFirstInvocationARB(u_lightingUniforms.cameraPosFar.w)
-#	define u_cameraPos readFirstInvocationARB(u_lightingUniforms.cameraPosFar.xyz)
-#	define u_clusterCountX readFirstInvocationARB(u_lightingUniforms.tileCount.x)
-#	define u_clusterCountY readFirstInvocationARB(u_lightingUniforms.tileCount.y)
+#	define u_near UNIFORM(u_lightingUniforms.rendererSizeTimeNear.w)
+#	define u_far UNIFORM(u_lightingUniforms.cameraPosFar.w)
+#	define u_cameraPos UNIFORM(u_lightingUniforms.cameraPosFar.xyz)
+#	define u_clusterCountX UNIFORM(u_lightingUniforms.tileCount.x)
+#	define u_clusterCountY UNIFORM(u_lightingUniforms.tileCount.y)
 #	define u_clustererMagic u_lightingUniforms.clustererMagicValues
 #	define u_clustererMagic u_lightingUniforms.clustererMagicValues
-#	define u_time readFirstInvocationARB(u_lightingUniforms.rendererSizeTimeNear.z)
-#	define u_unprojectionParams readFirstInvocationARB(u_lightingUniforms.unprojectionParams)
+#	define u_time UNIFORM(u_lightingUniforms.rendererSizeTimeNear.z)
+#	define u_unprojectionParams UNIFORM(u_lightingUniforms.unprojectionParams)
 #	define u_rendererSize u_lightingUniforms.rendererSizeTimeNear.xy
 #	define u_rendererSize u_lightingUniforms.rendererSizeTimeNear.xy
 
 
 #	define u_viewMat u_lightingUniforms.viewMat
 #	define u_viewMat u_lightingUniforms.viewMat

+ 11 - 3
shaders/Common.glsl

@@ -8,13 +8,19 @@
 #ifndef ANKI_SHADERS_COMMON_GLSL
 #ifndef ANKI_SHADERS_COMMON_GLSL
 #define ANKI_SHADERS_COMMON_GLSL
 #define ANKI_SHADERS_COMMON_GLSL
 
 
-// WORKAROUND
+// WORKAROUNDS
 #if defined(ANKI_VENDOR_NVIDIA)
 #if defined(ANKI_VENDOR_NVIDIA)
 #	define NVIDIA_LINK_ERROR_WORKAROUND 1
 #	define NVIDIA_LINK_ERROR_WORKAROUND 1
 #else
 #else
 #	define NVIDIA_LINK_ERROR_WORKAROUND 0
 #	define NVIDIA_LINK_ERROR_WORKAROUND 0
 #endif
 #endif
 
 
+#if defined(ANKI_VENDOR_AMD) && defined(ANKI_BACKEND_VULKAN)
+#	define AMD_VK_READ_FIRST_INVOCATION_COMPILER_CRASH 1
+#else
+#	define AMD_VK_READ_FIRST_INVOCATION_COMPILER_CRASH 0
+#endif
+
 // Default precision
 // Default precision
 #ifndef DEFAULT_FLOAT_PRECISION
 #ifndef DEFAULT_FLOAT_PRECISION
 #	define DEFAULT_FLOAT_PRECISION highp
 #	define DEFAULT_FLOAT_PRECISION highp
@@ -60,8 +66,10 @@ const uint UBO_MAX_SIZE = 16384u;
 #define PASS_EZ 2
 #define PASS_EZ 2
 
 
 // Other
 // Other
-#if !defined(ANKI_ARB_SHADER_BALLOT)
-#	define readFirstInvocationARB(x_) (x_)
+#if defined(ANKI_ARB_SHADER_BALLOT) && AMD_VK_READ_FIRST_INVOCATION_COMPILER_CRASH == 0
+#	define UNIFORM(x_) readFirstInvocationARB(x_)
+#else
+#	define UNIFORM(x_) x_
 #endif
 #endif
 
 
 #define CALC_BITANGENT_IN_VERT 1
 #define CALC_BITANGENT_IN_VERT 1