SPIRV-Cross/reference/opt/shaders-hlsl/frag/spec-constant-block-size.frag
Hans-Kristian Arntzen 226d837d7e HLSL: Use same logic as GLSL for picking cbuffer block name.
HLSL just picked the variable name which did not work as expected for
some users. Use the same logic as GLSL and set up declared_block_names,
so the actual name can be queried later.
2018-10-22 09:50:04 +02:00

35 lines
574 B
GLSL

static const int Value = 2;
cbuffer SpecConstArray : register(b0)
{
float4 _15_samples[Value] : packoffset(c0);
};
static float4 FragColor;
static int Index;
struct SPIRV_Cross_Input
{
nointerpolation int Index : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = _15_samples[Index];
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
Index = stage_input.Index;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}