Commit 66bdc47f by John Kessenich

SPV: add version checks for AMD type extensions.

I'm not yet clear if these are the right checks, but it puts the right infrastructure and example in place. Note: semantic checking against versions/extensions should happen earlier than SPIR-V generation, so SPIR-V generation need only assume it is okay to do what was asked.
parent 1790a40c
...@@ -2452,7 +2452,8 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty ...@@ -2452,7 +2452,8 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case glslang::EbtFloat16: case glslang::EbtFloat16:
builder.addCapability(spv::CapabilityFloat16); builder.addCapability(spv::CapabilityFloat16);
#if AMD_EXTENSIONS #if AMD_EXTENSIONS
builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float); if (builder.getSpvVersion() < 0x00010300)
builder.addExtension(spv::E_SPV_AMD_gpu_shader_half_float);
#endif #endif
spvType = builder.makeFloatType(16); spvType = builder.makeFloatType(16);
break; break;
...@@ -2475,14 +2476,16 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty ...@@ -2475,14 +2476,16 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
case glslang::EbtInt16: case glslang::EbtInt16:
builder.addCapability(spv::CapabilityInt16); builder.addCapability(spv::CapabilityInt16);
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16); if (builder.getSpvVersion() < 0x00010300)
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16);
#endif #endif
spvType = builder.makeIntType(16); spvType = builder.makeIntType(16);
break; break;
case glslang::EbtUint16: case glslang::EbtUint16:
builder.addCapability(spv::CapabilityInt16); builder.addCapability(spv::CapabilityInt16);
#ifdef AMD_EXTENSIONS #ifdef AMD_EXTENSIONS
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16); if (builder.getSpvVersion() < 0x00010300)
builder.addExtension(spv::E_SPV_AMD_gpu_shader_int16);
#endif #endif
spvType = builder.makeUintType(16); spvType = builder.makeUintType(16);
break; break;
......
...@@ -66,6 +66,8 @@ public: ...@@ -66,6 +66,8 @@ public:
static const int maxMatrixSize = 4; static const int maxMatrixSize = 4;
unsigned int getSpvVersion() const { return spvVersion; }
void setSource(spv::SourceLanguage lang, int version) void setSource(spv::SourceLanguage lang, int version)
{ {
source = lang; source = lang;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment