Skip to content

Commit

Permalink
Update webgpu header (#235)
Browse files Browse the repository at this point in the history
* Update webgpu header

* remove deprecated tex format

* write MaxBufferSize

* Set default to correct placeholder
  • Loading branch information
almarklein authored Jan 13, 2023
1 parent f523fb7 commit 2305180
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
4 changes: 0 additions & 4 deletions examples/framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@ void printAdapterFeatures(WGPUAdapter adapter) {
printf("\tDepthClipControl\n");
break;

case WGPUFeatureName_Depth24UnormStencil8:
printf("\tDepth24UnormStencil8\n");
break;

case WGPUFeatureName_Depth32FloatStencil8:
printf("\tDepth32FloatStencil8\n");
break;
Expand Down
1 change: 1 addition & 0 deletions examples/framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
.minUniformBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED, \
.minStorageBufferOffsetAlignment = WGPU_LIMIT_U32_UNDEFINED, \
.maxVertexBuffers = WGPU_LIMIT_U32_UNDEFINED, \
.maxBufferSize = WGPU_LIMIT_U64_UNDEFINED, \
.maxVertexAttributes = WGPU_LIMIT_U32_UNDEFINED, \
.maxVertexBufferArrayStride = WGPU_LIMIT_U32_UNDEFINED, \
.maxInterStageShaderComponents = WGPU_LIMIT_U32_UNDEFINED, \
Expand Down
2 changes: 1 addition & 1 deletion ffi/webgpu-headers
Submodule webgpu-headers updated 1 files
+119 −75 webgpu.h
2 changes: 0 additions & 2 deletions ffi/wgpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,11 @@ typedef struct WGPUDeviceExtras {
typedef struct WGPURequiredLimitsExtras {
WGPUChainedStruct chain;
uint32_t maxPushConstantSize;
uint64_t maxBufferSize;
} WGPURequiredLimitsExtras;

typedef struct WGPUSupportedLimitsExtras {
WGPUChainedStructOut chain;
uint32_t maxPushConstantSize;
uint64_t maxBufferSize;
} WGPUSupportedLimitsExtras;

typedef struct WGPUPushConstantRange {
Expand Down
16 changes: 12 additions & 4 deletions src/conv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ pub fn map_required_limits(
if limits.maxBindGroups != native::WGPU_LIMIT_U32_UNDEFINED {
wgt_limits.max_bind_groups = limits.maxBindGroups;
}
//if limits.maxBindingsPerBindGroup != native::WGPU_LIMIT_U32_UNDEFINED {
// wgt_limits.max_bindings_per_bind_group = limits.maxBindingsPerBindGroup;
//} not yet supportted in wgt
if limits.maxDynamicUniformBuffersPerPipelineLayout != native::WGPU_LIMIT_U32_UNDEFINED {
wgt_limits.max_dynamic_uniform_buffers_per_pipeline_layout =
limits.maxDynamicUniformBuffersPerPipelineLayout;
Expand Down Expand Up @@ -369,6 +372,9 @@ pub fn map_required_limits(
if limits.maxVertexBuffers != native::WGPU_LIMIT_U32_UNDEFINED {
wgt_limits.max_vertex_buffers = limits.maxVertexBuffers;
}
if limits.maxBufferSize != native::WGPU_LIMIT_U64_UNDEFINED as u64 {
wgt_limits.max_buffer_size = limits.maxBufferSize;
}
if limits.maxVertexAttributes != native::WGPU_LIMIT_U32_UNDEFINED {
wgt_limits.max_vertex_attributes = limits.maxVertexAttributes;
}
Expand All @@ -378,6 +384,12 @@ pub fn map_required_limits(
if limits.maxInterStageShaderComponents != native::WGPU_LIMIT_U32_UNDEFINED {
wgt_limits.max_inter_stage_shader_components = limits.maxInterStageShaderComponents;
}
//if limits.maxInterStageShaderVariables != native::WGPU_LIMIT_U32_UNDEFINED {
// wgt_limits.max_inter_stage_shader_variables = limits.maxIntmaxInterStageShaderVariableserStageShaderComponents;
//} not yet in wgt
//if limits.maxColorAttachments != native::WGPU_LIMIT_U32_UNDEFINED {
// wgt_limits.max_color_attachments = limits.maxColorAttachments;
//} not yet in wgt
if limits.maxComputeWorkgroupStorageSize != native::WGPU_LIMIT_U32_UNDEFINED {
wgt_limits.max_compute_workgroup_storage_size = limits.maxComputeWorkgroupStorageSize;
}
Expand All @@ -400,9 +412,6 @@ pub fn map_required_limits(
if extras.maxPushConstantSize != native::WGPU_LIMIT_U32_UNDEFINED {
wgt_limits.max_push_constant_size = extras.maxPushConstantSize;
}
if extras.maxBufferSize != native::WGPU_LIMIT_U64_UNDEFINED as u64 {
wgt_limits.max_buffer_size = extras.maxBufferSize;
}
}
wgt_limits
}
Expand Down Expand Up @@ -583,7 +592,6 @@ pub fn map_texture_format(value: native::WGPUTextureFormat) -> Option<wgt::Textu
native::WGPUTextureFormat_Depth16Unorm => Some(wgt::TextureFormat::Depth16Unorm),
native::WGPUTextureFormat_Depth24Plus => Some(wgt::TextureFormat::Depth24Plus),
native::WGPUTextureFormat_Depth24PlusStencil8 => Some(wgt::TextureFormat::Depth24PlusStencil8),
native::WGPUTextureFormat_Depth24UnormStencil8 => None, // unimplmented in wgpu-core
native::WGPUTextureFormat_Depth32Float => Some(wgt::TextureFormat::Depth32Float),
native::WGPUTextureFormat_Depth32FloatStencil8 => Some(wgt::TextureFormat::Depth32FloatStencil8),
native::WGPUTextureFormat_BC1RGBAUnorm => Some(wgt::TextureFormat::Bc1RgbaUnorm),
Expand Down
2 changes: 1 addition & 1 deletion src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ fn write_limits_struct(
limits.minUniformBufferOffsetAlignment = wgt_limits.min_uniform_buffer_offset_alignment;
limits.minStorageBufferOffsetAlignment = wgt_limits.min_storage_buffer_offset_alignment;
limits.maxVertexBuffers = wgt_limits.max_vertex_buffers;
limits.maxBufferSize = wgt_limits.max_buffer_size as u64;
limits.maxVertexAttributes = wgt_limits.max_vertex_attributes;
limits.maxVertexBufferArrayStride = wgt_limits.max_vertex_buffer_array_stride;
limits.maxInterStageShaderComponents = wgt_limits.max_inter_stage_shader_components;
Expand All @@ -323,7 +324,6 @@ fn write_limits_struct(
(*extras).chain.sType = native::WGPUSType_SupportedLimitsExtras;

(*extras).maxPushConstantSize = wgt_limits.max_push_constant_size;
(*extras).maxBufferSize = wgt_limits.max_buffer_size;
}
}
}
Expand Down

0 comments on commit 2305180

Please sign in to comment.