Skip to content

Commit b9cb487

Browse files
committed
removed clear heads shader (not needed)
1 parent ed63b8c commit b9cb487

3 files changed

Lines changed: 6 additions & 31 deletions

File tree

‎lib/binning.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include <stddef.h>
55

6-
static const size_t binning_shader_size = 26020;
6+
static const size_t binning_shader_size = 25989;
77
static const char binning_shader[] =
88
"// ---------------------------------------------------------------------------------------------------------------------------\n"
99
"// Structures\n"
@@ -814,7 +814,7 @@ static const char binning_shader[] =
814814
"@compute @workgroup_size(1, 1, 1)\n"
815815
"fn write_indirect_args()\n"
816816
"{\n"
817-
" g_indirect_draw.vertex_count = 4u; // 4 vertices for a quad/strip\n"
817+
" g_indirect_draw.vertex_count = 4u;\n"
818818
" g_indirect_draw.instance_count = atomicLoad(&g_counters.num_tiles);\n"
819819
" g_indirect_draw.first_vertex = 0u;\n"
820820
" g_indirect_draw.first_instance = 0u;\n"

‎lib/onedraw.c‎

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ struct onedraw
144144
struct
145145
{
146146
WGPUBuffer heads;
147-
WGPUComputePipeline clear_pso;
148147
WGPUComputePipeline binning_pso;
149148
WGPUComputePipeline write_indirect_buffer_pso;
150149
WGPUBuffer counters;
@@ -933,21 +932,7 @@ void build_pso(struct onedraw* r, WGPUTextureFormat surface_format)
933932
.label = WGPU_STRING_VIEW("binning")
934933
});
935934

936-
WGPUComputePipelineDescriptor compute_pipeline_desc =
937-
{
938-
.layout = layout,
939-
.compute =
940-
{
941-
.module = shader,
942-
.entryPoint = WGPU_STRING_VIEW("clear_heads"),
943-
.constants = NULL
944-
}
945-
};
946-
947-
r->tiles.clear_pso = wgpuDeviceCreateComputePipeline(r->device, &compute_pipeline_desc);
948-
assert_msg(r->tiles.clear_pso != NULL, "can't create binning pso");
949-
950-
compute_pipeline_desc = (WGPUComputePipelineDescriptor)
935+
WGPUComputePipelineDescriptor compute_pipeline_desc = (WGPUComputePipelineDescriptor)
951936
{
952937
.layout = layout,
953938
.compute =
@@ -1310,18 +1295,6 @@ void od_end_frame(struct onedraw* r, WGPUTextureView target_view)
13101295
// clear counter
13111296
wgpuCommandEncoderClearBuffer(encoder, r->tiles.counters, 0, sizeof(uint32_t) * 2);
13121297

1313-
// clear heads pass
1314-
{
1315-
WGPUComputePassDescriptor desc = {.label = WGPU_STRING_VIEW("clear_heads pass")};
1316-
WGPUComputePassEncoder pass = wgpuCommandEncoderBeginComputePass(encoder, &desc);
1317-
wgpuComputePassEncoderSetPipeline(pass, r->tiles.clear_pso);
1318-
wgpuComputePassEncoderSetBindGroup(pass, 0, r->binding.binning_bindgroup, 0, NULL);
1319-
wgpuComputePassEncoderSetBindGroup(pass, 1, r->binding.frame_bindgroup[buffer_index], 0, NULL);
1320-
wgpuComputePassEncoderDispatchWorkgroups(pass, r->tiles.num_width * r->tiles.num_height, 1, 1);
1321-
wgpuComputePassEncoderEnd(pass);
1322-
wgpuComputePassEncoderRelease(pass);
1323-
}
1324-
13251298
// binning pass
13261299
{
13271300
WGPUComputePassDescriptor desc = {.label = WGPU_STRING_VIEW("binning pass")};
@@ -1418,6 +1391,8 @@ void od_terminate(struct onedraw* r)
14181391
SAFE_RELEASE(r->tiles.nodes, wgpuBufferRelease);
14191392
SAFE_RELEASE(r->tiles.heads, wgpuBufferRelease);
14201393
SAFE_RELEASE(r->rasterizer.pso, wgpuRenderPipelineRelease);
1394+
SAFE_RELEASE(r->tiles.binning_pso, wgpuComputePipelineRelease);
1395+
SAFE_RELEASE(r->tiles.write_indirect_buffer_pso, wgpuComputePipelineRelease);
14211396
r->mem_interface.free_fn(r, r->mem_interface.user);
14221397
}
14231398

‎src/shaders/binning.wgsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ fn tile_bin(@builtin(global_invocation_id) global_id: vec3<u32>)
613613
@compute @workgroup_size(1, 1, 1)
614614
fn write_indirect_args()
615615
{
616-
g_indirect_draw.vertex_count = 4u; // 4 vertices for a quad/strip
616+
g_indirect_draw.vertex_count = 4u;
617617
g_indirect_draw.instance_count = atomicLoad(&g_counters.num_tiles);
618618
g_indirect_draw.first_vertex = 0u;
619619
g_indirect_draw.first_instance = 0u;

0 commit comments

Comments
 (0)