diff --git a/GLSLCompiler.dll b/GLSLCompiler.dll index bc7e5267..df06947a 100644 Binary files a/GLSLCompiler.dll and b/GLSLCompiler.dll differ diff --git a/example/common/VulkanAppFramework.h b/example/common/VulkanAppFramework.h index 4823ce23..66129f02 100644 --- a/example/common/VulkanAppFramework.h +++ b/example/common/VulkanAppFramework.h @@ -116,7 +116,6 @@ public: cili.lunarg.standard_validation = true; cili.khronos.validation = true; - cili.RenderDoc.Capture = true; inst=CreateInstance("VulkanTest",nullptr,&cili); diff --git a/inc/hgl/graph/VKDeviceCreater.h b/inc/hgl/graph/VKDeviceCreater.h index 20f9682b..134dcd68 100644 --- a/inc/hgl/graph/VKDeviceCreater.h +++ b/inc/hgl/graph/VKDeviceCreater.h @@ -106,9 +106,9 @@ constexpr const VkFormat SwapchainPreferFormatsLDR[]= constexpr const VkFormat SwapchainPreferFormatsSDR[]= { - PF_RGBA8UN,PF_RGBA8s, - PF_BGRA8UN,PF_BGRA8s, - PF_ABGR8UN,PF_ABGR8s, + PF_RGBA8UN,//PF_RGBA8s, + PF_BGRA8UN,//PF_BGRA8s, + PF_ABGR8UN,//PF_ABGR8s, PF_A2RGB10UN, PF_A2BGR10UN, // PF_B10GR11UF diff --git a/inc/hgl/graph/VKInstance.h b/inc/hgl/graph/VKInstance.h index 5187d71d..8e3590ee 100644 --- a/inc/hgl/graph/VKInstance.h +++ b/inc/hgl/graph/VKInstance.h @@ -23,7 +23,9 @@ VK_NAMESPACE_BEGIN struct { + VK_BOOL1BIT(synchronization2) VK_BOOL1BIT(validation) + VK_BOOL1BIT(profiles) }khronos; struct diff --git a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp index 288b952c..c174f4da 100644 --- a/src/SceneGraph/Vulkan/VKDeviceCreater.cpp +++ b/src/SceneGraph/Vulkan/VKDeviceCreater.cpp @@ -14,6 +14,8 @@ VK_NAMESPACE_BEGIN VkPipelineCache CreatePipelineCache(VkDevice device,const VkPhysicalDeviceProperties &); +void SetShaderCompilerVersion(const GPUPhysicalDevice *); + #ifdef _DEBUG DebugMaker *CreateDebugMaker(VkDevice); DebugUtils *CreateDebugUtils(VkDevice); @@ -415,6 +417,8 @@ GPUDevice *VulkanDeviceCreater::Create() OutputPhysicalDeviceCaps(physical_device); #endif//_DEBUG + SetShaderCompilerVersion(physical_device); + if(!RequirementCheck()) return(nullptr); diff --git a/src/SceneGraph/Vulkan/VKProperties.cpp b/src/SceneGraph/Vulkan/VKProperties.cpp index e7f8532b..c5b14d32 100644 --- a/src/SceneGraph/Vulkan/VKProperties.cpp +++ b/src/SceneGraph/Vulkan/VKProperties.cpp @@ -86,7 +86,9 @@ void CheckInstanceLayer(CharPointerList &layer_list,CreateInstanceLayerInfo *lay #define VK_LAYER_KHRONOS_ADD(name) VK_LAYER_CHECK(khronos,"KHRONOS",name) + VK_LAYER_KHRONOS_ADD(synchronization2) VK_LAYER_KHRONOS_ADD(validation) + VK_LAYER_KHRONOS_ADD(profiles) #define VK_LAYER_NV_ADD(name) VK_LAYER_CHECK(nv,"NV",name) diff --git a/src/ShaderGen/GLSLCompiler.cpp b/src/ShaderGen/GLSLCompiler.cpp index de9d79b4..8ff9d842 100644 --- a/src/ShaderGen/GLSLCompiler.cpp +++ b/src/ShaderGen/GLSLCompiler.cpp @@ -2,11 +2,22 @@ #include #include #include +#include +#include namespace hgl { namespace graph { + // µÈͬÓÚEShTargetLanguageVersion + constexpr const uint32_t SPV_VERSION_1_0 = (1 << 16); // SPIR-V 1.0 + constexpr const uint32_t SPV_VERSION_1_1 = (1 << 16) | (1 << 8); // SPIR-V 1.1 + constexpr const uint32_t SPV_VERSION_1_2 = (1 << 16) | (2 << 8); // SPIR-V 1.2 + constexpr const uint32_t SPV_VERSION_1_3 = (1 << 16) | (3 << 8); // SPIR-V 1.3 + constexpr const uint32_t SPV_VERSION_1_4 = (1 << 16) | (4 << 8); // SPIR-V 1.4 + constexpr const uint32_t SPV_VERSION_1_5 = (1 << 16) | (5 << 8); // SPIR-V 1.5 + constexpr const uint32_t SPV_VERSION_1_6 = (1 << 16) | (6 << 8); // SPIR-V 1.6 + enum class ShaderLanguageType { GLSL=0, @@ -24,9 +35,26 @@ namespace hgl const char ** includes = nullptr; const char * preamble = nullptr; + + uint32_t vulkan_version = VK_API_VERSION_1_0; + uint32_t spv_version = SPV_VERSION_1_0; }; - CompileInfo compile_info; + static CompileInfo compile_info; + + void SetShaderCompilerVersion(const GPUPhysicalDevice *pd) + { + const auto &pdp=pd->GetProperties(); + + compile_info.vulkan_version =pdp.apiVersion; + + if(pdp.apiVersion>=VK_API_VERSION_1_3)compile_info.spv_version=SPV_VERSION_1_6;else + if(pdp.apiVersion>=VK_API_VERSION_1_2)compile_info.spv_version=SPV_VERSION_1_5;else + if(pd->CheckExtensionSupport(VK_KHR_SPIRV_1_4_EXTENSION_NAME)) + compile_info.spv_version=SPV_VERSION_1_4;else + if(pdp.apiVersion>=VK_API_VERSION_1_1)compile_info.spv_version=SPV_VERSION_1_3;else + compile_info.spv_version=SPV_VERSION_1_0; + } struct SPVParseData; @@ -39,8 +67,8 @@ namespace hgl bool (*SetLimit)(void *,const int); uint32_t (*GetType)(const char *ext_name); - SPVData * (*Compile)(const uint32_t stage,const char *shader_source, const CompileInfo *compile_info); - SPVData * (*CompileFromPath)(const uint32_t stage,const char *shader_filename, const CompileInfo *compile_info); + SPVData * (*Compile)(const uint32_t stage,const char *shader_source, const CompileInfo *ci); + SPVData * (*CompileFromPath)(const uint32_t stage,const char *shader_filename, const CompileInfo *ci); void (*Free)(SPVData *); @@ -48,7 +76,7 @@ namespace hgl void (*FreeParseSPVData)(SPVParseData *); }; - ExternalModule *gsi_module=nullptr; + static ExternalModule *gsi_module=nullptr; static GLSLCompilerInterface *gsi=nullptr;