summaryrefslogtreecommitdiff
path: root/source/slang/modifier-defs.h
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-12 13:40:30 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-12 13:40:30 -0700
commitaca34e771d0ad76d396415e45c5f3cbf294709c9 (patch)
tree07b4413d679e52cc56d48fb21b11d66b4e37b26b /source/slang/modifier-defs.h
parentb65861fc32a54d28b3fbbaf0d31bb1d71889f570 (diff)
Don't emit interpolation modifiers on struct fields when outputting GLSL
HLSL (and thus Slang) commonly puts interpolation modifiers like `sample` on the fields of `struct` types used as stage input/output, while GLSL only allows them on global-scope `in` and `out` variables (or ones in blocks). This change emits a really hacky filtering step to skip over certain modifiers when emitting a declaration. This lets us skip interpolation-mode modifiers when outputting a struct field to GLSL. Note: this probably gets the `in` or `out` block case wrong...
Diffstat (limited to 'source/slang/modifier-defs.h')
-rw-r--r--source/slang/modifier-defs.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/source/slang/modifier-defs.h b/source/slang/modifier-defs.h
index c401b3353..2b5c77d86 100644
--- a/source/slang/modifier-defs.h
+++ b/source/slang/modifier-defs.h
@@ -208,17 +208,20 @@ SIMPLE_SYNTAX_CLASS(GLSLColumnMajorLayoutModifier, RowMajorLayoutModifier)
// More HLSL Keyword
+ABSTRACT_SYNTAX_CLASS(InterpolationModeModifier, Modifier)
+END_SYNTAX_CLASS()
+
// HLSL `nointerpolation` modifier
-SIMPLE_SYNTAX_CLASS(HLSLNoInterpolationModifier, Modifier)
+SIMPLE_SYNTAX_CLASS(HLSLNoInterpolationModifier, InterpolationModeModifier)
// HLSL `linear` modifier
-SIMPLE_SYNTAX_CLASS(HLSLLinearModifier, Modifier)
+SIMPLE_SYNTAX_CLASS(HLSLLinearModifier, InterpolationModeModifier)
// HLSL `sample` modifier
-SIMPLE_SYNTAX_CLASS(HLSLSampleModifier, Modifier)
+SIMPLE_SYNTAX_CLASS(HLSLSampleModifier, InterpolationModeModifier)
// HLSL `centroid` modifier
-SIMPLE_SYNTAX_CLASS(HLSLCentroidModifier, Modifier)
+SIMPLE_SYNTAX_CLASS(HLSLCentroidModifier, InterpolationModeModifier)
// HLSL `precise` modifier
SIMPLE_SYNTAX_CLASS(HLSLPreciseModifier, Modifier)