summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2022-10-13 05:41:46 +0800
committerGitHub <noreply@github.com>2022-10-12 14:41:46 -0700
commit12e7d70655bdf7c796ab86bff7af636d198aa222 (patch)
tree82feab99f8e766900338ba89b5e13da4a4d805c2 /source
parent53b180a9383668246a152af41aec8f6e565904a4 (diff)
Add support for SV_ViewID (#2440)
closes https://github.com/shader-slang/slang/issues/2410 Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-glsl-legalize.cpp8
-rw-r--r--source/slang/slang-language-server-completion.cpp1
2 files changed, 9 insertions, 0 deletions
diff --git a/source/slang/slang-ir-glsl-legalize.cpp b/source/slang/slang-ir-glsl-legalize.cpp
index 59f741050..76c73796f 100644
--- a/source/slang/slang-ir-glsl-legalize.cpp
+++ b/source/slang/slang-ir-glsl-legalize.cpp
@@ -662,6 +662,14 @@ GLSLSystemValueInfo* getGLSLSystemValueInfo(
requiredType = builder->getBasicType(BaseType::Int);
name = "gl_VertexIndex";
}
+ else if (semanticName == "sv_viewid")
+ {
+ // uint in hlsl, int in glsl
+ // https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GL_EXT_multiview.txt
+ requiredType = builder->getBasicType(BaseType::Int);
+ context->requireGLSLExtension(UnownedStringSlice::fromLiteral("GL_EXT_multiview"));
+ name = "gl_ViewIndex";
+ }
else if (semanticName == "sv_viewportarrayindex")
{
// uint on hlsl, int on glsl
diff --git a/source/slang/slang-language-server-completion.cpp b/source/slang/slang-language-server-completion.cpp
index c1d6fc9b5..92a0b3860 100644
--- a/source/slang/slang-language-server-completion.cpp
+++ b/source/slang/slang-language-server-completion.cpp
@@ -65,6 +65,7 @@ static const char* hlslSemanticNames[] = {
"SV_Target",
"SV_TessFactor",
"SV_VertexID",
+ "SV_ViewID",
"SV_ViewportArrayIndex",
"SV_ShadingRate",
};