rt: a translator's viewport and scissor dynamic states are the pipeline's with-count states

The viewports' piece made the pipeline's viewports and scissors dynamic with their count
(VIEWPORT_WITH_COUNT, SCISSOR_WITH_COUNT), but render.rs still compared the translator's dynamic
states (VIEWPORT, SCISSOR) with that list one for one, so every render pipeline state was
RenderPipelineKind::DynamicState (m3-max-62168, at 99e5d42deb). The ash form of a translator
state now maps VIEWPORT and SCISSOR to their with-count states, which the pipeline holds in
their place (VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-04132 and -04133 forbid both
forms).

The translator's tests of target indices (engine_target_indices) that read runtime-floor as a
device without multiViewport now take it below the floor, without multiViewport and
shaderOutputViewportIndex, which the floor now requires: the raw viewport index alone, and a
fragment function's read of a viewport no stage writes, which reads 0 only where the device
cannot declare ViewportIndex (with multiViewport it declares the input). The same fix was made
to engine_selected_indices before development deleted that file (3ecf606aa8).
This commit is contained in:
Anees Iqbal committed 2026-11-21 00:34:20 -08:00
1 parent d00c32ecf6
commit d6c110338d
2 files changed
+21 -8

No files matched your search

+8 -2
View File
@@ -814,9 +814,15 @@ fn unbuilt(pipeline: &RenderPipeline, enabled: &EnabledCaps) -> Option<RenderPip
})
}
/// The ash form of a translator dynamic state.
/// The ash form of a translator dynamic state, as the pipeline holds it: the viewport and the
/// scissor are the with-count states, which set them with their count, as a pipeline holds no
/// state in both forms (VUID-VkGraphicsPipelineCreateInfo-pDynamicStates-04132 and -04133).
fn dynamic(state: metal2vulkan::vk::DynamicState) -> vk::DynamicState {
vk::DynamicState::from_raw(state.as_raw())
match vk::DynamicState::from_raw(state.as_raw()) {
vk::DynamicState::VIEWPORT => vk::DynamicState::VIEWPORT_WITH_COUNT,
vk::DynamicState::SCISSOR => vk::DynamicState::SCISSOR_WITH_COUNT,
other => other,
}
}
impl Fixed {
@@ -193,13 +193,16 @@ fn a_uniform_viewport_takes_the_output_or_goes_nowhere() {
needs(F::ShaderOutputViewportIndex),
"multiViewport without the output",
);
// Without `multiViewport`, on the floor too: the raw index alone.
// Without `multiViewport`, below the floor too, which requires it: the raw index alone.
for dev in [
device(
"lavapipe",
&[F::ShaderOutputViewportIndex, F::MultiViewport],
),
device("runtime-floor", &[]),
device(
"runtime-floor",
&[F::ShaderOutputViewportIndex, F::MultiViewport],
),
] {
let (outputs, builtins) = vertex_io(&bc, "rt6_select", &dev);
assert_eq!(outputs, [IoRole::ViewportIndex], "{builtins:?}");
@@ -267,10 +270,11 @@ fn indices_that_differ_among_a_primitive_s_vertices_are_refused() {
}
/// A fragment function that reads the slice or viewport no stage writes reads 0 on a device that
/// cannot declare the builtin, which it lists: the viewport on the floor, and the slice on the
/// floor without its `shaderOutputLayer`.
/// cannot declare the builtin, which it lists: below the floor, the viewport without
/// `multiViewport` and `shaderOutputViewportIndex`, and the slice without `shaderOutputLayer`,
/// each of which the floor requires.
#[test]
fn on_the_floor_a_read_of_an_index_no_stage_writes_is_zero() {
fn below_the_floor_a_read_of_an_index_no_stage_writes_is_zero() {
let Some(amp) = assemble("vertex_amplification.ll") else {
return;
};
@@ -283,7 +287,10 @@ fn on_the_floor_a_read_of_an_index_no_stage_writes_is_zero() {
(
"amp_fragment",
vec![StageBuiltin::ViewportIndex],
device("runtime-floor", &[]),
device(
"runtime-floor",
&[F::ShaderOutputViewportIndex, F::MultiViewport],
),
),
] {
let a = compile(&amp, entry, floor.profile()).unwrap_or_else(|e| panic!("{entry}: {e}"));