summaryrefslogtreecommitdiffstats
path: root/tests/rewriter/resources-in-structs.glsl
diff options
context:
space:
mode:
authorTim Foley <tfoley@nvidia.com>2017-07-23 18:22:30 -0700
committerTim Foley <tfoley@nvidia.com>2017-07-23 18:37:52 -0700
commitd4cfe5781284551d7c5ccf2cf1d28a86211bb1df (patch)
tree977c7923635dcbb57716a38cde82b75736841936 /tests/rewriter/resources-in-structs.glsl
parent376e61abe84ed386df7aa28867c1aeb5f52881ca (diff)
Work around glslang issue 988
The basic bug there is that if you have a member of `struct` type in a `uniform` block and then pass a reference to that member directly to a call: ``` struct Foo { vec4 bar; }; uniform U { Foo foo; }; void main() { doSomething(foo); } ``` then glslang generates invalid SPIR-V which seems to cause an issue for some drivers. This change works around the problem by detecting cases where an argument to a function call is a reference to `uniform` block member (of `struct` type) and then rewrites the code to move that value to a temporary before the call.
Diffstat (limited to 'tests/rewriter/resources-in-structs.glsl')
-rw-r--r--tests/rewriter/resources-in-structs.glsl3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/rewriter/resources-in-structs.glsl b/tests/rewriter/resources-in-structs.glsl
index 6273e8720..206e4a8d8 100644
--- a/tests/rewriter/resources-in-structs.glsl
+++ b/tests/rewriter/resources-in-structs.glsl
@@ -55,8 +55,9 @@ out vec4 color;
void main()
{
+ Material SLANG_tmp_0 = m;
color = evaluateMaterial(
- m,
+ SLANG_tmp_0,
SLANG_parameterBlock_U_m_t,
SLANG_parameterBlock_U_m_s, uv);
}