Add VERTEX_WRITABLE_STORAGE feature, refactor the sample border

This commit is contained in:
Dzmitry Malyshau
2021-05-17 10:14:07 -04:00
parent e00251d3e3
commit f0a145d0fa
3 changed files with 29 additions and 6 deletions

View File

@@ -342,7 +342,6 @@ impl<B: GfxBackend> Device<B> {
spv::Capability::Image1D,
spv::Capability::SampledCubeArray,
spv::Capability::ImageCubeArray,
spv::Capability::ImageMSArray,
spv::Capability::StorageImageExtendedFormats,
]
.iter()

View File

@@ -217,9 +217,14 @@ impl<B: GfxBackend> Adapter<B> {
wgt::Features::STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING,
adapter_features.contains(hal::Features::STORAGE_BUFFER_DESCRIPTOR_INDEXING),
);
#[cfg(not(target_os = "ios"))]
//TODO: https://github.com/gfx-rs/gfx/issues/3346
features.set(wgt::Features::ADDRESS_MODE_CLAMP_TO_BORDER, true);
features.set(
wgt::Features::VERTEX_WRITABLE_STORAGE,
adapter_features.contains(hal::Features::VERTEX_STORES_AND_ATOMICS),
);
features.set(
wgt::Features::ADDRESS_MODE_CLAMP_TO_BORDER,
adapter_features.contains(hal::Features::SAMPLER_BORDER_COLOR),
);
let private_features = PrivateFeatures {
anisotropic_filtering: adapter_features.contains(hal::Features::SAMPLER_ANISOTROPY),
@@ -452,12 +457,12 @@ impl<B: GfxBackend> Adapter<B> {
// Check features that are always needed
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
| hal::Features::SAMPLER_ANISOTROPY
| hal::Features::IMAGE_CUBE_ARRAY;
| hal::Features::IMAGE_CUBE_ARRAY
| hal::Features::SAMPLE_RATE_SHADING;
let mut enabled_features = available_features & wishful_features;
if enabled_features != wishful_features {
log::warn!(
@@ -556,6 +561,16 @@ impl<B: GfxBackend> Adapter<B> {
desc.features
.contains(wgt::Features::STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING),
);
enabled_features.set(
hal::Features::VERTEX_STORES_AND_ATOMICS,
desc.features
.contains(wgt::Features::VERTEX_WRITABLE_STORAGE),
);
enabled_features.set(
hal::Features::SAMPLER_BORDER_COLOR,
desc.features
.contains(wgt::Features::ADDRESS_MODE_CLAMP_TO_BORDER),
);
let family = self
.raw

View File

@@ -526,6 +526,15 @@ bitflags::bitflags! {
///
/// This is a native only feature.
const STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING = 0x0000_0010_0000_0000;
/// Enables bindings of writable storage buffers and textures visible to vertex shaders.
///
/// Note: some (tiled-based) platforms do not support vertex shaders with any side-effects.
///
/// Supported Platforms:
/// - All
///
/// This is a native-only feature.
const VERTEX_WRITABLE_STORAGE = 0x0000_0020_0000_0000;
/// Features which are part of the upstream WebGPU standard.
const ALL_WEBGPU = 0x0000_0000_0000_FFFF;
/// Features that are only available when targeting native (not web).