Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove surface extent validation
Browse files Browse the repository at this point in the history
Wumpf committed Nov 28, 2023
1 parent 238c373 commit 8c93031
Showing 8 changed files with 2 additions and 60 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ Previously, `DeviceExt::create_texture_with_data` only allowed data to be provid

#### General
- Added `DownlevelFlags::VERTEX_AND_INSTANCE_INDEX_RESPECTS_RESPECTIVE_FIRST_VALUE_IN_INDIRECT_DRAW` to know if `@builtin(vertex_index)` and `@builtin(instance_index)` will respect the `first_vertex` / `first_instance` in indirect calls. If this is not present, both will always start counting from 0. Currently enabled on all backends except DX12. By @cwfitzgerald in [#4722](https://github.com/gfx-rs/wgpu/pull/4722)
- No longer validate surfaces against their allowed extent range on configure. This caused warnings that were almost impossible to avoid. As before, the resulting behavior depends on the compositor. By @wumpf in [#????](https://github.com/gfx-rs/wgpu/pull/????)

#### OpenGL
- `@builtin(instance_index)` now properly reflects the range provided in the draw call instead of always counting from 0. By @cwfitzgerald in [#4722](https://github.com/gfx-rs/wgpu/pull/4722).
13 changes: 1 addition & 12 deletions wgpu-core/src/device/global.rs
Original file line number Diff line number Diff line change
@@ -1812,18 +1812,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
) -> Result<(), E> {
let width = config.extent.width;
let height = config.extent.height;
if width < caps.extents.start().width
|| width > caps.extents.end().width
|| height < caps.extents.start().height
|| height > caps.extents.end().height
{
log::warn!(
"Requested size {}x{} is outside of the supported range: {:?}",
width,
height,
caps.extents
);
}

if !caps.present_modes.contains(&config.present_mode) {
let new_mode = 'b: loop {
// Automatic present mode checks.
10 changes: 0 additions & 10 deletions wgpu-hal/src/dx12/adapter.rs
Original file line number Diff line number Diff line change
@@ -625,16 +625,6 @@ impl crate::Adapter<super::Api> for super::Adapter {
// we currently use a flip effect which supports 2..=16 buffers
swap_chain_sizes: 2..=16,
current_extent,
// TODO: figure out the exact bounds
extents: wgt::Extent3d {
width: 16,
height: 16,
depth_or_array_layers: 1,
}..=wgt::Extent3d {
width: 4096,
height: 4096,
depth_or_array_layers: 1,
},
usage: crate::TextureUses::COLOR_TARGET
| crate::TextureUses::COPY_SRC
| crate::TextureUses::COPY_DST,
10 changes: 0 additions & 10 deletions wgpu-hal/src/gles/adapter.rs
Original file line number Diff line number Diff line change
@@ -798,7 +798,6 @@ impl super::Adapter {
workarounds,
features,
shading_language_version,
max_texture_size,
next_shader_id: Default::default(),
program_cache: Default::default(),
es: es_ver.is_some(),
@@ -1144,15 +1143,6 @@ impl crate::Adapter<super::Api> for super::Adapter {
composite_alpha_modes: vec![wgt::CompositeAlphaMode::Opaque], //TODO
swap_chain_sizes: 2..=2,
current_extent: None,
extents: wgt::Extent3d {
width: 4,
height: 4,
depth_or_array_layers: 1,
}..=wgt::Extent3d {
width: self.shared.max_texture_size,
height: self.shared.max_texture_size,
depth_or_array_layers: 1,
},
usage: crate::TextureUses::COLOR_TARGET,
})
} else {
1 change: 0 additions & 1 deletion wgpu-hal/src/gles/mod.rs
Original file line number Diff line number Diff line change
@@ -249,7 +249,6 @@ struct AdapterShared {
features: wgt::Features,
workarounds: Workarounds,
shading_language_version: naga::back::glsl::Version,
max_texture_size: u32,
next_shader_id: AtomicU32,
program_cache: Mutex<ProgramCache>,
es: bool,
5 changes: 0 additions & 5 deletions wgpu-hal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -882,11 +882,6 @@ pub struct SurfaceCapabilities {
/// Current extent of the surface, if known.
pub current_extent: Option<wgt::Extent3d>,

/// Range of supported extents.
///
/// `current_extent` must be inside this range.
pub extents: RangeInclusive<wgt::Extent3d>,

/// Supported texture usage flags.
///
/// Must have at least `TextureUses::COLOR_TARGET`
9 changes: 0 additions & 9 deletions wgpu-hal/src/metal/adapter.rs
Original file line number Diff line number Diff line change
@@ -338,15 +338,6 @@ impl crate::Adapter<super::Api> for super::Adapter {
],

current_extent,
extents: wgt::Extent3d {
width: 4,
height: 4,
depth_or_array_layers: 1,
}..=wgt::Extent3d {
width: pc.max_texture_size as u32,
height: pc.max_texture_size as u32,
depth_or_array_layers: 1,
},
usage: crate::TextureUses::COLOR_TARGET | crate::TextureUses::COPY_DST, //TODO: expose more
})
}
13 changes: 0 additions & 13 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
@@ -1642,18 +1642,6 @@ impl crate::Adapter<super::Api> for super::Adapter {
None
};

let min_extent = wgt::Extent3d {
width: caps.min_image_extent.width,
height: caps.min_image_extent.height,
depth_or_array_layers: 1,
};

let max_extent = wgt::Extent3d {
width: caps.max_image_extent.width,
height: caps.max_image_extent.height,
depth_or_array_layers: caps.max_image_array_layers,
};

let raw_present_modes = {
profiling::scope!("vkGetPhysicalDeviceSurfacePresentModesKHR");
match unsafe {
@@ -1692,7 +1680,6 @@ impl crate::Adapter<super::Api> for super::Adapter {
formats,
swap_chain_sizes: caps.min_image_count..=max_image_count,
current_extent,
extents: min_extent..=max_extent,
usage: conv::map_vk_image_usage(caps.supported_usage_flags),
present_modes: raw_present_modes
.into_iter()

0 comments on commit 8c93031

Please sign in to comment.