SPIRV-Cross/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag
Hans-Kristian Arntzen 6a614cc7f7 Normalize all internal workaround methods to use spv prefix.
We have been interchanging spv and SPIRV_Cross_ for a while, which
causes weirdness since we don't explicitly ban SPIRV_Cross identifiers,
as these identifiers are generally used for interface variable
workarounds.
2020-11-23 15:42:27 +01:00

34 lines
678 B
GLSL

static float4 FragColor;
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
uint64_t spvPackUint2x32(uint2 value)
{
return (uint64_t(value.y) << 32) | uint64_t(value.x);
}
uint2 spvUnpackUint2x32(uint64_t value)
{
uint2 Unpacked;
Unpacked.x = uint(value & 0xffffffff);
Unpacked.y = uint(value >> 32);
return Unpacked;
}
void frag_main()
{
uint2 unpacked = spvUnpackUint2x32(spvPackUint2x32(uint2(18u, 52u)));
FragColor = float4(float(unpacked.x), float(unpacked.y), 1.0f, 1.0f);
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}