Uniform
gfx-rs を使用して頂点シェーダーに s のリストを渡そうとしています。データは次のように定義されます
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",
}
}
頂点シェーダーは次のとおりです。
#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);
}
の最初の行を導入するmain()
と、アプリケーションが次のエラーでクラッシュします。
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: DescriptorInit(GlobalConstant("my_const[0].my_val", None))'