diff --git a/CHANGELOG.md b/CHANGELOG.md index 86c182df2..887c4775f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -264,6 +264,10 @@ By @jimblandy in [#3254](https://github.com/gfx-rs/wgpu/pull/3254). - Support alpha to coverage. By @Wumpf in [#3156](https://github.com/gfx-rs/wgpu/pull/3156) - Support filtering f32 textures. By @expenses in [#3261](https://github.com/gfx-rs/wgpu/pull/3261) +#### Vulkan + +- Add `SHADER_INT16` feature to enable the `shaderInt16` VkPhysicalDeviceFeature. By @Elabajaba in [#3401](https://github.com/gfx-rs/wgpu/pull/3401) + #### WebGPU - Add `MULTISAMPLE_X2`, `MULTISAMPLE_X4` and `MULTISAMPLE_X8` to `TextureFormatFeatureFlags`. By @39ali in [3140](https://github.com/gfx-rs/wgpu/pull/3140) diff --git a/deno_webgpu/src/02_idl_types.js b/deno_webgpu/src/02_idl_types.js index c927f10a5..d07dc68fc 100644 --- a/deno_webgpu/src/02_idl_types.js +++ b/deno_webgpu/src/02_idl_types.js @@ -134,6 +134,7 @@ "clear-commands", "spirv-shader-passthrough", "shader-primitive-index", + "shader-i16", ], ); diff --git a/deno_webgpu/src/lib.rs b/deno_webgpu/src/lib.rs index 23c49ac67..d798eefa4 100644 --- a/deno_webgpu/src/lib.rs +++ b/deno_webgpu/src/lib.rs @@ -164,7 +164,7 @@ fn deserialize_features(features: &wgpu_types::Features) -> Vec<&'static str> { return_features.push("indirect-first-instance"); } if features.contains(wgpu_types::Features::SHADER_FLOAT16) { - return_features.push("shader-f16") + return_features.push("shader-f16"); } // extended from spec @@ -214,6 +214,9 @@ fn deserialize_features(features: &wgpu_types::Features) -> Vec<&'static str> { if features.contains(wgpu_types::Features::PARTIALLY_BOUND_BINDING_ARRAY) { return_features.push("shader-primitive-index"); } + if features.contains(wgpu_types::Features::SHADER_INT16) { + return_features.push("shader-i16"); + } return_features } @@ -380,6 +383,10 @@ impl From for wgpu_types::Features { wgpu_types::Features::SHADER_FLOAT64, required_features.0.contains("shader-float64"), ); + features.set( + wgpu_types::Features::SHADER_INT16, + required_features.0.contains("shader-i16"), + ); features.set( wgpu_types::Features::VERTEX_ATTRIBUTE_64BIT, required_features.0.contains("vertex-attribute-64bit"), diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index c8315390b..772a37b1d 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -176,7 +176,7 @@ impl PhysicalDeviceFeatures { //.shader_cull_distance(requested_features.contains(wgt::Features::SHADER_CULL_DISTANCE)) .shader_float64(requested_features.contains(wgt::Features::SHADER_FLOAT64)) //.shader_int64(requested_features.contains(wgt::Features::SHADER_INT64)) - //.shader_int16(requested_features.contains(wgt::Features::SHADER_INT16)) + .shader_int16(requested_features.contains(wgt::Features::SHADER_INT16)) //.shader_resource_residency(requested_features.contains(wgt::Features::SHADER_RESOURCE_RESIDENCY)) .geometry_shader(requested_features.contains(wgt::Features::SHADER_PRIMITIVE_INDEX)) .build(), @@ -420,7 +420,7 @@ impl PhysicalDeviceFeatures { //if self.core.shader_cull_distance != 0 { features.set(F::SHADER_FLOAT64, self.core.shader_float64 != 0); //if self.core.shader_int64 != 0 { - //if self.core.shader_int16 != 0 { + features.set(F::SHADER_INT16, self.core.shader_int16 != 0); //if caps.supports_extension(vk::KhrSamplerMirrorClampToEdgeFn::name()) { //if caps.supports_extension(vk::ExtSamplerFilterMinmaxFn::name()) { diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 8307ad564..2fa8f62fe 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -674,6 +674,13 @@ bitflags::bitflags! { /// - DX12 /// - Metal (Intel and AMD GPUs) const WRITE_TIMESTAMP_INSIDE_PASSES = 1 << 41; + /// Allows shaders to use i16. Not currently supported in naga, only available through `spirv-passthrough`. + /// + /// Supported platforms: + /// - Vulkan + /// + /// This is a native-only feature. + const SHADER_INT16 = 1 << 42; } }