Skip to content

Commit

Permalink
Add RenderBundleEncoderSetPushConstants (#446)
Browse files Browse the repository at this point in the history
  • Loading branch information
fyellin authored Nov 21, 2024
1 parent 52bb912 commit ba1bf59
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions ffi/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ uint32_t wgpuGetVersion(void);

void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, void const * data);
void wgpuComputePassEncoderSetPushConstants(WGPUComputePassEncoder encoder, uint32_t offset, uint32_t sizeBytes, void const * data);
void wgpuRenderBundleEncoderSetPushConstants(WGPURenderBundleEncoder encoder, WGPUShaderStageFlags stages, uint32_t offset, uint32_t sizeBytes, void const * data);

void wgpuRenderPassEncoderMultiDrawIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count);
void wgpuRenderPassEncoderMultiDrawIndexedIndirect(WGPURenderPassEncoder encoder, WGPUBuffer buffer, uint64_t offset, uint32_t count);
Expand Down
22 changes: 22 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4314,6 +4314,28 @@ pub unsafe extern "C" fn wgpuComputePassEncoderSetPushConstants(
}
}

#[no_mangle]
pub unsafe extern "C" fn wgpuRenderBundleEncoderSetPushConstants(
bundle: native::WGPURenderBundleEncoder,
stages: native::WGPUShaderStageFlags,
offset: u32,
size_bytes: u32,
data: *const u8,
) {
let bundle = bundle.as_ref().expect("invalid render bundle");
let encoder = bundle.encoder.as_mut().expect("invalid render bundle");
let encoder = encoder.expect("invalid render bundle");
let encoder = encoder.as_mut().unwrap();

bundle_ffi::wgpu_render_bundle_set_push_constants(
encoder,
wgt::ShaderStages::from_bits(stages).expect("invalid shader stage"),
offset,
size_bytes,
data,
);
}

#[no_mangle]
pub unsafe extern "C" fn wgpuRenderPassEncoderMultiDrawIndirect(
pass: native::WGPURenderPassEncoder,
Expand Down

0 comments on commit ba1bf59

Please sign in to comment.