Add newly moved reference files.
This commit is contained in:
parent
cdbd376c42
commit
a6afda650f
@ -0,0 +1,16 @@
|
||||
static const uint _5 = 9u;
|
||||
static const uint _6 = 4u;
|
||||
static const uint3 gl_WorkGroupSize = uint3(_5, 20u, _6);
|
||||
|
||||
RWByteAddressBuffer _4 : register(u0);
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
_4.Store(0, asuint(asfloat(_4.Load(0)) + 1.0f));
|
||||
}
|
||||
|
||||
[numthreads(9, 20, 4)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
void vert_main()
|
||||
{
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vert_main();
|
||||
}
|
113
reference/shaders-hlsl-no-opt/comp/bitfield.comp
Normal file
113
reference/shaders-hlsl-no-opt/comp/bitfield.comp
Normal file
@ -0,0 +1,113 @@
|
||||
uint SPIRV_Cross_bitfieldInsert(uint Base, uint Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint2 SPIRV_Cross_bitfieldInsert(uint2 Base, uint2 Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint3 SPIRV_Cross_bitfieldInsert(uint3 Base, uint3 Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint4 SPIRV_Cross_bitfieldInsert(uint4 Base, uint4 Insert, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : (((1u << Count) - 1) << (Offset & 31));
|
||||
return (Base & ~Mask) | ((Insert << Offset) & Mask);
|
||||
}
|
||||
|
||||
uint SPIRV_Cross_bitfieldUExtract(uint Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
uint2 SPIRV_Cross_bitfieldUExtract(uint2 Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
uint3 SPIRV_Cross_bitfieldUExtract(uint3 Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
uint4 SPIRV_Cross_bitfieldUExtract(uint4 Base, uint Offset, uint Count)
|
||||
{
|
||||
uint Mask = Count == 32 ? 0xffffffff : ((1 << Count) - 1);
|
||||
return (Base >> Offset) & Mask;
|
||||
}
|
||||
|
||||
int SPIRV_Cross_bitfieldSExtract(int Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
int2 SPIRV_Cross_bitfieldSExtract(int2 Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int2 Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
int3 SPIRV_Cross_bitfieldSExtract(int3 Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int3 Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
int4 SPIRV_Cross_bitfieldSExtract(int4 Base, int Offset, int Count)
|
||||
{
|
||||
int Mask = Count == 32 ? -1 : ((1 << Count) - 1);
|
||||
int4 Masked = (Base >> Offset) & Mask;
|
||||
int ExtendShift = (32 - Count) & 31;
|
||||
return (Masked << ExtendShift) >> ExtendShift;
|
||||
}
|
||||
|
||||
void comp_main()
|
||||
{
|
||||
int signed_value = 0;
|
||||
uint unsigned_value = 0u;
|
||||
int3 signed_values = int3(0, 0, 0);
|
||||
uint3 unsigned_values = uint3(0u, 0u, 0u);
|
||||
int s = SPIRV_Cross_bitfieldSExtract(signed_value, 5, 20);
|
||||
uint u = SPIRV_Cross_bitfieldUExtract(unsigned_value, 6, 21);
|
||||
s = int(SPIRV_Cross_bitfieldInsert(s, 40, 5, 4));
|
||||
u = SPIRV_Cross_bitfieldInsert(u, 60u, 5, 4);
|
||||
u = reversebits(u);
|
||||
s = reversebits(s);
|
||||
int v0 = countbits(u);
|
||||
int v1 = countbits(s);
|
||||
int v2 = firstbithigh(u);
|
||||
int v3 = firstbitlow(s);
|
||||
int3 s_1 = SPIRV_Cross_bitfieldSExtract(signed_values, 5, 20);
|
||||
uint3 u_1 = SPIRV_Cross_bitfieldUExtract(unsigned_values, 6, 21);
|
||||
s_1 = int3(SPIRV_Cross_bitfieldInsert(s_1, int3(40, 40, 40), 5, 4));
|
||||
u_1 = SPIRV_Cross_bitfieldInsert(u_1, uint3(60u, 60u, 60u), 5, 4);
|
||||
u_1 = reversebits(u_1);
|
||||
s_1 = reversebits(s_1);
|
||||
int3 v0_1 = countbits(u_1);
|
||||
int3 v1_1 = countbits(s_1);
|
||||
int3 v2_1 = firstbithigh(u_1);
|
||||
int3 v3_1 = firstbitlow(s_1);
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void main()
|
||||
{
|
||||
comp_main();
|
||||
}
|
79
reference/shaders-hlsl-no-opt/frag/spec-constant.frag
Normal file
79
reference/shaders-hlsl-no-opt/frag/spec-constant.frag
Normal file
@ -0,0 +1,79 @@
|
||||
static const float a = 1.0f;
|
||||
static const float b = 2.0f;
|
||||
static const int c = 3;
|
||||
static const int d = 4;
|
||||
static const uint e = 5u;
|
||||
static const uint f = 6u;
|
||||
static const bool g = false;
|
||||
static const bool h = true;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float elems[(d + 2)];
|
||||
};
|
||||
|
||||
static float4 FragColor;
|
||||
|
||||
struct SPIRV_Cross_Output
|
||||
{
|
||||
float4 FragColor : SV_Target0;
|
||||
};
|
||||
|
||||
void frag_main()
|
||||
{
|
||||
float t0 = a;
|
||||
float t1 = b;
|
||||
uint c0 = (uint(c) + 0u);
|
||||
int c1 = (-c);
|
||||
int c2 = (~c);
|
||||
int c3 = (c + d);
|
||||
int c4 = (c - d);
|
||||
int c5 = (c * d);
|
||||
int c6 = (c / d);
|
||||
uint c7 = (e / f);
|
||||
int c8 = (c % d);
|
||||
uint c9 = (e % f);
|
||||
int c10 = (c >> d);
|
||||
uint c11 = (e >> f);
|
||||
int c12 = (c << d);
|
||||
int c13 = (c | d);
|
||||
int c14 = (c ^ d);
|
||||
int c15 = (c & d);
|
||||
bool c16 = (g || h);
|
||||
bool c17 = (g && h);
|
||||
bool c18 = (!g);
|
||||
bool c19 = (g == h);
|
||||
bool c20 = (g != h);
|
||||
bool c21 = (c == d);
|
||||
bool c22 = (c != d);
|
||||
bool c23 = (c < d);
|
||||
bool c24 = (e < f);
|
||||
bool c25 = (c > d);
|
||||
bool c26 = (e > f);
|
||||
bool c27 = (c <= d);
|
||||
bool c28 = (e <= f);
|
||||
bool c29 = (c >= d);
|
||||
bool c30 = (e >= f);
|
||||
int c31 = c8 + c3;
|
||||
int c32 = int(e + 0u);
|
||||
bool c33 = (c != int(0u));
|
||||
bool c34 = (e != 0u);
|
||||
int c35 = int(g);
|
||||
uint c36 = uint(g);
|
||||
float c37 = float(g);
|
||||
float vec0[(c + 3)][8];
|
||||
vec0[0][0] = 10.0f;
|
||||
float vec1[(c + 2)];
|
||||
vec1[0] = 20.0f;
|
||||
Foo foo;
|
||||
foo.elems[c] = 10.0f;
|
||||
FragColor = (((t0 + t1).xxxx + vec0[0][0].xxxx) + vec1[0].xxxx) + foo.elems[c].xxxx;
|
||||
}
|
||||
|
||||
SPIRV_Cross_Output main()
|
||||
{
|
||||
frag_main();
|
||||
SPIRV_Cross_Output stage_output;
|
||||
stage_output.FragColor = FragColor;
|
||||
return stage_output;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
vertex void main0()
|
||||
{
|
||||
}
|
||||
|
47
reference/shaders-msl-no-opt/comp/bitfield.comp
Normal file
47
reference/shaders-msl-no-opt/comp/bitfield.comp
Normal file
@ -0,0 +1,47 @@
|
||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
// Implementation of the GLSL findLSB() function
|
||||
template<typename T>
|
||||
T findLSB(T x)
|
||||
{
|
||||
return select(ctz(x), T(-1), x == T(0));
|
||||
}
|
||||
|
||||
// Implementation of the signed GLSL findMSB() function
|
||||
template<typename T>
|
||||
T findSMSB(T x)
|
||||
{
|
||||
T v = select(x, T(-1) - x, x < T(0));
|
||||
return select(clz(T(0)) - (clz(v) + T(1)), T(-1), v == T(0));
|
||||
}
|
||||
|
||||
// Implementation of the unsigned GLSL findMSB() function
|
||||
template<typename T>
|
||||
T findUMSB(T x)
|
||||
{
|
||||
return select(clz(T(0)) - (clz(x) + T(1)), T(-1), x == T(0));
|
||||
}
|
||||
|
||||
kernel void main0()
|
||||
{
|
||||
int signed_value = 0;
|
||||
uint unsigned_value = 0u;
|
||||
int s = extract_bits(signed_value, 5, 20);
|
||||
uint u = extract_bits(unsigned_value, 6, 21);
|
||||
s = insert_bits(s, 40, 5, 4);
|
||||
u = insert_bits(u, 60u, 5, 4);
|
||||
u = reverse_bits(u);
|
||||
s = reverse_bits(s);
|
||||
int v0 = popcount(u);
|
||||
int v1 = popcount(s);
|
||||
int v2 = findUMSB(u);
|
||||
int v3 = findSMSB(s);
|
||||
int v4 = findLSB(u);
|
||||
int v5 = findLSB(s);
|
||||
}
|
||||
|
107
reference/shaders-msl-no-opt/comp/loop.comp
Normal file
107
reference/shaders-msl-no-opt/comp/loop.comp
Normal file
@ -0,0 +1,107 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct SSBO
|
||||
{
|
||||
float4x4 mvp;
|
||||
float4 in_data[1];
|
||||
};
|
||||
|
||||
struct SSBO2
|
||||
{
|
||||
float4 out_data[1];
|
||||
};
|
||||
|
||||
kernel void main0(device SSBO& _24 [[buffer(0)]], device SSBO2& _177 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
|
||||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
float4 idat = _24.in_data[ident];
|
||||
int k = 0;
|
||||
uint i = 0u;
|
||||
if (idat.y == 20.0)
|
||||
{
|
||||
do
|
||||
{
|
||||
k *= 2;
|
||||
i++;
|
||||
} while (i < ident);
|
||||
}
|
||||
switch (k)
|
||||
{
|
||||
case 10:
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
i++;
|
||||
if (i > 10u)
|
||||
{
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
i += 2u;
|
||||
if (i > 20u)
|
||||
{
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (k < 10)
|
||||
{
|
||||
idat *= 2.0;
|
||||
k++;
|
||||
}
|
||||
for (uint i_1 = 0u; i_1 < 16u; i_1++, k++)
|
||||
{
|
||||
for (uint j = 0u; j < 30u; j++)
|
||||
{
|
||||
idat = _24.mvp * idat;
|
||||
}
|
||||
}
|
||||
k = 0;
|
||||
for (;;)
|
||||
{
|
||||
k++;
|
||||
if (k > 10)
|
||||
{
|
||||
k += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
k += 3;
|
||||
continue;
|
||||
}
|
||||
k += 10;
|
||||
continue;
|
||||
}
|
||||
k = 0;
|
||||
do
|
||||
{
|
||||
k++;
|
||||
} while (k > 10);
|
||||
int l = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (l == 5)
|
||||
{
|
||||
l++;
|
||||
continue;
|
||||
}
|
||||
idat += float4(1.0);
|
||||
l++;
|
||||
continue;
|
||||
}
|
||||
_177.out_data[ident] = idat;
|
||||
}
|
||||
|
30
reference/shaders-msl-no-opt/frag/in_block_assign.frag
Normal file
30
reference/shaders-msl-no-opt/frag/in_block_assign.frag
Normal file
@ -0,0 +1,30 @@
|
||||
#include <metal_stdlib>
|
||||
#include <simd/simd.h>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
struct VOUT
|
||||
{
|
||||
float4 a;
|
||||
};
|
||||
|
||||
struct main0_in
|
||||
{
|
||||
float4 VOUT_a [[user(locn0)]];
|
||||
};
|
||||
|
||||
struct main0_out
|
||||
{
|
||||
float4 FragColor [[color(0)]];
|
||||
};
|
||||
|
||||
fragment main0_out main0(main0_in in [[stage_in]])
|
||||
{
|
||||
main0_out out = {};
|
||||
VOUT tmp;
|
||||
tmp.a = in.VOUT_a;
|
||||
tmp.a += float4(1.0);
|
||||
out.FragColor = tmp.a;
|
||||
return out;
|
||||
}
|
||||
|
@ -0,0 +1,228 @@
|
||||
#version 450
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
vec4 HPosition;
|
||||
vec4 Uv_EdgeDistance1;
|
||||
vec4 UvStuds_EdgeDistance2;
|
||||
vec4 Color;
|
||||
vec4 LightPosition_Fog;
|
||||
vec4 View_Depth;
|
||||
vec4 Normal_SpecPower;
|
||||
vec3 Tangent;
|
||||
vec4 PosLightSpace_Reflectance;
|
||||
float studIndex;
|
||||
};
|
||||
|
||||
struct Surface
|
||||
{
|
||||
vec3 albedo;
|
||||
vec3 normal;
|
||||
float specular;
|
||||
float gloss;
|
||||
float reflectance;
|
||||
float opacity;
|
||||
};
|
||||
|
||||
struct SurfaceInput
|
||||
{
|
||||
vec4 Color;
|
||||
vec2 Uv;
|
||||
vec2 UvStuds;
|
||||
};
|
||||
|
||||
struct Globals
|
||||
{
|
||||
mat4 ViewProjection;
|
||||
vec4 ViewRight;
|
||||
vec4 ViewUp;
|
||||
vec4 ViewDir;
|
||||
vec3 CameraPosition;
|
||||
vec3 AmbientColor;
|
||||
vec3 Lamp0Color;
|
||||
vec3 Lamp0Dir;
|
||||
vec3 Lamp1Color;
|
||||
vec4 FogParams;
|
||||
vec3 FogColor;
|
||||
vec4 LightBorder;
|
||||
vec4 LightConfig0;
|
||||
vec4 LightConfig1;
|
||||
vec4 LightConfig2;
|
||||
vec4 LightConfig3;
|
||||
vec4 RefractionBias_FadeDistance_GlowFactor;
|
||||
vec4 OutlineBrightness_ShadowInfo;
|
||||
vec4 ShadowMatrix0;
|
||||
vec4 ShadowMatrix1;
|
||||
vec4 ShadowMatrix2;
|
||||
};
|
||||
|
||||
struct Params
|
||||
{
|
||||
vec4 LqmatFarTilingFactor;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform CB0
|
||||
{
|
||||
Globals CB0;
|
||||
} _19;
|
||||
|
||||
uniform sampler2D SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler;
|
||||
uniform sampler2D SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler;
|
||||
uniform sampler2D SPIRV_Cross_CombinedNormalDetailMapTextureNormalDetailMapSampler;
|
||||
uniform sampler2D SPIRV_Cross_CombinedStudsMapTextureStudsMapSampler;
|
||||
uniform sampler2D SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler;
|
||||
uniform sampler3D SPIRV_Cross_CombinedLightMapTextureLightMapSampler;
|
||||
uniform sampler2D SPIRV_Cross_CombinedShadowMapTextureShadowMapSampler;
|
||||
uniform samplerCube SPIRV_Cross_CombinedEnvironmentMapTextureEnvironmentMapSampler;
|
||||
|
||||
layout(location = 0) in vec4 IN_Uv_EdgeDistance1;
|
||||
layout(location = 1) in vec4 IN_UvStuds_EdgeDistance2;
|
||||
layout(location = 2) in vec4 IN_Color;
|
||||
layout(location = 3) in vec4 IN_LightPosition_Fog;
|
||||
layout(location = 4) in vec4 IN_View_Depth;
|
||||
layout(location = 5) in vec4 IN_Normal_SpecPower;
|
||||
layout(location = 6) in vec3 IN_Tangent;
|
||||
layout(location = 7) in vec4 IN_PosLightSpace_Reflectance;
|
||||
layout(location = 8) in float IN_studIndex;
|
||||
layout(location = 0) out vec4 _entryPointOutput;
|
||||
|
||||
VertexOutput _121;
|
||||
SurfaceInput _122;
|
||||
vec2 _123;
|
||||
vec4 _124;
|
||||
Surface _125;
|
||||
vec4 _192;
|
||||
vec4 _219;
|
||||
vec4 _297;
|
||||
|
||||
void main()
|
||||
{
|
||||
VertexOutput _128 = _121;
|
||||
_128.HPosition = gl_FragCoord;
|
||||
VertexOutput _130 = _128;
|
||||
_130.Uv_EdgeDistance1 = IN_Uv_EdgeDistance1;
|
||||
VertexOutput _132 = _130;
|
||||
_132.UvStuds_EdgeDistance2 = IN_UvStuds_EdgeDistance2;
|
||||
VertexOutput _134 = _132;
|
||||
_134.Color = IN_Color;
|
||||
VertexOutput _136 = _134;
|
||||
_136.LightPosition_Fog = IN_LightPosition_Fog;
|
||||
VertexOutput _138 = _136;
|
||||
_138.View_Depth = IN_View_Depth;
|
||||
VertexOutput _140 = _138;
|
||||
_140.Normal_SpecPower = IN_Normal_SpecPower;
|
||||
VertexOutput _142 = _140;
|
||||
_142.Tangent = IN_Tangent;
|
||||
VertexOutput _144 = _142;
|
||||
_144.PosLightSpace_Reflectance = IN_PosLightSpace_Reflectance;
|
||||
VertexOutput _146 = _144;
|
||||
_146.studIndex = IN_studIndex;
|
||||
SurfaceInput _147 = _122;
|
||||
_147.Color = IN_Color;
|
||||
SurfaceInput _149 = _147;
|
||||
_149.Uv = IN_Uv_EdgeDistance1.xy;
|
||||
SurfaceInput _151 = _149;
|
||||
_151.UvStuds = IN_UvStuds_EdgeDistance2.xy;
|
||||
SurfaceInput _156 = _151;
|
||||
_156.UvStuds.y = (fract(_151.UvStuds.y) + IN_studIndex) * 0.25;
|
||||
float _163 = _146.View_Depth.w * _19.CB0.RefractionBias_FadeDistance_GlowFactor.y;
|
||||
float _165 = clamp(1.0 - _163, 0.0, 1.0);
|
||||
vec2 _166 = IN_Uv_EdgeDistance1.xy * 1.0;
|
||||
bool _173;
|
||||
vec4 _193;
|
||||
do
|
||||
{
|
||||
_173 = 0.0 == 0.0;
|
||||
if (_173)
|
||||
{
|
||||
_193 = texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
float _180 = 1.0 / (1.0 - 0.0);
|
||||
_193 = mix(texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedDiffuseMapTextureDiffuseMapSampler, _166), vec4(clamp((clamp(1.0 - (_146.View_Depth.w * 0.00333332992158830165863037109375), 0.0, 1.0) * _180) - (0.0 * _180), 0.0, 1.0)));
|
||||
break;
|
||||
}
|
||||
_193 = _192;
|
||||
break;
|
||||
} while (false);
|
||||
vec4 _194 = _193 * 1.0;
|
||||
vec4 _220;
|
||||
do
|
||||
{
|
||||
if (_173)
|
||||
{
|
||||
_220 = texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
float _207 = 1.0 / (1.0 - 0.0);
|
||||
_220 = mix(texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedNormalMapTextureNormalMapSampler, _166), vec4(clamp((_165 * _207) - (0.0 * _207), 0.0, 1.0)));
|
||||
break;
|
||||
}
|
||||
_220 = _219;
|
||||
break;
|
||||
} while (false);
|
||||
vec2 _223 = vec2(1.0);
|
||||
vec2 _224 = (_220.wy * 2.0) - _223;
|
||||
vec3 _232 = vec3(_224, sqrt(clamp(1.0 + dot(-_224, _224), 0.0, 1.0)));
|
||||
vec2 _240 = (texture(SPIRV_Cross_CombinedNormalDetailMapTextureNormalDetailMapSampler, _166 * 0.0).wy * 2.0) - _223;
|
||||
vec2 _252 = _232.xy + (vec3(_240, sqrt(clamp(1.0 + dot(-_240, _240), 0.0, 1.0))).xy * 0.0);
|
||||
vec3 _253 = vec3(_252.x, _252.y, _232.z);
|
||||
vec2 _255 = _253.xy * _165;
|
||||
vec3 _256 = vec3(_255.x, _255.y, _253.z);
|
||||
vec3 _271 = ((IN_Color.xyz * _194.xyz) * (1.0 + (_256.x * 0.300000011920928955078125))) * (texture(SPIRV_Cross_CombinedStudsMapTextureStudsMapSampler, _156.UvStuds).x * 2.0);
|
||||
vec4 _298;
|
||||
do
|
||||
{
|
||||
if (0.75 == 0.0)
|
||||
{
|
||||
_298 = texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
float _285 = 1.0 / (1.0 - 0.75);
|
||||
_298 = mix(texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166 * 0.25), texture(SPIRV_Cross_CombinedSpecularMapTextureSpecularMapSampler, _166), vec4(clamp((_165 * _285) - (0.75 * _285), 0.0, 1.0)));
|
||||
break;
|
||||
}
|
||||
_298 = _297;
|
||||
break;
|
||||
} while (false);
|
||||
vec2 _303 = mix(vec2(0.800000011920928955078125, 120.0), (_298.xy * vec2(2.0, 256.0)) + vec2(0.0, 0.00999999977648258209228515625), vec2(_165));
|
||||
Surface _304 = _125;
|
||||
_304.albedo = _271;
|
||||
Surface _305 = _304;
|
||||
_305.normal = _256;
|
||||
float _306 = _303.x;
|
||||
Surface _307 = _305;
|
||||
_307.specular = _306;
|
||||
float _308 = _303.y;
|
||||
Surface _309 = _307;
|
||||
_309.gloss = _308;
|
||||
float _312 = (_298.xy.y * _165) * 0.0;
|
||||
Surface _313 = _309;
|
||||
_313.reflectance = _312;
|
||||
vec4 _318 = vec4(_271, _146.Color.w);
|
||||
vec3 _329 = normalize(((IN_Tangent * _313.normal.x) + (cross(IN_Normal_SpecPower.xyz, IN_Tangent) * _313.normal.y)) + (IN_Normal_SpecPower.xyz * _313.normal.z));
|
||||
vec3 _332 = -_19.CB0.Lamp0Dir;
|
||||
float _333 = dot(_329, _332);
|
||||
float _357 = clamp(dot(step(_19.CB0.LightConfig3.xyz, abs(IN_LightPosition_Fog.xyz - _19.CB0.LightConfig2.xyz)), vec3(1.0)), 0.0, 1.0);
|
||||
vec4 _368 = mix(texture(SPIRV_Cross_CombinedLightMapTextureLightMapSampler, IN_LightPosition_Fog.xyz.yzx - (IN_LightPosition_Fog.xyz.yzx * _357)), _19.CB0.LightBorder, vec4(_357));
|
||||
vec2 _376 = texture(SPIRV_Cross_CombinedShadowMapTextureShadowMapSampler, IN_PosLightSpace_Reflectance.xyz.xy).xy;
|
||||
float _392 = (1.0 - (((step(_376.x, IN_PosLightSpace_Reflectance.xyz.z) * clamp(9.0 - (20.0 * abs(IN_PosLightSpace_Reflectance.xyz.z - 0.5)), 0.0, 1.0)) * _376.y) * _19.CB0.OutlineBrightness_ShadowInfo.w)) * _368.w;
|
||||
vec3 _403 = mix(_318.xyz, texture(SPIRV_Cross_CombinedEnvironmentMapTextureEnvironmentMapSampler, reflect(-IN_View_Depth.xyz, _329)).xyz, vec3(_312));
|
||||
vec4 _404 = vec4(_403.x, _403.y, _403.z, _318.w);
|
||||
vec3 _422 = (((_19.CB0.AmbientColor + (((_19.CB0.Lamp0Color * clamp(_333, 0.0, 1.0)) + (_19.CB0.Lamp1Color * max(-_333, 0.0))) * _392)) + _368.xyz) * _404.xyz) + (_19.CB0.Lamp0Color * (((step(0.0, _333) * _306) * _392) * pow(clamp(dot(_329, normalize(_332 + normalize(IN_View_Depth.xyz))), 0.0, 1.0), _308)));
|
||||
vec4 _425 = vec4(_422.x, _422.y, _422.z, _124.w);
|
||||
_425.w = _404.w;
|
||||
vec2 _435 = min(IN_Uv_EdgeDistance1.wz, IN_UvStuds_EdgeDistance2.wz);
|
||||
float _439 = min(_435.x, _435.y) / _163;
|
||||
vec3 _445 = _425.xyz * clamp((clamp((_163 * _19.CB0.OutlineBrightness_ShadowInfo.x) + _19.CB0.OutlineBrightness_ShadowInfo.y, 0.0, 1.0) * (1.5 - _439)) + _439, 0.0, 1.0);
|
||||
vec4 _446 = vec4(_445.x, _445.y, _445.z, _425.w);
|
||||
vec3 _453 = mix(_19.CB0.FogColor, _446.xyz, vec3(clamp(_146.LightPosition_Fog.w, 0.0, 1.0)));
|
||||
_entryPointOutput = vec4(_453.x, _453.y, _453.z, _446.w);
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
#version 450
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
|
19
reference/shaders-no-opt/comp/bitfield.comp
Normal file
19
reference/shaders-no-opt/comp/bitfield.comp
Normal file
@ -0,0 +1,19 @@
|
||||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
void main()
|
||||
{
|
||||
int signed_value = 0;
|
||||
uint unsigned_value = 0u;
|
||||
int s = bitfieldExtract(signed_value, 5, 20);
|
||||
uint u = bitfieldExtract(unsigned_value, 6, 21);
|
||||
s = bitfieldInsert(s, 40, 5, 4);
|
||||
u = bitfieldInsert(u, 60u, 5, 4);
|
||||
u = bitfieldReverse(u);
|
||||
s = bitfieldReverse(s);
|
||||
int v0 = bitCount(u);
|
||||
int v1 = bitCount(s);
|
||||
int v2 = findMSB(u);
|
||||
int v3 = findLSB(s);
|
||||
}
|
||||
|
105
reference/shaders-no-opt/comp/loop.comp
Normal file
105
reference/shaders-no-opt/comp/loop.comp
Normal file
@ -0,0 +1,105 @@
|
||||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 0, std430) readonly buffer SSBO
|
||||
{
|
||||
mat4 mvp;
|
||||
vec4 in_data[];
|
||||
} _24;
|
||||
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _177;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
vec4 idat = _24.in_data[ident];
|
||||
int k = 0;
|
||||
uint i = 0u;
|
||||
if (idat.y == 20.0)
|
||||
{
|
||||
do
|
||||
{
|
||||
k *= 2;
|
||||
i++;
|
||||
} while (i < ident);
|
||||
}
|
||||
switch (k)
|
||||
{
|
||||
case 10:
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
i++;
|
||||
if (i > 10u)
|
||||
{
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
i += 2u;
|
||||
if (i > 20u)
|
||||
{
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (k < 10)
|
||||
{
|
||||
idat *= 2.0;
|
||||
k++;
|
||||
}
|
||||
for (uint i_1 = 0u; i_1 < 16u; i_1++, k++)
|
||||
{
|
||||
for (uint j = 0u; j < 30u; j++)
|
||||
{
|
||||
idat = _24.mvp * idat;
|
||||
}
|
||||
}
|
||||
k = 0;
|
||||
for (;;)
|
||||
{
|
||||
k++;
|
||||
if (k > 10)
|
||||
{
|
||||
k += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
k += 3;
|
||||
continue;
|
||||
}
|
||||
k += 10;
|
||||
continue;
|
||||
}
|
||||
k = 0;
|
||||
do
|
||||
{
|
||||
k++;
|
||||
} while (k > 10);
|
||||
int l = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (l == 5)
|
||||
{
|
||||
l++;
|
||||
continue;
|
||||
}
|
||||
idat += vec4(1.0);
|
||||
l++;
|
||||
continue;
|
||||
}
|
||||
_177.out_data[ident] = idat;
|
||||
}
|
||||
|
34
reference/shaders-no-opt/comp/return.comp
Normal file
34
reference/shaders-no-opt/comp/return.comp
Normal file
@ -0,0 +1,34 @@
|
||||
#version 310 es
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
|
||||
layout(binding = 1, std430) writeonly buffer SSBO2
|
||||
{
|
||||
vec4 out_data[];
|
||||
} _27;
|
||||
|
||||
void main()
|
||||
{
|
||||
uint ident = gl_GlobalInvocationID.x;
|
||||
if (ident == 2u)
|
||||
{
|
||||
_27.out_data[ident] = vec4(20.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ident == 4u)
|
||||
{
|
||||
_27.out_data[ident] = vec4(10.0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if (i == 10)
|
||||
{
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
_27.out_data[ident] = vec4(10.0);
|
||||
}
|
||||
|
59
reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag
Normal file
59
reference/shaders-no-opt/vulkan/frag/spec-constant.vk.frag
Normal file
@ -0,0 +1,59 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float elems[(4 + 2)];
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float t0 = 1.0;
|
||||
float t1 = 2.0;
|
||||
mediump uint c0 = (uint(3) + 0u);
|
||||
mediump int c1 = (-3);
|
||||
mediump int c2 = (~3);
|
||||
mediump int c3 = (3 + 4);
|
||||
mediump int c4 = (3 - 4);
|
||||
mediump int c5 = (3 * 4);
|
||||
mediump int c6 = (3 / 4);
|
||||
mediump uint c7 = (5u / 6u);
|
||||
mediump int c8 = (3 % 4);
|
||||
mediump uint c9 = (5u % 6u);
|
||||
mediump int c10 = (3 >> 4);
|
||||
mediump uint c11 = (5u >> 6u);
|
||||
mediump int c12 = (3 << 4);
|
||||
mediump int c13 = (3 | 4);
|
||||
mediump int c14 = (3 ^ 4);
|
||||
mediump int c15 = (3 & 4);
|
||||
bool c16 = (false || true);
|
||||
bool c17 = (false && true);
|
||||
bool c18 = (!false);
|
||||
bool c19 = (false == true);
|
||||
bool c20 = (false != true);
|
||||
bool c21 = (3 == 4);
|
||||
bool c22 = (3 != 4);
|
||||
bool c23 = (3 < 4);
|
||||
bool c24 = (5u < 6u);
|
||||
bool c25 = (3 > 4);
|
||||
bool c26 = (5u > 6u);
|
||||
bool c27 = (3 <= 4);
|
||||
bool c28 = (5u <= 6u);
|
||||
bool c29 = (3 >= 4);
|
||||
bool c30 = (5u >= 6u);
|
||||
mediump int c31 = c8 + c3;
|
||||
mediump int c32 = int(5u + 0u);
|
||||
bool c33 = (3 != int(0u));
|
||||
bool c34 = (5u != 0u);
|
||||
mediump int c35 = int(false);
|
||||
mediump uint c36 = uint(false);
|
||||
float c37 = float(false);
|
||||
float vec0[(3 + 3)][8];
|
||||
float vec1[(3 + 2)];
|
||||
Foo foo;
|
||||
FragColor = ((vec4(t0 + t1) + vec4(vec0[0][0])) + vec4(vec1[0])) + vec4(foo.elems[3]);
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
precision highp int;
|
||||
|
||||
layout(constant_id = 1) const float a = 1.0;
|
||||
layout(constant_id = 2) const float b = 2.0;
|
||||
layout(constant_id = 3) const int c = 3;
|
||||
layout(constant_id = 4) const int d = 4;
|
||||
layout(constant_id = 5) const uint e = 5u;
|
||||
layout(constant_id = 6) const uint f = 6u;
|
||||
layout(constant_id = 7) const bool g = false;
|
||||
layout(constant_id = 8) const bool h = true;
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float elems[(d + 2)];
|
||||
};
|
||||
|
||||
layout(location = 0) out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float t0 = a;
|
||||
float t1 = b;
|
||||
mediump uint c0 = (uint(c) + 0u);
|
||||
mediump int c1 = (-c);
|
||||
mediump int c2 = (~c);
|
||||
mediump int c3 = (c + d);
|
||||
mediump int c4 = (c - d);
|
||||
mediump int c5 = (c * d);
|
||||
mediump int c6 = (c / d);
|
||||
mediump uint c7 = (e / f);
|
||||
mediump int c8 = (c % d);
|
||||
mediump uint c9 = (e % f);
|
||||
mediump int c10 = (c >> d);
|
||||
mediump uint c11 = (e >> f);
|
||||
mediump int c12 = (c << d);
|
||||
mediump int c13 = (c | d);
|
||||
mediump int c14 = (c ^ d);
|
||||
mediump int c15 = (c & d);
|
||||
bool c16 = (g || h);
|
||||
bool c17 = (g && h);
|
||||
bool c18 = (!g);
|
||||
bool c19 = (g == h);
|
||||
bool c20 = (g != h);
|
||||
bool c21 = (c == d);
|
||||
bool c22 = (c != d);
|
||||
bool c23 = (c < d);
|
||||
bool c24 = (e < f);
|
||||
bool c25 = (c > d);
|
||||
bool c26 = (e > f);
|
||||
bool c27 = (c <= d);
|
||||
bool c28 = (e <= f);
|
||||
bool c29 = (c >= d);
|
||||
bool c30 = (e >= f);
|
||||
mediump int c31 = c8 + c3;
|
||||
mediump int c32 = int(e + 0u);
|
||||
bool c33 = (c != int(0u));
|
||||
bool c34 = (e != 0u);
|
||||
mediump int c35 = int(g);
|
||||
mediump uint c36 = uint(g);
|
||||
float c37 = float(g);
|
||||
float vec0[(c + 3)][8];
|
||||
float vec1[(c + 2)];
|
||||
Foo foo;
|
||||
FragColor = ((vec4(t0 + t1) + vec4(vec0[0][0])) + vec4(vec1[0])) + vec4(foo.elems[c]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user