Remove DEPTH24PLUS_STENCIL8 feature (#3151)

This commit is contained in:
Lilith 2022-11-02 21:44:15 +01:00 committed by GitHub
parent 8a7240cdbe
commit a31cd2ef5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 90 deletions

View File

@ -75,6 +75,7 @@ Bottom level categories:
- Bother to free the `hal::Api::CommandBuffer` when a `wgpu_core::command::CommandEncoder` is dropped. By @jimblandy in [#3069](https://github.com/gfx-rs/wgpu/pull/3069). - Bother to free the `hal::Api::CommandBuffer` when a `wgpu_core::command::CommandEncoder` is dropped. By @jimblandy in [#3069](https://github.com/gfx-rs/wgpu/pull/3069).
- Fixed the mipmap example by adding the missing WRITE_TIMESTAMP_INSIDE_PASSES feature. By @Olaroll in [#3081](https://github.com/gfx-rs/wgpu/pull/3081). - Fixed the mipmap example by adding the missing WRITE_TIMESTAMP_INSIDE_PASSES feature. By @Olaroll in [#3081](https://github.com/gfx-rs/wgpu/pull/3081).
- Avoid panicking in some interactions with invalid resources by @nical in (#3094)[https://github.com/gfx-rs/wgpu/pull/3094] - Avoid panicking in some interactions with invalid resources by @nical in (#3094)[https://github.com/gfx-rs/wgpu/pull/3094]
- Remove `wgpu_types::Features::DEPTH24PLUS_STENCIL8`, making `wgpu::TextureFormat::Depth24PlusStencil8` available on all backends. By @Healthire in (#3151)[https://github.com/gfx-rs/wgpu/pull/3151]
#### WebGPU #### WebGPU
- Use `log` instead of `println` in hello example by @JolifantoBambla in [#2858](https://github.com/gfx-rs/wgpu/pull/2858) - Use `log` instead of `println` in hello example by @JolifantoBambla in [#2858](https://github.com/gfx-rs/wgpu/pull/2858)

View File

@ -191,7 +191,6 @@ impl super::Adapter {
let mut features = wgt::Features::empty() let mut features = wgt::Features::empty()
| wgt::Features::DEPTH_CLIP_CONTROL | wgt::Features::DEPTH_CLIP_CONTROL
| wgt::Features::DEPTH24PLUS_STENCIL8
| wgt::Features::DEPTH32FLOAT_STENCIL8 | wgt::Features::DEPTH32FLOAT_STENCIL8
| wgt::Features::INDIRECT_FIRST_INSTANCE | wgt::Features::INDIRECT_FIRST_INSTANCE
| wgt::Features::MAPPABLE_PRIMARY_BUFFERS | wgt::Features::MAPPABLE_PRIMARY_BUFFERS

View File

@ -778,7 +778,6 @@ impl super::PrivateCapabilities {
features.set(F::TEXTURE_COMPRESSION_ETC2, self.format_eac_etc); features.set(F::TEXTURE_COMPRESSION_ETC2, self.format_eac_etc);
features.set(F::DEPTH_CLIP_CONTROL, self.supports_depth_clip_control); features.set(F::DEPTH_CLIP_CONTROL, self.supports_depth_clip_control);
features.set(F::DEPTH24PLUS_STENCIL8, self.format_depth24_stencil8);
features.set( features.set(
F::TEXTURE_BINDING_ARRAY F::TEXTURE_BINDING_ARRAY

View File

@ -481,17 +481,6 @@ impl PhysicalDeviceFeatures {
), ),
); );
features.set(
F::DEPTH24PLUS_STENCIL8,
supports_format(
instance,
phd,
vk::Format::D24_UNORM_S8_UINT,
vk::ImageTiling::OPTIMAL,
vk::FormatFeatureFlags::DEPTH_STENCIL_ATTACHMENT,
),
);
(features, dl_flags) (features, dl_flags)
} }

View File

@ -188,15 +188,6 @@ bitflags::bitflags! {
/// ///
/// This is a web and native feature. /// This is a web and native feature.
const DEPTH_CLIP_CONTROL = 1 << 0; const DEPTH_CLIP_CONTROL = 1 << 0;
/// Allows for explicit creation of textures of format [`TextureFormat::Depth24PlusStencil8`]
///
/// Supported platforms:
/// - Vulkan (some)
/// - DX12
/// - Metal (Macs with amd GPUs)
///
/// This is a web and native feature.
const DEPTH24PLUS_STENCIL8 = 1 << 1;
/// Allows for explicit creation of textures of format [`TextureFormat::Depth32FloatStencil8`] /// Allows for explicit creation of textures of format [`TextureFormat::Depth32FloatStencil8`]
/// ///
/// Supported platforms: /// Supported platforms:
@ -2293,7 +2284,6 @@ impl TextureFormat {
let astc_hdr = Features::TEXTURE_COMPRESSION_ASTC_HDR; let astc_hdr = Features::TEXTURE_COMPRESSION_ASTC_HDR;
let norm16bit = Features::TEXTURE_FORMAT_16BIT_NORM; let norm16bit = Features::TEXTURE_FORMAT_16BIT_NORM;
let d32_s8 = Features::DEPTH32FLOAT_STENCIL8; let d32_s8 = Features::DEPTH32FLOAT_STENCIL8;
let d24_s8 = Features::DEPTH24PLUS_STENCIL8;
// Sample Types // Sample Types
let uint = TextureSampleType::Uint; let uint = TextureSampleType::Uint;
@ -2378,7 +2368,7 @@ impl TextureFormat {
// Depth-stencil textures // Depth-stencil textures
Self::Depth16Unorm => ( native, depth, linear, msaa, (1, 1), 2, attachment, 1), Self::Depth16Unorm => ( native, depth, linear, msaa, (1, 1), 2, attachment, 1),
Self::Depth24Plus => ( native, depth, linear, msaa, (1, 1), 4, attachment, 1), Self::Depth24Plus => ( native, depth, linear, msaa, (1, 1), 4, attachment, 1),
Self::Depth24PlusStencil8 => ( d24_s8, depth, linear, msaa, (1, 1), 4, attachment, 2), Self::Depth24PlusStencil8 => ( native, depth, linear, msaa, (1, 1), 4, attachment, 2),
Self::Depth32Float => ( native, depth, linear, msaa, (1, 1), 4, attachment, 1), Self::Depth32Float => ( native, depth, linear, msaa, (1, 1), 4, attachment, 1),
Self::Depth32FloatStencil8 =>( d32_s8, depth, linear, msaa, (1, 1), 4, attachment, 2), Self::Depth32FloatStencil8 =>( d32_s8, depth, linear, msaa, (1, 1), 4, attachment, 2),
// Packed uncompressed // Packed uncompressed

View File

@ -44,6 +44,7 @@ static TEXTURE_FORMATS_DEPTH: &[wgpu::TextureFormat] = &[
//wgpu::TextureFormat::Stencil8, //wgpu::TextureFormat::Stencil8,
wgpu::TextureFormat::Depth16Unorm, wgpu::TextureFormat::Depth16Unorm,
wgpu::TextureFormat::Depth24Plus, wgpu::TextureFormat::Depth24Plus,
wgpu::TextureFormat::Depth24PlusStencil8,
]; ];
// needs TEXTURE_COMPRESSION_BC // needs TEXTURE_COMPRESSION_BC
@ -329,22 +330,6 @@ fn clear_texture_d32_s8() {
) )
} }
#[test]
fn clear_texture_d24_s8() {
initialize_test(
TestParameters::default()
.features(wgpu::Features::CLEAR_TEXTURE | wgpu::Features::DEPTH24PLUS_STENCIL8),
|ctx| {
clear_texture_tests(
&ctx,
&[wgpu::TextureFormat::Depth24PlusStencil8],
false,
false,
);
},
)
}
#[test] #[test]
fn clear_texture_2d_bc() { fn clear_texture_2d_bc() {
initialize_test( initialize_test(

View File

@ -110,58 +110,55 @@ fn discarding_depth_target_resets_texture_init_state_check_visible_on_copy_in_sa
#[test] #[test]
fn discarding_either_depth_or_stencil_aspect() { fn discarding_either_depth_or_stencil_aspect() {
initialize_test( initialize_test(TestParameters::default(), |ctx| {
TestParameters::default().features(wgpu::Features::DEPTH24PLUS_STENCIL8), let (texture, _) = create_white_texture_and_readback_buffer(
|ctx| { &ctx,
let (texture, _) = create_white_texture_and_readback_buffer( wgpu::TextureFormat::Depth24PlusStencil8,
&ctx, );
wgpu::TextureFormat::Depth24PlusStencil8, // TODO: How do we test this other than "doesn't crash"? We can't copy the texture to/from buffers, so we would need to do a copy in a shader
); {
// TODO: How do we test this other than "doesn't crash"? We can't copy the texture to/from buffers, so we would need to do a copy in a shader let mut encoder = ctx
{ .device
let mut encoder = ctx .create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
.device encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default()); label: Some("Depth Discard, Stencil Load"),
encoder.begin_render_pass(&wgpu::RenderPassDescriptor { color_attachments: &[],
label: Some("Depth Discard, Stencil Load"), depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
color_attachments: &[], view: &texture.create_view(&wgpu::TextureViewDescriptor::default()),
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment { depth_ops: Some(wgpu::Operations {
view: &texture.create_view(&wgpu::TextureViewDescriptor::default()), load: wgpu::LoadOp::Load,
depth_ops: Some(wgpu::Operations { store: false, // discard!
load: wgpu::LoadOp::Load,
store: false, // discard!
}),
stencil_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(0),
store: true,
}),
}), }),
}); stencil_ops: Some(wgpu::Operations {
ctx.queue.submit([encoder.finish()]); load: wgpu::LoadOp::Clear(0),
} store: true,
{
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Depth Load, Stencil Discard"),
color_attachments: &[],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: &texture.create_view(&wgpu::TextureViewDescriptor::default()),
depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(0.0),
store: true,
}),
stencil_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Load,
store: false, // discard!
}),
}), }),
}); }),
ctx.queue.submit([encoder.finish()]); });
} ctx.queue.submit([encoder.finish()]);
}, }
); {
let mut encoder = ctx
.device
.create_command_encoder(&wgpu::CommandEncoderDescriptor::default());
encoder.begin_render_pass(&wgpu::RenderPassDescriptor {
label: Some("Depth Load, Stencil Discard"),
color_attachments: &[],
depth_stencil_attachment: Some(wgpu::RenderPassDepthStencilAttachment {
view: &texture.create_view(&wgpu::TextureViewDescriptor::default()),
depth_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Clear(0.0),
store: true,
}),
stencil_ops: Some(wgpu::Operations {
load: wgpu::LoadOp::Load,
store: false, // discard!
}),
}),
});
ctx.queue.submit([encoder.finish()]);
}
});
} }
const TEXTURE_SIZE: wgpu::Extent3d = wgpu::Extent3d { const TEXTURE_SIZE: wgpu::Extent3d = wgpu::Extent3d {