KhronosGroup / KhronosGroup/Vulkan-Docs

Pipeline stages confusion

Open
#1,020 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.3k
Forks
549
Avg merge
5d 5h
Merged PRs (30d)
2

Description

`VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT` is specified thus:

> `VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT` specifies the execution of all graphics pipeline stages, and is equivalent to the logical OR of:
> - `VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT`
> - `VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT`
> - `VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV`
> - `VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV`
> - `VK_PIPELINE_STAGE_VERTEX_INPUT_BIT`
> - `VK_PIPELINE_STAGE_VERTEX_SHADER_BIT`
> - `VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT`
> - `VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT`
> - `VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT`
> - `VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT`
> - `VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT`
> - `VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT`
> - `VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT`
> - `VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT`
> - `VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT`
> - `VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT`
> - `VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV`
> - `VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT`

It includes "graphics pipeline", fragment density, conditional rendering, and "graphics mesh shading pipeline".

Meanwhile it does not include "command processing pipeline", "ray tracing shader pipeline", "ray tracing acceleration structure operations", although those related commands can operate inside a render pass instance.

Meanwhile `VK_NV_mesh_shader` extensions says:

> 6. Should VK_SHADER_STAGE_ALL_GRAPHICS be updated to include the new stages?
> RESOLVED: No. [...]

The author was probably thrown off because `VK_SHADER_STAGE_ALL_GRAPHICS` definition does say "is equivalent to the logical OR" (but that is meant only figuratively, and in reality it is a single unique bit).

Meanwhile `VK_PIPELINE_STAGE_ALL_COMMANDS_BIT` says:

> - `VK_PIPELINE_STAGE_ALL_COMMANDS_BIT` is equivalent to the logical OR of every other pipeline stage flag that is supported on the queue it is used with.

It is not clear what "supported on the queue it is used with" means, considering the stages are often used before the queue type is known (render pass creation time; the subpass dependencies).

Also it leads to silly situations, like `VK_PIPELINE_STAGE_ALL_COMMANDS_BIT` would be allowed in render passes, if the queue family happens to be Graphics-only, but not if the queue can do Compute too.

Meanwhile subpass self-dependencies introduce that `srcStages` must be logically earlier than `dstStages`, which does not make clear how `VK_PIPELINE_STAGE_ALL_COMMANDS_BIT` and `VK_SHADER_STAGE_ALL_GRAPHICS_BIT` behave there (and if they are even valid). Conceivably the `ALL` flags may mean "all valid flags in a given context" (given that definition of `ALL_GRAPHICS_BIT` include flags that, if taken literally, would make it invalid everywhere if extensions are off). But if valid it is not clear what e.g. `srcStage = ALL_GRAPHICS_BIT, dstStage = ALL_GRAPHICS_BIT` would mean in self-dependency.

Meanwhile what I said above about `VK_SHADER_STAGE_ALL_GRAPHICS_BIT` that it includes flags that would make its use invalid everywhere in an app with extensions disabled.

Meanwhile subpass implicit dependency is defined thus:
```
VkSubpassDependency implicitDependency = {
.srcSubpass = VK_SUBPASS_EXTERNAL;
.dstSubpass = firstSubpass; // First subpass attachment is used in
.srcStageMask = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
.dstStageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
[...]
};
```

which looks like that `VK_PIPELINE_STAGE_ALL_COMMANDS_BIT` is allowed inside a Render Pass??

Meanwhile some of the stages (e.g. `VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT`) are not specified with logical-order relation to `VK_PIPELINE_STAGE_*_OF_PIPE_BIT`.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the quoted definitions for VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_SHADER_STAGE_ALL_GRAPHICS, and the implicit subpass dependency, along with the VK_NV_mesh_shader extension text. Done means resolving the semantics of ALL flags, queue support, subpass self-dependencies, and ordering, then clarifying the specification.

Written by the indexing model from the issue text.

Assessment

Domain
computer-graphics, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.