Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around glslang issue 988 #142

Merged

Conversation

tangent-vector
Copy link
Contributor

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.

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.
@tangent-vector tangent-vector force-pushed the glslang-bug-workaround branch from 9d0b0e7 to d4cfe57 Compare July 24, 2017 01:38
@tangent-vector tangent-vector merged commit 1d4633f into shader-slang:master Jul 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant