Skip to content

Add depthSlice to WGPURenderPassColorAttachment #21057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/generated_struct_info32.json
Original file line number Diff line number Diff line change
Expand Up @@ -1081,10 +1081,11 @@
"WGPURenderPassColorAttachment": {
"__size__": 56,
"clearValue": 24,
"loadOp": 12,
"depthSlice": 8,
"loadOp": 16,
"nextInChain": 0,
"resolveTarget": 8,
"storeOp": 16,
"resolveTarget": 12,
"storeOp": 20,
"view": 4
},
"WGPURenderPassDepthStencilAttachment": {
Expand Down
11 changes: 6 additions & 5 deletions src/generated_struct_info64.json
Original file line number Diff line number Diff line change
Expand Up @@ -1079,12 +1079,13 @@
"stencilReadOnly": 41
},
"WGPURenderPassColorAttachment": {
"__size__": 64,
"clearValue": 32,
"loadOp": 24,
"__size__": 72,
"clearValue": 40,
"depthSlice": 16,
"loadOp": 32,
"nextInChain": 0,
"resolveTarget": 16,
"storeOp": 28,
"resolveTarget": 24,
"storeOp": 36,
"view": 8
},
"WGPURenderPassDepthStencilAttachment": {
Expand Down
4 changes: 4 additions & 0 deletions src/library_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,9 @@ var LibraryWebGPU = {
return undefined;
}

var depthSlice = {{{ gpu.makeGetU32('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.depthSlice) }}};
{{{ gpu.convertSentinelToUndefined('depthSlice') }}}

var loadOpInt = {{{ gpu.makeGetU32('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.loadOp) }}};
#if ASSERTIONS
assert(loadOpInt !== {{{ gpu.LoadOp.Undefined }}});
Expand All @@ -1617,6 +1620,7 @@ var LibraryWebGPU = {

return {
"view": WebGPU.mgrTextureView.get(viewPtr),
"depthSlice": depthSlice,
"resolveTarget": WebGPU.mgrTextureView.get(
{{{ gpu.makeGetU32('caPtr', C_STRUCTS.WGPURenderPassColorAttachment.resolveTarget) }}}),
"clearValue": clearValue,
Expand Down
1 change: 1 addition & 0 deletions src/struct_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,7 @@
"WGPURenderPassColorAttachment": [
"nextInChain",
"view",
"depthSlice",
"resolveTarget",
"loadOp",
"storeOp",
Expand Down
2 changes: 2 additions & 0 deletions system/include/webgpu/webgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@

#define WGPU_ARRAY_LAYER_COUNT_UNDEFINED (0xffffffffUL)
#define WGPU_COPY_STRIDE_UNDEFINED (0xffffffffUL)
#define WGPU_DEPTH_SLICE_UNDEFINED (0xffffffffUL)
#define WGPU_LIMIT_U32_UNDEFINED (0xffffffffUL)
#define WGPU_LIMIT_U64_UNDEFINED (0xffffffffffffffffULL)
#define WGPU_MIP_LEVEL_COUNT_UNDEFINED (0xffffffffUL)
Expand Down Expand Up @@ -1120,6 +1121,7 @@ typedef struct WGPUProgrammableStageDescriptor {
typedef struct WGPURenderPassColorAttachment {
WGPUChainedStruct const * nextInChain;
WGPU_NULLABLE WGPUTextureView view;
uint32_t depthSlice;
WGPU_NULLABLE WGPUTextureView resolveTarget;
WGPULoadOp loadOp;
WGPUStoreOp storeOp;
Expand Down
2 changes: 2 additions & 0 deletions system/include/webgpu/webgpu_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ namespace wgpu {

static constexpr uint32_t kArrayLayerCountUndefined = WGPU_ARRAY_LAYER_COUNT_UNDEFINED;
static constexpr uint32_t kCopyStrideUndefined = WGPU_COPY_STRIDE_UNDEFINED;
static constexpr uint32_t kDepthSliceUndefined = WGPU_DEPTH_SLICE_UNDEFINED;
static constexpr uint32_t kLimitU32Undefined = WGPU_LIMIT_U32_UNDEFINED;
static constexpr uint64_t kLimitU64Undefined = WGPU_LIMIT_U64_UNDEFINED;
static constexpr uint32_t kMipLevelCountUndefined = WGPU_MIP_LEVEL_COUNT_UNDEFINED;
Expand Down Expand Up @@ -1647,6 +1648,7 @@ namespace wgpu {
struct RenderPassColorAttachment {
ChainedStruct const * nextInChain = nullptr;
TextureView view = nullptr;
uint32_t depthSlice = WGPU_DEPTH_SLICE_UNDEFINED;
TextureView resolveTarget = nullptr;
LoadOp loadOp;
StoreOp storeOp;
Expand Down
2 changes: 2 additions & 0 deletions system/lib/webgpu/webgpu_cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,8 @@ namespace wgpu {
"offsetof mismatch for RenderPassColorAttachment::nextInChain");
static_assert(offsetof(RenderPassColorAttachment, view) == offsetof(WGPURenderPassColorAttachment, view),
"offsetof mismatch for RenderPassColorAttachment::view");
static_assert(offsetof(RenderPassColorAttachment, depthSlice) == offsetof(WGPURenderPassColorAttachment, depthSlice),
"offsetof mismatch for RenderPassColorAttachment::depthSlice");
static_assert(offsetof(RenderPassColorAttachment, resolveTarget) == offsetof(WGPURenderPassColorAttachment, resolveTarget),
"offsetof mismatch for RenderPassColorAttachment::resolveTarget");
static_assert(offsetof(RenderPassColorAttachment, loadOp) == offsetof(WGPURenderPassColorAttachment, loadOp),
Expand Down