RetroArch/deps/SPIRV-Cross/shaders-msl/frag/shader-arithmetic-8bit.frag
twinaphex 420b7913d4 Squashed 'deps/SPIRV-Cross/' changes from 8aa6731925..2820ab0b51
2820ab0b51 Merge pull request #1076 from KhronosGroup/bitcast-pre-330-glsl
63bcbd511e GLSL: Need extension to use bitcast on GLSL < 330.
9f3bebe3d0 Merge pull request #1075 from lifpan/master
b11c20fc1d Remove unreasonable assertion for OpTypeImage Sampled parameter.
1a592b7c0f Merge pull request #1067 from cdavis5e/msl-scalar-block-layout
28454facbb MSL: Handle packed matrices.
ea5c0ed82f MSL: Fix alignment of packed types.
44f688bf0b Merge pull request #1070 from KhronosGroup/fix-1066
25c74b324e Forget loop variable enables after emitting block chain.
6b010e0cbc Merge pull request #1069 from KhronosGroup/fix-1053
f6f849397e MSL: Re-roll array expressions in initializers.
e5fa7edfd6 MSL: Support scalar block layout.

git-subtree-dir: deps/SPIRV-Cross
git-subtree-split: 2820ab0b51bf5e4187435d904b34e762b988f48b
2019-07-11 20:37:45 +02:00

89 lines
1.5 KiB
GLSL

#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
layout(location = 0) flat in ivec4 vColor;
layout(location = 0) out ivec4 FragColorInt;
layout(location = 1) out uvec4 FragColorUint;
layout(push_constant, std140) uniform Push
{
int8_t i8;
uint8_t u8;
} registers;
layout(binding = 1, std140) uniform UBO
{
int8_t i8;
uint8_t u8;
} ubo;
layout(binding = 2, std430) buffer SSBO
{
int8_t i8[16];
uint8_t u8[16];
} ssbo;
void packing_int8()
{
int16_t i16 = 10s;
int i32 = 20;
i8vec2 i8_2 = unpack8(i16);
i8vec4 i8_4 = unpack8(i32);
i16 = pack16(i8_2);
i32 = pack32(i8_4);
ssbo.i8[0] = i8_4.x;
ssbo.i8[1] = i8_4.y;
ssbo.i8[2] = i8_4.z;
ssbo.i8[3] = i8_4.w;
}
void packing_uint8()
{
uint16_t u16 = 10us;
uint u32 = 20u;
u8vec2 u8_2 = unpack8(u16);
u8vec4 u8_4 = unpack8(u32);
u16 = pack16(u8_2);
u32 = pack32(u8_4);
ssbo.u8[0] = u8_4.x;
ssbo.u8[1] = u8_4.y;
ssbo.u8[2] = u8_4.z;
ssbo.u8[3] = u8_4.w;
}
void compute_int8()
{
i8vec4 tmp = i8vec4(vColor);
tmp += registers.i8;
tmp += int8_t(-40);
tmp += i8vec4(-50);
tmp += i8vec4(10, 20, 30, 40);
tmp += ssbo.i8[4];
tmp += ubo.i8;
FragColorInt = ivec4(tmp);
}
void compute_uint8()
{
u8vec4 tmp = u8vec4(vColor);
tmp += registers.u8;
tmp += uint8_t(-40);
tmp += u8vec4(-50);
tmp += u8vec4(10, 20, 30, 40);
tmp += ssbo.u8[4];
tmp += ubo.u8;
FragColorUint = uvec4(tmp);
}
void main()
{
packing_int8();
packing_uint8();
compute_int8();
compute_uint8();
}