958: [0.6] fix device feature requests r=cwfitzgerald a=kvark

**Connections**
Looks like we were requesting a little bit too much?
Also includes #936  and #957

**Description**
Fix the features requested.

**Testing**
Confirmed by the virtue of `println!` :)

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
This commit is contained in:
bors[bot] 2020-10-06 00:11:25 +00:00 committed by GitHub
commit 3a62c24400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 36 deletions

View File

@ -1,5 +1,10 @@
# Change Log
## wgpu-core-0.6.4 (2020-10-05)
- don't request device features that aren't needed
- fix texture depth == 0 checks
- fix the order of texture feature checks
## wgpu-core-0.6.3 (2020-09-04)
- fix group bindings that aren't related to the current pipeline

6
Cargo.lock generated
View File

@ -389,9 +389,9 @@ dependencies = [
[[package]]
name = "generator"
version = "0.6.21"
version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68"
checksum = "f5e13c8f4607ff74f6d0fa37007cb95492531333f46bb9744f772d9e7830855c"
dependencies = [
"cc",
"libc",
@ -1619,7 +1619,7 @@ dependencies = [
[[package]]
name = "wgpu-core"
version = "0.6.3"
version = "0.6.4"
dependencies = [
"arrayvec",
"bitflags",

View File

@ -1,6 +1,6 @@
[package]
name = "wgpu-core"
version = "0.6.3"
version = "0.6.4"
authors = ["wgpu developers"]
edition = "2018"
description = "WebGPU core logic on gfx-hal"

View File

@ -1226,6 +1226,16 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let device = device_guard
.get(device_id)
.map_err(|_| DeviceError::Invalid)?;
let texture_features = conv::texture_features(desc.format);
if texture_features != wgt::Features::empty() && !device.features.contains(texture_features)
{
return Err(resource::CreateTextureError::MissingFeature(
texture_features,
desc.format,
));
}
let texture = device.create_texture(device_id, desc)?;
let num_levels = texture.full_range.levels.end;
let num_layers = texture.full_range.layers.end;
@ -1240,15 +1250,6 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
None => (),
};
let texture_features = conv::texture_features(desc.format);
if texture_features != wgt::Features::empty() && !device.features.contains(texture_features)
{
return Err(resource::CreateTextureError::MissingFeature(
texture_features,
desc.format,
));
}
device
.trackers
.lock()

View File

@ -289,7 +289,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
None => {}
}
if size.width == 0 || size.height == 0 || size.width == 0 {
if size.width == 0 || size.height == 0 || size.depth == 0 {
tracing::trace!("Ignoring write_texture of size 0");
return Ok(());
}

View File

@ -648,7 +648,8 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let available_features = adapter.raw.physical_device.features();
// Check features that are always needed
let wishful_features = hal::Features::VERTEX_STORES_AND_ATOMICS
let wishful_features = hal::Features::ROBUST_BUFFER_ACCESS
| hal::Features::VERTEX_STORES_AND_ATOMICS
| hal::Features::FRAGMENT_STORES_AND_ATOMICS
| hal::Features::NDC_Y_UP
| hal::Features::INDEPENDENT_BLENDING
@ -657,7 +658,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
let mut enabled_features = available_features & wishful_features;
if enabled_features != wishful_features {
tracing::warn!(
"Missing features: {:?}",
"Missing internal features: {:?}",
wishful_features - enabled_features
);
}
@ -665,44 +666,30 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
// Features
enabled_features.set(
hal::Features::TEXTURE_DESCRIPTOR_ARRAY,
adapter
.features
desc.features
.contains(wgt::Features::SAMPLED_TEXTURE_BINDING_ARRAY),
);
enabled_features.set(
hal::Features::SHADER_SAMPLED_IMAGE_ARRAY_DYNAMIC_INDEXING,
adapter
.features
.contains(wgt::Features::SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING),
);
enabled_features.set(
hal::Features::SHADER_SAMPLED_IMAGE_ARRAY_DYNAMIC_INDEXING,
adapter
.features
desc.features
.contains(wgt::Features::SAMPLED_TEXTURE_ARRAY_DYNAMIC_INDEXING),
);
enabled_features.set(
hal::Features::SAMPLED_TEXTURE_DESCRIPTOR_INDEXING,
adapter
.features
desc.features
.contains(wgt::Features::SAMPLED_TEXTURE_ARRAY_NON_UNIFORM_INDEXING),
);
enabled_features.set(
hal::Features::UNSIZED_DESCRIPTOR_ARRAY,
adapter
.features
.contains(wgt::Features::UNSIZED_BINDING_ARRAY),
desc.features.contains(wgt::Features::UNSIZED_BINDING_ARRAY),
);
enabled_features.set(
hal::Features::MULTI_DRAW_INDIRECT,
adapter
.features
.contains(wgt::Features::MULTI_DRAW_INDIRECT),
desc.features.contains(wgt::Features::MULTI_DRAW_INDIRECT),
);
enabled_features.set(
hal::Features::DRAW_INDIRECT_COUNT,
adapter
.features
desc.features
.contains(wgt::Features::MULTI_DRAW_INDIRECT_COUNT),
);