Skip to content

Commit

Permalink
SPV: Implement extension SPV_EXT_shader_stencil_export
Browse files Browse the repository at this point in the history
  • Loading branch information
amdrexu committed Aug 23, 2017
1 parent 778806a commit e8fdd79
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions SPIRV/GLSL.ext.KHR.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shade
static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage";
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_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export";

#endif // #ifndef GLSLextKHR_H
5 changes: 3 additions & 2 deletions SPIRV/GlslangToSpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,9 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
return spv::BuiltInPrimitiveId;

case glslang::EbvFragStencilRef:
logger->missingFunctionality("shader stencil export");
return spv::BuiltInMax;
builder.addExtension(spv::E_SPV_EXT_shader_stencil_export);
builder.addCapability(spv::CapabilityStencilExportEXT);
return spv::BuiltInFragStencilRefEXT;

case glslang::EbvInvocationId: return spv::BuiltInInvocationId;
case glslang::EbvTessLevelInner: return spv::BuiltInTessLevelInner;
Expand Down
3 changes: 3 additions & 0 deletions SPIRV/doc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ const char* BuiltInString(int builtIn)
case 4424: return "BaseVertex";
case 4425: return "BaseInstance";
case 4426: return "DrawIndex";
case 5014: return "FragStencilRefEXT";

#ifdef AMD_EXTENSIONS
case 4992: return "BaryCoordNoPerspAMD";
Expand Down Expand Up @@ -842,6 +843,8 @@ const char* CapabilityString(int info)
case 4437: return "DeviceGroup";
case 4439: return "MultiView";

case 5013: return "StencilExportEXT";

#ifdef AMD_EXTENSIONS
case 5009: return "ImageGatherBiasLodAMD";
#endif
Expand Down
7 changes: 5 additions & 2 deletions SPIRV/spirv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ namespace spv {
typedef unsigned int Id;

#define SPV_VERSION 0x10000
#define SPV_REVISION 11
#define SPV_REVISION 12

static const unsigned int MagicNumber = 0x07230203;
static const unsigned int Version = 0x00010000;
static const unsigned int Revision = 11;
static const unsigned int Revision = 12;
static const unsigned int OpCodeMask = 0xffff;
static const unsigned int WordCountShift = 16;

Expand Down Expand Up @@ -444,6 +444,7 @@ enum BuiltIn {
BuiltInBaryCoordSmoothCentroidAMD = 4996,
BuiltInBaryCoordSmoothSampleAMD = 4997,
BuiltInBaryCoordPullModelAMD = 4998,
BuiltInFragStencilRefEXT = 5014,
BuiltInViewportMaskNV = 5253,
BuiltInSecondaryPositionNV = 5257,
BuiltInSecondaryViewportMaskNV = 5258,
Expand Down Expand Up @@ -640,8 +641,10 @@ enum Capability {
CapabilityAtomicStorageOps = 4445,
CapabilitySampleMaskPostDepthCoverage = 4447,
CapabilityImageGatherBiasLodAMD = 5009,
CapabilityStencilExportEXT = 5013,
CapabilitySampleMaskOverrideCoverageNV = 5249,
CapabilityGeometryShaderPassthroughNV = 5251,
CapabilityShaderViewportIndexLayerEXT = 5254,
CapabilityShaderViewportIndexLayerNV = 5254,
CapabilityShaderViewportMaskNV = 5255,
CapabilityShaderStereoViewNV = 5259,
Expand Down
4 changes: 3 additions & 1 deletion Test/baseResults/spv.shaderStencilExport.frag.out
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
spv.shaderStencilExport.frag
Missing functionality: shader stencil export
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 10

Capability Shader
Capability StencilExportEXT
Extension "SPV_EXT_shader_stencil_export"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8
Expand All @@ -13,6 +14,7 @@ Missing functionality: shader stencil export
SourceExtension "GL_ARB_shader_stencil_export"
Name 4 "main"
Name 8 "gl_FragStencilRefARB"
Decorate 8(gl_FragStencilRefARB) BuiltIn FragStencilRefEXT
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1
Expand Down

0 comments on commit e8fdd79

Please sign in to comment.