diff options
Diffstat (limited to 'thirdparty/spirv-reflect/spirv_reflect.h')
-rw-r--r-- | thirdparty/spirv-reflect/spirv_reflect.h | 97 |
1 files changed, 17 insertions, 80 deletions
diff --git a/thirdparty/spirv-reflect/spirv_reflect.h b/thirdparty/spirv-reflect/spirv_reflect.h index 948533d3c0..50cc65222b 100644 --- a/thirdparty/spirv-reflect/spirv_reflect.h +++ b/thirdparty/spirv-reflect/spirv_reflect.h @@ -1,5 +1,5 @@ /* - Copyright 2017-2022 Google Inc. + Copyright 2017-2018 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -76,25 +76,6 @@ typedef enum SpvReflectResult { SPV_REFLECT_RESULT_ERROR_SPIRV_INVALID_EXECUTION_MODE, } SpvReflectResult; -/*! @enum SpvReflectModuleFlagBits - -SPV_REFLECT_MODULE_FLAG_NO_COPY - Disables copying of SPIR-V code - when a SPIRV-Reflect shader module is created. It is the - responsibility of the calling program to ensure that the pointer - remains valid and the memory it's pointing to is not freed while - SPIRV-Reflect operations are taking place. Freeing the backing - memory will cause undefined behavior or most likely a crash. - This is flag is intended for cases where the memory overhead of - storing the copied SPIR-V is undesirable. - -*/ -typedef enum SpvReflectModuleFlagBits { - SPV_REFLECT_MODULE_FLAG_NONE = 0x00000000, - SPV_REFLECT_MODULE_FLAG_NO_COPY = 0x00000001, -} SpvReflectModuleFlagBits; - -typedef uint32_t SpvReflectModuleFlags; - /*! @enum SpvReflectTypeFlagBits */ @@ -120,13 +101,6 @@ typedef uint32_t SpvReflectTypeFlags; /*! @enum SpvReflectDecorationBits -NOTE: HLSL row_major and column_major decorations are reversed - in SPIR-V. Meaning that matrices declrations with row_major - will get reflected as column_major and vice versa. The - row and column decorations get appied during the compilation. - SPIRV-Reflect reads the data as is and does not make any - attempt to correct it to match what's in the source. - */ typedef enum SpvReflectDecorationFlagBits { SPV_REFLECT_DECORATION_NONE = 0x00000000, @@ -138,7 +112,6 @@ typedef enum SpvReflectDecorationFlagBits { SPV_REFLECT_DECORATION_NOPERSPECTIVE = 0x00000020, SPV_REFLECT_DECORATION_FLAT = 0x00000040, SPV_REFLECT_DECORATION_NON_WRITABLE = 0x00000080, - SPV_REFLECT_DECORATION_RELAXED_PRECISION = 0x00000100, } SpvReflectDecorationFlagBits; typedef uint32_t SpvReflectDecorationFlags; @@ -225,12 +198,12 @@ typedef enum SpvReflectShaderStageFlagBits { SPV_REFLECT_SHADER_STAGE_COMPUTE_BIT = 0x00000020, // = VK_SHADER_STAGE_COMPUTE_BIT SPV_REFLECT_SHADER_STAGE_TASK_BIT_NV = 0x00000040, // = VK_SHADER_STAGE_TASK_BIT_NV SPV_REFLECT_SHADER_STAGE_MESH_BIT_NV = 0x00000080, // = VK_SHADER_STAGE_MESH_BIT_NV - SPV_REFLECT_SHADER_STAGE_RAYGEN_BIT_KHR = 0x00000100, // = VK_SHADER_STAGE_RAYGEN_BIT_KHR - SPV_REFLECT_SHADER_STAGE_ANY_HIT_BIT_KHR = 0x00000200, // = VK_SHADER_STAGE_ANY_HIT_BIT_KHR - SPV_REFLECT_SHADER_STAGE_CLOSEST_HIT_BIT_KHR = 0x00000400, // = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR - SPV_REFLECT_SHADER_STAGE_MISS_BIT_KHR = 0x00000800, // = VK_SHADER_STAGE_MISS_BIT_KHR - SPV_REFLECT_SHADER_STAGE_INTERSECTION_BIT_KHR = 0x00001000, // = VK_SHADER_STAGE_INTERSECTION_BIT_KHR - SPV_REFLECT_SHADER_STAGE_CALLABLE_BIT_KHR = 0x00002000, // = VK_SHADER_STAGE_CALLABLE_BIT_KHR + SPV_REFLECT_SHADER_STAGE_RAYGEN_BIT_KHR = 0x00000100, // VK_SHADER_STAGE_RAYGEN_BIT_KHR + SPV_REFLECT_SHADER_STAGE_ANY_HIT_BIT_KHR = 0x00000200, // VK_SHADER_STAGE_ANY_HIT_BIT_KHR + SPV_REFLECT_SHADER_STAGE_CLOSEST_HIT_BIT_KHR = 0x00000400, // VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR + SPV_REFLECT_SHADER_STAGE_MISS_BIT_KHR = 0x00000800, // VK_SHADER_STAGE_MISS_BIT_KHR + SPV_REFLECT_SHADER_STAGE_INTERSECTION_BIT_KHR = 0x00001000, // VK_SHADER_STAGE_INTERSECTION_BIT_KHR + SPV_REFLECT_SHADER_STAGE_CALLABLE_BIT_KHR = 0x00002000, // VK_SHADER_STAGE_CALLABLE_BIT_KHR } SpvReflectShaderStageFlagBits; @@ -288,11 +261,7 @@ typedef struct SpvReflectImageTraits { typedef struct SpvReflectArrayTraits { uint32_t dims_count; - // Each entry is: 0xFFFFFFFF for a specialization constant dimension, - // 0 for a runtime array dimension, and the array length otherwise. uint32_t dims[SPV_REFLECT_MAX_ARRAY_DIMS]; - // Stores Ids for dimensions that are specialization constants - uint32_t spec_constant_op_ids[SPV_REFLECT_MAX_ARRAY_DIMS]; uint32_t stride; // Measured in bytes } SpvReflectArrayTraits; @@ -463,8 +432,6 @@ typedef struct SpvReflectEntryPoint { uint32_t y; uint32_t z; } local_size; - uint32_t invocations; // valid for geometry - uint32_t output_vertices; // valid for geometry, tesselation } SpvReflectEntryPoint; /*! @struct SpvReflectShaderModule @@ -500,7 +467,6 @@ typedef struct SpvReflectShaderModule { // -- GODOT end -- struct Internal { - SpvReflectModuleFlags module_flags; size_t spirv_size; uint32_t* spirv_code; uint32_t spirv_word_count; @@ -529,22 +495,6 @@ SpvReflectResult spvReflectCreateShaderModule( SpvReflectShaderModule* p_module ); -/*! @fn spvReflectCreateShaderModule2 - - @param flags Flags for module creations. - @param size Size in bytes of SPIR-V code. - @param p_code Pointer to SPIR-V code. - @param p_module Pointer to an instance of SpvReflectShaderModule. - @return SPV_REFLECT_RESULT_SUCCESS on success. - -*/ -SpvReflectResult spvReflectCreateShaderModule2( - SpvReflectModuleFlags flags, - size_t size, - const void* p_code, - SpvReflectShaderModule* p_module -); - SPV_REFLECT_DEPRECATED("renamed to spvReflectCreateShaderModule") SpvReflectResult spvReflectGetShaderModule( size_t size, @@ -1432,7 +1382,7 @@ SpvReflectResult spvReflectChangeInputVariableLocation( by multiple entry points in the module, it will be changed in all of them. @param p_module Pointer to an instance of SpvReflectShaderModule. - @param p_output_variable Pointer to the output variable to update. + @param p_output_variable Pointer to the output variable to update. @param new_location The new location to assign to p_output_variable. @return If successful, returns SPV_REFLECT_RESULT_SUCCESS. Otherwise, the error code indicates the cause of @@ -1454,16 +1404,6 @@ SpvReflectResult spvReflectChangeOutputVariableLocation( */ const char* spvReflectSourceLanguage(SpvSourceLanguage source_lang); -/*! @fn spvReflectBlockVariableTypeName - - @param p_var Pointer to block variable. - @return Returns string of block variable's type description type name - or NULL if p_var is NULL. -*/ -const char* spvReflectBlockVariableTypeName( - const SpvReflectBlockVariable* p_var -); - #if defined(__cplusplus) }; #endif @@ -1481,9 +1421,9 @@ namespace spv_reflect { class ShaderModule { public: ShaderModule(); - ShaderModule(size_t size, const void* p_code, SpvReflectModuleFlags flags = SPV_REFLECT_MODULE_FLAG_NONE); - ShaderModule(const std::vector<uint8_t>& code, SpvReflectModuleFlags flags = SPV_REFLECT_MODULE_FLAG_NONE); - ShaderModule(const std::vector<uint32_t>& code, SpvReflectModuleFlags flags = SPV_REFLECT_MODULE_FLAG_NONE); + ShaderModule(size_t size, const void* p_code); + ShaderModule(const std::vector<uint8_t>& code); + ShaderModule(const std::vector<uint32_t>& code); ~ShaderModule(); ShaderModule(ShaderModule&& other); @@ -1593,9 +1533,8 @@ inline ShaderModule::ShaderModule() {} @param p_code */ -inline ShaderModule::ShaderModule(size_t size, const void* p_code, SpvReflectModuleFlags flags) { - m_result = spvReflectCreateShaderModule2( - flags, +inline ShaderModule::ShaderModule(size_t size, const void* p_code) { + m_result = spvReflectCreateShaderModule( size, p_code, &m_module); @@ -1606,9 +1545,8 @@ inline ShaderModule::ShaderModule(size_t size, const void* p_code, SpvReflectMod @param code */ -inline ShaderModule::ShaderModule(const std::vector<uint8_t>& code, SpvReflectModuleFlags flags) { - m_result = spvReflectCreateShaderModule2( - flags, +inline ShaderModule::ShaderModule(const std::vector<uint8_t>& code) { + m_result = spvReflectCreateShaderModule( code.size(), code.data(), &m_module); @@ -1619,9 +1557,8 @@ inline ShaderModule::ShaderModule(const std::vector<uint8_t>& code, SpvReflectMo @param code */ -inline ShaderModule::ShaderModule(const std::vector<uint32_t>& code, SpvReflectModuleFlags flags) { - m_result = spvReflectCreateShaderModule2( - flags, +inline ShaderModule::ShaderModule(const std::vector<uint32_t>& code) { + m_result = spvReflectCreateShaderModule( code.size() * sizeof(uint32_t), code.data(), &m_module); |