Tests: supportsTextureSampleCount: answers Metal's 1, 2, 4 and 8 a device renders into a colour, a depth and a stencil attachment (red)
The planner's ruling: a device answers each of Metal's sample counts, 1, 2, 4 and 8, that its
framebufferColorSampleCounts, framebufferDepthSampleCounts and framebufferStencilSampleCounts all
hold. A Mac with an AMD GPU renders 8 samples (an AMD Radeon Pro 5300M under macOS 26.7.1 answers
supportsTextureSampleCount: yes for 1, 2, 4 and 8 and no for 16, job 82204), as Apple10 does
("Maximum sample count in render passes with MSAA" 8); the runtime answers an Apple9 GPU's 1, 2
and 4 alone today.
- The translator's metal_properties tests hold raster_sample_counts to the three framebuffer
counts and {1, 2, 4, 8} on every committed profile: lavapipe 1, 4 and 8, moltenvk-m3 1, 2 and 4.
- The runtime's four-sample draw test holds the device's answer at every count from 0 to 64 to
the same rule from the device's own limits.
- Metal's default positions at 8 samples, the 5300M's getDefaultSamplePositions:count: answer
(job 82204, Vulkan's standard 8 locations), join the table the runtime's default-positions test
compares with, which now reaches 8 wherever the device answers yes.
Red until the answer changes: today every profile and device that renders 8 answers no for it.
Verified red at this commit on 8a2acc84fb (m3-max-82304): both translator tests fail (lavapipe's
answer 1 | 2 | 4 where the rule gives 1 | 2 | 4 | 8, and the like on every profile that renders 8),
and the runtime's draw test fails on llvmpipe at 8 samples (framebuffer counts 0xd).
This commit is contained in:
1 parent
c1e6805526
commit
fda1e3602e
3 files changed
+59
-13
No files matched your search
@@ -4041,7 +4041,10 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
|
||||
/// Vulkan's standard locations are Metal's and the floor requires them
|
||||
/// (`standardSampleLocations`).
|
||||
/// A state of one sample drawn in the pass is `DrawKind::AttachmentFormats`, and a pass of a
|
||||
/// 4-sample and a 1-sample attachment `RenderPassKind::SampleCounts`.
|
||||
/// 4-sample and a 1-sample attachment `RenderPassKind::SampleCounts`. The device renders each
|
||||
/// of Metal's counts, 1, 2, 4 and 8, that its `framebufferColorSampleCounts`,
|
||||
/// `framebufferDepthSampleCounts` and `framebufferStencilSampleCounts` all hold, and no other
|
||||
/// (`supportsTextureSampleCount:`).
|
||||
#[test]
|
||||
fn every_device_draws_four_samples_where_metal_places_them() {
|
||||
let (Some(library), Some(kernels)) = (
|
||||
@@ -4062,10 +4065,23 @@ define internal void @_GLOBAL__sub_I_() section "air.static_init" {
|
||||
device.supports_texture_sample_count(1),
|
||||
"{name}: Vulkan requires 1"
|
||||
);
|
||||
for count in [0, 3, 8, 16] {
|
||||
assert!(
|
||||
!device.supports_texture_sample_count(count),
|
||||
"{name}: {count}"
|
||||
// Metal's counts (1, 2, 4 and 8) the device renders into a colour, a depth and a
|
||||
// stencil attachment, and nothing else.
|
||||
let raw = device.raw();
|
||||
// SAFETY: the physical device is the instance's.
|
||||
let limits =
|
||||
unsafe { (raw.instance).get_physical_device_properties(raw.physical_device) }
|
||||
.limits;
|
||||
let renders = (limits.framebuffer_color_sample_counts
|
||||
& limits.framebuffer_depth_sample_counts
|
||||
& limits.framebuffer_stencil_sample_counts)
|
||||
.as_raw();
|
||||
for count in 0..=64 {
|
||||
let metal = matches!(count, 1 | 2 | 4 | 8);
|
||||
assert_eq!(
|
||||
device.supports_texture_sample_count(count),
|
||||
metal && renders & count != 0,
|
||||
"{name}: {count} samples, of the framebuffer counts {renders:#x}"
|
||||
);
|
||||
}
|
||||
(device.grant_indices(IndexClass::Texture, 1, 1))
|
||||
|
||||
@@ -40,7 +40,8 @@
|
||||
//! the device's `sampleLocationSampleCounts` lacks, and a pass with a depth attachment, are the
|
||||
//! runtime's gap.
|
||||
//! - The standard locations the runtime answers `getDefaultSamplePositions:count:` with are plain
|
||||
//! Metal's answers on an Apple M3 Max at 1, 2 and 4 samples, bit for bit.
|
||||
//! Metal's answers on an Apple M3 Max at 1, 2 and 4 samples, and on an AMD Radeon Pro 5300M at
|
||||
//! 8, bit for bit.
|
||||
|
||||
/// The placement and the answer's gates, with no device.
|
||||
mod placed {
|
||||
@@ -343,7 +344,7 @@ mod placed {
|
||||
/// Plain Metal's answers to `getDefaultSamplePositions:count:` at each count an Apple M3 Max
|
||||
/// renders, macOS 27.0.1 (the conformance crate's `probes/default_sample_positions.m`, job
|
||||
/// m3-max-78953), sample `i` at `i`.
|
||||
pub(crate) const METAL_DEFAULTS: [(u32, &[[f32; 2]]); 3] = [
|
||||
pub(crate) const METAL_DEFAULTS: [(u32, &[[f32; 2]]); 4] = [
|
||||
(1, &[[0.5, 0.5]]),
|
||||
(2, &[[0.75, 0.75], [0.25, 0.25]]),
|
||||
(
|
||||
@@ -355,6 +356,21 @@ mod placed {
|
||||
[0.625, 0.875],
|
||||
],
|
||||
),
|
||||
// An AMD Radeon Pro 5300M's, macOS 26.7.1 (job 82204): the oracle, an Apple M3 Max,
|
||||
// renders no 8 samples.
|
||||
(
|
||||
8,
|
||||
&[
|
||||
[0.5625, 0.3125],
|
||||
[0.4375, 0.6875],
|
||||
[0.8125, 0.5625],
|
||||
[0.3125, 0.1875],
|
||||
[0.1875, 0.8125],
|
||||
[0.0625, 0.4375],
|
||||
[0.6875, 0.9375],
|
||||
[0.9375, 0.0625],
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
/// The standard locations the runtime answers Metal's default positions with are Metal's own,
|
||||
|
||||
@@ -521,12 +521,14 @@ fn a_class_measured_nowhere_in_a_stage_names_the_stage() {
|
||||
/// No device answers more than an Apple GPU: each answer a vendor's limit could raise past Apple's
|
||||
/// is the lower of the two. Every profile below has at least an Apple GPU's limits, and the
|
||||
/// profiles of other vendors' GPUs more of some, so each answers exactly the Apple GPU's: 1024
|
||||
/// threads, 32 KiB of threadgroup memory, 16384 texels a side, and no sample count above 4.
|
||||
/// threads, 32 KiB of threadgroup memory and 16384 texels a side. Its sample counts are Metal's
|
||||
/// (1, 2, 4 and 8) that the device renders into a colour, a depth and a stencil attachment.
|
||||
#[test]
|
||||
fn no_profile_answers_more_than_an_apple_gpu() {
|
||||
let apple = vk::SampleCountFlags::COUNT_1
|
||||
let metal = vk::SampleCountFlags::COUNT_1
|
||||
| vk::SampleCountFlags::COUNT_2
|
||||
| vk::SampleCountFlags::COUNT_4;
|
||||
| vk::SampleCountFlags::COUNT_4
|
||||
| vk::SampleCountFlags::COUNT_8;
|
||||
// (profile, its own [threads, threadgroup memory, most samples, 2D texture size])
|
||||
for (stem, own) in [
|
||||
("nvidia-pascal-linux", [1536, 49152, 8, 32768]),
|
||||
@@ -562,7 +564,8 @@ fn no_profile_answers_more_than_an_apple_gpu() {
|
||||
"{stem}"
|
||||
);
|
||||
assert_eq!(m.max_threadgroup_memory_length, 32 * 1024, "{stem}");
|
||||
assert_eq!(m.raster_sample_counts, both & apple, "{stem}");
|
||||
let renders = both & l.framebuffer_stencil_sample_counts;
|
||||
assert_eq!(m.raster_sample_counts, renders & metal, "{stem}");
|
||||
assert_eq!(m.max_texture_dimension_2d, 16_384, "{stem}");
|
||||
}
|
||||
let pascal = device("nvidia-pascal-linux");
|
||||
@@ -573,7 +576,16 @@ fn no_profile_answers_more_than_an_apple_gpu() {
|
||||
let lavapipe = device("lavapipe");
|
||||
assert_eq!(
|
||||
lavapipe.metal_properties().raster_sample_counts,
|
||||
vk::SampleCountFlags::COUNT_1 | vk::SampleCountFlags::COUNT_4
|
||||
vk::SampleCountFlags::COUNT_1
|
||||
| vk::SampleCountFlags::COUNT_4
|
||||
| vk::SampleCountFlags::COUNT_8
|
||||
);
|
||||
let m3 = device("moltenvk-m3");
|
||||
assert_eq!(
|
||||
m3.metal_properties().raster_sample_counts,
|
||||
vk::SampleCountFlags::COUNT_1
|
||||
| vk::SampleCountFlags::COUNT_2
|
||||
| vk::SampleCountFlags::COUNT_4
|
||||
);
|
||||
}
|
||||
|
||||
@@ -597,9 +609,11 @@ fn metal_properties_report_d3_d4_values() {
|
||||
m.raster_sample_counts,
|
||||
l.framebuffer_color_sample_counts
|
||||
& l.framebuffer_depth_sample_counts
|
||||
& l.framebuffer_stencil_sample_counts
|
||||
& (vk::SampleCountFlags::COUNT_1
|
||||
| vk::SampleCountFlags::COUNT_2
|
||||
| vk::SampleCountFlags::COUNT_4),
|
||||
| vk::SampleCountFlags::COUNT_4
|
||||
| vk::SampleCountFlags::COUNT_8),
|
||||
"{stem}"
|
||||
);
|
||||
assert_eq!(
|
||||
|
||||
Reference in new issue
Block a user