diff options
| -rw-r--r-- | cmake/DemoExecutables.cmake | 2 | ||||
| -rwxr-xr-x | scripts/build_win.sh | 4 | ||||
| -rw-r--r-- | src/effects/flash_effect.cc | 6 | ||||
| -rw-r--r-- | src/effects/gaussian_blur_effect.cc | 6 | ||||
| -rw-r--r-- | src/effects/heptagon_effect.cc | 6 | ||||
| -rw-r--r-- | src/effects/hybrid3_d_effect.cc | 7 | ||||
| -rw-r--r-- | src/effects/particles_effect.cc | 8 | ||||
| -rw-r--r-- | src/effects/passthrough_effect.cc | 8 | ||||
| -rw-r--r-- | src/effects/peak_meter_effect.cc | 5 | ||||
| -rw-r--r-- | src/effects/placeholder_effect.cc | 8 | ||||
| -rw-r--r-- | src/effects/rotating_cube_effect.cc | 6 | ||||
| -rw-r--r-- | src/gpu/gpu.h | 2 | ||||
| -rwxr-xr-x | tools/seq_compiler.py | 4 |
13 files changed, 23 insertions, 49 deletions
diff --git a/cmake/DemoExecutables.cmake b/cmake/DemoExecutables.cmake index 223f406..4417eec 100644 --- a/cmake/DemoExecutables.cmake +++ b/cmake/DemoExecutables.cmake @@ -55,7 +55,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/src/generated COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/seq_compiler.py ${TEST_DEMO_SEQ_PATH} --output ${GENERATED_TEST_DEMO_TIMELINE_CC} - DEPENDS ${TEST_DEMO_SEQ_PATH} src/gpu/demo_effects.h + DEPENDS ${TEST_DEMO_SEQ_PATH} src/gpu/demo_effects.h ${CMAKE_CURRENT_SOURCE_DIR}/tools/seq_compiler.py COMMENT "Compiling test_demo sequence..." ) add_custom_target(generate_test_demo_timeline ALL DEPENDS ${GENERATED_TEST_DEMO_TIMELINE_CC}) diff --git a/scripts/build_win.sh b/scripts/build_win.sh index 915d1e5..c1732f0 100755 --- a/scripts/build_win.sh +++ b/scripts/build_win.sh @@ -4,10 +4,9 @@ set -e # 1. Build native tools echo "Building native tools..." cmake -S . -B build_native -DDEMO_BUILD_TOOLS=OFF -DDEMO_BUILD_TESTS=OFF -cmake --build build_native --target asset_packer seq_compiler tracker_compiler_host -j8 +cmake --build build_native --target asset_packer tracker_compiler_host -j8 ASSET_PACKER_PATH=$(pwd)/build_native/asset_packer -SEQ_COMPILER_PATH=$(pwd)/build_native/seq_compiler TRACKER_COMPILER_PATH=$(pwd)/build_native/tools_host/tracker_compiler_host echo "Cross-compiling for Windows..." @@ -16,7 +15,6 @@ cmake -S . -B build_win \ -DDEMO_CROSS_COMPILE_WIN32=ON \ -DDEMO_STRIP_ALL=ON \ -DASSET_PACKER_PATH=$ASSET_PACKER_PATH \ - -DSEQ_COMPILER_PATH=$SEQ_COMPILER_PATH \ -DTRACKER_COMPILER_PATH=$TRACKER_COMPILER_PATH cmake --build build_win -j8 diff --git a/src/effects/flash_effect.cc b/src/effects/flash_effect.cc index c8638f0..7baf6a2 100644 --- a/src/effects/flash_effect.cc +++ b/src/effects/flash_effect.cc @@ -67,11 +67,7 @@ void Flash::render(WGPUCommandEncoder encoder, // Render pass WGPURenderPassColorAttachment color_attachment = {}; - color_attachment.view = output_view; - color_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; - color_attachment.loadOp = WGPULoadOp_Clear; - color_attachment.storeOp = WGPUStoreOp_Store; - color_attachment.clearValue = {0.0, 0.0, 0.0, 1.0}; + gpu_init_color_attachment(color_attachment, output_view); WGPURenderPassDescriptor pass_desc = {}; pass_desc.colorAttachmentCount = 1; diff --git a/src/effects/gaussian_blur_effect.cc b/src/effects/gaussian_blur_effect.cc index 02cd77e..7304321 100644 --- a/src/effects/gaussian_blur_effect.cc +++ b/src/effects/gaussian_blur_effect.cc @@ -68,11 +68,7 @@ void GaussianBlur::render(WGPUCommandEncoder encoder, // Render pass WGPURenderPassColorAttachment color_attachment = {}; - color_attachment.view = output_view; - color_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; - color_attachment.loadOp = WGPULoadOp_Clear; - color_attachment.storeOp = WGPUStoreOp_Store; - color_attachment.clearValue = {0.0, 0.0, 0.0, 1.0}; + gpu_init_color_attachment(color_attachment, output_view); WGPURenderPassDescriptor pass_desc = {}; pass_desc.colorAttachmentCount = 1; diff --git a/src/effects/heptagon_effect.cc b/src/effects/heptagon_effect.cc index 13d7aad..c472f2f 100644 --- a/src/effects/heptagon_effect.cc +++ b/src/effects/heptagon_effect.cc @@ -72,11 +72,7 @@ void Heptagon::render(WGPUCommandEncoder encoder, // Render pass WGPURenderPassColorAttachment color_attachment = {}; - color_attachment.view = output_view; - color_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; - color_attachment.loadOp = WGPULoadOp_Clear; - color_attachment.storeOp = WGPUStoreOp_Store; - color_attachment.clearValue = {0.0, 0.0, 0.0, 1.0}; + gpu_init_color_attachment(color_attachment, output_view); WGPURenderPassDescriptor pass_desc = {}; pass_desc.colorAttachmentCount = 1; diff --git a/src/effects/hybrid3_d_effect.cc b/src/effects/hybrid3_d_effect.cc index 1dd1c05..5832b57 100644 --- a/src/effects/hybrid3_d_effect.cc +++ b/src/effects/hybrid3_d_effect.cc @@ -106,12 +106,7 @@ void Hybrid3D::render(WGPUCommandEncoder encoder, // Render 3D scene using sequence encoder WGPURenderPassColorAttachment color_attachment = {}; -#if !defined(DEMO_CROSS_COMPILE_WIN32) - color_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; -#endif - color_attachment.view = color_view; - color_attachment.loadOp = WGPULoadOp_Clear; - color_attachment.storeOp = WGPUStoreOp_Store; + gpu_init_color_attachment(color_attachment, color_view); color_attachment.clearValue = {0.05f, 0.05f, 0.05f, 1.0f}; WGPURenderPassDepthStencilAttachment depth_attachment = {}; diff --git a/src/effects/particles_effect.cc b/src/effects/particles_effect.cc index 22e41e9..d83f303 100644 --- a/src/effects/particles_effect.cc +++ b/src/effects/particles_effect.cc @@ -84,12 +84,8 @@ void Particles::render(WGPUCommandEncoder encoder, // Run render pass (draw particles to output) WGPUTextureView output_view = nodes.get_view(output_nodes_[0]); - WGPURenderPassColorAttachment color_attachment = { - .view = output_view, - .depthSlice = WGPU_DEPTH_SLICE_UNDEFINED, - .loadOp = WGPULoadOp_Clear, - .storeOp = WGPUStoreOp_Store, - .clearValue = {0.0, 0.0, 0.0, 1.0}}; + WGPURenderPassColorAttachment color_attachment = {}; + gpu_init_color_attachment(color_attachment, output_view); WGPURenderPassDescriptor render_desc = { .colorAttachmentCount = 1, .colorAttachments = &color_attachment}; diff --git a/src/effects/passthrough_effect.cc b/src/effects/passthrough_effect.cc index 392102d..b9d9337 100644 --- a/src/effects/passthrough_effect.cc +++ b/src/effects/passthrough_effect.cc @@ -63,12 +63,8 @@ void Passthrough::render(WGPUCommandEncoder encoder, bind_group_ = wgpuDeviceCreateBindGroup(ctx_.device, &bg_desc); // Render pass - WGPURenderPassColorAttachment color_attachment = { - .view = output_view, - .depthSlice = WGPU_DEPTH_SLICE_UNDEFINED, - .loadOp = WGPULoadOp_Clear, - .storeOp = WGPUStoreOp_Store, - .clearValue = {0.0, 0.0, 0.0, 1.0}}; + WGPURenderPassColorAttachment color_attachment = {}; + gpu_init_color_attachment(color_attachment, output_view); WGPURenderPassDescriptor pass_desc = {}; pass_desc.colorAttachmentCount = 1; diff --git a/src/effects/peak_meter_effect.cc b/src/effects/peak_meter_effect.cc index 63be2c0..d823e20 100644 --- a/src/effects/peak_meter_effect.cc +++ b/src/effects/peak_meter_effect.cc @@ -81,11 +81,8 @@ void PeakMeter::render(WGPUCommandEncoder encoder, uniforms_buffer_.get(), {nullptr, 0}); WGPURenderPassColorAttachment color_attachment = {}; - color_attachment.view = output_view; - color_attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; + gpu_init_color_attachment(color_attachment, output_view); color_attachment.loadOp = WGPULoadOp_Load; - color_attachment.storeOp = WGPUStoreOp_Store; - color_attachment.clearValue = {0.0, 0.0, 0.0, 1.0}; WGPURenderPassDescriptor pass_desc = {}; pass_desc.colorAttachmentCount = 1; diff --git a/src/effects/placeholder_effect.cc b/src/effects/placeholder_effect.cc index 6ba665a..3367f1c 100644 --- a/src/effects/placeholder_effect.cc +++ b/src/effects/placeholder_effect.cc @@ -45,12 +45,8 @@ void Placeholder::render(WGPUCommandEncoder encoder, pp_update_bind_group(ctx_.device, pipeline_, &bind_group_, input_view, uniforms_buffer_.get(), {nullptr, 0}); - WGPURenderPassColorAttachment color_attachment = { - .view = output_view, - .depthSlice = WGPU_DEPTH_SLICE_UNDEFINED, - .loadOp = WGPULoadOp_Clear, - .storeOp = WGPUStoreOp_Store, - .clearValue = {0.0, 0.0, 0.0, 1.0}}; + WGPURenderPassColorAttachment color_attachment = {}; + gpu_init_color_attachment(color_attachment, output_view); WGPURenderPassDescriptor pass_desc = {}; pass_desc.colorAttachmentCount = 1; diff --git a/src/effects/rotating_cube_effect.cc b/src/effects/rotating_cube_effect.cc index 0f1781d..6c350a7 100644 --- a/src/effects/rotating_cube_effect.cc +++ b/src/effects/rotating_cube_effect.cc @@ -163,9 +163,9 @@ void RotatingCube::render(WGPUCommandEncoder encoder, WGPUTexture input_tex = nodes.get_texture(input_nodes_[0]); WGPUTexture output_tex = nodes.get_texture(output_nodes_[0]); if (input_tex && output_tex) { - WGPUTexelCopyTextureInfo src = { + GpuTextureCopyInfo src = { .texture = input_tex, .mipLevel = 0, .aspect = WGPUTextureAspect_All}; - WGPUTexelCopyTextureInfo dst = {.texture = output_tex, + GpuTextureCopyInfo dst = {.texture = output_tex, .mipLevel = 0, .aspect = WGPUTextureAspect_All}; WGPUExtent3D copy_size = {(uint32_t)params.resolution.x, @@ -181,7 +181,9 @@ void RotatingCube::render(WGPUCommandEncoder encoder, // Render pass with depth WGPURenderPassColorAttachment color_attachment = { .view = color_view, + #if !defined(DEMO_CROSS_COMPILE_WIN32) .depthSlice = WGPU_DEPTH_SLICE_UNDEFINED, +#endif // .loadOp = WGPULoadOp_Clear, .loadOp = WGPULoadOp_Load, .storeOp = WGPUStoreOp_Store, diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h index 5e928b2..de6c5ba 100644 --- a/src/gpu/gpu.h +++ b/src/gpu/gpu.h @@ -66,7 +66,9 @@ inline void gpu_init_color_attachment(WGPURenderPassColorAttachment& attachment, attachment.loadOp = WGPULoadOp_Clear; attachment.storeOp = WGPUStoreOp_Store; attachment.clearValue = {0.0f, 0.0f, 0.0f, 1.0f}; +#if !defined(DEMO_CROSS_COMPILE_WIN32) attachment.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; +#endif } // Texture creation helper diff --git a/tools/seq_compiler.py b/tools/seq_compiler.py index fc07f84..8c92996 100755 --- a/tools/seq_compiler.py +++ b/tools/seq_compiler.py @@ -640,7 +640,9 @@ void RenderTimeline(WGPUSurface surface, float time, int width, int height, // Clear source WGPURenderPassColorAttachment clear_attach = {}; clear_attach.view = g_source_view; + #if !defined(DEMO_CROSS_COMPILE_WIN32) clear_attach.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; +#endif clear_attach.loadOp = WGPULoadOp_Clear; clear_attach.storeOp = WGPUStoreOp_Store; clear_attach.clearValue = {0.0, 0.0, 0.0, 1.0}; @@ -665,7 +667,9 @@ void RenderTimeline(WGPUSurface surface, float time, int width, int height, blit_attach.view = surface_texture.texture ? wgpuTextureCreateView(surface_texture.texture, nullptr) : nullptr; + #if !defined(DEMO_CROSS_COMPILE_WIN32) blit_attach.depthSlice = WGPU_DEPTH_SLICE_UNDEFINED; +#endif blit_attach.loadOp = WGPULoadOp_Clear; blit_attach.storeOp = WGPUStoreOp_Store; blit_attach.clearValue = {0.0, 0.0, 0.0, 1.0}; |
