summaryrefslogtreecommitdiffstats
path: root/source/slang/lower.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-20 15:14:35 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-20 15:14:35 -0700
commit0cf9bcfc4fd68b9f4bb2ba55565af33e680177b0 (patch)
tree03983d2d8c66efa5df1957f5dbc7f5b736960c37 /source/slang/lower.cpp
parentb8478a457b7d26d497109d9a0a992dbc198eb47a (diff)
Require extension when using `gl_Layer` in VS
The requirements for using `gl_Layer` differ by stage, and so we need to pick an appropriate GL version based on the target stage, and then also require a specific extension for anything other than geometry or fragment.
Diffstat (limited to 'source/slang/lower.cpp')
-rw-r--r--source/slang/lower.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/slang/lower.cpp b/source/slang/lower.cpp
index 54afc283c..174c93c1d 100644
--- a/source/slang/lower.cpp
+++ b/source/slang/lower.cpp
@@ -3458,10 +3458,22 @@ struct LoweringVisitor
}
else if (ns == "sv_rendertargetarrayindex")
{
- if (info.direction == VaryingParameterDirection::Input)
+ switch (shared->entryPointRequest->profile.GetStage())
{
+ case Stage::Geometry:
+ requireGLSLVersion(ProfileVersion::GLSL_150);
+ break;
+
+ case Stage::Fragment:
requireGLSLVersion(ProfileVersion::GLSL_430);
+ break;
+
+ default:
+ requireGLSLVersion(ProfileVersion::GLSL_450);
+ requireGLSLExtension(shared->extensionUsageTracker, "GL_ARB_shader_viewport_layer_array");
+ break;
}
+
globalVarExpr = createGLSLBuiltinRef("gl_Layer", getIntType());
}
else if (ns == "sv_sampleindex")