Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function(add_shader FILE)
function(compile OUTPUT)
add_custom_command(
OUTPUT ${OUTPUT}
COMMAND ${SHADERCROSS} ${HLSL} -s hlsl -o ${OUTPUT} -I src
COMMAND ${SHADERCROSS} ${HLSL} -s hlsl -o ${OUTPUT} -I shaders
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
DEPENDS ${HLSL} ${DEPENDS}
COMMENT ${OUTPUT}
Expand Down
28 changes: 14 additions & 14 deletions shaders/bin/blur.comp.msl
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ kernel void main0(texture2d<float> inputTexture [[texture(0)]], texture2d<float,
uint2 _35 = uint2(outputTexture.get_width(), outputTexture.get_height());
uint _36 = _35.x;
uint _37 = _35.y;
bool _47;
if (!(gl_GlobalInvocationID.x >= _36))
bool _46;
if (gl_GlobalInvocationID.x < _36)
{
_47 = gl_GlobalInvocationID.y >= _37;
_46 = gl_GlobalInvocationID.y >= _37;
}
else
{
_47 = true;
_46 = true;
}
if (_47)
if (_46)
{
break;
}
float _50;
_50 = 0.0;
float _51;
_51 = 0.0;
float _52;
for (int _54 = -2; _54 <= 2; _51 = _52, _54++)
for (int _53 = -2; _53 <= 2; _50 = _51, _53++)
{
int _65 = int(clamp(gl_GlobalInvocationID.y + uint(_54), 0u, _37 - 1u));
_52 = _51;
for (int _69 = -2; _69 <= 2; )
uint _63 = clamp(gl_GlobalInvocationID.y + uint(_53), 0u, _37 - 1u);
_51 = _50;
for (int _67 = -2; _67 <= 2; )
{
_52 += inputTexture.read(uint2(uint2(uint(int(clamp(gl_GlobalInvocationID.x + uint(_69), 0u, _36 - 1u))), uint(_65))), 0u).x;
_69++;
_51 += inputTexture.read(uint2(uint2(clamp(gl_GlobalInvocationID.x + uint(_67), 0u, _36 - 1u), _63)), 0u).x;
_67++;
continue;
}
}
outputTexture.write(float4(_51 * 0.039999999105930328369140625), uint2(gl_GlobalInvocationID.xy));
outputTexture.write(float4(_50 * 0.039999999105930328369140625), uint2(gl_GlobalInvocationID.xy));
break;
} while(false);
}
Expand Down
Binary file modified shaders/bin/blur.comp.spv
Binary file not shown.
95 changes: 48 additions & 47 deletions shaders/bin/composite.comp.msl
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ kernel void main0(constant type_UniformBuffer& UniformBuffer [[buffer(0)]], cons
do
{
uint2 _93 = uint2(colorTexture.get_width(), colorTexture.get_height());
bool _105;
if (!(gl_GlobalInvocationID.x >= _93.x))
bool _104;
if (gl_GlobalInvocationID.x < _93.x)
{
_105 = gl_GlobalInvocationID.y >= _93.y;
_104 = gl_GlobalInvocationID.y >= _93.y;
}
else
{
_105 = true;
_104 = true;
}
if (_105)
if (_104)
{
break;
}
Expand All @@ -79,7 +79,7 @@ kernel void main0(constant type_UniformBuffer& UniformBuffer [[buffer(0)]], cons
uint _113 = _112.x;
float4 _115 = positionTexture.read(uint2(gl_GlobalInvocationID.xy), 0u);
float3 _124 = lightTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).xyz;
float _188;
float _186;
do
{
float4 _135 = UniformBuffer.ShadowTransform * float4(_115.xyz, 1.0);
Expand All @@ -89,103 +89,104 @@ kernel void main0(constant type_UniformBuffer& UniformBuffer [[buffer(0)]], cons
float2 _145 = _142;
_145.y = _144;
float _146 = _142.x;
bool _152;
if (!(_146 < 0.0))
bool _151;
if ((isunordered(_146, 0.0) || _146 >= 0.0))
{
_152 = _146 > 1.0;
_151 = _146 > 1.0;
}
else
{
_152 = true;
_151 = true;
}
bool _157;
if (!_152)
bool _156;
if (!_151)
{
_157 = _144 < 0.0;
_156 = _144 < 0.0;
}
else
{
_157 = true;
_156 = true;
}
bool _162;
if (!_157)
bool _161;
if (!_156)
{
_162 = _144 > 1.0;
_161 = _144 > 1.0;
}
else
{
_162 = true;
_161 = true;
}
if (_162)
if (_161)
{
_188 = 0.4000000059604644775390625;
_186 = 0.4000000059604644775390625;
break;
}
float _177;
if (((_113 >> 0u) & 1u) != 0u)
float _175;
if ((_113 & 1u) != 0u)
{
float _173 = dot(_79[((_113 >> 1u) & 15u) - 1u], fast::normalize(float4(UniformBuffer.ShadowTransform[0][2], UniformBuffer.ShadowTransform[1][2], UniformBuffer.ShadowTransform[2][2], UniformBuffer.ShadowTransform[3][2]).xyz));
if (_173 > 0.0)
float _171 = dot(_79[((_113 >> 1u) & 15u) - 1u], fast::normalize(float4(UniformBuffer.ShadowTransform[0][2], UniformBuffer.ShadowTransform[1][2], UniformBuffer.ShadowTransform[2][2], UniformBuffer.ShadowTransform[3][2]).xyz));
if (_171 > 0.0)
{
_188 = 0.0;
_186 = 0.0;
break;
}
_177 = _173;
_175 = _171;
}
else
{
_177 = -0.7070000171661376953125;
_175 = -0.7070000171661376953125;
}
if (_139.z < (shadowTexture.sample(shadowSampler, _145, level(0.0)).x + 0.001000000047497451305389404296875))
{
_188 = _177 * (-0.4000000059604644775390625);
_186 = _175 * (-0.4000000059604644775390625);
break;
}
else
{
_188 = 0.0;
_186 = 0.0;
break;
}
break; // unreachable workaround
} while(false);
float3 _220;
if (((_113 >> 0u) & 1u) != 0u)
float3 _216;
if ((_113 & 1u) != 0u)
{
_220 = _110 * (((_124 + float3(0.5)) + float3(_188)) - float3(ssaoTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).x * 2.0));
_216 = _110 * (((_124 + float3(0.5)) + float3(_186)) - float3(ssaoTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).x * 2.0));
}
else
{
bool _205;
if (!(length(_110) > 0.999000012874603271484375))
float _196 = length(_110);
bool _201;
if ((isunordered(_196, 0.999000012874603271484375) || _196 <= 0.999000012874603271484375))
{
_205 = _113 == 0u;
_201 = _113 == 0u;
}
else
{
_205 = true;
_201 = true;
}
float3 _213;
if (_205)
float3 _209;
if (_201)
{
_213 = _110;
_209 = _110;
}
else
{
_213 = _110 * ((_124 + float3(0.5)) + float3(_188));
_209 = _110 * ((_124 + float3(0.5)) + float3(_186));
}
_220 = _213;
_216 = _209;
}
float3 _246;
if (!(_113 == 0u))
float3 _241;
if (_113 != 0u)
{
float3 _227 = _115.xyz - UniformBuffer_1.PlayerPosition;
_246 = mix(_220, mix(float3(0.2199999988079071044921875, 0.3490000069141387939453125, 0.70200002193450927734375), float3(0.21199999749660491943359375, 0.7730000019073486328125, 0.9570000171661376953125), float3((precise::atan2(_227.y, length(float2(_227.xz))) + 1.57079637050628662109375) * 0.3183098733425140380859375)), float3(precise::min(powr(distance(_115.xz, UniformBuffer_1.PlayerPosition.xz) * 0.0040000001899898052215576171875, 2.5), 1.0)));
float3 _222 = _115.xyz - UniformBuffer_1.PlayerPosition;
_241 = mix(_216, mix(float3(0.2199999988079071044921875, 0.3490000069141387939453125, 0.70200002193450927734375), float3(0.21199999749660491943359375, 0.7730000019073486328125, 0.9570000171661376953125), float3((precise::atan2(_222.y, length(float2(_222.xz))) + 1.57079637050628662109375) * 0.3183098733425140380859375)), float3(precise::min(powr(distance(_115.xz, UniformBuffer_1.PlayerPosition.xz) * 0.0040000001899898052215576171875, 2.5), 1.0)));
}
else
{
_246 = _220;
_241 = _216;
}
compositeTexture.write(float4(_246, 1.0), uint2(gl_GlobalInvocationID.xy));
compositeTexture.write(float4(_241, 1.0), uint2(gl_GlobalInvocationID.xy));
break;
} while(false);
}
Expand Down
Binary file modified shaders/bin/composite.comp.spv
Binary file not shown.
2 changes: 1 addition & 1 deletion shaders/bin/depth.frag.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0, "inputs": [], "outputs": [] }
2 changes: 1 addition & 1 deletion shaders/bin/depth.vert.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 3 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 3, "inputs": [{ "name": "in.var.TEXCOORD0", "type": "uint", "location": 0 }], "outputs": [] }
2 changes: 1 addition & 1 deletion shaders/bin/opaque.frag.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 1, "storage_textures": 0, "storage_buffers": 1, "uniform_buffers": 1 }
{ "samplers": 1, "storage_textures": 0, "storage_buffers": 1, "uniform_buffers": 1, "inputs": [{ "name": "in.var.TEXCOORD0", "type": "float4", "location": 0 }, { "name": "in.var.TEXCOORD1", "type": "float3", "location": 1 }, { "name": "in.var.TEXCOORD2", "type": "float3", "location": 2 }, { "name": "in.var.TEXCOORD3", "type": "uint", "location": 3 }], "outputs": [{ "name": "out.var.SV_Target0", "type": "float4", "location": 0 }, { "name": "out.var.SV_Target1", "type": "float4", "location": 1 }, { "name": "out.var.SV_Target2", "type": "float4", "location": 2 }, { "name": "out.var.SV_Target3", "type": "uint", "location": 3 }] }
42 changes: 21 additions & 21 deletions shaders/bin/opaque.frag.msl
Original file line number Diff line number Diff line change
Expand Up @@ -45,43 +45,43 @@ fragment main0_out main0(main0_in in [[stage_in]], constant type_UniformBuffer&
{
discard_fragment();
}
uint _82 = uint(UniformBuffer.LightCount);
uint _81 = uint(UniformBuffer.LightCount);
float3 _83;
_83 = float3(0.0);
float3 _84;
_84 = float3(0.0);
float3 _85;
for (uint _87 = 0u; _87 < _82; _84 = _85, _87++)
for (uint _86 = 0u; _86 < _81; _83 = _84, _86++)
{
float _100 = float((lightBuffer._m0[_87].Color & 4278190080u) >> 24u);
float3 _107 = (float3(float(lightBuffer._m0[_87].X), float(lightBuffer._m0[_87].Y), float(lightBuffer._m0[_87].Z)) + float3(0.5, 0.75, 0.5)) - in.in_var_TEXCOORD0.xyz;
float _108 = length(_107);
bool _114;
if (!(_108 >= _100))
float _99 = float((lightBuffer._m0[_86].Color & 4278190080u) >> 24u);
float3 _106 = (float3(float(lightBuffer._m0[_86].X), float(lightBuffer._m0[_86].Y), float(lightBuffer._m0[_86].Z)) + float3(0.5, 0.75, 0.5)) - in.in_var_TEXCOORD0.xyz;
float _107 = length(_106);
bool _112;
if ((isunordered(_107, _99) || _107 < _99))
{
_114 = _100 <= 0.0;
_112 = _99 <= 0.0;
}
else
{
_114 = true;
_112 = true;
}
if (_114)
if (_112)
{
_85 = _84;
_84 = _83;
continue;
}
float _120 = fast::clamp(dot(in.in_var_TEXCOORD1, _107 / float3(_108)), 0.0, 1.0);
if (_120 <= 0.0)
float _118 = fast::clamp(dot(in.in_var_TEXCOORD1, _106 / float3(_107)), 0.0, 1.0);
if (_118 <= 0.0)
{
_85 = _84;
_84 = _83;
continue;
}
float _126 = fast::clamp(1.0 - (_108 / _100), 0.0, 1.0);
_85 = _84 + ((float3(float((lightBuffer._m0[_87].Color & 255u) >> 0u) * 0.0039215688593685626983642578125, float((lightBuffer._m0[_87].Color & 65280u) >> 8u) * 0.0039215688593685626983642578125, float((lightBuffer._m0[_87].Color & 16711680u) >> 16u) * 0.0039215688593685626983642578125) * _120) * (_126 * _126));
float _124 = fast::clamp(1.0 - (_107 / _99), 0.0, 1.0);
_84 = _83 + ((float3(float(lightBuffer._m0[_86].Color & 255u) * 0.0039215688593685626983642578125, float((lightBuffer._m0[_86].Color & 65280u) >> 8u) * 0.0039215688593685626983642578125, float((lightBuffer._m0[_86].Color & 16711680u) >> 16u) * 0.0039215688593685626983642578125) * _118) * (_124 * _124));
}
float3 _144 = _84 * 2.0;
float3 _141 = _83 * 2.0;
out.out_var_SV_Target0 = _71;
out.out_var_SV_Target1 = in.in_var_TEXCOORD0;
out.out_var_SV_Target2 = float4(_144.x, _144.y, _144.z, float4(0.0).w);
out.out_var_SV_Target3 = (0u | (in.in_var_TEXCOORD3 & 1u)) | (in.in_var_TEXCOORD3 & 30u);
out.out_var_SV_Target2 = float4(_141.x, _141.y, _141.z, float4(0.0).w);
out.out_var_SV_Target3 = (in.in_var_TEXCOORD3 & 1u) | (in.in_var_TEXCOORD3 & 30u);
return out;
}

Binary file modified shaders/bin/opaque.frag.spv
Binary file not shown.
2 changes: 1 addition & 1 deletion shaders/bin/opaque.vert.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 3 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 3, "inputs": [{ "name": "in.var.TEXCOORD0", "type": "uint", "location": 0 }], "outputs": [{ "name": "out.var.TEXCOORD0", "type": "float4", "location": 0 }, { "name": "out.var.TEXCOORD1", "type": "float3", "location": 1 }, { "name": "out.var.TEXCOORD2", "type": "float3", "location": 2 }, { "name": "out.var.TEXCOORD3", "type": "uint", "location": 3 }] }
2 changes: 1 addition & 1 deletion shaders/bin/raycast.frag.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0, "inputs": [], "outputs": [{ "name": "out.var.SV_Target0", "type": "float4", "location": 0 }] }
2 changes: 1 addition & 1 deletion shaders/bin/raycast.vert.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 2 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 2, "inputs": [], "outputs": [] }
Binary file modified shaders/bin/raycast.vert.spv
Binary file not shown.
2 changes: 1 addition & 1 deletion shaders/bin/shadow.frag.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0, "inputs": [], "outputs": [] }
2 changes: 1 addition & 1 deletion shaders/bin/shadow.vert.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 3 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 3, "inputs": [{ "name": "in.var.TEXCOORD0", "type": "uint", "location": 0 }], "outputs": [] }
2 changes: 1 addition & 1 deletion shaders/bin/sky.frag.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 0, "inputs": [{ "name": "in.var.TEXCOORD0", "type": "float3", "location": 0 }], "outputs": [{ "name": "out.var.SV_Target0", "type": "float4", "location": 0 }, { "name": "out.var.SV_Target3", "type": "uint", "location": 3 }] }
2 changes: 1 addition & 1 deletion shaders/bin/sky.vert.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 2 }
{ "samplers": 0, "storage_textures": 0, "storage_buffers": 0, "uniform_buffers": 2, "inputs": [], "outputs": [{ "name": "out.var.TEXCOORD0", "type": "float3", "location": 0 }] }
Loading
Loading