Browse Source

Fix some bugs appearing in AMD

Panagiotis Christopoulos Charitos 4 years ago
parent
commit
8964c60fde

+ 2 - 2
AnKi/Gr/Vulkan/GrManagerImpl.cpp

@@ -627,14 +627,14 @@ Error GrManagerImpl::initDevice(const GrManagerInitInfo& init)
 		features.pNext = &m_11Features;
 		vkGetPhysicalDeviceFeatures2(m_physicalDevice, &features);
 
-		if(!m_11Features.storageBuffer16BitAccess || !m_11Features.uniformAndStorageBuffer16BitAccess
-		   || !m_11Features.storagePushConstant16)
+		if(!m_11Features.storageBuffer16BitAccess || !m_11Features.uniformAndStorageBuffer16BitAccess)
 		{
 			ANKI_VK_LOGE("16bit buffer access is not supported");
 			return Error::FUNCTION_FAILED;
 		}
 
 		// Disable a few things
+		m_11Features.storagePushConstant16 = false; // Because AMD doesn't support it
 		m_11Features.protectedMemory = false;
 		m_11Features.multiview = false;
 		m_11Features.multiviewGeometryShader = false;

+ 2 - 4
AnKi/Shaders/VolumetricLightingAccumulation.ankiprog

@@ -60,9 +60,7 @@ Vec3 worldPosInsideClusterAndZViewSpace(Vec3 relativePos, out F32 negativeZViewS
 	const F32 zViewSpace = -negativeZViewSpace;
 
 	// Get the position in view space
-	const Vec2 uvMin = g_globalInvocationID.xy / Vec2(VOLUME_SIZE.xy);
-	const Vec2 uvMax = uvMin + 1.0 / Vec2(VOLUME_SIZE.xy);
-	const Vec2 uv = mix(uvMin, uvMax, relativePos.xy);
+	const Vec2 uv = mix(g_globalInvocationID.xy, g_globalInvocationID.xy + 1.0, relativePos.xy) / Vec2(VOLUME_SIZE.xy);
 	uvw.xy = uv;
 	const Vec2 xyViewSpace = UV_TO_NDC(uv) * u_clusteredShading.m_matrices.m_unprojectionParameters.xy * zViewSpace;
 
@@ -258,7 +256,7 @@ void main()
 	const Vec3 worldPos = worldPosInsideClusterAndZViewSpace(readRand(), negativeZViewSpace, uvw);
 
 	// Get the cluster
-	const UVec2 tileIdxXY = UVec2(uvw.xy * F32(TILE_COUNT));
+	const UVec2 tileIdxXY = UVec2(uvw.xy * Vec2(TILE_COUNT));
 	const U32 tileIdx = tileIdxXY.y * TILE_COUNT.x + tileIdxXY.x;
 	Cluster cluster = u_clusters2[tileIdx];