diff --git a/3rdparty/glslang/.appveyor.yml b/3rdparty/glslang/.appveyor.yml index e7c428275..32e8f2bde 100644 --- a/3rdparty/glslang/.appveyor.yml +++ b/3rdparty/glslang/.appveyor.yml @@ -66,7 +66,6 @@ after_test: bin\glslangValidator.exe bin\spirv-remap.exe include\glslang\* - include\SPIRV\* lib\glslang%SUFFIX%.lib lib\HLSL%SUFFIX%.lib lib\OGLCompiler%SUFFIX%.lib diff --git a/3rdparty/glslang/.travis.yml b/3rdparty/glslang/.travis.yml index 247891217..1fa3fc01c 100644 --- a/3rdparty/glslang/.travis.yml +++ b/3rdparty/glslang/.travis.yml @@ -99,7 +99,6 @@ after_success: zip ${TARBALL} bin/glslangValidator include/glslang/* - include/SPIRV/* lib/libglslang${SUFFIX}.a lib/libHLSL${SUFFIX}.a lib/libOGLCompiler${SUFFIX}.a diff --git a/3rdparty/glslang/SPIRV/CMakeLists.txt b/3rdparty/glslang/SPIRV/CMakeLists.txt index 94d2ebebb..f47c8a0e7 100644 --- a/3rdparty/glslang/SPIRV/CMakeLists.txt +++ b/3rdparty/glslang/SPIRV/CMakeLists.txt @@ -87,5 +87,5 @@ if(ENABLE_GLSLANG_INSTALL) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() - install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/) + install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/) endif(ENABLE_GLSLANG_INSTALL) diff --git a/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h b/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h index ac26a0540..e58e836a8 100644 --- a/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h +++ b/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h @@ -40,6 +40,7 @@ static const char* const E_SPV_KHR_8bit_storage = "SPV_KHR_8bit_ static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class"; static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage"; static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model"; +static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physical_storage_buffer"; static const char* const E_SPV_KHR_physical_storage_buffer = "SPV_KHR_physical_storage_buffer"; static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragment_shader_interlock"; static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock"; diff --git a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index afb405e40..2d50074ff 100644 --- a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -1399,7 +1399,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const gl if (glslangIntermediate->usingPhysicalStorageBuffer()) { addressingModel = spv::AddressingModelPhysicalStorageBuffer64EXT; - builder.addIncorporatedExtension(spv::E_SPV_KHR_physical_storage_buffer, spv::Spv_1_5); + builder.addIncorporatedExtension(spv::E_SPV_EXT_physical_storage_buffer, spv::Spv_1_5); builder.addCapability(spv::CapabilityPhysicalStorageBufferAddressesEXT); }; if (glslangIntermediate->usingVulkanMemoryModel()) { @@ -6275,6 +6275,9 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, OpDecora break; case glslang::EOpConvPtrToUvec2: case glslang::EOpConvUvec2ToPtr: + if (builder.isVector(operand)) + builder.promoteIncorporatedExtension(spv::E_SPV_EXT_physical_storage_buffer, + spv::E_SPV_KHR_physical_storage_buffer, spv::Spv_1_5); convOp = spv::OpBitcast; break; #endif diff --git a/3rdparty/glslang/SPIRV/SpvBuilder.h b/3rdparty/glslang/SPIRV/SpvBuilder.h index bef7d3db1..55754f606 100644 --- a/3rdparty/glslang/SPIRV/SpvBuilder.h +++ b/3rdparty/glslang/SPIRV/SpvBuilder.h @@ -106,11 +106,20 @@ public: void addModuleProcessed(const std::string& p) { moduleProcesses.push_back(p.c_str()); } void setEmitOpLines() { emitOpLines = true; } void addExtension(const char* ext) { extensions.insert(ext); } + void removeExtension(const char* ext) + { + extensions.erase(ext); + } void addIncorporatedExtension(const char* ext, SpvVersion incorporatedVersion) { if (getSpvVersion() < static_cast(incorporatedVersion)) addExtension(ext); } + void promoteIncorporatedExtension(const char* baseExt, const char* promoExt, SpvVersion incorporatedVersion) + { + removeExtension(baseExt); + addIncorporatedExtension(promoExt, incorporatedVersion); + } void addInclude(const std::string& name, const std::string& text) { spv::Id incId = getStringId(name); diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle1.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle1.frag.out index 8457eaca8..6e50c7052 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle1.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle1.frag.out @@ -6,7 +6,7 @@ spv.bufferhandle1.frag Capability Shader Capability VulkanMemoryModelKHR Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" Extension "SPV_KHR_vulkan_memory_model" 1: ExtInstImport "GLSL.std.450" diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle10.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle10.frag.out index 871b0177b..a95dc7197 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle10.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle10.frag.out @@ -6,7 +6,7 @@ spv.bufferhandle10.frag Capability Shader Capability VulkanMemoryModelKHR Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" Extension "SPV_KHR_vulkan_memory_model" 1: ExtInstImport "GLSL.std.450" diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle11.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle11.frag.out index 6f3cbe158..3469715be 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle11.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle11.frag.out @@ -9,8 +9,8 @@ WARNING: 0:6: '' : all default precisions are highp; use precision statements to Capability Shader Capability StorageBuffer8BitAccess Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_8bit_storage" - Extension "SPV_KHR_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle12.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle12.frag.out index 1808c5fad..6c20f02c8 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle12.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle12.frag.out @@ -9,8 +9,8 @@ WARNING: 0:6: '' : all default precisions are highp; use precision statements to Capability Shader Capability StorageUniformBufferBlock16 Capability PhysicalStorageBufferAddressesEXT + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_16bit_storage" - Extension "SPV_KHR_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle13.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle13.frag.out index 7b83210a2..1231cf679 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle13.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle13.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle13.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle14.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle14.frag.out index b44391a3e..940793d3a 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle14.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle14.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle14.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 EntryPoint Fragment 4 "main" diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle15.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle15.frag.out index 2eae28b29..ec7064d9d 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle15.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle15.frag.out @@ -8,7 +8,7 @@ WARNING: 0:16: '' : all default precisions are highp; use precision statements t Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle16.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle16.frag.out index 235559183..16e69d1d2 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle16.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle16.frag.out @@ -6,7 +6,7 @@ spv.bufferhandle16.frag Capability Shader Capability Int64 Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 EntryPoint Fragment 4 "main" diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle18.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle18.frag.out index 6d2178df7..567295d30 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle18.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle18.frag.out @@ -6,7 +6,7 @@ spv.bufferhandle18.frag Capability Shader Capability Int64 Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 EntryPoint Fragment 4 "main" diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle2.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle2.frag.out index 728bee383..8fee6db6b 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle2.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle2.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle2.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle3.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle3.frag.out index b888fe422..c02c34cf8 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle3.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle3.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle3.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle4.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle4.frag.out index e5a4f5d3c..3f568b0f0 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle4.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle4.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle4.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle5.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle5.frag.out index c663c42d7..3f1d21412 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle5.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle5.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle5.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 EntryPoint Fragment 4 "main" diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle6.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle6.frag.out index 2a9b484cb..866741f94 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle6.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle6.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle6.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle7.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle7.frag.out index c5bbc5d47..d09eded3c 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle7.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle7.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle7.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle8.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle8.frag.out index 3219734af..c37fa3fe6 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle8.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle8.frag.out @@ -5,7 +5,7 @@ spv.bufferhandle8.frag Capability Shader Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.bufferhandle9.frag.out b/3rdparty/glslang/Test/baseResults/spv.bufferhandle9.frag.out index df2b677c7..5b91eda91 100644 --- a/3rdparty/glslang/Test/baseResults/spv.bufferhandle9.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.bufferhandle9.frag.out @@ -6,7 +6,7 @@ spv.bufferhandle9.frag Capability Shader Capability Int64 Capability PhysicalStorageBufferAddressesEXT - Extension "SPV_KHR_physical_storage_buffer" + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" 1: ExtInstImport "GLSL.std.450" MemoryModel PhysicalStorageBuffer64EXT GLSL450 diff --git a/3rdparty/glslang/Test/baseResults/spv.coopmat.comp.out b/3rdparty/glslang/Test/baseResults/spv.coopmat.comp.out index 976c59f47..acdcbc4fc 100644 --- a/3rdparty/glslang/Test/baseResults/spv.coopmat.comp.out +++ b/3rdparty/glslang/Test/baseResults/spv.coopmat.comp.out @@ -9,8 +9,8 @@ spv.coopmat.comp Capability VulkanMemoryModelKHR Capability PhysicalStorageBufferAddressesEXT Capability CooperativeMatrixNV + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_16bit_storage" - Extension "SPV_KHR_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" Extension "SPV_KHR_vulkan_memory_model" Extension "SPV_NV_cooperative_matrix" diff --git a/3rdparty/glslang/Test/baseResults/spv.intcoopmat.comp.out b/3rdparty/glslang/Test/baseResults/spv.intcoopmat.comp.out index a854ed553..06f5623d3 100644 --- a/3rdparty/glslang/Test/baseResults/spv.intcoopmat.comp.out +++ b/3rdparty/glslang/Test/baseResults/spv.intcoopmat.comp.out @@ -10,8 +10,8 @@ spv.intcoopmat.comp Capability VulkanMemoryModelKHR Capability PhysicalStorageBufferAddressesEXT Capability CooperativeMatrixNV + Extension "SPV_EXT_physical_storage_buffer" Extension "SPV_KHR_8bit_storage" - Extension "SPV_KHR_physical_storage_buffer" Extension "SPV_KHR_storage_buffer_storage_class" Extension "SPV_KHR_vulkan_memory_model" Extension "SPV_NV_cooperative_matrix" diff --git a/3rdparty/glslang/glslang/Include/Types.h b/3rdparty/glslang/glslang/Include/Types.h index 9961c943a..59ead22d7 100644 --- a/3rdparty/glslang/glslang/Include/Types.h +++ b/3rdparty/glslang/glslang/Include/Types.h @@ -135,6 +135,8 @@ struct TSampler { // misnomer now; includes images, textures without sampler, bool isYuv() const { return yuv; } #endif void setCombined(bool c) { combined = c; } + void setBasicType(TBasicType t) { type = t; }; + TBasicType getBasicType() const { return type; }; bool isShadow() const { return shadow; } bool isArrayed() const { return arrayed; } @@ -2193,7 +2195,8 @@ public: const TTypeList* getStruct() const { assert(isStruct()); return structure; } void setStruct(TTypeList* s) { assert(isStruct()); structure = s; } TTypeList* getWritableStruct() const { assert(isStruct()); return structure; } // This should only be used when known to not be sharing with other threads - + void setBasicType(const TBasicType& t) { basicType = t; } + int computeNumComponents() const { int components = 0; diff --git a/3rdparty/glslang/glslang/Include/intermediate.h b/3rdparty/glslang/glslang/Include/intermediate.h index b599a905c..f966899f0 100644 --- a/3rdparty/glslang/glslang/Include/intermediate.h +++ b/3rdparty/glslang/glslang/Include/intermediate.h @@ -1189,6 +1189,7 @@ public: virtual void traverse(TIntermTraverser*); TOperator getFlowOp() const { return flowOp; } TIntermTyped* getExpression() const { return expression; } + void setExpression(TIntermTyped* pExpression) { expression = pExpression; } protected: TOperator flowOp; TIntermTyped* expression; diff --git a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index 93d41f7da..429e1e8d3 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -562,6 +562,237 @@ bool TIntermediate::isConversionAllowed(TOperator op, TIntermTyped* node) const return true; } +bool TIntermediate::buildConvertOp(TBasicType dst, TBasicType src, TOperator& newOp) const +{ + switch (dst) { +#ifndef GLSLANG_WEB + case EbtDouble: + switch (src) { + case EbtUint: newOp = EOpConvUintToDouble; break; + case EbtBool: newOp = EOpConvBoolToDouble; break; + case EbtFloat: newOp = EOpConvFloatToDouble; break; + case EbtInt: newOp = EOpConvIntToDouble; break; + case EbtInt8: newOp = EOpConvInt8ToDouble; break; + case EbtUint8: newOp = EOpConvUint8ToDouble; break; + case EbtInt16: newOp = EOpConvInt16ToDouble; break; + case EbtUint16: newOp = EOpConvUint16ToDouble; break; + case EbtFloat16: newOp = EOpConvFloat16ToDouble; break; + case EbtInt64: newOp = EOpConvInt64ToDouble; break; + case EbtUint64: newOp = EOpConvUint64ToDouble; break; + default: + return false; + } + break; +#endif + case EbtFloat: + switch (src) { + case EbtInt: newOp = EOpConvIntToFloat; break; + case EbtUint: newOp = EOpConvUintToFloat; break; + case EbtBool: newOp = EOpConvBoolToFloat; break; +#ifndef GLSLANG_WEB + case EbtDouble: newOp = EOpConvDoubleToFloat; break; + case EbtInt8: newOp = EOpConvInt8ToFloat; break; + case EbtUint8: newOp = EOpConvUint8ToFloat; break; + case EbtInt16: newOp = EOpConvInt16ToFloat; break; + case EbtUint16: newOp = EOpConvUint16ToFloat; break; + case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; + case EbtInt64: newOp = EOpConvInt64ToFloat; break; + case EbtUint64: newOp = EOpConvUint64ToFloat; break; +#endif + default: + return false; + } + break; +#ifndef GLSLANG_WEB + case EbtFloat16: + switch (src) { + case EbtInt8: newOp = EOpConvInt8ToFloat16; break; + case EbtUint8: newOp = EOpConvUint8ToFloat16; break; + case EbtInt16: newOp = EOpConvInt16ToFloat16; break; + case EbtUint16: newOp = EOpConvUint16ToFloat16; break; + case EbtInt: newOp = EOpConvIntToFloat16; break; + case EbtUint: newOp = EOpConvUintToFloat16; break; + case EbtBool: newOp = EOpConvBoolToFloat16; break; + case EbtFloat: newOp = EOpConvFloatToFloat16; break; + case EbtDouble: newOp = EOpConvDoubleToFloat16; break; + case EbtInt64: newOp = EOpConvInt64ToFloat16; break; + case EbtUint64: newOp = EOpConvUint64ToFloat16; break; + default: + return false; + } + break; +#endif + case EbtBool: + switch (src) { + case EbtInt: newOp = EOpConvIntToBool; break; + case EbtUint: newOp = EOpConvUintToBool; break; + case EbtFloat: newOp = EOpConvFloatToBool; break; +#ifndef GLSLANG_WEB + case EbtDouble: newOp = EOpConvDoubleToBool; break; + case EbtInt8: newOp = EOpConvInt8ToBool; break; + case EbtUint8: newOp = EOpConvUint8ToBool; break; + case EbtInt16: newOp = EOpConvInt16ToBool; break; + case EbtUint16: newOp = EOpConvUint16ToBool; break; + case EbtFloat16: newOp = EOpConvFloat16ToBool; break; + case EbtInt64: newOp = EOpConvInt64ToBool; break; + case EbtUint64: newOp = EOpConvUint64ToBool; break; +#endif + default: + return false; + } + break; +#ifndef GLSLANG_WEB + case EbtInt8: + switch (src) { + case EbtUint8: newOp = EOpConvUint8ToInt8; break; + case EbtInt16: newOp = EOpConvInt16ToInt8; break; + case EbtUint16: newOp = EOpConvUint16ToInt8; break; + case EbtInt: newOp = EOpConvIntToInt8; break; + case EbtUint: newOp = EOpConvUintToInt8; break; + case EbtInt64: newOp = EOpConvInt64ToInt8; break; + case EbtUint64: newOp = EOpConvUint64ToInt8; break; + case EbtBool: newOp = EOpConvBoolToInt8; break; + case EbtFloat: newOp = EOpConvFloatToInt8; break; + case EbtDouble: newOp = EOpConvDoubleToInt8; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt8; break; + default: + return false; + } + break; + case EbtUint8: + switch (src) { + case EbtInt8: newOp = EOpConvInt8ToUint8; break; + case EbtInt16: newOp = EOpConvInt16ToUint8; break; + case EbtUint16: newOp = EOpConvUint16ToUint8; break; + case EbtInt: newOp = EOpConvIntToUint8; break; + case EbtUint: newOp = EOpConvUintToUint8; break; + case EbtInt64: newOp = EOpConvInt64ToUint8; break; + case EbtUint64: newOp = EOpConvUint64ToUint8; break; + case EbtBool: newOp = EOpConvBoolToUint8; break; + case EbtFloat: newOp = EOpConvFloatToUint8; break; + case EbtDouble: newOp = EOpConvDoubleToUint8; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint8; break; + default: + return false; + } + break; + + case EbtInt16: + switch (src) { + case EbtUint8: newOp = EOpConvUint8ToInt16; break; + case EbtInt8: newOp = EOpConvInt8ToInt16; break; + case EbtUint16: newOp = EOpConvUint16ToInt16; break; + case EbtInt: newOp = EOpConvIntToInt16; break; + case EbtUint: newOp = EOpConvUintToInt16; break; + case EbtInt64: newOp = EOpConvInt64ToInt16; break; + case EbtUint64: newOp = EOpConvUint64ToInt16; break; + case EbtBool: newOp = EOpConvBoolToInt16; break; + case EbtFloat: newOp = EOpConvFloatToInt16; break; + case EbtDouble: newOp = EOpConvDoubleToInt16; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt16; break; + default: + return false; + } + break; + case EbtUint16: + switch (src) { + case EbtInt8: newOp = EOpConvInt8ToUint16; break; + case EbtUint8: newOp = EOpConvUint8ToUint16; break; + case EbtInt16: newOp = EOpConvInt16ToUint16; break; + case EbtInt: newOp = EOpConvIntToUint16; break; + case EbtUint: newOp = EOpConvUintToUint16; break; + case EbtInt64: newOp = EOpConvInt64ToUint16; break; + case EbtUint64: newOp = EOpConvUint64ToUint16; break; + case EbtBool: newOp = EOpConvBoolToUint16; break; + case EbtFloat: newOp = EOpConvFloatToUint16; break; + case EbtDouble: newOp = EOpConvDoubleToUint16; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint16; break; + default: + return false; + } + break; +#endif + + case EbtInt: + switch (src) { + case EbtUint: newOp = EOpConvUintToInt; break; + case EbtBool: newOp = EOpConvBoolToInt; break; + case EbtFloat: newOp = EOpConvFloatToInt; break; +#ifndef GLSLANG_WEB + case EbtInt8: newOp = EOpConvInt8ToInt; break; + case EbtUint8: newOp = EOpConvUint8ToInt; break; + case EbtInt16: newOp = EOpConvInt16ToInt; break; + case EbtUint16: newOp = EOpConvUint16ToInt; break; + case EbtDouble: newOp = EOpConvDoubleToInt; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt; break; + case EbtInt64: newOp = EOpConvInt64ToInt; break; + case EbtUint64: newOp = EOpConvUint64ToInt; break; +#endif + default: + return false; + } + break; + case EbtUint: + switch (src) { + case EbtInt: newOp = EOpConvIntToUint; break; + case EbtBool: newOp = EOpConvBoolToUint; break; + case EbtFloat: newOp = EOpConvFloatToUint; break; +#ifndef GLSLANG_WEB + case EbtInt8: newOp = EOpConvInt8ToUint; break; + case EbtUint8: newOp = EOpConvUint8ToUint; break; + case EbtInt16: newOp = EOpConvInt16ToUint; break; + case EbtUint16: newOp = EOpConvUint16ToUint; break; + case EbtDouble: newOp = EOpConvDoubleToUint; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint; break; + case EbtInt64: newOp = EOpConvInt64ToUint; break; + case EbtUint64: newOp = EOpConvUint64ToUint; break; +#endif + default: + return false; + } + break; +#ifndef GLSLANG_WEB + case EbtInt64: + switch (src) { + case EbtInt8: newOp = EOpConvInt8ToInt64; break; + case EbtUint8: newOp = EOpConvUint8ToInt64; break; + case EbtInt16: newOp = EOpConvInt16ToInt64; break; + case EbtUint16: newOp = EOpConvUint16ToInt64; break; + case EbtInt: newOp = EOpConvIntToInt64; break; + case EbtUint: newOp = EOpConvUintToInt64; break; + case EbtBool: newOp = EOpConvBoolToInt64; break; + case EbtFloat: newOp = EOpConvFloatToInt64; break; + case EbtDouble: newOp = EOpConvDoubleToInt64; break; + case EbtFloat16: newOp = EOpConvFloat16ToInt64; break; + case EbtUint64: newOp = EOpConvUint64ToInt64; break; + default: + return false; + } + break; + case EbtUint64: + switch (src) { + case EbtInt8: newOp = EOpConvInt8ToUint64; break; + case EbtUint8: newOp = EOpConvUint8ToUint64; break; + case EbtInt16: newOp = EOpConvInt16ToUint64; break; + case EbtUint16: newOp = EOpConvUint16ToUint64; break; + case EbtInt: newOp = EOpConvIntToUint64; break; + case EbtUint: newOp = EOpConvUintToUint64; break; + case EbtBool: newOp = EOpConvBoolToUint64; break; + case EbtFloat: newOp = EOpConvFloatToUint64; break; + case EbtDouble: newOp = EOpConvDoubleToUint64; break; + case EbtFloat16: newOp = EOpConvFloat16ToUint64; break; + case EbtInt64: newOp = EOpConvInt64ToUint64; break; + default: + return false; + } + break; +#endif + default: + return false; + } + return true; +} + // This is 'mechanism' here, it does any conversion told. // It is about basic type, not about shape. // The policy comes from the shader or the calling code. @@ -608,230 +839,7 @@ TIntermTyped* TIntermediate::createConversion(TBasicType convertTo, TIntermTyped return nullptr; } - switch (convertTo) { -#ifndef GLSLANG_WEB - case EbtDouble: - switch (node->getBasicType()) { - case EbtUint: newOp = EOpConvUintToDouble; break; - case EbtBool: newOp = EOpConvBoolToDouble; break; - case EbtFloat: newOp = EOpConvFloatToDouble; break; - case EbtInt: newOp = EOpConvIntToDouble; break; - case EbtInt8: newOp = EOpConvInt8ToDouble; break; - case EbtUint8: newOp = EOpConvUint8ToDouble; break; - case EbtInt16: newOp = EOpConvInt16ToDouble; break; - case EbtUint16: newOp = EOpConvUint16ToDouble; break; - case EbtFloat16: newOp = EOpConvFloat16ToDouble; break; - case EbtInt64: newOp = EOpConvInt64ToDouble; break; - case EbtUint64: newOp = EOpConvUint64ToDouble; break; - default: - return nullptr; - } - break; -#endif - case EbtFloat: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToFloat; break; - case EbtUint: newOp = EOpConvUintToFloat; break; - case EbtBool: newOp = EOpConvBoolToFloat; break; -#ifndef GLSLANG_WEB - case EbtDouble: newOp = EOpConvDoubleToFloat; break; - case EbtInt8: newOp = EOpConvInt8ToFloat; break; - case EbtUint8: newOp = EOpConvUint8ToFloat; break; - case EbtInt16: newOp = EOpConvInt16ToFloat; break; - case EbtUint16: newOp = EOpConvUint16ToFloat; break; - case EbtFloat16: newOp = EOpConvFloat16ToFloat; break; - case EbtInt64: newOp = EOpConvInt64ToFloat; break; - case EbtUint64: newOp = EOpConvUint64ToFloat; break; -#endif - default: - return nullptr; - } - break; -#ifndef GLSLANG_WEB - case EbtFloat16: - switch (node->getBasicType()) { - case EbtInt8: newOp = EOpConvInt8ToFloat16; break; - case EbtUint8: newOp = EOpConvUint8ToFloat16; break; - case EbtInt16: newOp = EOpConvInt16ToFloat16; break; - case EbtUint16: newOp = EOpConvUint16ToFloat16; break; - case EbtInt: newOp = EOpConvIntToFloat16; break; - case EbtUint: newOp = EOpConvUintToFloat16; break; - case EbtBool: newOp = EOpConvBoolToFloat16; break; - case EbtFloat: newOp = EOpConvFloatToFloat16; break; - case EbtDouble: newOp = EOpConvDoubleToFloat16; break; - case EbtInt64: newOp = EOpConvInt64ToFloat16; break; - case EbtUint64: newOp = EOpConvUint64ToFloat16; break; - default: - return nullptr; - } - break; -#endif - case EbtBool: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToBool; break; - case EbtUint: newOp = EOpConvUintToBool; break; - case EbtFloat: newOp = EOpConvFloatToBool; break; -#ifndef GLSLANG_WEB - case EbtDouble: newOp = EOpConvDoubleToBool; break; - case EbtInt8: newOp = EOpConvInt8ToBool; break; - case EbtUint8: newOp = EOpConvUint8ToBool; break; - case EbtInt16: newOp = EOpConvInt16ToBool; break; - case EbtUint16: newOp = EOpConvUint16ToBool; break; - case EbtFloat16: newOp = EOpConvFloat16ToBool; break; - case EbtInt64: newOp = EOpConvInt64ToBool; break; - case EbtUint64: newOp = EOpConvUint64ToBool; break; -#endif - default: - return nullptr; - } - break; -#ifndef GLSLANG_WEB - case EbtInt8: - switch (node->getBasicType()) { - case EbtUint8: newOp = EOpConvUint8ToInt8; break; - case EbtInt16: newOp = EOpConvInt16ToInt8; break; - case EbtUint16: newOp = EOpConvUint16ToInt8; break; - case EbtInt: newOp = EOpConvIntToInt8; break; - case EbtUint: newOp = EOpConvUintToInt8; break; - case EbtInt64: newOp = EOpConvInt64ToInt8; break; - case EbtUint64: newOp = EOpConvUint64ToInt8; break; - case EbtBool: newOp = EOpConvBoolToInt8; break; - case EbtFloat: newOp = EOpConvFloatToInt8; break; - case EbtDouble: newOp = EOpConvDoubleToInt8; break; - case EbtFloat16: newOp = EOpConvFloat16ToInt8; break; - default: - return nullptr; - } - break; - case EbtUint8: - switch (node->getBasicType()) { - case EbtInt8: newOp = EOpConvInt8ToUint8; break; - case EbtInt16: newOp = EOpConvInt16ToUint8; break; - case EbtUint16: newOp = EOpConvUint16ToUint8; break; - case EbtInt: newOp = EOpConvIntToUint8; break; - case EbtUint: newOp = EOpConvUintToUint8; break; - case EbtInt64: newOp = EOpConvInt64ToUint8; break; - case EbtUint64: newOp = EOpConvUint64ToUint8; break; - case EbtBool: newOp = EOpConvBoolToUint8; break; - case EbtFloat: newOp = EOpConvFloatToUint8; break; - case EbtDouble: newOp = EOpConvDoubleToUint8; break; - case EbtFloat16: newOp = EOpConvFloat16ToUint8; break; - default: - return nullptr; - } - break; - - case EbtInt16: - switch (node->getBasicType()) { - case EbtUint8: newOp = EOpConvUint8ToInt16; break; - case EbtInt8: newOp = EOpConvInt8ToInt16; break; - case EbtUint16: newOp = EOpConvUint16ToInt16; break; - case EbtInt: newOp = EOpConvIntToInt16; break; - case EbtUint: newOp = EOpConvUintToInt16; break; - case EbtInt64: newOp = EOpConvInt64ToInt16; break; - case EbtUint64: newOp = EOpConvUint64ToInt16; break; - case EbtBool: newOp = EOpConvBoolToInt16; break; - case EbtFloat: newOp = EOpConvFloatToInt16; break; - case EbtDouble: newOp = EOpConvDoubleToInt16; break; - case EbtFloat16: newOp = EOpConvFloat16ToInt16; break; - default: - return nullptr; - } - break; - case EbtUint16: - switch (node->getBasicType()) { - case EbtInt8: newOp = EOpConvInt8ToUint16; break; - case EbtUint8: newOp = EOpConvUint8ToUint16; break; - case EbtInt16: newOp = EOpConvInt16ToUint16; break; - case EbtInt: newOp = EOpConvIntToUint16; break; - case EbtUint: newOp = EOpConvUintToUint16; break; - case EbtInt64: newOp = EOpConvInt64ToUint16; break; - case EbtUint64: newOp = EOpConvUint64ToUint16; break; - case EbtBool: newOp = EOpConvBoolToUint16; break; - case EbtFloat: newOp = EOpConvFloatToUint16; break; - case EbtDouble: newOp = EOpConvDoubleToUint16; break; - case EbtFloat16: newOp = EOpConvFloat16ToUint16; break; - default: - return nullptr; - } - break; -#endif - - case EbtInt: - switch (node->getBasicType()) { - case EbtUint: newOp = EOpConvUintToInt; break; - case EbtBool: newOp = EOpConvBoolToInt; break; - case EbtFloat: newOp = EOpConvFloatToInt; break; -#ifndef GLSLANG_WEB - case EbtInt8: newOp = EOpConvInt8ToInt; break; - case EbtUint8: newOp = EOpConvUint8ToInt; break; - case EbtInt16: newOp = EOpConvInt16ToInt; break; - case EbtUint16: newOp = EOpConvUint16ToInt; break; - case EbtDouble: newOp = EOpConvDoubleToInt; break; - case EbtFloat16: newOp = EOpConvFloat16ToInt; break; - case EbtInt64: newOp = EOpConvInt64ToInt; break; - case EbtUint64: newOp = EOpConvUint64ToInt; break; -#endif - default: - return nullptr; - } - break; - case EbtUint: - switch (node->getBasicType()) { - case EbtInt: newOp = EOpConvIntToUint; break; - case EbtBool: newOp = EOpConvBoolToUint; break; - case EbtFloat: newOp = EOpConvFloatToUint; break; -#ifndef GLSLANG_WEB - case EbtInt8: newOp = EOpConvInt8ToUint; break; - case EbtUint8: newOp = EOpConvUint8ToUint; break; - case EbtInt16: newOp = EOpConvInt16ToUint; break; - case EbtUint16: newOp = EOpConvUint16ToUint; break; - case EbtDouble: newOp = EOpConvDoubleToUint; break; - case EbtFloat16: newOp = EOpConvFloat16ToUint; break; - case EbtInt64: newOp = EOpConvInt64ToUint; break; - case EbtUint64: newOp = EOpConvUint64ToUint; break; -#endif - default: - return nullptr; - } - break; -#ifndef GLSLANG_WEB - case EbtInt64: - switch (node->getBasicType()) { - case EbtInt8: newOp = EOpConvInt8ToInt64; break; - case EbtUint8: newOp = EOpConvUint8ToInt64; break; - case EbtInt16: newOp = EOpConvInt16ToInt64; break; - case EbtUint16: newOp = EOpConvUint16ToInt64; break; - case EbtInt: newOp = EOpConvIntToInt64; break; - case EbtUint: newOp = EOpConvUintToInt64; break; - case EbtBool: newOp = EOpConvBoolToInt64; break; - case EbtFloat: newOp = EOpConvFloatToInt64; break; - case EbtDouble: newOp = EOpConvDoubleToInt64; break; - case EbtFloat16: newOp = EOpConvFloat16ToInt64; break; - case EbtUint64: newOp = EOpConvUint64ToInt64; break; - default: - return nullptr; - } - break; - case EbtUint64: - switch (node->getBasicType()) { - case EbtInt8: newOp = EOpConvInt8ToUint64; break; - case EbtUint8: newOp = EOpConvUint8ToUint64; break; - case EbtInt16: newOp = EOpConvInt16ToUint64; break; - case EbtUint16: newOp = EOpConvUint16ToUint64; break; - case EbtInt: newOp = EOpConvIntToUint64; break; - case EbtUint: newOp = EOpConvUintToUint64; break; - case EbtBool: newOp = EOpConvBoolToUint64; break; - case EbtFloat: newOp = EOpConvFloatToUint64; break; - case EbtDouble: newOp = EOpConvDoubleToUint64; break; - case EbtFloat16: newOp = EOpConvFloat16ToUint64; break; - case EbtInt64: newOp = EOpConvInt64ToUint64; break; - default: - return nullptr; - } - break; -#endif - default: + if (!buildConvertOp(convertTo, node->getBasicType(), newOp)) { return nullptr; } diff --git a/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h b/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h index 10f994788..13b0f6c21 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h +++ b/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h @@ -786,6 +786,9 @@ public: void merge(TInfoSink&, TIntermediate&); void finalCheck(TInfoSink&, bool keepUncalled); + bool buildConvertOp(TBasicType dst, TBasicType src, TOperator& convertOp) const; + TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const; + void addIoAccessed(const TString& name) { ioAccessed.insert(name); } bool inIoAccessed(const TString& name) const { return ioAccessed.find(name) != ioAccessed.end(); } @@ -876,7 +879,6 @@ protected: bool specConstantPropagates(const TIntermTyped&, const TIntermTyped&); void performTextureUpgradeAndSamplerRemovalTransformation(TIntermNode* root); bool isConversionAllowed(TOperator op, TIntermTyped* node) const; - TIntermTyped* createConversion(TBasicType convertTo, TIntermTyped* node) const; std::tuple getConversionDestinatonType(TBasicType type0, TBasicType type1, TOperator op) const; // JohnK: I think this function should go away. diff --git a/3rdparty/glslang/glslang/Public/ShaderLang.h b/3rdparty/glslang/glslang/Public/ShaderLang.h index bb06acc0a..9782475d2 100755 --- a/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -487,6 +487,8 @@ public: environment.target.version = version; } + void getStrings(const char* const* &s, int& n) { s = strings; n = numStrings; }; + #ifdef ENABLE_HLSL void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; } bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; } @@ -773,7 +775,7 @@ public: TProgram(); virtual ~TProgram(); void addShader(TShader* shader) { stages[shader->stage].push_back(shader); } - + std::list& getShaders(EShLanguage stage) { return stages[stage]; }; // Link Validation interface bool link(EShMessages); const char* getInfoLog(); diff --git a/3rdparty/glslang/known_good.json b/3rdparty/glslang/known_good.json index 6a1390709..3d8994a61 100644 --- a/3rdparty/glslang/known_good.json +++ b/3rdparty/glslang/known_good.json @@ -5,14 +5,14 @@ "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Tools", "subdir" : "External/spirv-tools", - "commit" : "bbb29870b510f83f99994358179c9ea6838c3100" + "commit" : "c3ca04741945c332ddbeb7d7125dbae2809b7195" }, { "name" : "spirv-tools/external/spirv-headers", "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Headers", "subdir" : "External/spirv-tools/external/spirv-headers", - "commit" : "601d738723ac381741311c6c98c36d6170be14a2" + "commit" : "b252a50953ac4375cb1864e94f4b0234db9d215d" } ] }