From 4c4fd77daeda0cf6067643c435f82379e82efee9 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Wed, 11 Jan 2023 14:05:22 +0100 Subject: [PATCH 1/4] Update webgpu header --- ffi/webgpu-headers | 2 +- ffi/wgpu.h | 2 -- src/conv.rs | 16 ++++++++++++---- src/device.rs | 1 - 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ffi/webgpu-headers b/ffi/webgpu-headers index 402ee247..fa1c6ab4 160000 --- a/ffi/webgpu-headers +++ b/ffi/webgpu-headers @@ -1 +1 @@ -Subproject commit 402ee247cfbd9a65673e0f9141d80ccf38e79959 +Subproject commit fa1c6ab4927ef1fa5731907b42b62ea93119866c diff --git a/ffi/wgpu.h b/ffi/wgpu.h index da4d0017..dfa8b01a 100644 --- a/ffi/wgpu.h +++ b/ffi/wgpu.h @@ -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 { diff --git a/src/conv.rs b/src/conv.rs index e0bc9de6..286c5bc2 100644 --- a/src/conv.rs +++ b/src/conv.rs @@ -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; @@ -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; } @@ -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; } @@ -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 } @@ -583,7 +592,6 @@ pub fn map_texture_format(value: native::WGPUTextureFormat) -> Option 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), diff --git a/src/device.rs b/src/device.rs index 9305a840..7d942ad5 100644 --- a/src/device.rs +++ b/src/device.rs @@ -323,7 +323,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; } } } From 67cc63e07c833a8038d0b2cf6a549765ec46e8b6 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Wed, 11 Jan 2023 14:12:55 +0100 Subject: [PATCH 2/4] remove deprecated tex format --- examples/framework.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/examples/framework.c b/examples/framework.c index 74b9daa7..f54a69a3 100644 --- a/examples/framework.c +++ b/examples/framework.c @@ -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; From 2a04a879490b3111bf10168bed8634ed28d12767 Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Wed, 11 Jan 2023 17:16:10 +0100 Subject: [PATCH 3/4] write MaxBufferSize --- src/device.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/device.rs b/src/device.rs index 7d942ad5..4e12394d 100644 --- a/src/device.rs +++ b/src/device.rs @@ -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; From 2f08880b8d4ee4ced00ad2dcde0045793537100e Mon Sep 17 00:00:00 2001 From: Almar Klein Date: Wed, 11 Jan 2023 23:32:33 +0100 Subject: [PATCH 4/4] Set default to correct placeholder --- examples/framework.h | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/framework.h b/examples/framework.h index 5e6839e1..30bf4c1d 100644 --- a/examples/framework.h +++ b/examples/framework.h @@ -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, \