[glsl-in] Allow field selection behind pointers (#948)

This commit is contained in:
João Capucho 2021-06-03 21:09:20 +01:00 committed by GitHub
parent 87748a2fe3
commit 1c3baf4557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -116,7 +116,11 @@ impl Program<'_> {
name: &str,
meta: SourceMetadata,
) -> Result<Handle<Expression>, ErrorKind> {
match *self.resolve_type(ctx, expression, meta)? {
let ty = match *self.resolve_type(ctx, expression, meta)? {
TypeInner::Pointer { base, .. } => &self.module.types[base].inner,
ref ty => ty,
};
match *ty {
TypeInner::Struct { ref members, .. } => {
let index = members
.iter()

View File

@ -0,0 +1,9 @@
// AUTHOR: JCapucho
// ISSUE: #901
// FIX: #948
#version 450
void main() {
vec4 a = vec4(1.0);
a.x = 2.0;
}