rt: a state takes the loop's colour flag at its make where a function can read a texture
T1 (795edfb733) made every render pipeline without the attachment feedback loop's colour flag and, at a state's first draw that reads its pass's attachment through a texture, made a flagged one on the encoding thread. In a window-drag stream (windrag-780m-b4, to frame 500) that was 110 compiles at first use on each desktop card that the base (every pipeline flagged at its make) did not have: 603.7 ms in all on the RX 7900 XTX with the driver's shader cache off (m3-max-81076), 2.39 ms on the RTX 2080 (m3-max-80961). None of the 110 was a state whose fragment function fetches its attachment ([[color(n)]]): T1 flagged those at their make. Each was a draw handed its pass's attachment as a texture, which no state's make can know. The ruled form decides the flag at the state's make from its functions' structure (Draws::reads_textures): a state takes the flag on every pipeline where a function of any stage can read a texture (a texture slot it reads, at any stage; a colour the fragment function fetches; or a read beyond its slots, an argument buffer's texture or a resource ID, which the structure cannot settle). A state whose functions read no texture never reads an attachment other than as one, and takes no flag. No draw makes a pipeline for the loop: Raster's `loops`, FirstUse::Loop and the content's per-raster flags go, and the content's later pipelines are again at most 15. Metrics::first_use_loop_waits, first_use_loop_wait_nanos and first_use_loop_wait_max_nanos go with the site they counted (api_signatures.tsv), as do Raster's `loops` and FirstUse::Loop; the replay's report drops their two keys. No consumer search was needed: T1 never reached a pushed sha (origin is at9186e2fe46, and T1 sits above it on development), so no consumer pin can hold them. Docs: the runtime README's attachment-read paragraph says which states take the flag; the first use waits list drops the loop's; the known gap of render encoders for T1's first-use compile gives way to one for the flag on the pipelines of every state that can read a texture, whether or not a draw hands it an attachment, with what the flag costs a draw that reads none, and what leaving it off saves, not measured on a tile-based phone GPU (no such device in the lab). The floor table's VK_EXT_attachment_feedback_loop_layout row, Core::feedback_loop, floor::Capabilities::feedback_loop and the render encoder's module doc say the same. No gain is claimed for any device. Verified at 00fe2f78be, this patch on development 795edfb733 (base =59326c8dff, before T1), then rebased ontod69a0bda18with the same patch: - Red/green: both tests of the red commit fail at it and pass here, on the RTX 2080 and on lavapipe (llvmpipe, LLVM 23.1.4) in m3-max-81257, on the Iris Xe (RPL-P) in m3-max-81291 and m3-max-81367, on the RX 7900 XTX (RADV NAVI31) in m3-max-81373 and on the RTX 3090 in m3-max-81365. At the red commit the fragment test reads ((1, 0), (1, 0)) against ((1, 0), (0, 1)), and the vertex test (1, 0) against (0, 1). - The stream's states, counted with a build of this tree that printed each content and each render pipeline made (never committed; one play of windrag-780m-b4 to frame 500 on the 2080 in m3-max-81257): 275 render contents, 218 of which can read a texture, every one through a fragment texture slot, and 57 read none. 281 render pipelines: 220 with the flag, 61 without. The play's Metrics::pipelines_created, 407, counts compute and the runtime's own pipelines too; the 281 render pipelines are the ones the base flagged, and 61 of them lose the flag here. - The A/B on the RTX 2080 (m3-max-81257): arms alternating a:cold, b:cold, a, b, a, b, cold with the driver's disk cache off (__GL_SHADER_DISK_CACHE=0), each with a fresh rt shader cache. Every play of both arms: pipelines_created 407, rendering interrupts 28857, barriers 136307, attachment loop reads 33533, 0 refused; first-use waits a 17, 18, 15 and b 17, 16, 17 (the other kinds; none for the loop, which the base never had and this tree no longer has). Median frame GPU time: a 1.7290 (cold), 1.7267, 1.7542 ms; b 1.7188 (cold), 1.2215, 1.7233 ms. Every play's clock samples mix P0, P5 and P8, and b's 1.2215 ms play is the one whose median moved alone; b's other two sit at or below a's range. No gain is claimed. - Merged-tree check (m3-max-81184, at 00fe2f78be): signatures, clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd, rustdoc, private intra-doc links, the translator's core (3420 passed, 37 skipped), the runtime on lavapipe (947 passed, 4 skipped), validation (1319 passed, 3 skipped), validation on lavapipe (1441 passed, 3 skipped), and the conformance replay on lavapipe (exactly the ledger's gaps, 0 drift), each exit 0. Clippy plain, --cfg m2v_gpu and --cfg m2v_cpu_icd at the rebased tree (m3-max-81311), each exit 0. - The A/B on the RX 7900 XTX (m3-max-81373, holding its node alone; cold with MESA_SHADER_CACHE_DISABLE=true): every play's counts equal (pipelines_created 407, barriers 127909); the play's GPU time a 128.88 (cold), 129.16, 128.96 ms against b 129.12 (cold), 129.48, 129.20 ms (+0.21%, same-arm spreads 0.22% and 0.28%); median frame a 341.2, 340.0, 339.7 us against b 339.8, 340.5, 339.9 us (-0.07%). - The A/B on the Iris Xe (m3-max-81367, holding its node alone; a:cold, b:cold, then three pairs): every play's pipelines_created 407, barriers 135343, loop reads 33533; median frame a 518.9 (cold), 524.8, 522.6, 525.2 us against b 507.8 (cold), 494.6, 522.0, 467.3 us, none of b's above a's highest; the play's GPU time a 287.5, 292.6, 272.1, 280.9 ms against b 281.5, 281.3, 273.7, 277.4 ms, b's within a's range. - The RTX 3090 (m3-max-81365): every play's pipelines_created 407 and other counts as the 2080's; its clock samples mix P0, P5 and P8 within every play, so its timing is not read. - Runtime command buffers per play vary between plays of one arm, the base's included (6258 to 6263 on the Iris Xe, 6320 and 6321 on the 3090): the play's own variance. - Not measured on a tile-based phone GPU (no such device in the lab).
This commit is contained in:
1 parent
d781dbbe93
commit
0d2d3ef99b
9 files changed
+73
-136
No files matched your search
@@ -3564,9 +3564,7 @@ while the driver's exit handler waited on a lock, with every runtime thread alre
|
||||
for a new workgroup size, threadgroup memory lengths, imageblock size or tiles), `first_use_line_waits` (a
|
||||
render content's line-class pipeline), `first_use_point_waits` (its point-class pipeline),
|
||||
`first_use_raster_waits` (its pipeline under the depth clip mode `Clamp` or the triangle fill
|
||||
mode `Lines`), `first_use_loop_waits` (its pipeline with the attachment feedback loop's colour
|
||||
flag, at its first draw that reads an attachment through the loop) and
|
||||
`first_use_unfinished_waits` (a state's main pipeline, compute or render,
|
||||
mode `Lines`) and `first_use_unfinished_waits` (a state's main pipeline, compute or render,
|
||||
before its `finish_pipeline` made it, and the pipeline of a render state drawn without the
|
||||
colours its pass lacks, which no `finish_pipeline` makes).
|
||||
No dispatch lowers a function. `Counters::variant_makes(from)` answers the kept makes of
|
||||
@@ -5119,18 +5117,18 @@ cache is answered compile-required on both.
|
||||
with the attachment in that layout; the pass's second barrier moves the whole image home. Until then every draw of the
|
||||
pass reads the image's textures through their second elements (Set 1), a texture that reaches
|
||||
no rendered level among them. A render pipeline takes the feedback loop's colour flag
|
||||
(`VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`) only where a draw reads an
|
||||
attachment through the loop, as Vulkan asks of such a read and of no other draw: the state's
|
||||
pipelines are made without it, and its first draw that reads an attachment through a texture
|
||||
makes the state's pipeline with the flag, which its later reading draws take (Known gaps of
|
||||
render encoders, below). A state whose fragment function fetches a colour (`[[color(n)]]`,
|
||||
below) reads through the loop at every draw, so its pipelines all take the flag from the
|
||||
start; so does an execution of an indirect command buffer, whose commands bind their own
|
||||
slots, and a draw that may read beyond its slots while a read declaration covers an attachment
|
||||
the pass holds out of its home layout. A draw that reads none takes a pipeline without the flag,
|
||||
the attachment in the feedback layout or not, and no draw records a state for the loop. Each
|
||||
draw that reads an attachment through the loop, through a texture or by a fetch (below), counts
|
||||
in `Metrics::attachment_loop_reads`, its barriers in `Metrics::barriers`.
|
||||
(`VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`), which Vulkan asks of a draw that
|
||||
reads an attachment in the feedback layout other than as an attachment, where its state's
|
||||
functions can read a texture: a texture slot a function of any stage reads, a colour the
|
||||
fragment function fetches (`[[color(n)]]`, below), or a read beyond its slots (an argument
|
||||
buffer's texture, a resource ID), which the structure cannot settle. A state is made before any
|
||||
draw binds its textures, and any draw of such a state may be handed an attachment of its pass,
|
||||
so all its pipelines take the flag from the state's make and no draw makes a pipeline for the
|
||||
loop; a draw of it that reads none is valid with the flag, the attachment in the feedback
|
||||
layout or not. A state whose functions read no texture reads no attachment other than as one,
|
||||
and its pipelines take no flag (Known gaps of render encoders, below). Each draw that reads an
|
||||
attachment through the loop, through a texture or by a fetch (below), counts in
|
||||
`Metrics::attachment_loop_reads`, its barriers in `Metrics::barriers`.
|
||||
- Through a copy, on a device without the feedback loop, and for a surface plane or a texture in
|
||||
place over a buffer whose image took no feedback usage (Exported surfaces; Memory blocks and
|
||||
buffers), the draw reads the image's shadow: an image of the same
|
||||
@@ -5214,15 +5212,12 @@ cache is answered compile-required on both.
|
||||
|
||||
### Known gaps of render encoders
|
||||
|
||||
- A state's first draw that reads its pass's attachment through a texture, on a device with the
|
||||
attachment feedback loop, compiles a second `VkPipeline` of the state's content, with the
|
||||
loop's colour flag, on the encoding thread, which waits for it; it is counted in
|
||||
`Metrics::first_use_loop_waits` with its time, and the state's later reading draws take it. A
|
||||
state whose fragment function reads no attachment that way never makes it. The flag stays off
|
||||
every other draw's pipeline for tile-based GPUs, which are a target of the runtime; what the
|
||||
flag costs there is not measured on a tile-based phone GPU (no such device in the lab). This
|
||||
form is not run on an Intel card, and not on the M3 Max under KosmicKrisp, which ignores the
|
||||
pipeline's flag.
|
||||
- On a device with the attachment feedback loop, every pipeline of a state whose functions can
|
||||
read a texture takes the loop's colour flag, whether or not a draw hands it an attachment of
|
||||
its pass, and one whose functions read none takes no flag. What the flag costs a draw that reads
|
||||
no attachment, and what leaving it off saves, is not measured on a tile-based phone GPU (no such
|
||||
device in the lab). On the M3 Max under KosmicKrisp the flag has no effect: KosmicKrisp reads no
|
||||
pipeline's feedback-loop state.
|
||||
- A draw that reads its own pass's attachment through an argument buffer or a resource ID reads a
|
||||
descriptor whose layout differs from the image's, which Vulkan leaves undefined
|
||||
(`VUID-vkCmdDraw-imageLayout-00344`); such draws count in
|
||||
@@ -5995,7 +5990,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported.
|
||||
| `VK_EXT_shader_stencil_export` | device, where listed | a fragment function's `[[stencil]]` output as the fragment's stencil reference (`FragStencilRefEXT`); a device without it draws the output by bits (the known gaps); RADV, ANV, lavapipe, KosmicKrisp and the UHD 630's Windows driver list it, NVIDIA's 615 and 620 drivers do not |
|
||||
| `VK_KHR_portability_enumeration` | instance, where offered | listing portability devices, each checked against the floor as any other |
|
||||
| `VK_KHR_portability_subset` | device, where listed | Vulkan requires it enabled where a device lists it; the device is asked for the portability features below |
|
||||
| `VK_EXT_attachment_feedback_loop_layout` | device, with the feedback loop | a draw's read of an attachment of its own pass through a texture, in the feedback layout, with the colour flag the reading draw's pipeline takes (Render encoders) |
|
||||
| `VK_EXT_attachment_feedback_loop_layout` | device, with the feedback loop | a draw's read of an attachment of its own pass through a texture, in the feedback layout, with the colour flag the pipelines of a state whose functions can read a texture take (Render encoders) |
|
||||
| `VK_KHR_vertex_attribute_divisor` | device, where listed | a vertex layout stepped per instance at a rate above 1, through the step-rate feature below |
|
||||
| `VK_EXT_vertex_attribute_divisor` | device, where listed | the same, on a device that lists only this extension, which the KHR was promoted from with the same feature and pipeline structures |
|
||||
| `VK_EXT_external_memory_host` | device, where listed | importing host memory by its address (`Device::import_host_memory`) |
|
||||
|
||||
@@ -129,10 +129,6 @@ pub(crate) enum FirstUse {
|
||||
/// A render content's pipeline for the depth clip mode `Clamp` or the triangle fill mode
|
||||
/// `Lines`, at its first draw under them ([`Metrics::first_use_raster_waits`]).
|
||||
Raster,
|
||||
/// A render content's pipeline with the attachment feedback loop's colour flag, at its first
|
||||
/// draw that reads an attachment of its pass through the loop
|
||||
/// ([`Metrics::first_use_loop_waits`]).
|
||||
Loop,
|
||||
/// A state's main pipeline, which its `finish_pipeline` makes, met by a dispatch or a draw
|
||||
/// before that make ended ([`Metrics::first_use_unfinished_waits`]).
|
||||
Unfinished,
|
||||
@@ -1974,12 +1970,11 @@ impl Counters {
|
||||
};
|
||||
let first_use =
|
||||
|site: FirstUse| (a.first_use_sites[site as usize].each_ref()).map(|n| n.load(Relaxed));
|
||||
let [variant, lines, points, raster, looped, unfinished] = [
|
||||
let [variant, lines, points, raster, unfinished] = [
|
||||
FirstUse::Variant,
|
||||
FirstUse::Lines,
|
||||
FirstUse::Points,
|
||||
FirstUse::Raster,
|
||||
FirstUse::Loop,
|
||||
FirstUse::Unfinished,
|
||||
]
|
||||
.map(first_use);
|
||||
@@ -2116,9 +2111,6 @@ impl Counters {
|
||||
first_use_raster_waits: raster[0],
|
||||
first_use_raster_wait_nanos: raster[1],
|
||||
first_use_raster_wait_max_nanos: raster[2],
|
||||
first_use_loop_waits: looped[0],
|
||||
first_use_loop_wait_nanos: looped[1],
|
||||
first_use_loop_wait_max_nanos: looped[2],
|
||||
first_use_unfinished_waits: unfinished[0],
|
||||
first_use_unfinished_wait_nanos: unfinished[1],
|
||||
first_use_unfinished_wait_max_nanos: unfinished[2],
|
||||
@@ -2777,16 +2769,6 @@ pub struct Metrics {
|
||||
/// The longest of the [`first_use_raster_waits`](Self::first_use_raster_waits), in
|
||||
/// nanoseconds; a maximum since the device was made.
|
||||
pub first_use_raster_wait_max_nanos: u64,
|
||||
/// Of the [`first_use_waits`](Self::first_use_waits), those for a render content's pipeline
|
||||
/// with the attachment feedback loop's colour flag
|
||||
/// (`VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`), made by its first draw that
|
||||
/// reads an attachment of its pass through the loop, under any raster state.
|
||||
pub first_use_loop_waits: u64,
|
||||
/// The nanoseconds of the [`first_use_loop_waits`](Self::first_use_loop_waits), in total.
|
||||
pub first_use_loop_wait_nanos: u64,
|
||||
/// The longest of the [`first_use_loop_waits`](Self::first_use_loop_waits), in nanoseconds;
|
||||
/// a maximum since the device was made.
|
||||
pub first_use_loop_wait_max_nanos: u64,
|
||||
/// Of the [`first_use_waits`](Self::first_use_waits), those for a state's main pipeline (the
|
||||
/// one its `finish_pipeline` makes:
|
||||
/// [`ComputePipelineState::finish_pipeline`](crate::ComputePipelineState::finish_pipeline),
|
||||
|
||||
@@ -272,7 +272,8 @@ pub(crate) struct Core {
|
||||
pub(crate) calibrated: ash::ext::calibrated_timestamps::Device,
|
||||
/// Device creation enabled the attachment feedback loop (`floor::Capabilities::feedback_loop`):
|
||||
/// a draw reads an attachment of its pass with the image in the feedback layout, through a
|
||||
/// pipeline that takes the loop's colour flag (`crate::render::Raster`'s `loops`).
|
||||
/// pipeline of a state whose functions can read a texture, which takes the loop's colour flag
|
||||
/// at the state's make (`crate::render::Draws::reads_textures`).
|
||||
pub(crate) feedback_loop: bool,
|
||||
/// `VK_EXT_device_fault`'s command, where device creation enabled it (where the device lists
|
||||
/// it): a lost device's fault report, read once, at its first loss (`crate::fault`).
|
||||
|
||||
@@ -1104,8 +1104,8 @@ pub struct Capabilities {
|
||||
pub attachment_reads: bool,
|
||||
/// The attachment reads hold, and so does the attachment-read feature, with
|
||||
/// [`ATTACHMENT_READ_EXTENSIONS`]: a draw reads an attachment through the attachment feedback
|
||||
/// loop, the feedback layout its image moves to and the colour flag the reading draw's
|
||||
/// pipeline takes.
|
||||
/// loop, the feedback layout its image moves to and the colour flag the pipelines of a state
|
||||
/// whose functions can read a texture take.
|
||||
pub feedback_loop: bool,
|
||||
/// The features device creation enables: every one the floor requires, each of the optional,
|
||||
/// step-rate, min-LOD, fill-mode, alpha-to-one, quad-control, pixel-interlock, linear-attachment
|
||||
|
||||
@@ -344,6 +344,19 @@ pub(crate) struct Draws {
|
||||
pub(crate) stencil_bit: Option<u32>,
|
||||
}
|
||||
|
||||
impl Draws {
|
||||
/// Whether a function of the content can read a texture, so that a draw may hand it an
|
||||
/// attachment of its pass to read other than as one: a texture slot a function reads, at any
|
||||
/// stage, a colour attachment the fragment function fetches (`fetched`), or a read beyond its
|
||||
/// slots (`reads_unbound`: an argument buffer's texture, a resource ID), which the structure
|
||||
/// cannot settle.
|
||||
pub(crate) fn reads_textures(&self) -> bool {
|
||||
(self.textures.iter()).any(|&(_, _, access)| access.reads())
|
||||
|| !self.fetched.is_empty()
|
||||
|| self.reads_unbound
|
||||
}
|
||||
}
|
||||
|
||||
/// The state Vulkan 1.3 lets a draw set, which every render `VkPipeline` takes as dynamic.
|
||||
const DYNAMIC: [vk::DynamicState; 17] = [
|
||||
vk::DynamicState::VIEWPORT_WITH_COUNT,
|
||||
@@ -373,13 +386,15 @@ pub(crate) struct RenderCompiled {
|
||||
stages: Vec<Module>,
|
||||
/// The fixed-function state every `VkPipeline` of the content takes.
|
||||
fixed: Fixed,
|
||||
/// Every `VkPipeline` of the content takes the attachment feedback loop's colour flag
|
||||
/// (`VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`): device creation enabled the
|
||||
/// loop (`Core::feedback_loop`) and the fragment function reads a colour attachment
|
||||
/// (`[[color(n)]]`, `Draws::fetched`), which each of its draws reads through the loop where
|
||||
/// the attachment's image takes it. Elsewhere only a pipeline made for a draw that reads an
|
||||
/// attachment through a texture takes it ([`Raster`]'s `loops`).
|
||||
fetch_loops: bool,
|
||||
/// The create flags every `VkPipeline` of the content takes: the attachment feedback loop's
|
||||
/// colour flag (`VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`) where device
|
||||
/// creation enabled the loop (`Core::feedback_loop`) and a function of the content can read a
|
||||
/// texture ([`Draws::reads_textures`]), none otherwise. A state is made before any draw binds
|
||||
/// its textures, and which texture a draw binds decides whether it reads an attachment of its
|
||||
/// pass, so every pipeline of a content that can read one takes it from its make, and no draw
|
||||
/// makes a pipeline for the loop; a draw that reads none is valid with it. A content that can
|
||||
/// read no texture never reads an attachment other than as one.
|
||||
pub(crate) flags: vk::PipelineCreateFlags,
|
||||
/// The content's main `VkPipeline`: the triangle class's, or a post-tessellation vertex
|
||||
/// function's patch class's, its only class, at the default [`Raster`].
|
||||
primary: Main,
|
||||
@@ -389,9 +404,9 @@ pub(crate) struct RenderCompiled {
|
||||
named: Option<(vk::PrimitiveTopology, Main)>,
|
||||
/// The content's other `VkPipeline`s, each by its class's list topology and its raster state,
|
||||
/// each made by the first draw that takes it: the line and the point class's at the default
|
||||
/// raster state where the descriptor names neither, and those under other raster states, the
|
||||
/// feedback loop's flag among them. At most 31: the triangle or patch class's fifteen other
|
||||
/// raster states, and eight of each other class.
|
||||
/// raster state where the descriptor names neither, and those under other raster states. At
|
||||
/// most 15: the triangle or patch class's seven other raster states, and four of each other
|
||||
/// class.
|
||||
later: Mutex<Vec<(vk::PrimitiveTopology, Raster, vk::Pipeline)>>,
|
||||
/// Whether a draw of points rasterizes them: the vertex function writes `[[point_size]]`, or
|
||||
/// the descriptor names the point class, under which Metal draws a point of a function that
|
||||
@@ -435,10 +450,8 @@ pub(crate) struct RenderCompiled {
|
||||
/// What the render encoder sets that a `VkPipeline` bakes: `setDepthClipMode:` and
|
||||
/// `setTriangleFillMode:`, in `VkPipelineRasterizationStateCreateInfo`, which only
|
||||
/// `VK_EXT_extended_dynamic_state3` makes dynamic, and the floor does not require it, and whether
|
||||
/// its pass sets sample positions, which only a pipeline made with `sampleLocationsEnable` takes,
|
||||
/// and whether the draw reads an attachment of its pass through the attachment feedback loop,
|
||||
/// which only a pipeline made with the loop's colour flag may. The default is Metal's, `Clip` and
|
||||
/// `Fill`, at the default positions, reading no attachment.
|
||||
/// its pass sets sample positions, which only a pipeline made with `sampleLocationsEnable` takes.
|
||||
/// The default is Metal's, `Clip` and `Fill`, at the default positions.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
pub(crate) struct Raster {
|
||||
/// `MTLDepthClipModeClamp`: `depthClampEnable`.
|
||||
@@ -450,13 +463,6 @@ pub(crate) struct Raster {
|
||||
/// its dynamic state (`VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT`), which the encoder records
|
||||
/// before the pass's first draw.
|
||||
pub(crate) positions: bool,
|
||||
/// The draw reads an attachment of its pass through the attachment feedback loop, or may
|
||||
/// (`crate::render_encoder`): the pipeline is made with the loop's colour flag,
|
||||
/// `VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`, which Vulkan asks of a draw
|
||||
/// that reads an attachment in the feedback layout other than as an attachment (vkspec
|
||||
/// "Non-Overlapping Access Between Resources"). A content whose every pipeline takes the flag
|
||||
/// ([`RenderCompiled`]'s `fetch_loops`) takes it with or without this.
|
||||
pub(crate) loops: bool,
|
||||
}
|
||||
|
||||
/// One of a content's main `VkPipeline`s ([`RenderCompiled::primary`],
|
||||
@@ -1539,7 +1545,10 @@ impl RenderCompiled {
|
||||
core: Arc::clone(core),
|
||||
stages,
|
||||
fixed: Fixed::of(&pipeline),
|
||||
fetch_loops: core.feedback_loop && !draws.fetched.is_empty(),
|
||||
flags: match core.feedback_loop && draws.reads_textures() {
|
||||
true => vk::PipelineCreateFlags::COLOR_ATTACHMENT_FEEDBACK_LOOP_EXT,
|
||||
false => vk::PipelineCreateFlags::empty(),
|
||||
},
|
||||
primary: Main::default(),
|
||||
named: named.map(|list| (list, Main::default())),
|
||||
later: Mutex::new(Vec::new()),
|
||||
@@ -1640,7 +1649,6 @@ impl RenderCompiled {
|
||||
clamp: raster.clamp,
|
||||
lines: raster.lines && polygons,
|
||||
positions: raster.positions,
|
||||
loops: raster.loops && !self.fetch_loops,
|
||||
};
|
||||
let counters = &self.core.counters;
|
||||
if polygons && raster == Raster::default() {
|
||||
@@ -1659,7 +1667,6 @@ impl RenderCompiled {
|
||||
let made = self.make(class, raster)?;
|
||||
later.push((class, raster, made));
|
||||
let site = match (class, raster == Raster::default()) {
|
||||
_ if raster.loops => FirstUse::Loop,
|
||||
(T::LINE_LIST, true) => FirstUse::Lines,
|
||||
(T::POINT_LIST, true) => FirstUse::Points,
|
||||
_ => FirstUse::Raster,
|
||||
@@ -1673,22 +1680,10 @@ impl RenderCompiled {
|
||||
#[cfg(all(test, any(m2v_gpu, m2v_cpu_icd)))]
|
||||
pub(crate) fn made_flags(&self) -> Vec<vk::PipelineCreateFlags> {
|
||||
let named = (self.named.as_ref()).and_then(|(_, named)| named.get());
|
||||
let mains = usize::from(self.primary.get().is_some()) + usize::from(named.is_some());
|
||||
let main = self.flags(Raster::default());
|
||||
let later = lock(&self.later);
|
||||
let later = later.iter().map(|&(_, raster, _)| self.flags(raster));
|
||||
std::iter::repeat_n(main, mains).chain(later).collect()
|
||||
}
|
||||
|
||||
/// The create flags of the content's `VkPipeline` under `raster`: the attachment feedback
|
||||
/// loop's colour flag where every pipeline of the content takes it (`fetch_loops`) or the
|
||||
/// draws it is made for read an attachment through the loop ([`Raster`]'s `loops`), none
|
||||
/// otherwise.
|
||||
fn flags(&self, raster: Raster) -> vk::PipelineCreateFlags {
|
||||
match self.fetch_loops || raster.loops {
|
||||
true => vk::PipelineCreateFlags::COLOR_ATTACHMENT_FEEDBACK_LOOP_EXT,
|
||||
false => vk::PipelineCreateFlags::empty(),
|
||||
}
|
||||
let made = usize::from(self.primary.get().is_some())
|
||||
+ usize::from(named.is_some())
|
||||
+ lock(&self.later).len();
|
||||
vec![self.flags; made]
|
||||
}
|
||||
|
||||
/// Whether the content's `VkPipeline`s render into `pass`'s attachments: its colour formats are
|
||||
@@ -1864,7 +1859,7 @@ impl RenderCompiled {
|
||||
.depth_attachment_format(fixed.depth)
|
||||
.stencil_attachment_format(fixed.stencil);
|
||||
let mut info = vk::GraphicsPipelineCreateInfo::default()
|
||||
.flags(self.flags(raster))
|
||||
.flags(self.flags)
|
||||
.push_next(&mut rendering)
|
||||
.stages(&stages)
|
||||
.vertex_input_state(&vertex_input)
|
||||
|
||||
@@ -34,11 +34,13 @@
|
||||
//! attachment layout, the rest from home), and the rendering begins again with the attachment in
|
||||
//! that layout; the pass's second barrier moves the whole image home. While it is there, every
|
||||
//! draw of the pass reads the image's textures through their elements in that layout
|
||||
//! (`crate::arrays`). A draw that reads an attachment through the loop draws with a pipeline made
|
||||
//! with the loop's colour flag (`VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`),
|
||||
//! which its content makes at the first such draw where its main pipelines lack it (`Raster`'s
|
||||
//! `loops`, counted in `Metrics::first_use_loop_waits`); a draw that reads none draws with one
|
||||
//! made without it, the attachment in the feedback layout or not, and needs nothing set.
|
||||
//! (`crate::arrays`). Every render pipeline of a state whose functions can read a texture is made
|
||||
//! with the feedback loop's colour flag
|
||||
//! (`VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT`) at the state's make
|
||||
//! (`crate::render::Draws::reads_textures`), so any draw that may read an attachment in the
|
||||
//! feedback layout can, and no draw makes a pipeline for the loop; a state whose functions read
|
||||
//! none reads no attachment other than as one, and its pipelines take no flag. A draw that reads
|
||||
//! none needs nothing set.
|
||||
//!
|
||||
//! What such a draw reads that an earlier draw of the pass rendered, Metal orders by a memory
|
||||
//! barrier between the two. A memory barrier after draws that wrote no memory, where the pass
|
||||
@@ -2974,22 +2976,7 @@ impl RenderCommandEncoder {
|
||||
};
|
||||
// Points Metal does not rasterize: the vertex function runs, behind an empty scissor.
|
||||
let hidden = topology == vk::PrimitiveTopology::POINT_LIST && !compiled.rasterizes_points();
|
||||
// The pipeline takes the attachment feedback loop's colour flag where the draw reads an
|
||||
// attachment of its pass through the loop: through a texture it binds or a colour it
|
||||
// fetches, or beyond its slots while a read declaration covers an attachment the pass
|
||||
// holds out of its home layout (`Metrics::unslotted_attachment_reads`). An execution's
|
||||
// commands bind their own slots, so an execution takes it wherever the device has the
|
||||
// loop, as its part does ([`execution_part`](Self::execution_part)).
|
||||
let executes = matches!(call, Call::Commands { .. });
|
||||
let loops = self.core.feedback_loop
|
||||
&& (executes
|
||||
|| reads.as_ref().is_some_and(|reads| reads.reads)
|
||||
|| (self.declared.held && draws.reads_unbound));
|
||||
let raster = Raster {
|
||||
loops,
|
||||
..self.raster
|
||||
};
|
||||
let pipeline = compiled.pipeline(topology, raster)?;
|
||||
let pipeline = compiled.pipeline(topology, self.raster)?;
|
||||
let discards = compiled.discards();
|
||||
let writes_memory = draws.writes_memory;
|
||||
let building = (self.building.as_ref())
|
||||
@@ -3006,7 +2993,7 @@ impl RenderCommandEncoder {
|
||||
};
|
||||
let shape = (indirect).shape(
|
||||
&self.core,
|
||||
(compiled, raster, pipeline),
|
||||
(compiled, self.raster, pipeline),
|
||||
buffer.layout(),
|
||||
buffer.size(),
|
||||
)?;
|
||||
@@ -3487,14 +3474,8 @@ impl RenderCommandEncoder {
|
||||
}));
|
||||
};
|
||||
let (topology, _) = primitives(PrimitiveType::Triangle);
|
||||
// An execution's pipeline takes the attachment feedback loop's colour flag wherever the
|
||||
// device has the loop, as its draw's does ([`draw`](Self::draw)).
|
||||
let raster = Raster {
|
||||
loops: self.core.feedback_loop,
|
||||
..self.raster
|
||||
};
|
||||
let pipeline = compiled.pipeline(topology, raster)?;
|
||||
let made = (&**compiled, raster, pipeline);
|
||||
let pipeline = compiled.pipeline(topology, self.raster)?;
|
||||
let made = (&**compiled, self.raster, pipeline);
|
||||
let shape = indirect.shape(&self.core, made, buffer.layout(), buffer.size())?;
|
||||
Ok(shape.part)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ fn each_first_use_wait_adds_to_its_site_and_the_total() {
|
||||
counters.first_use_wait(FirstUse::Lines, 11_000);
|
||||
counters.first_use_wait(FirstUse::Points, 5_000);
|
||||
counters.first_use_wait(FirstUse::Raster, 13_000);
|
||||
counters.first_use_wait(FirstUse::Loop, 17_000);
|
||||
let m = counters.metrics();
|
||||
assert_eq!(
|
||||
(
|
||||
@@ -48,21 +47,13 @@ fn each_first_use_wait_adds_to_its_site_and_the_total() {
|
||||
),
|
||||
(1, 13_000, 13_000)
|
||||
);
|
||||
assert_eq!(
|
||||
(
|
||||
m.first_use_loop_waits,
|
||||
m.first_use_loop_wait_nanos,
|
||||
m.first_use_loop_wait_max_nanos
|
||||
),
|
||||
(1, 17_000, 17_000)
|
||||
);
|
||||
assert_eq!(
|
||||
(
|
||||
m.first_use_waits,
|
||||
m.first_use_wait_nanos,
|
||||
m.first_use_wait_max_nanos
|
||||
),
|
||||
(6, 56_000, 17_000)
|
||||
(5, 39_000, 13_000)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3326,11 +3326,6 @@ impl Backend for NewRuntime {
|
||||
"first_use_variant_wait_nanos",
|
||||
metrics.first_use_variant_wait_nanos,
|
||||
),
|
||||
("first_use_loop_waits", metrics.first_use_loop_waits),
|
||||
(
|
||||
"first_use_loop_wait_nanos",
|
||||
metrics.first_use_loop_wait_nanos,
|
||||
),
|
||||
("made_ahead_variants", metrics.made_ahead_variants),
|
||||
("made_ahead_variant_nanos", metrics.made_ahead_variant_nanos),
|
||||
("translations_at_encode", metrics.translations_at_encode),
|
||||
|
||||
@@ -1456,9 +1456,6 @@ field metal2vulkan-runtime::Metrics.finished_pipelines pub finished_pipelines: u
|
||||
field metal2vulkan-runtime::Metrics.first_use_line_wait_max_nanos pub first_use_line_wait_max_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_line_wait_nanos pub first_use_line_wait_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_line_waits pub first_use_line_waits: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_loop_wait_max_nanos pub first_use_loop_wait_max_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_loop_wait_nanos pub first_use_loop_wait_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_loop_waits pub first_use_loop_waits: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_point_wait_max_nanos pub first_use_point_wait_max_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_point_wait_nanos pub first_use_point_wait_nanos: u64
|
||||
field metal2vulkan-runtime::Metrics.first_use_point_waits pub first_use_point_waits: u64
|
||||
|
||||
|
Can't render this file because it is too large.
|
Reference in new issue
Block a user