to supported new version of GLSLCompiler.dll

This commit is contained in:
HuYingzhuo(hugo/hyzboy) 2023-05-31 17:18:14 +08:00
parent 71fd42cfc8
commit 5521c53c94
7 changed files with 43 additions and 8 deletions

Binary file not shown.

View File

@ -116,7 +116,6 @@ public:
cili.lunarg.standard_validation = true;
cili.khronos.validation = true;
cili.RenderDoc.Capture = true;
inst=CreateInstance("VulkanTest",nullptr,&cili);

View File

@ -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

View File

@ -23,7 +23,9 @@ VK_NAMESPACE_BEGIN
struct
{
VK_BOOL1BIT(synchronization2)
VK_BOOL1BIT(validation)
VK_BOOL1BIT(profiles)
}khronos;
struct

View File

@ -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);

View File

@ -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)

View File

@ -2,11 +2,22 @@
#include<hgl/platform/ExternalModule.h>
#include<hgl/type/StringList.h>
#include<hgl/filesystem/FileSystem.h>
#include<vulkan/vulkan.h>
#include<hgl/graph/VKPhysicalDevice.h>
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;