I am trying to pass a list of Uniform
s to a vertex shader using gfx-rs. The data is defined as follows
gfx_defines! {
vertex Vertex { ... }
constant MyConst {
valoo: i32 = "my_val",
}
pipeline pipe {
my_const: gfx::ConstantBuffer<MyConst> = "my_const",
vbuf: gfx::VertexBuffer<Vertex> = (),
out: gfx::RenderTarget<ColorFormat> = "Target0",
}
}
The vertex shader is as follows:
#version 150 core
struct MyConst
{
uint my_val;
};
in vec2 a_Pos;
in vec3 a_Color;
uniform MyConst my_const[];
out vec4 v_Color;
void main() {
MyConst cc = my_const[0];
v_Color = vec4(a_Color, 1.0);
gl_Position = vec4(a_Pos, 0.0, 1.0);
}
When I introduce the first line in main()
, the application crashes with the error:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DescriptorInit(GlobalConstant("my_const[0].my_val", None))'