James-Jones / HLSLCrossCompiler

Other
468 stars 81 forks source link

Declaring constant buffers out of order #9

Closed Tisten closed 10 years ago

Tisten commented 10 years ago

There is a problem in reflection of constant buffers. If a buffer bound to b1 is declared before the buffer bound to b0 like this: cbuffer cb1 : register(b1) { float4x4 world_view_proj; }; cbuffer cb0 : register(b0) { float4 vars; }; void main( in float4 in_pos : POSITION0, out float4 out_pos : POSITION ) { float4 pos = in_pos + vars; out_pos = mul(pos, world_view_proj); }

the cross compiler will crash in TranslateVariableName because the buffers are swapped.