Runtime: the plane's import extent check has a test with no device; the layer's silence is noted
The planner's two additions before landing. The maxExtent refusal had only a Windows device test, and on the UHD 630 the import query answers what the plain query does, so no card in the lab fails without the check. The check is now one function, texture::plane_within (a plane of one 2D layer against the import query's answer, which d3d11_plane_form calls), compiled for Windows and the tests, and a_plane_past_its_import_s_max_extent_is_texture_size (no device, every leg) gives it an import answer one texel narrower, then one shorter, than a 64x32 plane: each is Limit::TextureSize carrying the import's extent; an answer of the plane's own extent passes. Replacing the check with Ok fails it. Removing d3d11_plane_form's call is not caught on Linux, where that function is not compiled; no card in the lab shows the import check firing on its own. The Khronos validation layer does not track a Direct3D 11 import's layout: on the UHD 630, layer 1.4.363.0 reported neither the old form's first acquire from the general layout (job m3-max-76170) nor the new form's from the undefined layout (job m3-max-76174). The Layout paragraph of import_d3d11_surface and the first-use test's doc say so, so its silence is not read as evidence.
This commit is contained in:
1 parent
55f6c2760b
commit
57dcc7f826
4 files changed
+65
-6
No files matched your search
@@ -16,7 +16,7 @@ use crate::hazard::HeapId;
|
||||
use crate::import::ImportHandle;
|
||||
use crate::memory;
|
||||
use crate::surface::{Surface, MAX_PLANES};
|
||||
use crate::texture::{size_within, Backing, SurfaceImage, Texture, TextureDescriptor};
|
||||
use crate::texture::{plane_within, Backing, SurfaceImage, Texture, TextureDescriptor};
|
||||
use crate::PixelFormat;
|
||||
use ash::vk;
|
||||
use metal2vulkan::metal::format as formats;
|
||||
@@ -120,7 +120,10 @@ impl Device {
|
||||
/// consumer reported no Direct3D 11 access of it before
|
||||
/// ([`Surface::external_writes_done`]), and the general layout where it did; every later
|
||||
/// acquire names the general layout, the plane being general after rt's own first acquire
|
||||
/// and release. "First" is the first acquire rt records for the plane.
|
||||
/// and release. "First" is the first acquire rt records for the plane. The Khronos validation
|
||||
/// layer does not track this import's layout: on the UHD 630 its 1.4.363.0 reported neither
|
||||
/// a first acquire from the general layout nor one from the undefined layout, so its silence
|
||||
/// is no evidence of either.
|
||||
///
|
||||
/// **Ownership.** Each `vkQueueSubmit2` whose command buffers or uploads use a plane acquires
|
||||
/// it from `VK_QUEUE_FAMILY_EXTERNAL` in a command buffer of rt's own ahead of everything in
|
||||
@@ -315,7 +318,7 @@ impl Device {
|
||||
// external memory handle type).
|
||||
let (_, made) = (import_query(core, format, usage, &list))
|
||||
.map_err(|_| Error::Limit(Limit::NoImport { handle }))?;
|
||||
size_within([d.width, d.height, 1], 1, &made)?;
|
||||
plane_within(d, &made)?;
|
||||
Ok((usage, list))
|
||||
}
|
||||
|
||||
|
||||
@@ -716,7 +716,10 @@ mod on_device {
|
||||
/// that read is picture 3's exactly. On a surface Direct3D 11 draws first, reported by
|
||||
/// `external_writes_done`, every acquire names the general layout, the first included,
|
||||
/// and rt reads picture 1 exactly. The acquires are read from the record the hand-over
|
||||
/// keeps for the device tests (`Work::acquired`).
|
||||
/// keeps for the device tests (`Work::acquired`). The Khronos validation layer does not
|
||||
/// track this import's layout, so it is no check here: on the UHD 630 its 1.4.363.0
|
||||
/// reported neither the old form's first acquire from the general layout (job
|
||||
/// m3-max-76170) nor this form's from the undefined layout (job m3-max-76174).
|
||||
#[test]
|
||||
fn every_device_acquires_a_direct3d_11_plane_from_undefined_only_before_any_access() {
|
||||
each_device("import_d3d11_surface_first_use", |name, _, device| {
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
//! device.
|
||||
|
||||
use crate::arrays::Grants;
|
||||
use crate::error::{Error, Refusal};
|
||||
use crate::texture::{combined, components, linear_rounding, shape};
|
||||
use crate::error::{Error, Limit, Refusal};
|
||||
use crate::texture::{combined, components, linear_rounding, plane_within, shape};
|
||||
use crate::{IndexClass, PixelFormat, TextureDescriptor, TextureType};
|
||||
use ash::vk;
|
||||
use metal2vulkan::metal::{TextureSwizzle, TextureSwizzleChannels};
|
||||
@@ -267,6 +267,45 @@ fn a_views_components_are_the_swizzle_over_the_formats_mapping() {
|
||||
);
|
||||
}
|
||||
|
||||
/// A surface plane is checked against what the image format query answers of its image with its
|
||||
/// import's handle type (a Direct3D 11 plane's, `d3d11_plane_form`), which can be less than the
|
||||
/// query without the handle answers: a plane 64 wide where the import answers 63 is
|
||||
/// `Limit::TextureSize` carrying the import's extent, as is one 32 high where it answers 31; one
|
||||
/// the import answers exactly passes. The check is the import's answer alone: no card in the lab
|
||||
/// answers less with the handle than without it.
|
||||
#[test]
|
||||
fn a_plane_past_its_import_s_max_extent_is_texture_size() {
|
||||
let plane = TextureDescriptor::new(TextureType::Type2D, PixelFormat::R8Unorm, 64, 32);
|
||||
let answer = |width: u32, height: u32| vk::ImageFormatProperties {
|
||||
max_extent: vk::Extent3D {
|
||||
width,
|
||||
height,
|
||||
depth: 1,
|
||||
},
|
||||
max_array_layers: 2048,
|
||||
..vk::ImageFormatProperties::default()
|
||||
};
|
||||
for (max, case) in [([63, 16384], "narrower"), ([16384, 31], "shorter")] {
|
||||
let refused = plane_within(&plane, &answer(max[0], max[1])).err();
|
||||
assert!(
|
||||
matches!(
|
||||
refused,
|
||||
Some(Error::Limit(Limit::TextureSize {
|
||||
extent: [64, 32, 1],
|
||||
layers: 1,
|
||||
max_extent,
|
||||
max_layers: 2048,
|
||||
})) if max_extent == [max[0], max[1], 1]
|
||||
),
|
||||
"an import answer {case} than the plane: {refused:?}"
|
||||
);
|
||||
}
|
||||
assert!(
|
||||
plane_within(&plane, &answer(64, 32)).is_ok(),
|
||||
"an import answer of the plane's own extent"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_views_swizzle_reads_its_parents_swizzled_channels() {
|
||||
use TextureSwizzle::{Alpha, Blue, Green, One, Red, Zero};
|
||||
|
||||
@@ -2417,6 +2417,20 @@ pub(crate) fn size_within(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Whether a surface plane of `d`, one 2D layer, is within what the image format query answered
|
||||
/// of its image with its import's handle type (`import`): a Direct3D 11 plane's
|
||||
/// (`Device::import_d3d11_surface`, on Windows), whose import can make a smaller image than the
|
||||
/// query without the handle answers (`VUID-VkImageCreateInfo-extent-02252`).
|
||||
///
|
||||
/// Err: [`Limit::TextureSize`] carrying the import's `maxExtent` where the plane is past it.
|
||||
#[cfg(any(windows, test))]
|
||||
pub(crate) fn plane_within(
|
||||
d: &TextureDescriptor,
|
||||
import: &vk::ImageFormatProperties,
|
||||
) -> Result<(), Error> {
|
||||
size_within([d.width, d.height, 1], 1, import)
|
||||
}
|
||||
|
||||
/// The largest extent of a linear image of `plan`'s format and usage of `shape`'s type, where the
|
||||
/// device makes one; made for memory of the import `handle`, where the device makes one that such
|
||||
/// memory binds at any place: its external query (`VkPhysicalDeviceExternalImageFormatInfo`)
|
||||
|
||||
Reference in new issue
Block a user