runtime: lines by Bresenham's rule, bresenhamLines on the floor

Metal covers the pixels whose diamond a line exits. Vulkan's default line rule is the device's
own: on a device whose strictLines is set (lavapipe, NVIDIA's driver), the rectangle of the line's
width. The new runtime chained no line state, so primitive-type-restart-indices' four Line and
LineStrip cells differed from Metal on lavapipe (m3-max-60347) and on the RTX 2080, 3090 and 5080
(round 50b8fbb64f) by 7, 7, 5 and 13 texels. Those are exactly the counts the case's doc records
for lavapipe without Bresenham's mode. The old runtime chained the mode (73c4e3ab3c). Restart is
not involved: rt restarts strips alone, as Metal's recording does.

The floor takes VK_EXT_line_rasterization and its bresenhamLines (the planner's ruling, rung 1:
one form for every device). There is one extension name, the EXT, because every capture lists it:
- RX 7900 XTX, RX 550, RTX 3090 and RTX 2080: vulkaninfo, jobs m3-max-60382 to 60385. Each also
  lists the KHR, with bresenhamLines true.
- KosmicKrisp on the M3: m3-max-60379.
- The committed profiles of RADV (780M, RDNA2, RDNA3), ANV (Iris Xe RPL-P and TGL, ARL, UHD 770),
  lavapipe and NVIDIA (RTX 5080 and the laptop part, GTX 1060).
- The Windows UHD 630's capture, a Vulkan 1.3.215 device.
No venue lists the KHR name alone. Vulkan 1.4 requires bresenhamLines of every device.

The line class's VkPipeline chains VkPipelineRasterizationLineStateCreateInfoEXT with
VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT. A state that enables alpha to coverage or alpha to one
is the exception, since the mode takes neither (VUID-VkGraphicsPipelineCreateInfo-
lineRasterizationMode-02766); the runtime enables no sample shading, the third member the VUID
names. Such a state's lines are drawn by the device's default rule, and the state carries the new
static PrecisionNote::DeviceLineRasterization (metal2vulkan-degrade-device-line-rasterization),
decided by its descriptor alone and never fatal. The note is entered in docs/API.md's catalogue,
mapped in the conformance crate's Degradation and validation's allowance table, and added to the
cache codec's list (the translator never records it).

docs/API.md's accepted differences gain the one sentence on a line's tie-break: Vulkan's diamond
is open, so which pixel a line covers where it only touches a diamond's vertex is the device's
own. The case's doc measured Metal covering the lower pixel and the RTX 5080 the upper.

The README's floor lists gain VK_EXT_line_rasterization and bresenhamLines, and its render
pipeline section the line rule. The floor tests take the feature and the extension.

Test: draw's every_device_notes_the_device_line_rule_under_alpha_to_coverage_or_one
(`draw_line_rule`): a plain state carries no DeviceLineRasterization and draws its line across row
2 by Bresenham's rule; alpha-to-coverage and alpha-to-one states carry the note and draw the same
row by the device's rule.
This commit is contained in:
Anees Iqbal committed 2026-11-20 15:09:44 -08:00
1 parent 1fb5c22bc7
commit 107dba0b33
13 files changed
+184 -13

No files matched your search

@@ -183,6 +183,8 @@ pub enum Degradation {
DeviceDepthBias,
/// `metal2vulkan-degrade-swizzled-opaque-black-border`.
SwizzledOpaqueBlackBorder,
/// `metal2vulkan-degrade-device-line-rasterization`.
DeviceLineRasterization,
}
impl Degradation {
@@ -274,6 +276,7 @@ impl Degradation {
Degradation::NativeFloat8,
Degradation::DeviceDepthBias,
Degradation::SwizzledOpaqueBlackBorder,
Degradation::DeviceLineRasterization,
];
/// The kind's code, `metal2vulkan-degrade-<kind>`.
@@ -409,6 +412,9 @@ impl Degradation {
Degradation::SwizzledOpaqueBlackBorder => {
"metal2vulkan-degrade-swizzled-opaque-black-border"
}
Degradation::DeviceLineRasterization => {
"metal2vulkan-degrade-device-line-rasterization"
}
}
}
@@ -507,6 +513,7 @@ impl Degradation {
PrecisionNote::SharedExponentKept => Degradation::SharedExponentKept,
PrecisionNote::DeviceReconvergence => Degradation::DeviceReconvergence,
PrecisionNote::SimdgroupAccessOrder => Degradation::SimdgroupAccessOrder,
PrecisionNote::DeviceLineRasterization => Degradation::DeviceLineRasterization,
}
}
}
+9
View File
@@ -2765,6 +2765,13 @@ or does not check is rebuilt from the generations' names, with young counted ful
Metal's creation refuses it. A point near the viewport's edge or the clip volume is clipped or
culled by the device's own rule (its `pointClippingBehavior` and the driver's handling of the
viewport), as Metal states no rule for it (docs/API.md, section 10).
- A line is drawn by Bresenham's rule, which is Metal's: the pixels whose diamond the line exits
(`bresenhamLines`, Floor). The line class's `VkPipeline` chains
`VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT`, except for a state that enables alpha to coverage or
alpha to one, which Vulkan's Bresenham mode does not take: its lines are drawn by the device's
default rule, the rectangle of the line's width on a device whose `strictLines` is set, and the
state carries `PrecisionNote::DeviceLineRasterization`. Where a line only touches a pixel's
diamond at its vertex, which pixel it covers is the device's own (docs/API.md, section 10).
- A post-tessellation vertex function's state draws its patches through the device's tessellator
(`tessellationShader`, Floor). Its one `VkPipeline` is the patch class's, made with the state:
the translator's synthesized vertex stage (each patch one vertex of a `PATCH_LIST` of one control
@@ -3368,6 +3375,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
| `VK_KHR_swapchain` | device | presenting |
| `VK_EXT_robustness2` | device | null descriptors, and image reads out of range answered by the device |
| `VK_EXT_calibrated_timestamps` | device | GPU times on the host clock: the device calibrates its own clock (`VK_TIME_DOMAIN_DEVICE_EXT`) with the host's (`floor::TIME_DOMAINS`) |
| `VK_EXT_line_rasterization` | device | lines drawn by Bresenham's rule, through `bresenhamLines` below; every venue's driver lists this name (RADV, ANV, lavapipe, NVIDIA's, KosmicKrisp, and the UHD 630's Windows driver, a Vulkan 1.3 device) |
| `VK_KHR_shader_maximal_reconvergence` | device, where listed | SIMD groups that reconverge as Metal's do |
| `VK_KHR_shader_subgroup_uniform_control_flow` | device, where listed | SIMD groups' reconvergence where maximal reconvergence is not offered |
| `VK_KHR_portability_enumeration` | instance, where offered | listing portability devices, each checked against the floor as any other |
@@ -3423,6 +3431,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
| `fragmentStoresAndAtomics` | `VkPhysicalDeviceFeatures` | a fragment function's writes and atomics on device memory |
| `alphaToOne` | `VkPhysicalDeviceFeatures` | a render pipeline's `alphaToOneEnabled` |
| `logicOp` | `VkPhysicalDeviceFeatures` | a render pipeline's logic operation (private render state), the device's own; without it the fragment function would compute it, which needs fragment interlock or raster-order attachment access |
| `bresenhamLines` | `VkPhysicalDeviceLineRasterizationFeaturesEXT` | a line drawn by Metal's rule, the pixels whose diamond it exits (`VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT`), where Vulkan's default rule is the device's own: the rectangle of the line's width on a device whose `strictLines` is set (lavapipe, NVIDIA's driver); Vulkan 1.4 requires it |
| `fullDrawIndexUint32` | `VkPhysicalDeviceFeatures` | an indexed draw's 32-bit indices past `2^24 - 1`; Vulkan 1.4 and Roadmap 2022 require it |
| `shaderClipDistance` | `VkPhysicalDeviceFeatures` | a vertex or post-tessellation vertex function's `[[clip_distance]]` |
| `tessellationShader` | `VkPhysicalDeviceFeatures` | a post-tessellation vertex function's patches, drawn through the device's tessellator |
+3 -1
View File
@@ -507,6 +507,7 @@ impl Device {
mut divisor,
mut border_swizzle,
mut linear_attachment,
mut line_rasterization,
} = enabled_features;
// `sparseBinding` for imports over several dma-bufs (`Device::import_dma_bufs`), only where
// the device's queries offer that import: it changes no other path, as only that import
@@ -529,7 +530,8 @@ impl Device {
.push_next(&mut vulkan11)
.push_next(&mut vulkan12)
.push_next(&mut vulkan13)
.push_next(&mut robustness2);
.push_next(&mut robustness2)
.push_next(&mut line_rasterization);
// An optional extension's structure goes in only where the extension is enabled.
let enabled = |name: &std::ffi::CStr| capabilities.extensions.contains(&name);
if enabled(ash::khr::shader_maximal_reconvergence::NAME) {
+21 -2
View File
@@ -24,12 +24,14 @@ pub const INSTANCE_EXTENSIONS: &[&CStr] = &[ash::khr::surface::NAME];
pub const OPTIONAL_INSTANCE_EXTENSIONS: &[&CStr] = &[ash::khr::portability_enumeration::NAME];
/// The device extensions the runtime requires and device creation enables: presenting, null
/// descriptors and image reads out of range answered by the device, and the GPU's clock read with
/// the host's, for GPU times on the host clock ([`host_time`](crate::host_time)).
/// descriptors and image reads out of range answered by the device, the GPU's clock read with
/// the host's, for GPU times on the host clock ([`host_time`](crate::host_time)), and lines drawn
/// by Bresenham's rule, Metal's (`VK_EXT_line_rasterization`'s `bresenhamLines`).
pub const DEVICE_EXTENSIONS: &[&CStr] = &[
ash::khr::swapchain::NAME,
ash::ext::robustness2::NAME,
ash::ext::calibrated_timestamps::NAME,
ash::ext::line_rasterization::NAME,
];
/// The time domains the floor requires the device to calibrate together: its own clock, and the
@@ -245,6 +247,9 @@ pub struct Features {
/// `VkPhysicalDeviceLinearColorAttachmentFeaturesNV`, of `VK_NV_linear_color_attachment`:
/// read and enabled only where the device lists it ([`OPTIONAL_EXTENSIONS`]).
pub linear_attachment: vk::PhysicalDeviceLinearColorAttachmentFeaturesNV<'static>,
/// `VkPhysicalDeviceLineRasterizationFeaturesEXT`, of `VK_EXT_line_rasterization`:
/// `bresenhamLines` is enabled, and none of the other line modes beside it.
pub line_rasterization: vk::PhysicalDeviceLineRasterizationFeaturesEXT<'static>,
}
/// One feature: the Vulkan structure that reports it, its member as ash spells it, the member, and
@@ -296,6 +301,9 @@ macro_rules! feature {
(@structure linear_attachment) => {
"VkPhysicalDeviceLinearColorAttachmentFeaturesNV"
};
(@structure line_rasterization) => {
"VkPhysicalDeviceLineRasterizationFeaturesEXT"
};
(@translator) => {
None
};
@@ -375,6 +383,11 @@ pub(crate) const REQUIRED: &[Feature] = &[
// A render pipeline's `alphaToOneEnabled`, the device's own: each sample's alpha 1 after the
// coverage is taken. Every floor driver reports it.
feature!(core.alpha_to_one => AlphaToOne),
// A line drawn by Bresenham's rule, which is Metal's: the pixels whose diamond the line exits.
// Vulkan's default rule is the device's own, the rectangle of the line's width on a device
// whose `strictLines` is set (lavapipe, NVIDIA's driver). Vulkan 1.4 requires it of every
// device.
feature!(line_rasterization.bresenham_lines),
// A render pipeline's logic operation (private render state), the device's own `logicOp`. A
// device without it would compute the operation in the fragment function, which needs
// fragment interlock or raster-order attachment access, neither in the floor. Every floor
@@ -787,6 +800,7 @@ unsafe fn query(
|| listed(ash::ext::vertex_attribute_divisor::NAME);
let border_swizzle_listed = listed(ash::ext::border_color_swizzle::NAME);
let linear_attachment_listed = listed(ash::nv::linear_color_attachment::NAME);
let line_rasterization_listed = listed(ash::ext::line_rasterization::NAME);
let Features {
core,
@@ -802,6 +816,7 @@ unsafe fn query(
divisor,
border_swizzle,
linear_attachment,
line_rasterization,
} = &mut queried.features;
let mut features = vk::PhysicalDeviceFeatures2::default()
.push_next(&mut *vulkan11)
@@ -834,6 +849,9 @@ unsafe fn query(
if linear_attachment_listed {
features = features.push_next(&mut *linear_attachment);
}
if line_rasterization_listed {
features = features.push_next(&mut *line_rasterization);
}
instance.get_physical_device_features2(physical, &mut features);
*core = features.features;
vulkan11.p_next = std::ptr::null_mut();
@@ -848,6 +866,7 @@ unsafe fn query(
divisor.p_next = std::ptr::null_mut();
border_swizzle.p_next = std::ptr::null_mut();
linear_attachment.p_next = std::ptr::null_mut();
line_rasterization.p_next = std::ptr::null_mut();
queried.families = instance.get_physical_device_queue_family_properties(physical);
queried.memory = instance.get_physical_device_memory_properties(physical);
+35 -5
View File
@@ -47,6 +47,11 @@
//! class; under any other class it rasterizes nothing and runs the vertex function all the same,
//! so the encoder draws such points behind an empty scissor.
//!
//! A line is drawn by Bresenham's rule, which is Metal's (`bresenhamLines`, Floor): the line
//! class's `VkPipeline` chains `VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT`, except under alpha to
//! coverage or alpha to one, which the mode does not take, where the device's default rule draws
//! it (`PrecisionNote::DeviceLineRasterization`).
//!
//! A content whose vertex function is post-tessellation draws patches alone, so its one
//! `VkPipeline` is the patch class's, made with the state: the translator's synthesized vertex and
//! control stages, the function as the evaluation stage, and a `PATCH_LIST` of one control point
@@ -201,8 +206,9 @@ pub(crate) struct RenderCompiled {
/// Metal rasterizes no point of such a function and runs its vertex function all the same
/// (`metal2vulkan::pipeline::GraphicsState::writes_point_size`).
rasterizes_points: bool,
/// The translator's notes of where the pipeline's answers may differ from Metal's, and its
/// functions' constexpr samplers' (`constexpr_notes`).
/// The translator's notes of where the pipeline's answers may differ from Metal's, its
/// functions' constexpr samplers' (`constexpr_notes`), and `DeviceLineRasterization` where its
/// lines are drawn by the device's default rule (`lines_by_device_rule`).
notes: Vec<PrecisionNote>,
/// What a draw supplies.
pub(crate) draws: Draws,
@@ -357,6 +363,15 @@ impl crate::Device {
}
}
/// Whether a content's lines are drawn by the device's default rule rather than Bresenham's:
/// its state enables alpha to coverage or alpha to one, which Vulkan's Bresenham mode does not
/// take (`VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766`). Decided by the
/// descriptor alone, so a state of it carries `PrecisionNote::DeviceLineRasterization` whether or
/// not it draws lines.
fn lines_by_device_rule(fixed: &Fixed) -> bool {
fixed.alpha_to_coverage || fixed.alpha_to_one
}
/// The samplers a state of a content numbers and the constexpr samplers its functions sample
/// through ([`RenderCompiled::numbered`]).
type Numbering = (Vec<NumberedSampler>, Vec<(usize, CombinedSampler)>);
@@ -918,9 +933,12 @@ impl RenderCompiled {
});
notes.extend(stage.precision_notes.iter().copied());
}
let fixed = Fixed::of(&pipeline);
if lines_by_device_rule(&fixed) {
notes.push(PrecisionNote::DeviceLineRasterization);
}
notes.sort_unstable();
notes.dedup();
let fixed = Fixed::of(&pipeline);
core.counters.rise(Gauge::RenderContents);
// A state whose fragment function reaches an imageblock is not made (`unbuilt`), so its
// sample is its colors alone.
@@ -1070,10 +1088,20 @@ impl RenderCompiled {
let viewport = vk::PipelineViewportStateCreateInfo::default()
.viewport_count(1)
.scissor_count(1);
let rasterization = vk::PipelineRasterizationStateCreateInfo::default()
let mut rasterization = vk::PipelineRasterizationStateCreateInfo::default()
.polygon_mode(vk::PolygonMode::FILL)
.rasterizer_discard_enable(fixed.discard)
.line_width(1.0);
// The line class draws by Bresenham's rule, Metal's (`bresenhamLines`, Floor), except
// under alpha to coverage or alpha to one, which Vulkan's Bresenham mode does not take
// (`VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766`; the runtime enables no
// sample shading, the third it names): such a state draws its lines by the device's
// default rule (`PrecisionNote::DeviceLineRasterization`, of `lines_by_device_rule`).
let mut line = vk::PipelineRasterizationLineStateCreateInfoEXT::default()
.line_rasterization_mode(vk::LineRasterizationModeEXT::BRESENHAM);
if topology == vk::PrimitiveTopology::LINE_LIST && !lines_by_device_rule(fixed) {
rasterization = rasterization.push_next(&mut line);
}
let multisample = vk::PipelineMultisampleStateCreateInfo::default()
.rasterization_samples(fixed.samples)
.alpha_to_coverage_enable(fixed.alpha_to_coverage)
@@ -1142,7 +1170,9 @@ impl RenderPipelineState {
/// [`PrecisionNote::SwizzledOpaqueBlackBorder`] where a function samples through a constexpr
/// sampler whose address mode reads an opaque-black border (decided by the sampler's own
/// constants, as [`SamplerState::precision_note`](crate::SamplerState::precision_note) is by
/// its descriptor); empty where they match.
/// its descriptor), and [`PrecisionNote::DeviceLineRasterization`] where the descriptor
/// enables alpha to coverage or alpha to one, under which the state's lines are drawn by the
/// device's default rule, not Bresenham's; empty where they match.
pub fn precision_notes(&self) -> Vec<PrecisionNote> {
self.inner.compiled.notes.clone()
}
@@ -616,6 +616,63 @@ pub(crate) mod on_device {
});
}
/// A state that enables alpha to coverage or alpha to one carries
/// `PrecisionNote::DeviceLineRasterization`, its lines drawn by the device's default rule,
/// which Vulkan's Bresenham mode leaves for such a state; a plain state carries none, its lines
/// drawn by Bresenham's rule. Each draws its line across row 2.
#[test]
fn every_device_notes_the_device_line_rule_under_alpha_to_coverage_or_one() {
let Some(library) = examples() else {
return;
};
let plain = descriptor(&library, "colored_fragment", PixelFormat::RGBA8Unorm);
let mut coverage = plain.clone();
coverage.alpha_to_coverage = true;
let mut one = plain.clone();
one.alpha_to_one = true;
let note = crate::PrecisionNote::DeviceLineRasterization;
each_device("draw_line_rule", |name, _, device| {
let y = 1.0 - 2.5 / 4.0;
let mut buffers = Buffers::new(&device);
let positions = buffers.of(&device, &floats(&[-1.0, y, 1.0, y]));
let colors = buffers.of(&device, &floats(&[GREEN, GREEN].concat()));
let queue = device.new_command_queue(4).expect("a queue");
let draw = |result: Result<(), Error>| result.unwrap_or_else(|e| panic!("{name}: {e}"));
for (what, d, noted) in [
("plain", &plain, false),
("alpha to coverage", &coverage, true),
("alpha to one", &one, true),
] {
let state = state(name, &device, d);
assert_eq!(
state.precision_notes().contains(&note),
noted,
"{name}: {what}: the device line rule's note"
);
let color = target(
&device,
PixelFormat::RGBA8Unorm,
TextureUsage::RENDER_TARGET,
);
let command_buffer = queue.command_buffer().expect("a command buffer");
let mut encoder = (command_buffer.render_command_encoder(&pass(&color, None)))
.unwrap_or_else(|error| panic!("{name}: {error}"));
draw(encoder.set_render_pipeline_state(&state));
draw(encoder.set_vertex_buffer(Some(&positions), 0, 0));
draw(encoder.set_vertex_buffer(Some(&colors), 0, 1));
draw(encoder.draw_primitives(PrimitiveType::Line, 0, 2, 1, 0));
encoder.end_encoding();
run(name, &command_buffer);
let texels = read(&color, 4);
for x in 1..SIDE - 1 {
let i = ((2 * SIDE + x) * 4) as usize;
assert_eq!(texels[i..i + 4], rgba8(GREEN), "{name}: {what}: ({x}, 2)");
}
}
println!("{name}: the device line rule noted under alpha to coverage and alpha to one");
});
}
/// A state whose descriptor names the line class (`inputPrimitiveTopology`) makes its line
/// pipeline with the state, beside the triangle one: its first draw of lines makes nothing and
/// waits for nothing, and draws its row.
+11 -2
View File
@@ -95,6 +95,7 @@ fn at_the_floor() -> Queried {
features.vulkan13.synchronization2 = vk::TRUE;
features.vulkan13.dynamic_rendering = vk::TRUE;
features.robustness2.null_descriptor = vk::TRUE;
features.line_rasterization.bresenham_lines = vk::TRUE;
Queried {
version: vk::make_api_version(0, 1, 3, 0),
@@ -360,7 +361,7 @@ fn each_missing_feature_is_named() {
const CORE: &str = "VkPhysicalDeviceFeatures";
const ROBUSTNESS2: &str = "VkPhysicalDeviceRobustness2FeaturesEXT";
type Clear = fn(&mut Features);
let cases: [(Clear, Missing); 51] = [
let cases: [(Clear, Missing); 52] = [
(
|f| f.vulkan12.buffer_device_address = vk::FALSE,
feature(V12, "bufferDeviceAddress"),
@@ -568,6 +569,13 @@ fn each_missing_feature_is_named() {
|f| f.core.large_points = vk::FALSE,
feature(CORE, "largePoints"),
),
(
|f| f.line_rasterization.bresenham_lines = vk::FALSE,
feature(
"VkPhysicalDeviceLineRasterizationFeaturesEXT",
"bresenhamLines",
),
),
];
assert_eq!(
cases.len(),
@@ -923,6 +931,7 @@ fn every_missing_item_is_named_at_once() {
Missing::Extension(ash::khr::swapchain::NAME),
Missing::Extension(ash::ext::robustness2::NAME),
Missing::Extension(ash::ext::calibrated_timestamps::NAME),
Missing::Extension(ash::ext::line_rasterization::NAME),
feature("VkPhysicalDeviceFeatures", "shaderInt64"),
feature("VkPhysicalDeviceVulkan13Features", "dynamicRendering"),
Missing::Limit {
@@ -939,7 +948,7 @@ fn every_missing_item_is_named_at_once() {
assert_eq!(
below.to_string(),
"the device is below the runtime's floor: it lacks VK_KHR_swapchain; \
VK_EXT_robustness2; VK_EXT_calibrated_timestamps; VkPhysicalDeviceFeatures.shaderInt64; VkPhysicalDeviceVulkan13Features.dynamicRendering; \
VK_EXT_robustness2; VK_EXT_calibrated_timestamps; VK_EXT_line_rasterization; VkPhysicalDeviceFeatures.shaderInt64; VkPhysicalDeviceVulkan13Features.dynamicRendering; \
maxPushConstantsSize 64, below 256; a queue family with graphics and compute; a memory \
type with VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT | VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | \
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT for buffers"
@@ -346,7 +346,8 @@ pub fn allowance(note: PrecisionNote) -> Allowance {
| N::DeviceRoundedResolve
| N::CompressedTexelDecode
| N::SharedExponentKept
| N::SwizzledOpaqueBlackBorder => Allowance::Unbounded,
| N::SwizzledOpaqueBlackBorder
| N::DeviceLineRasterization => Allowance::Unbounded,
}
}
@@ -90,6 +90,7 @@ fn every_precision_note_has_its_table_row() {
(N::SharedExponentKept, Allowance::Unbounded),
(N::SwizzledOpaqueBlackBorder, Allowance::Unbounded),
(N::SimdgroupAccessOrder, Allowance::Unbounded),
(N::DeviceLineRasterization, Allowance::Unbounded),
];
for (note, expected) in rows {
assert_eq!(allowance(note), expected, "{note:?}");
+1
View File
@@ -1542,6 +1542,7 @@ codec_enum! {
DeviceRoundedResolve,
SwizzledOpaqueBlackBorder,
SimdgroupAccessOrder,
DeviceLineRasterization,
}
BindingSource {
Buffer(f0), Texture(f0), Sampler(f0), CombinedTextureSampler { texture, sampler },
@@ -2375,6 +2375,20 @@ pub enum PrecisionNote {
/// Validation derives no tolerance from it: a difference stays a mismatch, which the note
/// explains.
SwizzledOpaqueBlackBorder,
/// A render pipeline state that enables alpha to coverage or alpha to one draws its lines by
/// the device's default rule, not Bresenham's: Vulkan's Bresenham mode takes neither
/// (`VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766`). Metal covers the pixels
/// whose diamond a line exits, which Bresenham's mode is; a device whose `strictLines` is set
/// (lavapipe, NVIDIA's driver) covers the rectangle of the line's width instead, so the pixels
/// at a line's two ends, and on either side of a pixel boundary the line runs along, may
/// differ from Metal's. Every other state draws its lines by Bresenham's rule and records no
/// note. Static, decided by the descriptor alone: no translated stage records it; on
/// `metal2vulkan-runtime` such a state carries it among its notes (`precision_notes`),
/// whether or not it draws lines.
///
/// Validation derives no tolerance from it: a difference stays a mismatch, which the note
/// explains.
DeviceLineRasterization,
}
/// The math mode of an entry's module, which decides, on a device whose `float` functions are
+4 -1
View File
@@ -1107,7 +1107,7 @@ const-value metal2vulkan-runtime::MAX_COLOR_ATTACHMENTS 8
const-value metal2vulkan-runtime::floor::ATTACHMENT_READ_EXTENSIONS &[ash::ext::attachment_feedback_loop_layout::NAME, ash::ext::attachment_feedback_loop_dynamic_state::NAME]
const-value metal2vulkan-runtime::floor::BORDER_SWIZZLE_EXTENSIONS &[ash::ext::custom_border_color::NAME, ash::ext::border_color_swizzle::NAME]
const-value metal2vulkan-runtime::floor::BUFFER_USAGE vk::BufferUsageFlags::from_raw(vk::BufferUsageFlags::TRANSFER_SRC.as_raw() | vk::BufferUsageFlags::TRANSFER_DST.as_raw() | vk::BufferUsageFlags::UNIFORM_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::UNIFORM_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_BUFFER.as_raw() | vk::BufferUsageFlags::INDEX_BUFFER.as_raw() | vk::BufferUsageFlags::VERTEX_BUFFER.as_raw() | vk::BufferUsageFlags::INDIRECT_BUFFER.as_raw() | vk::BufferUsageFlags::SHADER_DEVICE_ADDRESS.as_raw())
const-value metal2vulkan-runtime::floor::DEVICE_EXTENSIONS &[ash::khr::swapchain::NAME, ash::ext::robustness2::NAME, ash::ext::calibrated_timestamps::NAME]
const-value metal2vulkan-runtime::floor::DEVICE_EXTENSIONS &[ash::khr::swapchain::NAME, ash::ext::robustness2::NAME, ash::ext::calibrated_timestamps::NAME, ash::ext::line_rasterization::NAME]
const-value metal2vulkan-runtime::floor::INSTANCE_EXTENSIONS &[ash::khr::surface::NAME]
const-value metal2vulkan-runtime::floor::OPTIONAL_EXTENSIONS &[ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME, ash::khr::portability_subset::NAME, ash::khr::vertex_attribute_divisor::NAME, ash::ext::vertex_attribute_divisor::NAME, ash::ext::external_memory_host::NAME, ash::khr::external_memory_fd::NAME, ash::ext::external_memory_dma_buf::NAME, ash::khr::external_memory_win32::NAME, ash::ext::queue_family_foreign::NAME, ash::ext::image_drm_format_modifier::NAME, ash::nv::linear_color_attachment::NAME]
const-value metal2vulkan-runtime::floor::OPTIONAL_INSTANCE_EXTENSIONS &[ash::khr::portability_enumeration::NAME]
@@ -2482,6 +2482,7 @@ field metal2vulkan-runtime::floor::Features.core pub core: vk::PhysicalDeviceFea
field metal2vulkan-runtime::floor::Features.divisor pub divisor: vk::PhysicalDeviceVertexAttributeDivisorFeaturesKHR<'static>
field metal2vulkan-runtime::floor::Features.feedback_loop pub feedback_loop: vk::PhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT<'static>
field metal2vulkan-runtime::floor::Features.feedback_loop_dynamic pub feedback_loop_dynamic: vk::PhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT<'static>
field metal2vulkan-runtime::floor::Features.line_rasterization pub line_rasterization: vk::PhysicalDeviceLineRasterizationFeaturesEXT<'static>
field metal2vulkan-runtime::floor::Features.linear_attachment pub linear_attachment: vk::PhysicalDeviceLinearColorAttachmentFeaturesNV<'static>
field metal2vulkan-runtime::floor::Features.maximal_reconvergence pub maximal_reconvergence: vk::PhysicalDeviceShaderMaximalReconvergenceFeaturesKHR<'static>
field metal2vulkan-runtime::floor::Features.portability pub portability: vk::PhysicalDevicePortabilitySubsetFeaturesKHR<'static>
@@ -10391,6 +10392,7 @@ variant metal2vulkan-runtime::PrecisionNote::DeviceDepthBias DeviceDepthBias
variant metal2vulkan-runtime::PrecisionNote::DeviceFilteredMipmaps DeviceFilteredMipmaps
variant metal2vulkan-runtime::PrecisionNote::DeviceInterpolation DeviceInterpolation
variant metal2vulkan-runtime::PrecisionNote::DeviceInterpolationOffset DeviceInterpolationOffset
variant metal2vulkan-runtime::PrecisionNote::DeviceLineRasterization DeviceLineRasterization
variant metal2vulkan-runtime::PrecisionNote::DeviceNanEncoding DeviceNanEncoding
variant metal2vulkan-runtime::PrecisionNote::DevicePackConversion DevicePackConversion
variant metal2vulkan-runtime::PrecisionNote::DevicePointSize DevicePointSize
@@ -12101,6 +12103,7 @@ variant metal2vulkan::pipeline::PrecisionNote::DeviceDepthBias DeviceDepthBias
variant metal2vulkan::pipeline::PrecisionNote::DeviceFilteredMipmaps DeviceFilteredMipmaps
variant metal2vulkan::pipeline::PrecisionNote::DeviceInterpolation DeviceInterpolation
variant metal2vulkan::pipeline::PrecisionNote::DeviceInterpolationOffset DeviceInterpolationOffset
variant metal2vulkan::pipeline::PrecisionNote::DeviceLineRasterization DeviceLineRasterization
variant metal2vulkan::pipeline::PrecisionNote::DeviceNanEncoding DeviceNanEncoding
variant metal2vulkan::pipeline::PrecisionNote::DevicePackConversion DevicePackConversion
variant metal2vulkan::pipeline::PrecisionNote::DevicePointSize DevicePointSize
Can't render this file because it is too large.
+19 -1
View File
@@ -1744,7 +1744,9 @@ the translated module, the pixel format, the descriptor or the state, on every d
- `ComputePipelineState::precision_notes` and `RenderPipelineState::precision_notes`: the
translator's notes of the state's modules, with `SwizzledOpaqueBlackBorder` where a function
samples through a constexpr sampler whose address mode reads an opaque-black border;
samples through a constexpr sampler whose address mode reads an opaque-black border, and
`DeviceLineRasterization` where a render pipeline's descriptor enables alpha to coverage or
alpha to one;
- `Texture::precision_note`: `CompressedTexelDecode` where the texture's own pixel format is
block-compressed;
- `SamplerState::precision_note`: `SwizzledOpaqueBlackBorder` where an address mode reads an
@@ -2633,6 +2635,15 @@ bound.
the sampler names the view's mapping, which a sampler that meets every view cannot, and the
NVIDIA driver reads `(0, 0, 0, 1)`, where Metal reads the border colour in the format's channels
through the swizzle. A device with the feature reads Metal's texel.
- `metal2vulkan-degrade-device-line-rasterization` (precision).
`PrecisionNote::DeviceLineRasterization`: A render pipeline state that enables alpha to coverage
or alpha to one, which carries it among its notes (`precision_notes`), decided by its descriptor
alone. Its lines are drawn by the device's default rule, not Bresenham's, which Vulkan takes with
neither (`VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766`). Metal covers the
pixels whose diamond a line exits; a device whose `strictLines` is set (lavapipe, NVIDIA's
driver) covers the rectangle of the line's width instead, so the pixels at a line's two ends,
and on either side of a pixel boundary the line runs along, may differ from Metal's. Every other
state draws its lines by Bresenham's rule (`bresenhamLines`, the runtime's floor).
- `metal2vulkan-degrade-device-pack-conversion` (precision). `PrecisionNote::DevicePackConversion`:
Native device maths (a conversion): `air.pack` or `air.unpack` of a normalized format is the
device's: `GLSL.std.450`'s `Pack`/`Unpack` `Unorm4x8`, `Snorm4x8`, `Unorm2x16` and `Snorm2x16`,
@@ -2697,6 +2708,13 @@ each item named states the rule in full.
viewport's centre and covers its square whole, past the viewport's edge, where lavapipe covers
no pixel whose centre lies on or past that edge and culls no point at the clip volume (the
conformance case `point-viewport-coverage`).
- **A line's tie-break is the device's own.** Lines draw by Bresenham's rule, which is Metal's
(`bresenhamLines`, the runtime's floor): the pixels whose diamond the line exits. Vulkan's
diamond is open (`|p - x| + |q - y| < 0.5`), so a line that only touches a diamond's vertex
exits neither diamond the vertex joins, and no Vulkan control decides which pixel a conforming
driver covers there. Measured, where a line of the conformance case
`primitive-type-restart-indices` runs through the boundary point (3.5, 1.0), Metal on an Apple M3
Max covers the lower pixel and NVIDIA's driver on an RTX 5080 the upper.
**Resource IDs and identifiers**