Updated spirv-cross.

This commit is contained in:
Бранимир Караџић
2019-02-01 21:35:55 -08:00
parent 926ce6a7b4
commit 06e8c2e7ed
119 changed files with 1401 additions and 573 deletions

View File

@@ -1,8 +1,8 @@
#!/bin/bash
GLSLANG_REV=91ac4290bcf2cb930b4fb0981f09c00c0b6797e1
SPIRV_TOOLS_REV=9bfe0eb25e3dfdf4f3fd86ab6c0cda009c9bd661
SPIRV_HEADERS_REV=d5b2e1255f706ce1f88812217e9a554f299848af
GLSLANG_REV=c9e03360e2a78a95a8571292aefa5ddbdbf66daf
SPIRV_TOOLS_REV=e2279da7148d19bd21c6d47ffc96ee4176f43dba
SPIRV_HEADERS_REV=8bea0a266ac9b718aa0818d9e3a47c0b77c2cb23
if [ -d external/glslang ]; then
echo "Updating glslang to revision $GLSLANG_REV."

View File

@@ -0,0 +1,23 @@
static const float4 _20[2] = { float4(1.0f, 2.0f, 3.0f, 4.0f), 10.0f.xxxx };
static float4 FragColors[2] = _20;
static float4 FragColor = 5.0f.xxxx;
struct SPIRV_Cross_Output
{
float4 FragColors[2] : SV_Target0;
float4 FragColor : SV_Target2;
};
void frag_main()
{
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColors = FragColors;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@@ -13,21 +13,21 @@ struct SPIRV_Cross_Output
void frag_main()
{
bool _29;
float4 _33;
for (;;)
{
_29 = counter == 10;
if (_29)
if (counter == 10)
{
_33 = 10.0f.xxxx;
break;
}
else
{
_33 = 30.0f.xxxx;
break;
}
}
bool4 _35 = _29.xxxx;
FragColor = float4(_35.x ? 10.0f.xxxx.x : 30.0f.xxxx.x, _35.y ? 10.0f.xxxx.y : 30.0f.xxxx.y, _35.z ? 10.0f.xxxx.z : 30.0f.xxxx.z, _35.w ? 10.0f.xxxx.w : 30.0f.xxxx.w);
FragColor = _33;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -1,10 +1,10 @@
static float4 gl_Position;
static int gl_VertexID;
static int gl_InstanceID;
static int gl_VertexIndex;
static int gl_InstanceIndex;
struct SPIRV_Cross_Input
{
uint gl_VertexID : SV_VertexID;
uint gl_InstanceID : SV_InstanceID;
uint gl_VertexIndex : SV_VertexID;
uint gl_InstanceIndex : SV_InstanceID;
};
struct SPIRV_Cross_Output
@@ -14,13 +14,13 @@ struct SPIRV_Cross_Output
void vert_main()
{
gl_Position = float(gl_VertexID + gl_InstanceID).xxxx;
gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_VertexID = int(stage_input.gl_VertexID);
gl_InstanceID = int(stage_input.gl_InstanceID);
gl_VertexIndex = int(stage_input.gl_VertexIndex);
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;

View File

@@ -23,7 +23,7 @@ struct B
#define SPIRV_CROSS_CONSTANT_ID_2 300
#endif
static const int c = SPIRV_CROSS_CONSTANT_ID_2;
static const int _18 = (c + 50);
static const int d = (c + 50);
#ifndef SPIRV_CROSS_CONSTANT_ID_3
#define SPIRV_CROSS_CONSTANT_ID_3 400
#endif

View File

@@ -22,26 +22,11 @@ struct SPIRV_Cross_Output
float FragColor : SV_Target0;
};
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
{
return coord.x / coord.y;
}
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
{
return float2(coord.x, coord.y) / coord.z;
}
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
{
return float3(coord.x, coord.y, coord.z) / coord.w;
}
void frag_main()
{
float4 _80 = vDirRef;
_80.z = vDirRef.w;
FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1));
FragColor = (((((((uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1)) + uSampler2DArray.SampleCmp(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmp(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSamplerCubeArray.SampleCmp(_uSamplerCubeArray_sampler, vDirRef, 0.5f)) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1))) + uSampler2DArray.SampleCmpLevelZero(_uSampler2DArray_sampler, vDirRef.xyz, vDirRef.w, int2(-1, -1))) + uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w)) + uSampler2D.SampleCmp(_uSampler2D_sampler, _80.xy / _80.z, vDirRef.z / _80.z, int2(1, 1))) + uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, _80.xy / _80.z, vDirRef.z / _80.z, int2(1, 1));
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -3,7 +3,7 @@
#endif
static const uint s = SPIRV_CROSS_CONSTANT_ID_0;
static const bool _13 = (s > 20u);
static const uint _16 = _13 ? 30u : 50u;
static const uint f = _13 ? 30u : 50u;
static float FragColor;
@@ -14,7 +14,7 @@ struct SPIRV_Cross_Output
void frag_main()
{
FragColor = float(_16);
FragColor = float(f);
}
SPIRV_Cross_Output main()

View File

@@ -42,24 +42,12 @@ struct SPIRV_Cross_Output
float4 FragColor : SV_Target0;
};
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
{
return coord.x / coord.y;
}
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
{
return float2(coord.x, coord.y) / coord.z;
}
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
{
return float3(coord.x, coord.y, coord.z) / coord.w;
}
void frag_main()
{
float4 _162 = (((((((((((((((((((tex1d.Sample(_tex1d_sampler, texCoord1d) + tex1d.Sample(_tex1d_sampler, texCoord1d, 1)) + tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f)) + tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f)) + tex1d.Sample(_tex1d_sampler, SPIRV_Cross_projectTextureCoordinate(float2(texCoord1d, 2.0f)))) + tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f)) + tex2d.Sample(_tex2d_sampler, texCoord2d)) + tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2))) + tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f)) + tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2d.Sample(_tex2d_sampler, SPIRV_Cross_projectTextureCoordinate(float3(texCoord2d, 2.0f)))) + tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f)) + tex3d.Sample(_tex3d_sampler, texCoord3d)) + tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3))) + tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f)) + tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3d.Sample(_tex3d_sampler, SPIRV_Cross_projectTextureCoordinate(float4(texCoord3d, 2.0f)))) + tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f)) + texCube.Sample(_texCube_sampler, texCoord3d)) + texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f)) + texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f);
float2 _41 = float2(texCoord1d, 2.0f);
float3 _88 = float3(texCoord2d, 2.0f);
float4 _135 = float4(texCoord3d, 2.0f);
float4 _162 = (((((((((((((((((((tex1d.Sample(_tex1d_sampler, texCoord1d) + tex1d.Sample(_tex1d_sampler, texCoord1d, 1)) + tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f)) + tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f)) + tex1d.Sample(_tex1d_sampler, _41.x / _41.y)) + tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f)) + tex2d.Sample(_tex2d_sampler, texCoord2d)) + tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2))) + tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f)) + tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f))) + tex2d.Sample(_tex2d_sampler, _88.xy / _88.z)) + tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f)) + tex3d.Sample(_tex3d_sampler, texCoord3d)) + tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3))) + tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f)) + tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f))) + tex3d.Sample(_tex3d_sampler, _135.xyz / _135.w)) + tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f)) + texCube.Sample(_texCube_sampler, texCoord3d)) + texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f)) + texCube.SampleBias(_texCube_sampler, texCoord3d, 1.0f);
float4 _333 = _162;
_333.w = ((_162.w + tex1dShadow.SampleCmp(_tex1dShadow_sampler, float3(texCoord1d, 0.0f, 0.0f).x, 0.0f)) + tex2dShadow.SampleCmp(_tex2dShadow_sampler, float3(texCoord2d, 0.0f).xy, 0.0f)) + texCubeShadow.SampleCmp(_texCubeShadow_sampler, float4(texCoord3d, 0.0f).xyz, 0.0f);
float4 _308 = ((((((((((((((_333 + tex1dArray.Sample(_tex1dArray_sampler, texCoord2d)) + tex2dArray.Sample(_tex2dArray_sampler, texCoord3d)) + texCubeArray.Sample(_texCubeArray_sampler, texCoord4d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d)) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d)) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d)) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d)) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherRed(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherGreen(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherBlue(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.GatherAlpha(_tex2d_sampler, texCoord2d, int2(1, 1))) + tex2d.Load(int3(int2(1, 2), 0))) + separateTex2d.Sample(samplerNonDepth, texCoord2d);

View File

@@ -26,32 +26,17 @@ struct SPIRV_Cross_Output
float FragColor : SV_Target0;
};
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
{
return coord.x / coord.y;
}
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
{
return float2(coord.x, coord.y) / coord.z;
}
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
{
return float3(coord.x, coord.y, coord.z) / coord.w;
}
void frag_main()
{
float4 _20 = vClip4;
_20.y = vClip4.w;
FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, SPIRV_Cross_projectTextureCoordinate(_20.xy), vClip4.z);
FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, _20.x / _20.y, vClip4.z / _20.y);
float4 _30 = vClip4;
_30.z = vClip4.w;
FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, SPIRV_Cross_projectTextureCoordinate(_30.xyz), vClip4.z);
FragColor = uSampler1D.Sample(_uSampler1D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip2)).x;
FragColor = uSampler2D.Sample(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip3)).x;
FragColor = uSampler3D.Sample(_uSampler3D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip4)).x;
FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, _30.xy / _30.z, vClip4.z / _30.z);
FragColor = uSampler1D.Sample(_uSampler1D_sampler, vClip2.x / vClip2.y).x;
FragColor = uSampler2D.Sample(_uSampler2D_sampler, vClip3.xy / vClip3.z).x;
FragColor = uSampler3D.Sample(_uSampler3D_sampler, vClip4.xyz / vClip4.w).x;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -1,4 +1,4 @@
cbuffer UBO
cbuffer UBO : register(b0)
{
row_major float4x4 _16_uMVP : packoffset(c0);
};

View File

@@ -22,7 +22,7 @@ struct A_2
struct A_3
{
A_2 Data[1024];
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ A_2 Data[1024];
};
struct B
@@ -32,7 +32,7 @@ struct B
struct B_1
{
A_2 Data[1024];
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ A_2 Data[1024];
};
kernel void main0(device B& C3 [[buffer(0)]], device A_1& C1 [[buffer(1)]], constant A_3& C2 [[buffer(2)]], constant B_1& C4 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])

View File

@@ -0,0 +1,24 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant float4 _20[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
struct main0_out
{
float4 FragColors_0 [[color(0)]];
float4 FragColors_1 [[color(1)]];
float4 FragColor [[color(2)]];
};
fragment main0_out main0()
{
main0_out out = {};
float4 FragColors[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
out.FragColor = float4(5.0);
out.FragColors_0 = FragColors[0];
out.FragColors_1 = FragColors[1];
return out;
}

View File

@@ -16,21 +16,21 @@ struct main0_in
fragment main0_out main0(main0_in in [[stage_in]])
{
main0_out out = {};
bool _29;
float4 _33;
for (;;)
{
_29 = in.counter == 10;
if (_29)
if (in.counter == 10)
{
_33 = float4(10.0);
break;
}
else
{
_33 = float4(30.0);
break;
}
}
bool4 _35 = bool4(_29);
out.FragColor = float4(_35.x ? float4(10.0).x : float4(30.0).x, _35.y ? float4(10.0).y : float4(30.0).y, _35.z ? float4(10.0).z : float4(30.0).z, _35.w ? float4(10.0).w : float4(30.0).w);
out.FragColor = _33;
return out;
}

View File

@@ -73,7 +73,7 @@ struct _18
float2 _m24;
float2 _m25;
float2 _m26;
char pad27[8];
char _m27_pad[8];
packed_float3 _m27;
float _m28;
float _m29;

View File

@@ -40,6 +40,8 @@ kernel void main0(device SSBO& ssbo [[buffer(2)]])
{
_52 = 10;
} while (!atomic_compare_exchange_weak_explicit((volatile device atomic_int*)&ssbo.i32, &_52, 2, memory_order_relaxed, memory_order_relaxed));
shared_u32 = 10u;
shared_i32 = 10;
uint _57 = atomic_fetch_add_explicit((volatile threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed);
uint _58 = atomic_fetch_or_explicit((volatile threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed);
uint _59 = atomic_fetch_xor_explicit((volatile threadgroup atomic_uint*)&shared_u32, 1u, memory_order_relaxed);

View File

@@ -15,7 +15,7 @@ struct SSBO1
kernel void main0(device SSBO0& _25 [[buffer(0)]], device SSBO1& _39 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
{
_39.outputs[gl_GlobalInvocationID.x].x = int(as_type<uint>(as_type<half2>(_25.inputs[gl_GlobalInvocationID.x].xy) + half2(half(1))));
_39.outputs[gl_GlobalInvocationID.x].x = int(as_type<uint>(as_type<half2>(_25.inputs[gl_GlobalInvocationID.x].xy) + half2(1.0h)));
_39.outputs[gl_GlobalInvocationID.x].y = as_type<int>(_25.inputs[gl_GlobalInvocationID.x].zw);
_39.outputs[gl_GlobalInvocationID.x].z = int(as_type<uint>(ushort2(_25.inputs[gl_GlobalInvocationID.x].xy)));
}

View File

@@ -28,14 +28,14 @@ struct B
#define SPIRV_CROSS_CONSTANT_ID_2 300
#endif
constant int c = SPIRV_CROSS_CONSTANT_ID_2;
constant int _18 = (c + 50);
constant int d = (c + 50);
struct SSBO
{
A member_a;
B member_b;
int v[a];
int w[_18];
int w[d];
};
constant int e_tmp [[function_constant(3)]];

View File

@@ -43,7 +43,6 @@ struct Content
S1 m1;
S2 m2;
S3 m3;
char pad7[4];
float m4;
S4 m3s[8];
};
@@ -53,7 +52,6 @@ struct SSBO1
Content content;
Content content1[2];
Content content2;
char pad3[8];
float2x2 m0;
float2x2 m1;
float2x3 m2[4];
@@ -61,9 +59,9 @@ struct SSBO1
float2x2 m4;
float2x2 m5[9];
packed_float2x3 m6[4][2];
char pad10[8];
char _m10_pad[8];
float3x2 m7;
char pad11[8];
char _m11_pad[8];
float array[1];
};
@@ -105,9 +103,9 @@ struct Content_1
S1_1 m1;
S2_1 m2;
S3_1 m3;
char pad7[4];
float m4;
S4_1 m3s[8];
char _m8_pad[12];
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ S4_1 m3s[8];
};
struct SSBO0

View File

@@ -0,0 +1,77 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBO
{
char i8[16];
uchar u8[16];
};
struct Push
{
char i8;
uchar u8;
};
struct UBO
{
char i8;
uchar u8;
};
struct main0_out
{
int4 FragColorInt [[color(0)]];
uint4 FragColorUint [[color(1)]];
};
struct main0_in
{
int4 vColor [[user(locn0)]];
};
fragment main0_out main0(main0_in in [[stage_in]], constant Push& registers [[buffer(0)]], constant UBO& ubo [[buffer(1)]], device SSBO& ssbo [[buffer(2)]])
{
main0_out out = {};
short _196 = 10;
int _197 = 20;
char2 _198 = as_type<char2>(_196);
char4 _199 = as_type<char4>(_197);
_196 = as_type<short>(_198);
_197 = as_type<int>(_199);
ssbo.i8[0] = _199.x;
ssbo.i8[1] = _199.y;
ssbo.i8[2] = _199.z;
ssbo.i8[3] = _199.w;
ushort _220 = 10u;
uint _221 = 20u;
uchar2 _222 = as_type<uchar2>(_220);
uchar4 _223 = as_type<uchar4>(_221);
_220 = as_type<ushort>(_222);
_221 = as_type<uint>(_223);
ssbo.u8[0] = _223.x;
ssbo.u8[1] = _223.y;
ssbo.u8[2] = _223.z;
ssbo.u8[3] = _223.w;
char4 _246 = char4(in.vColor);
char4 _244 = _246;
_244 += char4(registers.i8);
_244 += char4(-40);
_244 += char4(-50);
_244 += char4(char(10), char(20), char(30), char(40));
_244 += char4(ssbo.i8[4]);
_244 += char4(ubo.i8);
out.FragColorInt = int4(_244);
uchar4 _271 = uchar4(_246);
_271 += uchar4(registers.u8);
_271 += uchar4(216);
_271 += uchar4(206);
_271 += uchar4(uchar(10), uchar(20), uchar(30), uchar(40));
_271 += uchar4(ssbo.u8[4]);
_271 += uchar4(ubo.u8);
out.FragColorUint = uint4(_271);
return out;
}

View File

@@ -6,7 +6,7 @@ using namespace metal;
constant uint s_tmp [[function_constant(0)]];
constant uint s = is_function_constant_defined(s_tmp) ? s_tmp : 10u;
constant bool _13 = (s > 20u);
constant uint _16 = _13 ? 30u : 50u;
constant uint f = _13 ? 30u : 50u;
struct main0_out
{
@@ -16,7 +16,7 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
out.FragColor = float(_16);
out.FragColor = float(f);
return out;
}

View File

@@ -20,7 +20,7 @@ fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uShadow2D [[te
main0_out out = {};
float4 _20 = in.vClip4;
_20.z = in.vClip4.w;
out.FragColor = uShadow2D.sample_compare(uShadow2DSmplr, _20.xy / _20.z, in.vClip4.z);
out.FragColor = uShadow2D.sample_compare(uShadow2DSmplr, _20.xy / _20.z, in.vClip4.z / _20.z);
out.FragColor = uSampler1D.sample(uSampler1DSmplr, in.vClip2.x / in.vClip2.y).x;
out.FragColor = uSampler2D.sample(uSampler2DSmplr, in.vClip3.xy / in.vClip3.z).x;
out.FragColor = uSampler3D.sample(uSampler3DSmplr, in.vClip4.xyz / in.vClip4.w).x;

View File

@@ -27,10 +27,10 @@ vertex void main0(main0_in in [[stage_in]], constant _40& _42 [[buffer(0)]], dev
{
main0_out out = {};
out.gl_Position = in.m_17;
for (int _51 = 0; _51 < 1024; )
for (int _52 = 0; _52 < 1024; )
{
_37._m0[_51] = _42._m0[_51];
_51++;
_37._m0[_52] = _42._m0[_52];
_52++;
continue;
}
}

View File

@@ -16,7 +16,7 @@ struct _42
float4x4 _m0;
float4x4 _m1;
float _m2;
char pad3[12];
char _m3_pad[12];
packed_float3 _m3;
float _m4;
packed_float3 _m5;

View File

@@ -20,14 +20,8 @@ struct constant_block
#endif
constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0;
vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array<texture2d<int>, 3> images [[texture(0)]])
vertex void main0(constant constant_block* constants_0 [[buffer(4)]], constant constant_block* constants_1 [[buffer(5)]], constant constant_block* constants_2 [[buffer(6)]], constant constant_block* constants_3 [[buffer(7)]], device storage_block* storage_0 [[buffer(8)]], device storage_block* storage_1 [[buffer(9)]], array<texture2d<int>, 3> images [[texture(0)]])
{
device storage_block* storage[] =
{
storage_0,
storage_1,
};
constant constant_block* constants[] =
{
constants_0,
@@ -35,7 +29,13 @@ vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_
constants_2,
constants_3,
};
device storage_block* storage[] =
{
storage_0,
storage_1,
};
storage[0]->baz = uint4(constants[3]->foo);
storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy;
}

View File

@@ -20,14 +20,8 @@ struct constant_block
#endif
constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0;
vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array<texture2d<int>, 3> images [[texture(0)]])
vertex void main0(constant constant_block* constants_0 [[buffer(4)]], constant constant_block* constants_1 [[buffer(5)]], constant constant_block* constants_2 [[buffer(6)]], constant constant_block* constants_3 [[buffer(7)]], device storage_block* storage_0 [[buffer(8)]], device storage_block* storage_1 [[buffer(9)]], array<texture2d<int>, 3> images [[texture(0)]])
{
device storage_block* storage[] =
{
storage_0,
storage_1,
};
constant constant_block* constants[] =
{
constants_0,
@@ -35,7 +29,13 @@ vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_
constants_2,
constants_3,
};
device storage_block* storage[] =
{
storage_0,
storage_1,
};
storage[0]->baz = uint4(constants[3]->foo);
storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy;
}

View File

@@ -7,7 +7,7 @@ struct UBO
{
float4x4 mvp;
float2 targSize;
char pad2[8];
char _m2_pad[8];
packed_float3 color;
float opacity;
};

View File

@@ -6,7 +6,7 @@ layout(binding = 0, std430) buffer Buf
vec4 _data[];
} Buf_1;
layout(std430) buffer Buf_count
layout(binding = 1, std430) buffer Buf_count
{
int _count;
} Buf_count_1;

View File

@@ -14,17 +14,16 @@ int _240;
void main()
{
bool _246;
uint _227;
int _237;
int _236;
for (;;)
{
_227 = 0u;
bool _164;
bool _231;
int _237;
for (;;)
{
_164 = _227 < _11.shadowCascadesNum;
if (_164)
if (_227 < _11.shadowCascadesNum)
{
mat4 _228;
for (;;)
@@ -44,6 +43,7 @@ void main()
if ((((_179 >= 0.0) && (_179 <= 1.0)) && (max(_186, _188) <= 1.0)) && (min(_186, _188) >= 0.0))
{
_237 = int(_227);
_231 = true;
break;
}
else
@@ -57,16 +57,18 @@ void main()
else
{
_237 = _240;
_231 = false;
break;
}
}
_246 = _164 ? true : false;
if (_246)
if (_231)
{
_236 = _237;
break;
}
_236 = -1;
break;
}
_entryPointOutput = _246 ? _237 : (-1);
_entryPointOutput = _236;
}

View File

@@ -0,0 +1,11 @@
#version 450
layout(location = 0) out vec4 FragColors[2];
layout(location = 2) out vec4 FragColor;
void main()
{
FragColors = vec4[](vec4(1.0, 2.0, 3.0, 4.0), vec4(10.0));
FragColor = vec4(5.0);
}

View File

@@ -5,7 +5,7 @@ struct MyStruct
vec4 color;
};
layout(std140) uniform MyStruct_CB
layout(binding = 0, std140) uniform MyStruct_CB
{
MyStruct g_MyStruct[4];
} _6;

View File

@@ -5,19 +5,20 @@ layout(location = 0) out vec4 FragColor;
void main()
{
bool _29;
vec4 _33;
for (;;)
{
_29 = counter == 10;
if (_29)
if (counter == 10)
{
_33 = vec4(10.0);
break;
}
else
{
_33 = vec4(30.0);
break;
}
}
FragColor = mix(vec4(30.0), vec4(10.0), bvec4(_29));
FragColor = _33;
}

View File

@@ -3,15 +3,11 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
@@ -31,7 +27,7 @@ void main()
{
uint ident = gl_GlobalInvocationID.x;
f16vec2 a = int16BitsToFloat16(_25.inputs[ident].xy);
_39.outputs[ident].x = int(packFloat2x16(a + f16vec2(float16_t(1), float16_t(1))));
_39.outputs[ident].x = int(packFloat2x16(a + f16vec2(1.0hf)));
_39.outputs[ident].y = packInt2x16(_25.inputs[ident].zw);
_39.outputs[ident].z = int(packUint2x16(u16vec2(_25.inputs[ident].xy)));
}

View File

@@ -1,8 +1,6 @@
#version 450
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
@@ -10,8 +8,6 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif

View File

@@ -3,8 +3,6 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif

View File

@@ -5,7 +5,7 @@ out gl_PerVertex
vec4 gl_Position;
};
layout(std140) uniform UBO
layout(binding = 0, std140) uniform UBO
{
mat4 uMVP;
} _16;

View File

@@ -3,15 +3,11 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif

View File

@@ -2,7 +2,7 @@
#extension GL_EXT_tessellation_shader : require
layout(vertices = 1) out;
layout(std140) uniform UBO
layout(binding = 0, std140) uniform UBO
{
vec4 uScale;
vec3 uCamPos;

View File

@@ -1,6 +1,6 @@
#version 310 es
layout(std140) uniform UBO
layout(binding = 0, std140) uniform UBO
{
mat4 uMVP;
} _16;

View File

@@ -26,7 +26,7 @@ struct B
#define SPIRV_CROSS_CONSTANT_ID_2 300
#endif
const int c = SPIRV_CROSS_CONSTANT_ID_2;
const int _18 = (c + 50);
const int d = (c + 50);
#ifndef SPIRV_CROSS_CONSTANT_ID_3
#define SPIRV_CROSS_CONSTANT_ID_3 400
#endif
@@ -37,7 +37,7 @@ layout(binding = 0, std430) buffer SSBO
A member_a;
B member_b;
int v[a];
int w[_18];
int w[d];
} _22;
void main()

View File

@@ -17,7 +17,7 @@ struct B
};
layout(constant_id = 2) const int c = 300;
const int _18 = (c + 50);
const int d = (c + 50);
layout(constant_id = 3) const int e = 400;
layout(set = 1, binding = 0, std430) buffer SSBO
@@ -25,7 +25,7 @@ layout(set = 1, binding = 0, std430) buffer SSBO
A member_a;
B member_b;
int v[a];
int w[_18];
int w[d];
} _22;
void main()

View File

@@ -0,0 +1,69 @@
#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
layout(set = 0, binding = 1, std430) buffer SSBO
{
int8_t i8[16];
uint8_t u8[16];
} ssbo;
layout(set = 0, binding = 0, std140) uniform UBO
{
int8_t i8;
uint8_t u8;
} ubo;
layout(push_constant, std430) uniform Push
{
int8_t i8;
uint8_t u8;
} registers;
layout(location = 0) flat in ivec4 vColor;
layout(location = 0) out ivec4 FragColorInt;
layout(location = 1) out uvec4 FragColorUint;
void main()
{
int16_t _196 = 10s;
int _197 = 20;
i8vec2 _198 = unpack8(_196);
i8vec4 _199 = unpack8(_197);
_196 = pack16(_198);
_197 = pack32(_199);
ssbo.i8[0] = _199.x;
ssbo.i8[1] = _199.y;
ssbo.i8[2] = _199.z;
ssbo.i8[3] = _199.w;
uint16_t _220 = 10us;
uint _221 = 20u;
u8vec2 _222 = unpack8(_220);
u8vec4 _223 = unpack8(_221);
_220 = pack16(_222);
_221 = pack32(_223);
ssbo.u8[0] = _223.x;
ssbo.u8[1] = _223.y;
ssbo.u8[2] = _223.z;
ssbo.u8[3] = _223.w;
i8vec4 _246 = i8vec4(vColor);
i8vec4 _244 = _246;
_244 += i8vec4(registers.i8);
_244 += i8vec4(-40);
_244 += i8vec4(-50);
_244 += i8vec4(int8_t(10), int8_t(20), int8_t(30), int8_t(40));
_244 += i8vec4(ssbo.i8[4]);
_244 += i8vec4(ubo.i8);
FragColorInt = ivec4(_244);
u8vec4 _271 = u8vec4(_246);
_271 += u8vec4(registers.u8);
_271 += u8vec4(216);
_271 += u8vec4(206);
_271 += u8vec4(uint8_t(10), uint8_t(20), uint8_t(30), uint8_t(40));
_271 += u8vec4(ssbo.u8[4]);
_271 += u8vec4(ubo.u8);
FragColorUint = uvec4(_271);
}

View File

@@ -5,12 +5,12 @@
#endif
const uint s = SPIRV_CROSS_CONSTANT_ID_0;
const bool _13 = (s > 20u);
const uint _16 = _13 ? 30u : 50u;
const uint f = _13 ? 30u : 50u;
layout(location = 0) out float FragColor;
void main()
{
FragColor = float(_16);
FragColor = float(f);
}

View File

@@ -2,12 +2,12 @@
layout(constant_id = 0) const uint s = 10u;
const bool _13 = (s > 20u);
const uint _16 = _13 ? 30u : 50u;
const uint f = _13 ? 30u : 50u;
layout(location = 0) out float FragColor;
void main()
{
FragColor = float(_16);
FragColor = float(f);
}

View File

@@ -1,18 +1,14 @@
#version 450
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
#extension GL_EXT_shader_8bit_storage : require
#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require
#if defined(GL_AMD_gpu_shader_half_float)
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif

View File

@@ -1,16 +1,12 @@
#version 450
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
#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_16bit_storage)
#extension GL_EXT_shader_16bit_storage : 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

View File

@@ -0,0 +1,23 @@
static const float4 _20[2] = { float4(1.0f, 2.0f, 3.0f, 4.0f), 10.0f.xxxx };
static float4 FragColors[2] = _20;
static float4 FragColor = 5.0f.xxxx;
struct SPIRV_Cross_Output
{
float4 FragColors[2] : SV_Target0;
float4 FragColor : SV_Target2;
};
void frag_main()
{
}
SPIRV_Cross_Output main()
{
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColors = FragColors;
stage_output.FragColor = FragColor;
return stage_output;
}

View File

@@ -1,10 +1,10 @@
static float4 gl_Position;
static int gl_VertexID;
static int gl_InstanceID;
static int gl_VertexIndex;
static int gl_InstanceIndex;
struct SPIRV_Cross_Input
{
uint gl_VertexID : SV_VertexID;
uint gl_InstanceID : SV_InstanceID;
uint gl_VertexIndex : SV_VertexID;
uint gl_InstanceIndex : SV_InstanceID;
};
struct SPIRV_Cross_Output
@@ -14,13 +14,13 @@ struct SPIRV_Cross_Output
void vert_main()
{
gl_Position = float(gl_VertexID + gl_InstanceID).xxxx;
gl_Position = float(gl_VertexIndex + gl_InstanceIndex).xxxx;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
gl_VertexID = int(stage_input.gl_VertexID);
gl_InstanceID = int(stage_input.gl_InstanceID);
gl_VertexIndex = int(stage_input.gl_VertexIndex);
gl_InstanceIndex = int(stage_input.gl_InstanceIndex);
vert_main();
SPIRV_Cross_Output stage_output;
stage_output.gl_Position = gl_Position;

View File

@@ -23,7 +23,7 @@ struct B
#define SPIRV_CROSS_CONSTANT_ID_2 300
#endif
static const int c = SPIRV_CROSS_CONSTANT_ID_2;
static const int _18 = (c + 50);
static const int d = (c + 50);
#ifndef SPIRV_CROSS_CONSTANT_ID_3
#define SPIRV_CROSS_CONSTANT_ID_3 400
#endif

View File

@@ -22,21 +22,6 @@ struct SPIRV_Cross_Output
float FragColor : SV_Target0;
};
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
{
return coord.x / coord.y;
}
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
{
return float2(coord.x, coord.y) / coord.z;
}
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
{
return float3(coord.x, coord.y, coord.z) / coord.w;
}
void frag_main()
{
float s0 = uSampler2D.SampleCmp(_uSampler2D_sampler, vUVRef.xy, vUVRef.z, int2(-1, -1));
@@ -48,10 +33,10 @@ void frag_main()
float l2 = uSamplerCube.SampleCmpLevelZero(_uSamplerCube_sampler, vDirRef.xyz, vDirRef.w);
float4 _80 = vDirRef;
_80.z = vDirRef.w;
float p0 = uSampler2D.SampleCmp(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_80.xyz), vDirRef.z, int2(1, 1));
float p0 = uSampler2D.SampleCmp(_uSampler2D_sampler, _80.xy / _80.z, vDirRef.z / _80.z, int2(1, 1));
float4 _87 = vDirRef;
_87.z = vDirRef.w;
float p1 = uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(_87.xyz), vDirRef.z, int2(1, 1));
float p1 = uSampler2D.SampleCmpLevelZero(_uSampler2D_sampler, _87.xy / _87.z, vDirRef.z / _87.z, int2(1, 1));
FragColor = (((((((s0 + s1) + s2) + s3) + l0) + l1) + l2) + p0) + p1;
}

View File

@@ -3,7 +3,7 @@
#endif
static const uint s = SPIRV_CROSS_CONSTANT_ID_0;
static const bool _13 = (s > 20u);
static const uint _16 = _13 ? 30u : 50u;
static const uint f = _13 ? 30u : 50u;
static float FragColor;
@@ -14,7 +14,7 @@ struct SPIRV_Cross_Output
void frag_main()
{
FragColor = float(_16);
FragColor = float(f);
}
SPIRV_Cross_Output main()

View File

@@ -42,40 +42,28 @@ struct SPIRV_Cross_Output
float4 FragColor : SV_Target0;
};
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
{
return coord.x / coord.y;
}
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
{
return float2(coord.x, coord.y) / coord.z;
}
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
{
return float3(coord.x, coord.y, coord.z) / coord.w;
}
void frag_main()
{
float4 texcolor = tex1d.Sample(_tex1d_sampler, texCoord1d);
texcolor += tex1d.Sample(_tex1d_sampler, texCoord1d, 1);
texcolor += tex1d.SampleLevel(_tex1d_sampler, texCoord1d, 2.0f);
texcolor += tex1d.SampleGrad(_tex1d_sampler, texCoord1d, 1.0f, 2.0f);
texcolor += tex1d.Sample(_tex1d_sampler, SPIRV_Cross_projectTextureCoordinate(float2(texCoord1d, 2.0f)));
float2 _41 = float2(texCoord1d, 2.0f);
texcolor += tex1d.Sample(_tex1d_sampler, _41.x / _41.y);
texcolor += tex1d.SampleBias(_tex1d_sampler, texCoord1d, 1.0f);
texcolor += tex2d.Sample(_tex2d_sampler, texCoord2d);
texcolor += tex2d.Sample(_tex2d_sampler, texCoord2d, int2(1, 2));
texcolor += tex2d.SampleLevel(_tex2d_sampler, texCoord2d, 2.0f);
texcolor += tex2d.SampleGrad(_tex2d_sampler, texCoord2d, float2(1.0f, 2.0f), float2(3.0f, 4.0f));
texcolor += tex2d.Sample(_tex2d_sampler, SPIRV_Cross_projectTextureCoordinate(float3(texCoord2d, 2.0f)));
float3 _88 = float3(texCoord2d, 2.0f);
texcolor += tex2d.Sample(_tex2d_sampler, _88.xy / _88.z);
texcolor += tex2d.SampleBias(_tex2d_sampler, texCoord2d, 1.0f);
texcolor += tex3d.Sample(_tex3d_sampler, texCoord3d);
texcolor += tex3d.Sample(_tex3d_sampler, texCoord3d, int3(1, 2, 3));
texcolor += tex3d.SampleLevel(_tex3d_sampler, texCoord3d, 2.0f);
texcolor += tex3d.SampleGrad(_tex3d_sampler, texCoord3d, float3(1.0f, 2.0f, 3.0f), float3(4.0f, 5.0f, 6.0f));
texcolor += tex3d.Sample(_tex3d_sampler, SPIRV_Cross_projectTextureCoordinate(float4(texCoord3d, 2.0f)));
float4 _135 = float4(texCoord3d, 2.0f);
texcolor += tex3d.Sample(_tex3d_sampler, _135.xyz / _135.w);
texcolor += tex3d.SampleBias(_tex3d_sampler, texCoord3d, 1.0f);
texcolor += texCube.Sample(_texCube_sampler, texCoord3d);
texcolor += texCube.SampleLevel(_texCube_sampler, texCoord3d, 2.0f);

View File

@@ -26,32 +26,17 @@ struct SPIRV_Cross_Output
float FragColor : SV_Target0;
};
float SPIRV_Cross_projectTextureCoordinate(float2 coord)
{
return coord.x / coord.y;
}
float2 SPIRV_Cross_projectTextureCoordinate(float3 coord)
{
return float2(coord.x, coord.y) / coord.z;
}
float3 SPIRV_Cross_projectTextureCoordinate(float4 coord)
{
return float3(coord.x, coord.y, coord.z) / coord.w;
}
void frag_main()
{
float4 _20 = vClip4;
_20.y = vClip4.w;
FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, SPIRV_Cross_projectTextureCoordinate(_20.xy), vClip4.z);
FragColor = uShadow1D.SampleCmp(_uShadow1D_sampler, _20.x / _20.y, vClip4.z / _20.y);
float4 _30 = vClip4;
_30.z = vClip4.w;
FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, SPIRV_Cross_projectTextureCoordinate(_30.xyz), vClip4.z);
FragColor = uSampler1D.Sample(_uSampler1D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip2)).x;
FragColor = uSampler2D.Sample(_uSampler2D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip3)).x;
FragColor = uSampler3D.Sample(_uSampler3D_sampler, SPIRV_Cross_projectTextureCoordinate(vClip4)).x;
FragColor = uShadow2D.SampleCmp(_uShadow2D_sampler, _30.xy / _30.z, vClip4.z / _30.z);
FragColor = uSampler1D.Sample(_uSampler1D_sampler, vClip2.x / vClip2.y).x;
FragColor = uSampler2D.Sample(_uSampler2D_sampler, vClip3.xy / vClip3.z).x;
FragColor = uSampler3D.Sample(_uSampler3D_sampler, vClip4.xyz / vClip4.w).x;
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)

View File

@@ -1,4 +1,4 @@
cbuffer UBO
cbuffer UBO : register(b0)
{
row_major float4x4 _16_uMVP : packoffset(c0);
};

View File

@@ -163,7 +163,7 @@ fragment void main0(constant spvAux& spvAuxBuffer [[buffer(0)]], texture1d<float
c = spvTextureSwizzle(tex3d.sample(tex3dSamp, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl);
float4 _152 = float4(0.0, 0.0, 1.0, 1.0);
_152.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, _152.xy / _152.z, float4(0.0, 0.0, 1.0, 1.0).z), depth2dSwzl);
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, _152.xy / _152.z, float4(0.0, 0.0, 1.0, 1.0).z / _152.z), depth2dSwzl);
c = spvTextureSwizzle(tex1d.sample(tex1dSamp, 0.0), tex1dSwzl);
c = spvTextureSwizzle(tex2d.sample(tex2dSamp, float2(0.0), level(0.0)), tex2dSwzl);
c = spvTextureSwizzle(tex3d.sample(tex3dSamp, float3(0.0), level(0.0)), tex3dSwzl);
@@ -176,7 +176,7 @@ fragment void main0(constant spvAux& spvAuxBuffer [[buffer(0)]], texture1d<float
c = spvTextureSwizzle(tex3d.sample(tex3dSamp, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl);
float4 _202 = float4(0.0, 0.0, 1.0, 1.0);
_202.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, _202.xy / _202.z, float4(0.0, 0.0, 1.0, 1.0).z, level(0.0)), depth2dSwzl);
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSamp, _202.xy / _202.z, float4(0.0, 0.0, 1.0, 1.0).z / _202.z, level(0.0)), depth2dSwzl);
c = spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl);
c = spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl);
c = spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl);

View File

@@ -153,7 +153,7 @@ float4 doSwizzle(thread texture1d<float> tex1d, thread const sampler tex1dSmplr,
c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl);
float4 _103 = float4(0.0, 0.0, 1.0, 1.0);
_103.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _103.xy / _103.z, float4(0.0, 0.0, 1.0, 1.0).z), depth2dSwzl);
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _103.xy / _103.z, float4(0.0, 0.0, 1.0, 1.0).z / _103.z), depth2dSwzl);
c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl);
c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0), level(0.0)), tex2dSwzl);
c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0), level(0.0)), tex3dSwzl);
@@ -166,7 +166,7 @@ float4 doSwizzle(thread texture1d<float> tex1d, thread const sampler tex1dSmplr,
c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl);
float4 _131 = float4(0.0, 0.0, 1.0, 1.0);
_131.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _131.xy / _131.z, float4(0.0, 0.0, 1.0, 1.0).z, level(0.0)), depth2dSwzl);
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _131.xy / _131.z, float4(0.0, 0.0, 1.0, 1.0).z / _131.z, level(0.0)), depth2dSwzl);
c = spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl);
c = spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl);
c = spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl);

View File

@@ -163,7 +163,7 @@ fragment void main0(constant spvAux& spvAuxBuffer [[buffer(0)]], texture1d<float
c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), tex3dSwzl);
float4 _100 = float4(0.0, 0.0, 1.0, 1.0);
_100.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _100.xy / _100.z, float4(0.0, 0.0, 1.0, 1.0).z), depth2dSwzl);
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _100.xy / _100.z, float4(0.0, 0.0, 1.0, 1.0).z / _100.z), depth2dSwzl);
c = spvTextureSwizzle(tex1d.sample(tex1dSmplr, 0.0), tex1dSwzl);
c = spvTextureSwizzle(tex2d.sample(tex2dSmplr, float2(0.0), level(0.0)), tex2dSwzl);
c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float3(0.0), level(0.0)), tex3dSwzl);
@@ -176,7 +176,7 @@ fragment void main0(constant spvAux& spvAuxBuffer [[buffer(0)]], texture1d<float
c = spvTextureSwizzle(tex3d.sample(tex3dSmplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), tex3dSwzl);
float4 _128 = float4(0.0, 0.0, 1.0, 1.0);
_128.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _128.xy / _128.z, float4(0.0, 0.0, 1.0, 1.0).z, level(0.0)), depth2dSwzl);
c.x = spvTextureSwizzle(depth2d.sample_compare(depth2dSmplr, _128.xy / _128.z, float4(0.0, 0.0, 1.0, 1.0).z / _128.z, level(0.0)), depth2dSwzl);
c = spvTextureSwizzle(tex1d.read(uint(0)), tex1dSwzl);
c = spvTextureSwizzle(tex2d.read(uint2(int2(0)), 0), tex2dSwzl);
c = spvTextureSwizzle(tex3d.read(uint3(int3(0)), 0), tex3dSwzl);

View File

@@ -158,7 +158,7 @@ float4 do_samples(thread const texture1d<float> t1, thread const sampler t1Smplr
c = spvTextureSwizzle(t3.sample(t3Smplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w), t3Swzl);
float4 _119 = float4(0.0, 0.0, 1.0, 1.0);
_119.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, _119.xy / _119.z, float4(0.0, 0.0, 1.0, 1.0).z), d2Swzl);
c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, _119.xy / _119.z, float4(0.0, 0.0, 1.0, 1.0).z / _119.z), d2Swzl);
c = spvTextureSwizzle(t1.sample(t1Smplr, 0.0), t1Swzl);
c = spvTextureSwizzle(t2.sample(defaultSampler, float2(0.0), level(0.0)), t2Swzl);
c = spvTextureSwizzle(t3.sample(t3Smplr, float3(0.0), level(0.0)), t3Swzl);
@@ -171,7 +171,7 @@ float4 do_samples(thread const texture1d<float> t1, thread const sampler t1Smplr
c = spvTextureSwizzle(t3.sample(t3Smplr, float4(0.0, 0.0, 0.0, 1.0).xyz / float4(0.0, 0.0, 0.0, 1.0).w, level(0.0)), t3Swzl);
float4 _153 = float4(0.0, 0.0, 1.0, 1.0);
_153.z = float4(0.0, 0.0, 1.0, 1.0).w;
c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, _153.xy / _153.z, float4(0.0, 0.0, 1.0, 1.0).z, level(0.0)), d2Swzl);
c.x = spvTextureSwizzle(d2.sample_compare(d2Smplr, _153.xy / _153.z, float4(0.0, 0.0, 1.0, 1.0).z / _153.z, level(0.0)), d2Swzl);
c = spvTextureSwizzle(t1.read(uint(0)), t1Swzl);
c = spvTextureSwizzle(t2.read(uint2(int2(0)), 0), t2Swzl);
c = spvTextureSwizzle(t3.read(uint3(int3(0)), 0), t3Swzl);

View File

@@ -22,7 +22,7 @@ struct A_2
struct A_3
{
A_2 Data[1024];
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ A_2 Data[1024];
};
struct B
@@ -32,7 +32,7 @@ struct B
struct B_1
{
A_2 Data[1024];
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ A_2 Data[1024];
};
kernel void main0(device B& C3 [[buffer(0)]], device A_1& C1 [[buffer(1)]], constant A_3& C2 [[buffer(2)]], constant B_1& C4 [[buffer(3)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])

View File

@@ -0,0 +1,24 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
constant float4 _20[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
struct main0_out
{
float4 FragColors_0 [[color(0)]];
float4 FragColors_1 [[color(1)]];
float4 FragColor [[color(2)]];
};
fragment main0_out main0()
{
main0_out out = {};
float4 FragColors[2] = { float4(1.0, 2.0, 3.0, 4.0), float4(10.0) };
out.FragColor = float4(5.0);
out.FragColors_0 = FragColors[0];
out.FragColors_1 = FragColors[1];
return out;
}

View File

@@ -73,7 +73,7 @@ struct _18
float2 _m24;
float2 _m25;
float2 _m26;
char pad27[8];
char _m27_pad[8];
packed_float3 _m27;
float _m28;
float _m29;

View File

@@ -17,7 +17,7 @@ kernel void main0(device SSBO0& _25 [[buffer(0)]], device SSBO1& _39 [[buffer(1)
{
uint ident = gl_GlobalInvocationID.x;
half2 a = as_type<half2>(_25.inputs[ident].xy);
_39.outputs[ident].x = int(as_type<uint>(a + half2(half(1), half(1))));
_39.outputs[ident].x = int(as_type<uint>(a + half2(1.0h)));
_39.outputs[ident].y = as_type<int>(_25.inputs[ident].zw);
_39.outputs[ident].z = int(as_type<uint>(ushort2(_25.inputs[ident].xy)));
}

View File

@@ -28,14 +28,14 @@ struct B
#define SPIRV_CROSS_CONSTANT_ID_2 300
#endif
constant int c = SPIRV_CROSS_CONSTANT_ID_2;
constant int _18 = (c + 50);
constant int d = (c + 50);
struct SSBO
{
A member_a;
B member_b;
int v[a];
int w[_18];
int w[d];
};
constant int e_tmp [[function_constant(3)]];

View File

@@ -43,7 +43,6 @@ struct Content
S1 m1;
S2 m2;
S3 m3;
char pad7[4];
float m4;
S4 m3s[8];
};
@@ -53,7 +52,6 @@ struct SSBO1
Content content;
Content content1[2];
Content content2;
char pad3[8];
float2x2 m0;
float2x2 m1;
float2x3 m2[4];
@@ -61,9 +59,9 @@ struct SSBO1
float2x2 m4;
float2x2 m5[9];
packed_float2x3 m6[4][2];
char pad10[8];
char _m10_pad[8];
float3x2 m7;
char pad11[8];
char _m11_pad[8];
float array[1];
};
@@ -105,9 +103,9 @@ struct Content_1
S1_1 m1;
S2_1 m2;
S3_1 m3;
char pad7[4];
float m4;
S4_1 m3s[8];
char _m8_pad[12];
/* FIXME: A padded struct is needed here. If you see this message, file a bug! */ S4_1 m3s[8];
};
struct SSBO0

View File

@@ -0,0 +1,98 @@
#pragma clang diagnostic ignored "-Wmissing-prototypes"
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct SSBO
{
char i8[16];
uchar u8[16];
};
struct Push
{
char i8;
uchar u8;
};
struct UBO
{
char i8;
uchar u8;
};
struct main0_out
{
int4 FragColorInt [[color(0)]];
uint4 FragColorUint [[color(1)]];
};
struct main0_in
{
int4 vColor [[user(locn0)]];
};
void packing_int8(device SSBO& ssbo)
{
short i16 = 10;
int i32 = 20;
char2 i8_2 = as_type<char2>(i16);
char4 i8_4 = as_type<char4>(i32);
i16 = as_type<short>(i8_2);
i32 = as_type<int>(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(device SSBO& ssbo)
{
ushort u16 = 10u;
uint u32 = 20u;
uchar2 u8_2 = as_type<uchar2>(u16);
uchar4 u8_4 = as_type<uchar4>(u32);
u16 = as_type<ushort>(u8_2);
u32 = as_type<uint>(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(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread int4& FragColorInt)
{
char4 tmp = char4(vColor);
tmp += char4(registers.i8);
tmp += char4(char(-40));
tmp += char4(-50);
tmp += char4(char(10), char(20), char(30), char(40));
tmp += char4(ssbo.i8[4]);
tmp += char4(ubo.i8);
FragColorInt = int4(tmp);
}
void compute_uint8(device SSBO& ssbo, thread int4& vColor, constant Push& registers, constant UBO& ubo, thread uint4& FragColorUint)
{
uchar4 tmp = uchar4(char4(vColor));
tmp += uchar4(registers.u8);
tmp += uchar4(uchar(216));
tmp += uchar4(206);
tmp += uchar4(uchar(10), uchar(20), uchar(30), uchar(40));
tmp += uchar4(ssbo.u8[4]);
tmp += uchar4(ubo.u8);
FragColorUint = uint4(tmp);
}
fragment main0_out main0(main0_in in [[stage_in]], constant Push& registers [[buffer(0)]], constant UBO& ubo [[buffer(1)]], device SSBO& ssbo [[buffer(2)]])
{
main0_out out = {};
packing_int8(ssbo);
packing_uint8(ssbo);
compute_int8(ssbo, in.vColor, registers, ubo, out.FragColorInt);
compute_uint8(ssbo, in.vColor, registers, ubo, out.FragColorUint);
return out;
}

View File

@@ -6,7 +6,7 @@ using namespace metal;
constant uint s_tmp [[function_constant(0)]];
constant uint s = is_function_constant_defined(s_tmp) ? s_tmp : 10u;
constant bool _13 = (s > 20u);
constant uint _16 = _13 ? 30u : 50u;
constant uint f = _13 ? 30u : 50u;
struct main0_out
{
@@ -16,7 +16,7 @@ struct main0_out
fragment main0_out main0()
{
main0_out out = {};
out.FragColor = float(_16);
out.FragColor = float(f);
return out;
}

View File

@@ -20,7 +20,7 @@ fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uShadow2D [[te
main0_out out = {};
float4 _20 = in.vClip4;
_20.z = in.vClip4.w;
out.FragColor = uShadow2D.sample_compare(uShadow2DSmplr, _20.xy / _20.z, in.vClip4.z);
out.FragColor = uShadow2D.sample_compare(uShadow2DSmplr, _20.xy / _20.z, in.vClip4.z / _20.z);
out.FragColor = uSampler1D.sample(uSampler1DSmplr, in.vClip2.x / in.vClip2.y).x;
out.FragColor = uSampler2D.sample(uSampler2DSmplr, in.vClip3.xy / in.vClip3.z).x;
out.FragColor = uSampler3D.sample(uSampler3DSmplr, in.vClip4.xyz / in.vClip4.w).x;

View File

@@ -16,7 +16,7 @@ struct _42
float4x4 _m0;
float4x4 _m1;
float _m2;
char pad3[12];
char _m3_pad[12];
packed_float3 _m3;
float _m4;
packed_float3 _m5;

View File

@@ -28,14 +28,8 @@ void doWork(device storage_block* (&storage)[2], constant constant_block* (&cons
storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy;
}
vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array<texture2d<int>, 3> images [[texture(0)]])
vertex void main0(constant constant_block* constants_0 [[buffer(4)]], constant constant_block* constants_1 [[buffer(5)]], constant constant_block* constants_2 [[buffer(6)]], constant constant_block* constants_3 [[buffer(7)]], device storage_block* storage_0 [[buffer(8)]], device storage_block* storage_1 [[buffer(9)]], array<texture2d<int>, 3> images [[texture(0)]])
{
device storage_block* storage[] =
{
storage_0,
storage_1,
};
constant constant_block* constants[] =
{
constants_0,
@@ -43,7 +37,13 @@ vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_
constants_2,
constants_3,
};
device storage_block* storage[] =
{
storage_0,
storage_1,
};
doWork(storage, constants, images);
}

View File

@@ -20,14 +20,8 @@ struct constant_block
#endif
constant int arraySize = SPIRV_CROSS_CONSTANT_ID_0;
vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_block* storage_1 [[buffer(1)]], constant constant_block* constants_0 [[buffer(2)]], constant constant_block* constants_1 [[buffer(3)]], constant constant_block* constants_2 [[buffer(4)]], constant constant_block* constants_3 [[buffer(5)]], array<texture2d<int>, 3> images [[texture(0)]])
vertex void main0(constant constant_block* constants_0 [[buffer(4)]], constant constant_block* constants_1 [[buffer(5)]], constant constant_block* constants_2 [[buffer(6)]], constant constant_block* constants_3 [[buffer(7)]], device storage_block* storage_0 [[buffer(8)]], device storage_block* storage_1 [[buffer(9)]], array<texture2d<int>, 3> images [[texture(0)]])
{
device storage_block* storage[] =
{
storage_0,
storage_1,
};
constant constant_block* constants[] =
{
constants_0,
@@ -35,7 +29,13 @@ vertex void main0(device storage_block* storage_0 [[buffer(0)]], device storage_
constants_2,
constants_3,
};
device storage_block* storage[] =
{
storage_0,
storage_1,
};
storage[0]->baz = uint4(constants[3]->foo);
storage[1]->quux = images[2].read(uint2(int2(constants[1]->bar))).xy;
}

View File

@@ -7,7 +7,7 @@ struct UBO
{
float4x4 mvp;
float2 targSize;
char pad2[8];
char _m2_pad[8];
packed_float3 color;
float opacity;
};

View File

@@ -6,7 +6,7 @@ layout(binding = 0, std430) buffer Buf
vec4 _data[];
} Buf_1;
layout(std430) buffer Buf_count
layout(binding = 1, std430) buffer Buf_count
{
int _count;
} Buf_count_1;

View File

@@ -0,0 +1,11 @@
#version 450
layout(location = 0) out vec4 FragColors[2];
layout(location = 2) out vec4 FragColor;
void main()
{
FragColors = vec4[](vec4(1.0, 2.0, 3.0, 4.0), vec4(10.0));
FragColor = vec4(5.0);
}

View File

@@ -5,7 +5,7 @@ struct MyStruct
vec4 color;
};
layout(std140) uniform MyStruct_CB
layout(binding = 0, std140) uniform MyStruct_CB
{
MyStruct g_MyStruct[4];
} _6;

View File

@@ -3,15 +3,11 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
@@ -31,7 +27,7 @@ void main()
{
uint ident = gl_GlobalInvocationID.x;
f16vec2 a = int16BitsToFloat16(_25.inputs[ident].xy);
_39.outputs[ident].x = int(packFloat2x16(a + f16vec2(float16_t(1), float16_t(1))));
_39.outputs[ident].x = int(packFloat2x16(a + f16vec2(1.0hf)));
_39.outputs[ident].y = packInt2x16(_25.inputs[ident].zw);
_39.outputs[ident].z = int(packUint2x16(u16vec2(_25.inputs[ident].xy)));
}

View File

@@ -1,8 +1,6 @@
#version 450
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
@@ -10,8 +8,6 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif

View File

@@ -3,8 +3,6 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif

View File

@@ -5,7 +5,7 @@ out gl_PerVertex
vec4 gl_Position;
};
layout(std140) uniform UBO
layout(binding = 0, std140) uniform UBO
{
mat4 uMVP;
} _16;

View File

@@ -3,15 +3,11 @@
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif

View File

@@ -2,7 +2,7 @@
#extension GL_EXT_tessellation_shader : require
layout(vertices = 1) out;
layout(std140) uniform UBO
layout(binding = 0, std140) uniform UBO
{
vec4 uScale;
vec3 uCamPos;

View File

@@ -1,6 +1,6 @@
#version 310 es
layout(std140) uniform UBO
layout(binding = 0, std140) uniform UBO
{
mat4 uMVP;
} _16;

View File

@@ -26,7 +26,7 @@ struct B
#define SPIRV_CROSS_CONSTANT_ID_2 300
#endif
const int c = SPIRV_CROSS_CONSTANT_ID_2;
const int _18 = (c + 50);
const int d = (c + 50);
#ifndef SPIRV_CROSS_CONSTANT_ID_3
#define SPIRV_CROSS_CONSTANT_ID_3 400
#endif
@@ -37,7 +37,7 @@ layout(binding = 0, std430) buffer SSBO
A member_a;
B member_b;
int v[a];
int w[_18];
int w[d];
} _22;
void main()

View File

@@ -17,7 +17,7 @@ struct B
};
layout(constant_id = 2) const int c = 300;
const int _18 = (c + 50);
const int d = (c + 50);
layout(constant_id = 3) const int e = 400;
layout(set = 1, binding = 0, std430) buffer SSBO
@@ -25,7 +25,7 @@ layout(set = 1, binding = 0, std430) buffer SSBO
A member_a;
B member_b;
int v[a];
int w[_18];
int w[d];
} _22;
void main()

View File

@@ -0,0 +1,88 @@
#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
layout(set = 0, binding = 1, std430) buffer SSBO
{
int8_t i8[16];
uint8_t u8[16];
} ssbo;
layout(set = 0, binding = 0, std140) uniform UBO
{
int8_t i8;
uint8_t u8;
} ubo;
layout(push_constant, std430) uniform Push
{
int8_t i8;
uint8_t u8;
} registers;
layout(location = 0) flat in ivec4 vColor;
layout(location = 0) out ivec4 FragColorInt;
layout(location = 1) out uvec4 FragColorUint;
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 += i8vec4(registers.i8);
tmp += i8vec4(int8_t(-40));
tmp += i8vec4(-50);
tmp += i8vec4(int8_t(10), int8_t(20), int8_t(30), int8_t(40));
tmp += i8vec4(ssbo.i8[4]);
tmp += i8vec4(ubo.i8);
FragColorInt = ivec4(tmp);
}
void compute_uint8()
{
u8vec4 tmp = u8vec4(i8vec4(vColor));
tmp += u8vec4(registers.u8);
tmp += u8vec4(uint8_t(216));
tmp += u8vec4(206);
tmp += u8vec4(uint8_t(10), uint8_t(20), uint8_t(30), uint8_t(40));
tmp += u8vec4(ssbo.u8[4]);
tmp += u8vec4(ubo.u8);
FragColorUint = uvec4(tmp);
}
void main()
{
packing_int8();
packing_uint8();
compute_int8();
compute_uint8();
}

View File

@@ -5,12 +5,12 @@
#endif
const uint s = SPIRV_CROSS_CONSTANT_ID_0;
const bool _13 = (s > 20u);
const uint _16 = _13 ? 30u : 50u;
const uint f = _13 ? 30u : 50u;
layout(location = 0) out float FragColor;
void main()
{
FragColor = float(_16);
FragColor = float(f);
}

View File

@@ -2,12 +2,12 @@
layout(constant_id = 0) const uint s = 10u;
const bool _13 = (s > 20u);
const uint _16 = _13 ? 30u : 50u;
const uint f = _13 ? 30u : 50u;
layout(location = 0) out float FragColor;
void main()
{
FragColor = float(_16);
FragColor = float(f);
}

View File

@@ -1,18 +1,14 @@
#version 450
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
#extension GL_EXT_shader_8bit_storage : require
#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require
#if defined(GL_AMD_gpu_shader_half_float)
#extension GL_AMD_gpu_shader_half_float : require
#elif defined(GL_NV_gpu_shader5)
#extension GL_NV_gpu_shader5 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for FP16.
#endif

View File

@@ -1,16 +1,12 @@
#version 450
#if defined(GL_AMD_gpu_shader_int16)
#extension GL_AMD_gpu_shader_int16 : require
#elif defined(GL_EXT_shader_16bit_storage)
#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
#extension GL_EXT_shader_16bit_storage : require
#else
#error No extension available for Int16.
#endif
#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_16bit_storage)
#extension GL_EXT_shader_16bit_storage : 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

View File

@@ -7,7 +7,6 @@
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %2 "main"
OpExecutionMode %2 OriginUpperLeft
OpName %Test "Test"
OpName %t "t"
OpName %retvar "retvar"

View File

@@ -0,0 +1,41 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 25
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %FragColors %FragColor
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 450
OpName %main "main"
OpName %FragColors "FragColors"
OpName %FragColor "FragColor"
OpDecorate %FragColors Location 0
OpDecorate %FragColor Location 2
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2
%_ptr_Output__arr_v4float_uint_2 = OpTypePointer Output %_arr_v4float_uint_2
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%17 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
%float_10 = OpConstant %float 10
%19 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10
%20 = OpConstantComposite %_arr_v4float_uint_2 %17 %19
%_ptr_Output_v4float = OpTypePointer Output %v4float
%float_5 = OpConstant %float 5
%24 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5
%FragColors = OpVariable %_ptr_Output__arr_v4float_uint_2 Output %20
%FragColor = OpVariable %_ptr_Output_v4float Output %24
%main = OpFunction %void None %3
%5 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -22,8 +22,8 @@
OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
OpDecorate %gl_PerVertex Block
OpDecorate %gl_VertexID BuiltIn VertexId
OpDecorate %gl_InstanceID BuiltIn InstanceId
OpDecorate %gl_VertexID BuiltIn VertexIndex
OpDecorate %gl_InstanceID BuiltIn InstanceIndex
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32

View File

@@ -7,7 +7,6 @@
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %2 "main"
OpExecutionMode %2 OriginUpperLeft
OpName %Test "Test"
OpName %t "t"
OpName %retvar "retvar"

View File

@@ -22,6 +22,7 @@
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 7
OpDecorate %buffer DescriptorSet 0
OpDecorate %buffer Binding 0
OpDecorate %group_id BuiltIn WorkgroupId
OpDecorate %group_index BuiltIn LocalInvocationIndex
%void = OpTypeVoid

View File

@@ -9,6 +9,7 @@
OpEntryPoint Fragment %func_alt "main2" %frag_in %frag_out
OpEntryPoint GLCompute %func "main"
OpExecutionMode %func LocalSize 1 1 1
OpExecutionMode %func_alt OriginUpperLeft
OpSource ESSL 310
OpSourceExtension "GL_GOOGLE_cpp_style_line_directive"
OpSourceExtension "GL_GOOGLE_include_directive"

View File

@@ -20,6 +20,8 @@
OpDecorate %bufA BufferBlock
OpDecorate %bufA_0 DescriptorSet 0
OpDecorate %bufB DescriptorSet 0
OpDecorate %bufA_0 Binding 0
OpDecorate %bufB Binding 1
%void = OpTypeVoid
%3 = OpTypeFunction %void
%uint = OpTypeInt 32 0

View File

@@ -7,7 +7,7 @@
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %2 "main" %3
OpExecutionMode %2 OriginLowerLeft
OpExecutionMode %2 OriginUpperLeft
OpDecorate %3 Location 0
%void = OpTypeVoid
%9 = OpTypeFunction %void

View File

@@ -34,6 +34,7 @@
OpMemberDecorate %buf 1 Offset 256
OpDecorate %buf Block
OpDecorate %_ DescriptorSet 0
OpDecorate %_ Binding 0
OpDecorate %pos_1 BuiltIn FragCoord
OpDecorate %_entryPointOutput Location 0
%void = OpTypeVoid

View File

@@ -6,6 +6,7 @@
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %8 %16 %22 %28 %33 %o0
OpExecutionMode %main OriginUpperLeft
OpName %main "main"
OpName %v1 "v1"
OpName %v2 "v2"

View File

@@ -6,6 +6,7 @@
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %o0
OpExecutionMode %main OriginUpperLeft
OpName %main "main"
OpName %t0 "t0"
OpName %o0 "o0"

View File

@@ -0,0 +1,41 @@
; SPIR-V
; Version: 1.0
; Generator: Khronos Glslang Reference Front End; 7
; Bound: 25
; Schema: 0
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %FragColors %FragColor
OpExecutionMode %main OriginUpperLeft
OpSource GLSL 450
OpName %main "main"
OpName %FragColors "FragColors"
OpName %FragColor "FragColor"
OpDecorate %FragColors Location 0
OpDecorate %FragColor Location 2
%void = OpTypeVoid
%3 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%uint = OpTypeInt 32 0
%uint_2 = OpConstant %uint 2
%_arr_v4float_uint_2 = OpTypeArray %v4float %uint_2
%_ptr_Output__arr_v4float_uint_2 = OpTypePointer Output %_arr_v4float_uint_2
%float_1 = OpConstant %float 1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
%17 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
%float_10 = OpConstant %float 10
%19 = OpConstantComposite %v4float %float_10 %float_10 %float_10 %float_10
%20 = OpConstantComposite %_arr_v4float_uint_2 %17 %19
%_ptr_Output_v4float = OpTypePointer Output %v4float
%float_5 = OpConstant %float 5
%24 = OpConstantComposite %v4float %float_5 %float_5 %float_5 %float_5
%FragColors = OpVariable %_ptr_Output__arr_v4float_uint_2 Output %20
%FragColor = OpVariable %_ptr_Output_v4float Output %24
%main = OpFunction %void None %3
%5 = OpLabel
OpReturn
OpFunctionEnd

View File

@@ -0,0 +1,88 @@
#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();
}

Some files were not shown because too many files have changed in this diff Show More