SPIRV-Cross/reference/shaders-no-opt/comp/glsl.std450.comp
Hans-Kristian Arntzen c7eda1bce9 Test glsl.std450 more exhaustively.
Make sure to test everything with scalar as well to catch any weird edge
cases.

Not all opcodes are covered here, just the arithmetic ones. FP64 packing
is also ignored.
2019-07-17 11:53:05 +02:00

113 lines
3.4 KiB
Plaintext

#version 450
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
struct ResType
{
float _m0;
int _m1;
};
layout(binding = 0, std430) buffer SSBO
{
float res;
int ires;
uint ures;
vec4 f32;
ivec4 s32;
uvec4 u32;
mat2 m2;
mat3 m3;
mat4 m4;
} _19;
void main()
{
_19.res = round(_19.f32.x);
_19.res = roundEven(_19.f32.x);
_19.res = trunc(_19.f32.x);
_19.res = abs(_19.f32.x);
_19.ires = abs(_19.s32.x);
_19.res = sign(_19.f32.x);
_19.ires = sign(_19.s32.x);
_19.res = floor(_19.f32.x);
_19.res = ceil(_19.f32.x);
_19.res = fract(_19.f32.x);
_19.res = radians(_19.f32.x);
_19.res = degrees(_19.f32.x);
_19.res = sin(_19.f32.x);
_19.res = cos(_19.f32.x);
_19.res = tan(_19.f32.x);
_19.res = asin(_19.f32.x);
_19.res = acos(_19.f32.x);
_19.res = atan(_19.f32.x);
_19.res = sinh(_19.f32.x);
_19.res = cosh(_19.f32.x);
_19.res = tanh(_19.f32.x);
_19.res = asinh(_19.f32.x);
_19.res = acosh(_19.f32.x);
_19.res = atanh(_19.f32.x);
_19.res = atan(_19.f32.x, _19.f32.y);
_19.res = pow(_19.f32.x, _19.f32.y);
_19.res = exp(_19.f32.x);
_19.res = log(_19.f32.x);
_19.res = exp2(_19.f32.x);
_19.res = log2(_19.f32.x);
_19.res = sqrt(_19.f32.x);
_19.res = inversesqrt(_19.f32.x);
_19.res = length(_19.f32.x);
_19.res = distance(_19.f32.x, _19.f32.y);
_19.res = normalize(_19.f32.x);
_19.res = faceforward(_19.f32.x, _19.f32.y, _19.f32.z);
_19.res = reflect(_19.f32.x, _19.f32.y);
_19.res = refract(_19.f32.x, _19.f32.y, _19.f32.z);
_19.res = length(_19.f32.xy);
_19.res = distance(_19.f32.xy, _19.f32.zw);
vec2 v2 = normalize(_19.f32.xy);
v2 = faceforward(_19.f32.xy, _19.f32.yz, _19.f32.zw);
v2 = reflect(_19.f32.xy, _19.f32.zw);
v2 = refract(_19.f32.xy, _19.f32.yz, _19.f32.w);
vec3 v3 = cross(_19.f32.xyz, _19.f32.yzw);
_19.res = determinant(_19.m2);
_19.res = determinant(_19.m3);
_19.res = determinant(_19.m4);
_19.m2 = inverse(_19.m2);
_19.m3 = inverse(_19.m3);
_19.m4 = inverse(_19.m4);
float tmp;
float _287 = modf(_19.f32.x, tmp);
_19.res = _287;
_19.res = min(_19.f32.x, _19.f32.y);
_19.ures = min(_19.u32.x, _19.u32.y);
_19.ires = min(_19.s32.x, _19.s32.y);
_19.res = max(_19.f32.x, _19.f32.y);
_19.ures = max(_19.u32.x, _19.u32.y);
_19.ires = max(_19.s32.x, _19.s32.y);
_19.res = clamp(_19.f32.x, _19.f32.y, _19.f32.z);
_19.ures = clamp(_19.u32.x, _19.u32.y, _19.u32.z);
_19.ires = clamp(_19.s32.x, _19.s32.y, _19.s32.z);
_19.res = mix(_19.f32.x, _19.f32.y, _19.f32.z);
_19.res = step(_19.f32.x, _19.f32.y);
_19.res = smoothstep(_19.f32.x, _19.f32.y, _19.f32.z);
_19.res = fma(_19.f32.x, _19.f32.y, _19.f32.z);
ResType _387;
_387._m0 = frexp(_19.f32.x, _387._m1);
int itmp = _387._m1;
_19.res = _387._m0;
_19.res = ldexp(_19.f32.x, itmp);
_19.ures = packSnorm4x8(_19.f32);
_19.ures = packUnorm4x8(_19.f32);
_19.ures = packSnorm2x16(_19.f32.xy);
_19.ures = packUnorm2x16(_19.f32.xy);
_19.ures = packHalf2x16(_19.f32.xy);
v2 = unpackSnorm2x16(_19.u32.x);
v2 = unpackUnorm2x16(_19.u32.x);
v2 = unpackHalf2x16(_19.u32.x);
vec4 v4 = unpackSnorm4x8(_19.u32.x);
v4 = unpackUnorm4x8(_19.u32.x);
_19.s32 = findLSB(_19.s32);
_19.s32 = findLSB(_19.u32);
_19.s32 = findMSB(_19.s32);
_19.s32 = findMSB(_19.u32);
}