From 7bf0184a3c3f1ad4efdfdef2a90ec6f6d917e7a9 Mon Sep 17 00:00:00 2001 From: floppyhammer Date: Mon, 24 Oct 2022 15:30:15 +0800 Subject: [PATCH] Fix data offset when zeroing out Z buffer (cherry picked from commit 8e926d63dddcac8c17bf2002c686088eba417817) --- renderer/src/gpu/d3d11/renderer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/renderer/src/gpu/d3d11/renderer.rs b/renderer/src/gpu/d3d11/renderer.rs index 6fdc1c46a..18e5ae2ee 100644 --- a/renderer/src/gpu/d3d11/renderer.rs +++ b/renderer/src/gpu/d3d11/renderer.rs @@ -12,6 +12,7 @@ //! //! This renderer supports OpenGL at least 4.3, OpenGL ES at least 3.1, and Metal of any version. +use std::mem; use crate::gpu::d3d11::shaders::{BOUND_WORKGROUP_SIZE, DICE_WORKGROUP_SIZE, BIN_WORKGROUP_SIZE}; use crate::gpu::d3d11::shaders::{PROPAGATE_WORKGROUP_SIZE, ProgramsD3D11, SORT_WORKGROUP_SIZE}; use crate::gpu::perf::TimeCategory; @@ -563,7 +564,7 @@ impl RendererD3D11 where D: Device { let z_buffer = core.allocator.get_general_buffer(z_buffer_id); let z_buffer_size = core.tile_size(); let tile_area = z_buffer_size.area() as usize; - core.device.upload_to_buffer(z_buffer, 0, &vec![0i32; tile_area], BufferTarget::Storage); + core.device.upload_to_buffer(z_buffer, FILL_INDIRECT_DRAW_PARAMS_SIZE * mem::size_of::(), &vec![0i32; tile_area], BufferTarget::Storage); // TODO(pcwalton): Initialize the first tiles buffer on GPU? let first_tile_map_storage_buffer = core.allocator