diff options
author | Malcolm Bechard <mbechard@users.noreply.github.com> | 2020-04-02 04:03:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-02 02:03:53 -0600 |
commit | 0b66fa3b62cb36a3bc86f5018cf92a5211b27156 (patch) | |
tree | 959ae6ddc0e9ff43e1c4ef966359c5e45e42cfa2 /glslang/Include/Types.h | |
parent | 1fff3623550471d20d2a4d0afeeb0bedf28edc54 (diff) | |
download | glslang-0b66fa3b62cb36a3bc86f5018cf92a5211b27156.tar.gz |
Shader interface matching rework to fix #2136 (#2156)
* rework how shader interface block naming rules are handled
* Fixes 2136
According to the spec, shader interfaces (uniform blocks, buffer
blocks, input blocks, output blocks) all should be matched up via
their block names across all compilation units, not instance names.
Also, all block names can be re-used between all 4 interface types
without conflict. This change makes it so all of these blocks are
matched and remapped using block name and not by instance name.
Additional the rule that matched uniform and buffer blocks must
either be anonymous or named (but not nessearily the same name) is
now imposed.
* add warning if instance names differ between matched shader interfaces
* Add test cases from #2137 which is now fixed as well.
* replace some tab characters with spaces
* buffer blocks and uniform blocks now share the same block namespace
Diffstat (limited to 'glslang/Include/Types.h')
-rw-r--r-- | glslang/Include/Types.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 3b530a29..b2c416d1 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -473,6 +473,18 @@ enum TInterlockOrdering { EioCount, }; +enum TShaderInterface +{ + // Includes both uniform blocks and buffer blocks + EsiUniform = 0, + EsiInput, + EsiOutput, + EsiNone, + + EsiCount +}; + + class TQualifier { public: static const int layoutNotSet = -1; @@ -1616,6 +1628,23 @@ public: assert(fieldName); return *fieldName; } + TShaderInterface getShaderInterface() const + { + if (basicType != EbtBlock) + return EsiNone; + + switch (qualifier.storage) { + default: + return EsiNone; + case EvqVaryingIn: + return EsiInput; + case EvqVaryingOut: + return EsiOutput; + case EvqUniform: + case EvqBuffer: + return EsiUniform; + } + } virtual TBasicType getBasicType() const { return basicType; } virtual const TSampler& getSampler() const { return sampler; } |