SPIRV-Cross/reference/shaders/vulkan/vert/small-storage.vk.vert.vk
Hans-Kristian Arntzen 2ed171e525 GLSL/MSL: Implement 8-bit part of VK_KHR_shader_float16_int8.
Storage was in place already, so mostly just dealing with bitcasts and
constants.

Simplies some of the bitcasting logic, and this exposed some bugs in the
implementation. Refactor to use correct width integers with explicit bitcast opcodes.
2019-01-30 15:45:24 +01:00

56 lines
1.6 KiB
Plaintext

#version 450
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
#extension GL_EXT_shader_16bit_storage : require
#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require
#extension GL_EXT_shader_8bit_storage : require
#if defined(GL_AMD_gpu_shader_half_float)
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_EXT_shader_explicit_arithmetic_types_float16)
#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
#else
#error No extension available for FP16.
#endif
layout(set = 0, binding = 0, std140) uniform block
{
i16vec2 a;
u16vec2 b;
i8vec2 c;
u8vec2 d;
f16vec2 e;
} _26;
layout(set = 0, binding = 1, std430) readonly buffer storage
{
i16vec3 f;
u16vec3 g;
i8vec3 h;
u8vec3 i;
f16vec3 j;
} _53;
layout(push_constant, std430) uniform pushconst
{
i16vec4 k;
u16vec4 l;
i8vec4 m;
u8vec4 n;
f16vec4 o;
} _76;
layout(location = 0) out i16vec4 p;
layout(location = 0, component = 0) in int16_t foo;
layout(location = 1) out u16vec4 q;
layout(location = 0, component = 1) in uint16_t bar;
layout(location = 2) out f16vec4 r;
layout(location = 1) in float16_t baz;
void main()
{
p = i16vec4((((ivec4(int(foo)) + ivec4(ivec2(_26.a), ivec2(_26.c))) - ivec4(ivec3(_53.f) / ivec3(_53.h), 1)) + ivec4(_76.k)) + ivec4(_76.m));
q = u16vec4((((uvec4(uint(bar)) + uvec4(uvec2(_26.b), uvec2(_26.d))) - uvec4(uvec3(_53.g) / uvec3(_53.i), 1u)) + uvec4(_76.l)) + uvec4(_76.n));
r = f16vec4(((vec4(float(baz)) + vec4(vec2(_26.e), 0.0, 1.0)) - vec4(vec3(_53.j), 1.0)) + vec4(_76.o));
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
}