Skip to content

Commit daa9434

Browse files
committed
more
1 parent 5cd7555 commit daa9434

35 files changed

Lines changed: 361 additions & 388 deletions

CMakeLists.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ function(add_shader FILE)
8585
endif()
8686
package(${JSON})
8787
endfunction()
88-
add_shader(blur.comp)
89-
add_shader(chunk.vert shaders/voxel.hlsl src/voxel.inc)
90-
add_shader(composite.comp shaders/voxel.hlsl src/voxel.inc shaders/shadow.hlsl)
91-
add_shader(empty.frag)
92-
add_shader(fullscreen.vert)
93-
add_shader(fxaa.comp)
94-
add_shader(opaque.frag shaders/voxel.hlsl src/voxel.inc shaders/light.hlsl)
95-
add_shader(predepth.vert shaders/voxel.hlsl src/voxel.inc)
96-
add_shader(raycast.frag)
97-
add_shader(raycast.vert shaders/cube.hlsl)
98-
add_shader(shadow.vert shaders/voxel.hlsl src/voxel.inc)
99-
add_shader(sky.frag shaders/sky.hlsl)
100-
add_shader(sky.vert)
101-
add_shader(ssao.comp shaders/voxel.hlsl src/voxel.inc shaders/random.hlsl)
102-
add_shader(transparent.frag shaders/voxel.hlsl src/voxel.inc shaders/light.hlsl shaders/shadow.hlsl)
103-
add_shader(ui.comp)
88+
add_shader(blur.comp shaders/shader.hlsl src/voxel.inc)
89+
add_shader(chunk.vert shaders/shader.hlsl src/voxel.inc)
90+
add_shader(composite.comp shaders/shader.hlsl src/voxel.inc)
91+
add_shader(empty.frag shaders/shader.hlsl src/voxel.inc)
92+
add_shader(fullscreen.vert shaders/shader.hlsl src/voxel.inc)
93+
add_shader(fxaa.comp shaders/shader.hlsl src/voxel.inc)
94+
add_shader(opaque.frag shaders/shader.hlsl src/voxel.inc)
95+
add_shader(predepth.vert shaders/shader.hlsl src/voxel.inc)
96+
add_shader(raycast.frag shaders/shader.hlsl src/voxel.inc)
97+
add_shader(raycast.vert shaders/shader.hlsl src/voxel.inc)
98+
add_shader(shadow.vert shaders/shader.hlsl src/voxel.inc)
99+
add_shader(sky.frag shaders/shader.hlsl src/voxel.inc)
100+
add_shader(sky.vert shaders/shader.hlsl src/voxel.inc)
101+
add_shader(ssao.comp shaders/shader.hlsl src/voxel.inc)
102+
add_shader(transparent.frag shaders/shader.hlsl src/voxel.inc)
103+
add_shader(ui.comp shaders/shader.hlsl src/voxel.inc)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
- Blocks and plants
88
- Persistent worlds
99
- Clustered dynamic lighting
10+
- Postprocessing
11+
- Single transparent layer

shaders/bin/chunk.vert.spv

-4 Bytes
Binary file not shown.

shaders/bin/composite.comp.msl

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -55,93 +55,92 @@ kernel void main0(constant type_UniformBuffer& UniformBuffer [[buffer(0)]], text
5555
{
5656
do
5757
{
58-
uint2 _73 = uint2(colorTexture.get_width(), colorTexture.get_height());
59-
bool _85;
60-
if (!(gl_GlobalInvocationID.x >= _73.x))
58+
uint2 _72 = uint2(colorTexture.get_width(), colorTexture.get_height());
59+
bool _84;
60+
if (!(gl_GlobalInvocationID.x >= _72.x))
6161
{
62-
_85 = gl_GlobalInvocationID.y >= _73.y;
62+
_84 = gl_GlobalInvocationID.y >= _72.y;
6363
}
6464
else
6565
{
66-
_85 = true;
66+
_84 = true;
6767
}
68-
if (_85)
68+
if (_84)
6969
{
7070
break;
7171
}
72-
float4 _90 = colorTexture.read(uint2(gl_GlobalInvocationID.xy), 0u);
73-
float3 _91 = _90.xyz;
74-
uint4 _94 = voxelTexture.read(uint2(gl_GlobalInvocationID.xy), 0u);
75-
uint _95 = _94.x;
76-
float3 _177;
77-
if ((_95 & 1u) != 0u)
72+
float4 _89 = colorTexture.read(uint2(gl_GlobalInvocationID.xy), 0u);
73+
float3 _90 = _89.xyz;
74+
uint4 _93 = voxelTexture.read(uint2(gl_GlobalInvocationID.xy), 0u);
75+
uint _94 = _93.x;
76+
float3 _172;
77+
if ((_94 & 1u) != 0u)
7878
{
79-
float _170;
79+
float _165;
8080
do
8181
{
82-
float4 _124 = UniformBuffer.ShadowTransform * float4(positionTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).xyz, 1.0);
83-
float3 _128 = _124.xyz / float3(_124.w);
84-
float2 _131 = (_128.xy * 0.5) + float2(0.5);
85-
float _133 = 1.0 - _131.y;
86-
float2 _134 = _131;
87-
_134.y = _133;
88-
float _135 = _131.x;
89-
bool _141;
90-
if (!(_135 < 0.0))
82+
float4 _123 = UniformBuffer.ShadowTransform * float4(positionTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).xyz, 1.0);
83+
float2 _126 = (_123.xy * 0.5) + float2(0.5);
84+
float _128 = 1.0 - _126.y;
85+
float2 _129 = _126;
86+
_129.y = _128;
87+
float _130 = _126.x;
88+
bool _136;
89+
if (!(_130 < 0.0))
9190
{
92-
_141 = _135 > 1.0;
91+
_136 = _130 > 1.0;
9392
}
9493
else
9594
{
96-
_141 = true;
95+
_136 = true;
9796
}
98-
bool _146;
99-
if (!_141)
97+
bool _141;
98+
if (!_136)
10099
{
101-
_146 = _133 < 0.0;
100+
_141 = _128 < 0.0;
102101
}
103102
else
104103
{
105-
_146 = true;
104+
_141 = true;
106105
}
107-
bool _151;
108-
if (!_146)
106+
bool _146;
107+
if (!_141)
109108
{
110-
_151 = _133 > 1.0;
109+
_146 = _128 > 1.0;
111110
}
112111
else
113112
{
114-
_151 = true;
113+
_146 = true;
115114
}
116-
if (_151)
115+
if (_146)
117116
{
118-
_170 = 0.0;
117+
_165 = 0.0;
119118
break;
120119
}
121-
if (dot(_65[(_95 >> 1u) & 7u], fast::normalize(float4(UniformBuffer.ShadowTransform[0][2], UniformBuffer.ShadowTransform[1][2], UniformBuffer.ShadowTransform[2][2], UniformBuffer.ShadowTransform[3][2]).xyz)) > 0.0)
120+
if (dot(_65[(_94 >> 1u) & 7u], fast::normalize(float4(UniformBuffer.ShadowTransform[0][2], UniformBuffer.ShadowTransform[1][2], UniformBuffer.ShadowTransform[2][2], UniformBuffer.ShadowTransform[3][2]).xyz)) > 0.0)
122121
{
123-
_170 = 0.4000000059604644775390625;
122+
_165 = 0.4000000059604644775390625;
124123
break;
125124
}
126-
if ((_128.z - 0.001000000047497451305389404296875) <= shadowTexture.sample(shadowSampler, _134, level(0.0)).x)
125+
if ((_123.z - 0.001000000047497451305389404296875) <= shadowTexture.sample(shadowSampler, _129, level(0.0)).x)
127126
{
128-
_170 = 0.0;
127+
_165 = 0.0;
129128
break;
130129
}
131130
else
132131
{
133-
_170 = 0.4000000059604644775390625;
132+
_165 = 0.4000000059604644775390625;
134133
break;
135134
}
136135
break; // unreachable workaround
137136
} while(false);
138-
_177 = _91 * (((lightTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).xyz + float3(0.5)) - float3(ssaoTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).x * 3.0)) - float3(_170));
137+
_172 = _90 * (((lightTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).xyz + float3(0.5)) - float3(ssaoTexture.read(uint2(gl_GlobalInvocationID.xy), 0u).x * 3.0)) - float3(_165));
139138
}
140139
else
141140
{
142-
_177 = _91;
141+
_172 = _90;
143142
}
144-
compositeTexture.write(float4(_177, _90.w), uint2(gl_GlobalInvocationID.xy));
143+
compositeTexture.write(float4(_172, _89.w), uint2(gl_GlobalInvocationID.xy));
145144
break;
146145
} while(false);
147146
}

shaders/bin/composite.comp.spv

-112 Bytes
Binary file not shown.

shaders/bin/opaque.frag.spv

0 Bytes
Binary file not shown.

shaders/bin/predepth.vert.spv

0 Bytes
Binary file not shown.

shaders/bin/raycast.vert.spv

-8 Bytes
Binary file not shown.

shaders/bin/shadow.vert.spv

0 Bytes
Binary file not shown.

shaders/bin/sky.frag.spv

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)