577: Remove array layer count from texture descriptor r=grovesNL a=kvark

Matches https://github.com/gpuweb/gpuweb/pull/613

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
This commit is contained in:
bors[bot]
2020-04-13 18:16:06 +00:00
committed by GitHub
5 changed files with 8 additions and 32 deletions

View File

@@ -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;

View File

@@ -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)
}

View File

@@ -365,12 +365,7 @@ impl<B: GfxBackend> Device<B> {
_ => {}
}
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<B: GfxBackend> Device<B> {
// 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<B: GfxBackend> Device<B> {
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(),

View File

@@ -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));
}

View File

@@ -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,