Skip to content

Commit

Permalink
wip compute encoder push constants
Browse files Browse the repository at this point in the history
  • Loading branch information
zackgomez committed Oct 11, 2024
1 parent e3bbc26 commit fec0d50
Show file tree
Hide file tree
Showing 2 changed files with 22 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 @@ -285,6 +285,7 @@ void wgpuSetLogLevel(WGPULogLevel level);
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 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
21 changes: 21 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4257,6 +4257,27 @@ pub unsafe extern "C" fn wgpuRenderPassEncoderSetPushConstants(
}
}

#[no_mangle]
pub unsafe extern "C" fn wgpuComputePassEncoderSetPushConstants(
pass: native::WGPUComputePassEncoder,
offset: u32,
size_bytes: u32,
data: *const u8,
) {
let pass = pass.as_ref().expect("invalid compute pass");
let encoder = pass.encoder.as_mut().unwrap();

match encoder.set_push_constants(&pass.context, offset, make_slice(data, size_bytes as usize)) {
Ok(()) => (),
Err(cause) => handle_error(
&pass.error_sink,
cause,
None,
"wgpuComputePassEncoderSetPushConstants",
),
}
}

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

0 comments on commit fec0d50

Please sign in to comment.