mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-27 01:03:41 +00:00
[glsl-in] Allow array constructors
This commit is contained in:
parent
70db5f681d
commit
160ab82fee
@ -243,7 +243,7 @@ impl Parser {
|
||||
}
|
||||
}
|
||||
}
|
||||
TypeInner::Struct { .. } => ctx.add_expression(
|
||||
TypeInner::Struct { .. } | TypeInner::Array { .. } => ctx.add_expression(
|
||||
Expression::Compose {
|
||||
ty,
|
||||
components: args.into_iter().map(|arg| arg.0).collect(),
|
||||
@ -253,7 +253,7 @@ impl Parser {
|
||||
),
|
||||
_ => {
|
||||
self.errors.push(Error {
|
||||
kind: ErrorKind::SemanticError("Bad cast".into()),
|
||||
kind: ErrorKind::SemanticError("Bad type constructor".into()),
|
||||
meta,
|
||||
});
|
||||
|
||||
|
@ -70,6 +70,10 @@ void testStructConstructor() {
|
||||
BST tree = BST(1);
|
||||
}
|
||||
|
||||
void testArrayConstructor() {
|
||||
float tree[1] = float[1](0.0);
|
||||
}
|
||||
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
o_color.rgba = vec4(1.0);
|
||||
|
@ -179,6 +179,11 @@ fn testStructConstructor() {
|
||||
|
||||
}
|
||||
|
||||
fn testArrayConstructor() {
|
||||
var tree1: array<f32,1> = array<f32,1>(0.0);
|
||||
|
||||
}
|
||||
|
||||
fn main1() {
|
||||
let e1: vec4<f32> = o_color;
|
||||
let e4: vec4<f32> = vec4<f32>(1.0);
|
||||
|
Loading…
Reference in New Issue
Block a user