Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SHADERINT_16 feature to allow 16bit ints in Vulkan shaders #3401

Merged
merged 5 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ let texture = device.create_texture(&wgpu::TextureDescriptor {
- 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)
Expand Down
1 change: 1 addition & 0 deletions deno_webgpu/src/02_idl_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
"clear-commands",
"spirv-shader-passthrough",
"shader-primitive-index",
"shader-i16",
],
);

Expand Down
9 changes: 8 additions & 1 deletion deno_webgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -380,6 +383,10 @@ impl From<GpuRequiredFeatures> 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"),
Expand Down
4 changes: 2 additions & 2 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,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(),
Expand Down Expand Up @@ -409,7 +409,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()) {
Expand Down
7 changes: 7 additions & 0 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,13 @@ bitflags::bitflags! {
/// - DX12
/// - Metal (Intel and AMD GPUs)
const WRITE_TIMESTAMP_INSIDE_PASSES = 1 << 41;
/// Allows shaders to acquire the INT16 ability
Elabajaba marked this conversation as resolved.
Show resolved Hide resolved
///
/// Supported platforms:
/// - Vulkan
///
/// This is a native-only feature.
const SHADER_INT16 = 1 << 42;
}
}

Expand Down