HLSL: Add ConstantBuffer<T> syntax
Note: multi-dimension arrays of ConstantBuffer objects will go through uniform flattening.
This commit is contained in:
parent
a1cdd13b1c
commit
a766b838f5
8 changed files with 319 additions and 1 deletions
26
Test/hlsl.constantbuffer.frag
Normal file
26
Test/hlsl.constantbuffer.frag
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
struct c1_t {
|
||||
float4 x;
|
||||
};
|
||||
|
||||
struct c2_t {
|
||||
bool x;
|
||||
float y;
|
||||
};
|
||||
|
||||
ConstantBuffer<c1_t> cb1 : register(b12);
|
||||
ConstantBuffer<c2_t> cb2[3];
|
||||
ConstantBuffer<c2_t> cb3[2][4];
|
||||
|
||||
cbuffer cbuff {
|
||||
int c1;
|
||||
};
|
||||
|
||||
float4 main() : SV_Target0
|
||||
{
|
||||
if (cb3[1][2].x)
|
||||
return cb1.x + cb2[1].y + c1;
|
||||
else
|
||||
return cb3[2][3].y;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue