diff --git a/ffi/wgpu.h b/ffi/wgpu.h index 7d7e7bfe52..b6585c8d40 100644 --- a/ffi/wgpu.h +++ b/ffi/wgpu.h @@ -37,7 +37,7 @@ typedef unsigned long long WGPUOption_TextureViewId; #define WGPUMAX_MIP_LEVELS 16 -#define WGPUMAX_VERTEX_BUFFERS 8 +#define WGPUMAX_VERTEX_BUFFERS 16 typedef enum { WGPUAddressMode_ClampToEdge = 0, @@ -683,7 +683,6 @@ typedef struct { typedef struct { const char *label; WGPUExtent3d size; - uint32_t array_layer_count; uint32_t mip_level_count; uint32_t sample_count; WGPUTextureDimension dimension; diff --git a/wgpu-core/src/conv.rs b/wgpu-core/src/conv.rs index 22c8e95634..5317634bb8 100644 --- a/wgpu-core/src/conv.rs +++ b/wgpu-core/src/conv.rs @@ -443,7 +443,6 @@ pub fn map_texture_dimension_size( height, depth, }: Extent3d, - array_size: u32, sample_size: u32, ) -> hal::image::Kind { use hal::image::Kind as H; @@ -451,31 +450,18 @@ pub fn map_texture_dimension_size( match dimension { D1 => { assert_eq!(height, 1); - assert_eq!(depth, 1); assert_eq!(sample_size, 1); - H::D1(width, checked_u32_as_u16(array_size)) + H::D1(width, checked_u32_as_u16(depth)) } D2 => { - assert_eq!(depth, 1); assert!( - sample_size == 1 - || sample_size == 2 - || sample_size == 4 - || sample_size == 8 - || sample_size == 16 - || sample_size == 32, + sample_size <= 32 && sample_size & (sample_size - 1) == 0, "Invalid sample_count of {}", sample_size ); - H::D2( - width, - height, - checked_u32_as_u16(array_size), - sample_size as u8, - ) + H::D2(width, height, checked_u32_as_u16(depth), sample_size as u8) } D3 => { - assert_eq!(array_size, 1); assert_eq!(sample_size, 1); H::D3(width, height, depth) } diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index e04c8395b4..536aaf2022 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -365,12 +365,7 @@ impl Device { _ => {} } - let kind = conv::map_texture_dimension_size( - desc.dimension, - desc.size, - desc.array_layer_count, - desc.sample_count, - ); + let kind = conv::map_texture_dimension_size(desc.dimension, desc.size, desc.sample_count); let format = conv::map_texture_format(desc.format, self.features); let aspects = format.surface_desc().aspects; let usage = conv::map_texture_usage(desc.usage, aspects); @@ -380,7 +375,7 @@ impl Device { // 2D textures with array layer counts that are multiples of 6 could be cubemaps // Following gpuweb/gpuweb#68 always add the hint in that case - if desc.dimension == TextureDimension::D2 && desc.array_layer_count % 6 == 0 { + if desc.dimension == TextureDimension::D2 && desc.size.depth % 6 == 0 { view_capabilities |= hal::image::ViewCapabilities::KIND_CUBE; }; @@ -437,7 +432,7 @@ impl Device { full_range: hal::image::SubresourceRange { aspects, levels: 0..desc.mip_level_count as hal::image::Level, - layers: 0..desc.array_layer_count as hal::image::Layer, + layers: 0..kind.num_layers(), }, memory, life_guard: LifeGuard::new(), diff --git a/wgpu-remote/src/server.rs b/wgpu-remote/src/server.rs index 8922bce718..d6988420b5 100644 --- a/wgpu-remote/src/server.rs +++ b/wgpu-remote/src/server.rs @@ -130,10 +130,7 @@ pub extern "C" fn wgpu_server_buffer_map_read( } #[no_mangle] -pub extern "C" fn wgpu_server_buffer_unmap( - global: &Global, - buffer_id: id::BufferId, -) { +pub extern "C" fn wgpu_server_buffer_unmap(global: &Global, buffer_id: id::BufferId) { gfx_select!(buffer_id => global.buffer_unmap(buffer_id)); } diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 434b101bff..d740c7a039 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -752,7 +752,6 @@ pub struct Extent3d { pub struct TextureDescriptor { pub label: *const std::os::raw::c_char, pub size: Extent3d, - pub array_layer_count: u32, pub mip_level_count: u32, pub sample_count: u32, pub dimension: TextureDimension,