From 77b856c7b0d66cd6762cf87aebbf0c6deb30083b Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Thu, 8 Dec 2022 23:19:33 +0100
Subject: [PATCH] Adjust shader compiler for cross compatible extension

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 .../src/vkcv/shader/GLSLCompiler.cpp          | 40 +++++++++----------
 projects/mesh_shader/src/main.cpp             | 10 +++--
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/modules/shader_compiler/src/vkcv/shader/GLSLCompiler.cpp b/modules/shader_compiler/src/vkcv/shader/GLSLCompiler.cpp
index 78a82113..77b83bc7 100644
--- a/modules/shader_compiler/src/vkcv/shader/GLSLCompiler.cpp
+++ b/modules/shader_compiler/src/vkcv/shader/GLSLCompiler.cpp
@@ -55,9 +55,9 @@ namespace vkcv::shader {
 			case ShaderStage::COMPUTE:
 				return EShLangCompute;
 			case ShaderStage::TASK:
-				return EShLangTaskNV;
+				return EShLangTask;
 			case ShaderStage::MESH:
-				return EShLangMeshNV;
+				return EShLangMesh;
 			case ShaderStage::RAY_GEN:
 			    return EShLangRayGen;
 			case ShaderStage::RAY_CLOSEST_HIT:
@@ -159,24 +159,24 @@ namespace vkcv::shader {
 		resources.maxCullDistances = 8;
 		resources.maxCombinedClipAndCullDistances = 8;
 		resources.maxSamples = 4;
-		resources.maxMeshOutputVerticesNV = 256;
-		resources.maxMeshOutputPrimitivesNV = 512;
-		resources.maxMeshWorkGroupSizeX_NV = 32;
-		resources.maxMeshWorkGroupSizeY_NV = 1;
-		resources.maxMeshWorkGroupSizeZ_NV = 1;
-		resources.maxTaskWorkGroupSizeX_NV = 32;
-		resources.maxTaskWorkGroupSizeY_NV = 1;
-		resources.maxTaskWorkGroupSizeZ_NV = 1;
-		resources.maxMeshViewCountNV = 4;
-		resources.limits.nonInductiveForLoops = 1;
-		resources.limits.whileLoops = 1;
-		resources.limits.doWhileLoops = 1;
-		resources.limits.generalUniformIndexing = 1;
-		resources.limits.generalAttributeMatrixVectorIndexing = 1;
-		resources.limits.generalVaryingIndexing = 1;
-		resources.limits.generalSamplerIndexing = 1;
-		resources.limits.generalVariableIndexing = 1;
-		resources.limits.generalConstantMatrixVectorIndexing = 1;
+		resources.maxMeshOutputVerticesEXT = 256;
+		resources.maxMeshOutputPrimitivesEXT = 512;
+		resources.maxMeshWorkGroupSizeX_EXT = 32;
+		resources.maxMeshWorkGroupSizeY_EXT = 1;
+		resources.maxMeshWorkGroupSizeZ_EXT = 1;
+		resources.maxTaskWorkGroupSizeX_EXT = 32;
+		resources.maxTaskWorkGroupSizeY_EXT = 1;
+		resources.maxTaskWorkGroupSizeZ_EXT = 1;
+		resources.maxMeshViewCountEXT = 4;
+		resources.limits.nonInductiveForLoops = true;
+		resources.limits.whileLoops = true;
+		resources.limits.doWhileLoops = true;
+		resources.limits.generalUniformIndexing = true;
+		resources.limits.generalAttributeMatrixVectorIndexing = true;
+		resources.limits.generalVaryingIndexing = true;
+		resources.limits.generalSamplerIndexing = true;
+		resources.limits.generalVariableIndexing = true;
+		resources.limits.generalConstantMatrixVectorIndexing = true;
 	}
 	
 	static std::vector<char> readShaderCode(const std::filesystem::path &shaderPath) {
diff --git a/projects/mesh_shader/src/main.cpp b/projects/mesh_shader/src/main.cpp
index 3f19f276..df2a0ec0 100644
--- a/projects/mesh_shader/src/main.cpp
+++ b/projects/mesh_shader/src/main.cpp
@@ -83,10 +83,12 @@ int main(int argc, const char** argv) {
 	vkcv::Features features;
 	features.requireExtension(VK_EXT_MESH_SHADER_EXTENSION_NAME);
 	features.requireExtensionFeature<vk::PhysicalDeviceMeshShaderFeaturesEXT>(
-			VK_EXT_MESH_SHADER_EXTENSION_NAME, [](vk::PhysicalDeviceMeshShaderFeaturesEXT& features) {
-		features.setTaskShader(true);
-		features.setMeshShader(true);
-	});
+			VK_EXT_MESH_SHADER_EXTENSION_NAME,
+			[](vk::PhysicalDeviceMeshShaderFeaturesEXT& features) {
+				features.setTaskShader(true);
+				features.setMeshShader(true);
+			}
+	);
 
 	vkcv::Core core = vkcv::Core::create(
 		applicationName,
-- 
GitLab