SPV: Implement new extensions GL_KHX_device_group and GL_KHX_multiview.

These correspond to SPV_KHR_device_group and SPV_KHR_multiview.
Also, bring tests up to date with Khronos internals, and some misc. related changes.
This commit is contained in:
John Kessenich
2017-02-27 01:20:51 -07:00
parent 4a57dced66
commit 6c8aaacd28
18 changed files with 252 additions and 26 deletions

View File

@@ -27,10 +27,17 @@
#ifndef GLSLextKHR_H
#define GLSLextKHR_H
// SPV_KHR_shader_ballot
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
enum BuiltIn;
enum Op;
enum Capability;
static const int GLSLextKHRVersion = 100;
static const int GLSLextKHRRevision = 1;
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
static const char* const E_SPV_KHR_device_group = "SPV_KHR_device_group";
static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview";
static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
// SPV_KHR_shader_draw_parameters
static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
#endif // #ifndef GLSLextKHR_H

View File

@@ -628,6 +628,16 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInBaryCoordPullModelAMD;
#endif
case glslang::EbvDeviceIndex:
builder.addExtension(spv::E_SPV_KHR_device_group);
builder.addCapability(spv::CapabilityDeviceGroup);
return spv::BuiltinDeviceIndex;
case glslang::EbvViewIndex:
builder.addExtension(spv::E_SPV_KHR_multiview);
builder.addCapability(spv::CapabilityMultiView);
return spv::BuiltinViewIndex;
#ifdef NV_EXTENSIONS
case glslang::EbvViewportMaskNV:
builder.addExtension(spv::E_SPV_NV_viewport_array2);

View File

@@ -48,6 +48,7 @@
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
@@ -318,15 +319,13 @@ const char* BuiltInString(int builtIn)
case 42: return "VertexIndex"; // TBD: put next to VertexId?
case 43: return "InstanceIndex"; // TBD: put next to InstanceId?
case BuiltInCeiling:
default: return "Bad";
case 4416: return "SubgroupEqMaskKHR";
case 4417: return "SubgroupGeMaskKHR";
case 4418: return "SubgroupGtMaskKHR";
case 4419: return "SubgroupLeMaskKHR";
case 4420: return "SubgroupLtMaskKHR";
case 4438: return "DeviceIndex";
case 4440: return "ViewIndex";
case 4424: return "BaseVertex";
case 4425: return "BaseInstance";
case 4426: return "DrawIndex";
@@ -340,6 +339,7 @@ const char* BuiltInString(int builtIn)
case 4997: return "BaryCoordSmoothSampleAMD";
case 4998: return "BaryCoordPullModelAMD";
#endif
#ifdef NV_EXTENSIONS
case 5253: return "ViewportMaskNV";
case 5257: return "SecondaryPositionNV";
@@ -347,6 +347,9 @@ const char* BuiltInString(int builtIn)
case 5260: return "PositionPerViewNV";
case 5261: return "ViewportMaskPerViewNV";
#endif
case BuiltInCeiling:
default: return "Bad";
}
}
@@ -823,13 +826,13 @@ const char* CapabilityString(int info)
case 56: return "StorageImageWriteWithoutFormat";
case 57: return "MultiViewport";
case CapabilityCeiling:
default: return "Bad";
case 4423: return "SubgroupBallotKHR";
case 4427: return "DrawParameters";
case 4431: return "SubgroupVoteKHR";
case 4437: return "DeviceGroup";
case 4439: return "MultiView";
#ifdef NV_EXTENSIONS
case 5251: return "GeometryShaderPassthroughNV";
case 5254: return "ShaderViewportIndexLayerNV";
@@ -838,6 +841,8 @@ const char* CapabilityString(int info)
case 5262: return "PerViewAttributesNV";
#endif
case CapabilityCeiling:
default: return "Bad";
}
}
@@ -1166,10 +1171,6 @@ const char* OpcodeString(int op)
case 319: return "OpAtomicFlagClear";
case 320: return "OpImageSparseRead";
case OpcodeCeiling:
default:
return "Bad";
case 4421: return "OpSubgroupBallotKHR";
case 4422: return "OpSubgroupFirstInvocationKHR";
case 4428: return "OpSubgroupAllKHR";
@@ -1187,6 +1188,10 @@ const char* OpcodeString(int op)
case 5006: return "OpGroupUMaxNonUniformAMD";
case 5007: return "OpGroupSMaxNonUniformAMD";
#endif
case OpcodeCeiling:
default:
return "Bad";
}
}

View File

@@ -428,6 +428,8 @@ enum BuiltIn {
BuiltInBaseVertex = 4424,
BuiltInBaseInstance = 4425,
BuiltInDrawIndex = 4426,
BuiltinDeviceIndex = 4438,
BuiltinViewIndex = 4440,
BuiltInMax = 0x7fffffff,
};
@@ -606,6 +608,8 @@ enum Capability {
CapabilitySubgroupBallotKHR = 4423,
CapabilityDrawParameters = 4427,
CapabilitySubgroupVoteKHR = 4431,
CapabilityDeviceGroup = 4437,
CapabilityMultiView = 4439,
CapabilityMax = 0x7fffffff,
};
@@ -906,10 +910,10 @@ enum Op {
OpImageSparseRead = 320,
OpSubgroupBallotKHR = 4421,
OpSubgroupFirstInvocationKHR = 4422,
OpSubgroupReadInvocationKHR = 4432,
OpSubgroupAllKHR = 4428,
OpSubgroupAnyKHR = 4429,
OpSubgroupAllKHR = 4428,
OpSubgroupAnyKHR = 4429,
OpSubgroupAllEqualKHR = 4430,
OpSubgroupReadInvocationKHR = 4432,
OpMax = 0x7fffffff,
};