Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/

## Unreleased

### Changed

### Changed
- Immediates no longer uses `WGPUPipelineLayoutExtras` chain, the `WGPUPipelineLayoutDescriptor` takes `uint32_t immediateSize` directily. By @Vipitis in [#583](https://github.com/gfx-rs/wgpu-native/pull/583).
- Updated all wgpu crates to v29
- MSRV bumped from 1.82 to 1.87.
- **Push constants renamed to immediates.** This matches the upstream wgpu rename.
Expand Down
11 changes: 2 additions & 9 deletions examples/immediates/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,6 @@ int main(int argc, char *argv[]) {
});
assert(staging_buffer);

WGPUPipelineLayoutExtras pipeline_layout_extras = {
.chain =
{
.sType = WGPUSType_PipelineLayoutExtras,
},
.immediateDataSize = sizeof(uint32_t),
};

WGPUBindGroupLayoutEntry bind_group_layout_entries[] = {
{
.binding = 0,
Expand All @@ -130,9 +122,10 @@ int main(int argc, char *argv[]) {

WGPUPipelineLayoutDescriptor pipeline_layout_desc = {
.label = {"pipeline_layout", WGPU_STRLEN},
.nextInChain = &pipeline_layout_extras.chain,
.nextInChain = NULL,
.bindGroupLayouts = &bind_group_layout,
.bindGroupLayoutCount = 1,
.immediateSize = sizeof(uint32_t),
};
WGPUPipelineLayout pipeline_layout =
wgpuDeviceCreatePipelineLayout(device, &pipeline_layout_desc);
Expand Down
20 changes: 2 additions & 18 deletions ffi/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ typedef enum WGPUNativeSType
WGPUSType_DeviceExtras = 0x00030001,
/** Identifies @ref WGPUNativeLimits. */
WGPUSType_NativeLimits = 0x00030002,
/** Identifies @ref WGPUPipelineLayoutExtras. */
WGPUSType_PipelineLayoutExtras = 0x00030003,
Comment thread
Vipitis marked this conversation as resolved.
/** Identifies @ref WGPUShaderSourceGLSL. */
WGPUSType_ShaderSourceGLSL = 0x00030004,
/** Identifies @ref WGPUInstanceExtras. */
Expand Down Expand Up @@ -96,8 +94,8 @@ typedef enum WGPUNativeFeature
* Enables @ref wgpuRenderPassEncoderSetImmediates,
* @ref wgpuComputePassEncoderSetImmediates,
* @ref wgpuRenderBundleEncoderSetImmediates,
* non-zero @c immediateDataSize in @ref WGPUPipelineLayoutExtras,
* and non-zero @c maxImmediateSize in @ref WGPUNativeLimits.
* non-zero @c immediateSize in @ref WGPUPipelineLayout,
* and non-zero @c maxImmediateSize in @ref WGPULimits.
*
* A block of immediate data can be declared in WGSL with
* @c var<immediate>:
Expand Down Expand Up @@ -1224,20 +1222,6 @@ typedef struct WGPUNativeLimits
/*.maxMultiviewViewCount=*/WGPU_LIMIT_U32_UNDEFINED _wgpu_COMMA \
})

typedef struct WGPUPipelineLayoutExtras
{
WGPUChainedStruct chain;
/**
* The number of bytes of immediate data allocated for use in shaders
* attached to this pipeline.
*
* The @c var<immediate> declarations in the shader must be equal or
* smaller than this size. If this value is non-zero,
* @ref WGPUNativeFeature_Immediates must be enabled.
*/
uint32_t immediateDataSize;
} WGPUPipelineLayoutExtras;

/**
* Identifier for a particular call to @ref wgpuQueueSubmitForIndex.
*
Expand Down
3 changes: 1 addition & 2 deletions src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ pub(crate) unsafe fn map_device_descriptor<'a>(
#[inline]
pub unsafe fn map_pipeline_layout_descriptor<'a>(
des: &native::WGPUPipelineLayoutDescriptor,
extras: Option<&native::WGPUPipelineLayoutExtras>,
) -> wgc::binding_model::PipelineLayoutDescriptor<'a> {
let bind_group_layouts = make_slice(des.bindGroupLayouts, des.bindGroupLayoutCount)
.iter()
Expand All @@ -509,7 +508,7 @@ pub unsafe fn map_pipeline_layout_descriptor<'a>(
})
.collect::<Vec<_>>();

let immediate_size = extras.map_or(0, |extras| extras.immediateDataSize);
let immediate_size = des.immediateSize;

wgc::binding_model::PipelineLayoutDescriptor {
label: string_view_into_label(des.label),
Expand Down
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2071,11 +2071,7 @@ pub unsafe extern "C" fn wgpuDeviceCreatePipelineLayout(
};
let descriptor = descriptor.expect("invalid descriptor");

let desc = follow_chain!(
map_pipeline_layout_descriptor(
(descriptor),
WGPUSType_PipelineLayoutExtras => native::WGPUPipelineLayoutExtras)
);
let desc = map_pipeline_layout_descriptor(descriptor);
let (pipeline_layout_id, error) = context.device_create_pipeline_layout(device_id, &desc, None);
if let Some(cause) = error {
handle_error(
Expand Down
Loading