Skip to content

Commit

Permalink
Fix type mismatch in wgpuRenderBundleEncoderSetPushConstants
Browse files Browse the repository at this point in the history
Updated the shader stage type from WGPUShaderStageFlags to WGPUShaderStage to align with API requirements. Adjusted conversion logic to handle the new type safely and ensure compatibility with associated functionality.
  • Loading branch information
ygdrasil-io committed Jan 25, 2025
1 parent 61c9e75 commit 2411bb8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ffi/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ uint32_t wgpuGetVersion(void);

void wgpuRenderPassEncoderSetPushConstants(WGPURenderPassEncoder encoder, WGPUShaderStage 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 wgpuRenderBundleEncoderSetPushConstants(WGPURenderBundleEncoder encoder, WGPUShaderStage 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
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4361,7 +4361,7 @@ pub unsafe extern "C" fn wgpuComputePassEncoderSetPushConstants(
#[no_mangle]
pub unsafe extern "C" fn wgpuRenderBundleEncoderSetPushConstants(
bundle: native::WGPURenderBundleEncoder,
stages: native::WGPUShaderStageFlags,
stages: native::WGPUShaderStage,
offset: u32,
size_bytes: u32,
data: *const u8,
Expand All @@ -4373,7 +4373,7 @@ pub unsafe extern "C" fn wgpuRenderBundleEncoderSetPushConstants(

bundle_ffi::wgpu_render_bundle_set_push_constants(
encoder,
wgt::ShaderStages::from_bits(stages).expect("invalid shader stage"),
wgt::ShaderStages::from_bits(stages.try_into().unwrap()).expect("invalid shader stage"),
offset,
size_bytes,
data,
Expand Down

0 comments on commit 2411bb8

Please sign in to comment.