Skip to content

Commit 73763db

Browse files
committed
Fixes for various 2d samples
- remove use of hard coded alignment - implement depth attachment - implement get_copyable_layout
1 parent 0dc499c commit 73763db

File tree

7 files changed

+476
-137
lines changed

7 files changed

+476
-137
lines changed

drivers/webgpu/rendering_device_driver_webgpu.cpp

Lines changed: 176 additions & 90 deletions
Large diffs are not rendered by default.

drivers/webgpu/rendering_device_driver_webgpu.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,16 @@ class RenderingDeviceDriverWebGpu : public RenderingDeviceDriver {
5353
struct TextureInfo {
5454
public:
5555
WGPUTexture texture;
56-
WGPUTextureFormat format;
57-
WGPUTextureUsage usage;
58-
bool is_original_texture;
5956
WGPUTextureView view;
60-
uint32_t width;
61-
uint32_t height;
62-
uint32_t depth_or_array;
57+
58+
// TODO: nextInChain is not preserved.
59+
WGPUTextureDescriptor texture_desc;
60+
WGPUTextureViewDescriptor texture_view_desc;
61+
62+
RDD::DataFormat rd_texture_format;
63+
64+
bool is_original_texture;
6365
bool is_using_depth;
64-
uint32_t mip_level_count;
6566
};
6667

6768
// Keep track of existing mirror textures to ensure we don't write to a deleted texture.
@@ -341,22 +342,20 @@ class RenderingDeviceDriverWebGpu : public RenderingDeviceDriver {
341342
};
342343

343344
Vector<uint8_t> push_constant_data;
344-
345345
};
346346

347347
struct ComputePassEncoderInfo {
348348
Vector<ComputePassEncoderCommand> commands;
349349
};
350350

351351
struct CommandBufferInfo {
352-
WGPUCommandEncoder encoder;
353-
bool is_render_pass_active;
354-
RenderPassEncoderInfo active_render_pass_info;
355-
ComputePassEncoderInfo active_compute_pass_info;
352+
WGPUCommandEncoder encoder = nullptr;
353+
bool is_render_pass_active = false;
354+
RenderPassEncoderInfo active_render_pass_info = RenderPassEncoderInfo();
355+
ComputePassEncoderInfo active_compute_pass_info = ComputePassEncoderInfo();
356356
};
357357

358358
public:
359-
360359
virtual CommandBufferID command_buffer_create(CommandPoolID p_cmd_pool) override final;
361360
virtual bool command_buffer_begin(CommandBufferID p_cmd_buffer) override final;
362361
virtual bool command_buffer_begin_secondary(CommandBufferID p_cmd_buffer, RenderPassID p_render_pass, uint32_t p_subpass, FramebufferID p_framebuffer) override final;
@@ -520,6 +519,8 @@ class RenderingDeviceDriverWebGpu : public RenderingDeviceDriver {
520519
WGPUStoreOp store_op;
521520
WGPULoadOp stencil_load_op;
522521
WGPUStoreOp stencil_store_op;
522+
bool is_depth_stencil;
523+
bool is_depth_stencil_read_only;
523524
};
524525

525526
struct RenderPassInfo {

0 commit comments

Comments
 (0)