SPV: Implement extension SPV_KHR_shader_draw_parameters.
This commit is contained in:
@@ -27,25 +27,10 @@
|
||||
#ifndef GLSLextKHR_H
|
||||
#define GLSLextKHR_H
|
||||
|
||||
enum BuiltIn;
|
||||
enum Op;
|
||||
enum Capability;
|
||||
|
||||
static const int GLSLextKHRVersion = 100;
|
||||
static const int GLSLextKHRRevision = 1;
|
||||
|
||||
// SPV_KHR_shader_ballot
|
||||
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
|
||||
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
|
||||
|
||||
static const BuiltIn BuiltInSubgroupEqMaskKHR = static_cast<BuiltIn>(4416);
|
||||
static const BuiltIn BuiltInSubgroupGeMaskKHR = static_cast<BuiltIn>(4417);
|
||||
static const BuiltIn BuiltInSubgroupGtMaskKHR = static_cast<BuiltIn>(4418);
|
||||
static const BuiltIn BuiltInSubgroupLeMaskKHR = static_cast<BuiltIn>(4419);
|
||||
static const BuiltIn BuiltInSubgroupLtMaskKHR = static_cast<BuiltIn>(4420);
|
||||
|
||||
static const Op OpSubgroupBallotKHR = static_cast<Op>(4421);
|
||||
static const Op OpSubgroupFirstInvocationKHR = static_cast<Op>(4422);
|
||||
|
||||
static const Capability CapabilitySubgroupBallotKHR = static_cast<Capability>(4423);
|
||||
// SPV_KHR_shader_draw_parameters
|
||||
static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
|
||||
|
||||
#endif // #ifndef GLSLextKHR_H
|
||||
|
||||
@@ -498,13 +498,21 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
|
||||
case glslang::EbvInstanceId: return spv::BuiltInInstanceId;
|
||||
case glslang::EbvVertexIndex: return spv::BuiltInVertexIndex;
|
||||
case glslang::EbvInstanceIndex: return spv::BuiltInInstanceIndex;
|
||||
|
||||
case glslang::EbvBaseVertex:
|
||||
builder.addExtension(spv::E_SPV_KHR_shader_draw_parameters);
|
||||
builder.addCapability(spv::CapabilityDrawParameters);
|
||||
return spv::BuiltInBaseVertex;
|
||||
|
||||
case glslang::EbvBaseInstance:
|
||||
builder.addExtension(spv::E_SPV_KHR_shader_draw_parameters);
|
||||
builder.addCapability(spv::CapabilityDrawParameters);
|
||||
return spv::BuiltInBaseInstance;
|
||||
|
||||
case glslang::EbvDrawId:
|
||||
// TODO: Add SPIR-V builtin ID.
|
||||
logger->missingFunctionality("shader draw parameters");
|
||||
return spv::BuiltInMax;
|
||||
builder.addExtension(spv::E_SPV_KHR_shader_draw_parameters);
|
||||
builder.addCapability(spv::CapabilityDrawParameters);
|
||||
return spv::BuiltInDrawIndex;
|
||||
|
||||
case glslang::EbvPrimitiveId:
|
||||
if (glslangIntermediate->getStage() == EShLangFragment)
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
namespace spv {
|
||||
extern "C" {
|
||||
// Include C-based headers that don't have a namespace
|
||||
#include "GLSL.ext.KHR.h"
|
||||
#ifdef AMD_EXTENSIONS
|
||||
#include "GLSL.ext.AMD.h"
|
||||
#endif
|
||||
@@ -319,6 +318,10 @@ const char* BuiltInString(int builtIn)
|
||||
case 4419: return "SubgroupLeMaskKHR";
|
||||
case 4420: return "SubgroupLtMaskKHR";
|
||||
|
||||
case 4424: return "BaseVertex";
|
||||
case 4425: return "BaseInstance";
|
||||
case 4426: return "DrawIndex";
|
||||
|
||||
#ifdef AMD_EXTENSIONS
|
||||
case 4992: return "BaryCoordNoPerspAMD";
|
||||
case 4993: return "BaryCoordNoPerspCentroidAMD";
|
||||
@@ -808,6 +811,7 @@ const char* CapabilityString(int info)
|
||||
default: return "Bad";
|
||||
|
||||
case 4423: return "SubgroupBallotKHR";
|
||||
case 4427: return "DrawParameters";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,11 @@ namespace spv {
|
||||
typedef unsigned int Id;
|
||||
|
||||
#define SPV_VERSION 0x10000
|
||||
#define SPV_REVISION 6
|
||||
#define SPV_REVISION 8
|
||||
|
||||
static const unsigned int MagicNumber = 0x07230203;
|
||||
static const unsigned int Version = 0x00010000;
|
||||
static const unsigned int Revision = 6;
|
||||
static const unsigned int Revision = 8;
|
||||
static const unsigned int OpCodeMask = 0xffff;
|
||||
static const unsigned int WordCountShift = 16;
|
||||
|
||||
@@ -420,6 +420,14 @@ enum BuiltIn {
|
||||
BuiltInSubgroupLocalInvocationId = 41,
|
||||
BuiltInVertexIndex = 42,
|
||||
BuiltInInstanceIndex = 43,
|
||||
BuiltInSubgroupEqMaskKHR = 4416,
|
||||
BuiltInSubgroupGeMaskKHR = 4417,
|
||||
BuiltInSubgroupGtMaskKHR = 4418,
|
||||
BuiltInSubgroupLeMaskKHR = 4419,
|
||||
BuiltInSubgroupLtMaskKHR = 4420,
|
||||
BuiltInBaseVertex = 4424,
|
||||
BuiltInBaseInstance = 4425,
|
||||
BuiltInDrawIndex = 4426,
|
||||
BuiltInMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
@@ -595,6 +603,8 @@ enum Capability {
|
||||
CapabilityStorageImageReadWithoutFormat = 55,
|
||||
CapabilityStorageImageWriteWithoutFormat = 56,
|
||||
CapabilityMultiViewport = 57,
|
||||
CapabilitySubgroupBallotKHR = 4423,
|
||||
CapabilityDrawParameters = 4427,
|
||||
CapabilityMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
@@ -893,6 +903,8 @@ enum Op {
|
||||
OpAtomicFlagTestAndSet = 318,
|
||||
OpAtomicFlagClear = 319,
|
||||
OpImageSparseRead = 320,
|
||||
OpSubgroupBallotKHR = 4421,
|
||||
OpSubgroupFirstInvocationKHR = 4422,
|
||||
OpMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user