Implement NVX_multiview_per_view_attributes

This commit is contained in:
chaoc 2017-02-14 14:52:34 -08:00
parent 7225a1cb1e
commit df3956c50f
17 changed files with 285 additions and 60 deletions

View file

@ -1,5 +1,5 @@
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
** Copyright (c) 2014-2017 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
@ -33,7 +33,7 @@ enum Op;
enum Capability;
static const int GLSLextNVVersion = 100;
static const int GLSLextNVRevision = 4;
static const int GLSLextNVRevision = 5;
//SPV_NV_sample_mask_override_coverage
const char* const E_SPV_NV_sample_mask_override_coverage = "SPV_NV_sample_mask_override_coverage";
@ -71,4 +71,13 @@ static const BuiltIn BuiltInSecondaryViewportMaskNV = static_cast<BuiltIn>(5258)
static const Capability CapabilityShaderStereoViewNV = static_cast<Capability>(5259);
//SPV_NVX_multiview_per_view_attributes
const char* const E_SPV_NVX_multiview_per_view_attributes = "SPV_NVX_multiview_per_view_attributes";
static const BuiltIn BuiltInPositionPerViewNV = static_cast<BuiltIn>(5260);
static const BuiltIn BuiltInViewportMaskPerViewNV = static_cast<BuiltIn>(5261);
static const Capability CapabilityPerViewAttributesNV = static_cast<Capability>(5262);
#endif // #ifndef GLSLextNV_H

View file

@ -642,6 +642,14 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
builder.addExtension(spv::E_SPV_NV_stereo_view_rendering);
builder.addCapability(spv::CapabilityShaderStereoViewNV);
return spv::BuiltInSecondaryViewportMaskNV;
case glslang::EbvPositionPerViewNV:
builder.addExtension(spv::E_SPV_NVX_multiview_per_view_attributes);
builder.addCapability(spv::CapabilityPerViewAttributesNV);
return spv::BuiltInPositionPerViewNV;
case glslang::EbvViewportMaskPerViewNV:
builder.addExtension(spv::E_SPV_NVX_multiview_per_view_attributes);
builder.addCapability(spv::CapabilityPerViewAttributesNV);
return spv::BuiltInViewportMaskPerViewNV;
#endif
default: return spv::BuiltInMax;
}
@ -2384,6 +2392,11 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type,
builder.addExtension(spv::E_SPV_NV_stereo_view_rendering);
}
}
if (glslangMember.getQualifier().layoutPassthrough) {
addMemberDecoration(spvType, member, (spv::Decoration)spv::DecorationPassthroughNV);
builder.addCapability(spv::CapabilityGeometryShaderPassthroughNV);
builder.addExtension(spv::E_SPV_NV_geometry_shader_passthrough);
}
#endif
}
}
@ -2661,6 +2674,8 @@ void TGlslangToSpvTraverser::declareUseOfStructMember(const glslang::TTypeList&
case glslang::EbvViewportMaskNV:
case glslang::EbvSecondaryPositionNV:
case glslang::EbvSecondaryViewportMaskNV:
case glslang::EbvPositionPerViewNV:
case glslang::EbvViewportMaskPerViewNV:
#endif
// Generate the associated capability. Delegate to TranslateBuiltInDecoration.
// Alternately, we could just call this for any glslang built-in, since the

View file

@ -483,7 +483,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
#ifdef NV_EXTENSIONS
}else if (strcmp(spv::E_SPV_NV_sample_mask_override_coverage, name) == 0 ||
strcmp(spv::E_SPV_NV_geometry_shader_passthrough, name) == 0 ||
strcmp(spv::E_SPV_NV_viewport_array2, name) == 0) {
strcmp(spv::E_SPV_NV_viewport_array2, name) == 0 ||
strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0) {
extInstSet = GLSLextNVInst;
#endif
}
@ -659,7 +660,8 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
if (strcmp(name, spv::E_SPV_NV_sample_mask_override_coverage) == 0 ||
strcmp(name, spv::E_SPV_NV_geometry_shader_passthrough) == 0 ||
strcmp(name, spv::E_ARB_shader_viewport_layer_array) == 0 ||
strcmp(name, spv::E_SPV_NV_viewport_array2) == 0){
strcmp(name, spv::E_SPV_NV_viewport_array2) == 0 ||
strcmp(spv::E_SPV_NVX_multiview_per_view_attributes, name) == 0) {
switch (entrypoint) {
case DecorationOverrideCoverageNV: return "OverrideCoverageNV";
case DecorationPassthroughNV: return "PassthroughNV";
@ -671,6 +673,9 @@ static const char* GLSLextNVGetDebugNames(const char* name, unsigned entrypoint)
case BuiltInSecondaryPositionNV: return "SecondaryPositionNV";
case BuiltInSecondaryViewportMaskNV: return "SecondaryViewportMaskNV";
case CapabilityShaderStereoViewNV: return "ShaderStereoViewNV";
case BuiltInPositionPerViewNV: return "PositionPerViewNV";
case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
case CapabilityPerViewAttributesNV: return "PerViewAttributesNV";
default: return "Bad";
}
}

View file

@ -344,6 +344,8 @@ const char* BuiltInString(int builtIn)
case 5253: return "ViewportMaskNV";
case 5257: return "SecondaryPositionNV";
case 5258: return "SecondaryViewportMaskNV";
case 5260: return "PositionPerViewNV";
case 5261: return "ViewportMaskPerViewNV";
#endif
}
}