diff options
author | Brian Ho <[email protected]> | 2020-05-15 10:52:43 -0700 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-06-22 14:35:45 +0000 |
commit | f08a80dcd493c64922c04a2563025bddabcac230 (patch) | |
tree | 13b3e71e8696801445da81f83f210897a5173dd7 /src/freedreno/vulkan/tu_private.h | |
parent | eefdca2e2f5a558e02102c1f6e1736b61acc67b2 (diff) |
turnip: Allocate tess BOs as a function of draw size
To store tess outputs, the HS stg's into two buffers, one for
per-vertex/per-patch output variables (tess_param) and one for
TessLevelInner/Outer (tess_factor). The addresses of these buffers
are uploaded as consts to the HS/DS and the tess_factor iova is
written to REG_A6XX_PC_TESSFACTOR_ADDR. While the sizes of these
buffers are a function of vetex count and patch count, allocation is
relatively straightforward on freedreno- just keep track of the max
required buffer size for the entire batch and allocate before batch
submit.
In Vulkan, however, a given pipeline can be bound multiple times
across any number of command buffers, each drawing with a different
number of vertices. One solution is to track the max buffer size for
the entire command buffer (similar to fd_batch) and on
vkEndCommandBuffer, allocate appropriately sized tess BOs. Since the
tess BOs addresses are emitted as part of the pipeline state setup
(e.g. PKT4 to REG_A6XX_PC_TESSFACTOR_ADDR), we need to create a new
state group independent of a specific pipeline and parameterize its
IB with the command buffer specific tess BO iovas.
Without a larger refactor, the simplest way to do this is just to
emit per-draw call consts and leverage scratch_bo to re-use buffers.
This way we won't have to store and rewrite earlier packets in the
command stream on vkEndCommandBuffer.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5059>
Diffstat (limited to 'src/freedreno/vulkan/tu_private.h')
-rw-r--r-- | src/freedreno/vulkan/tu_private.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h index 39f303ee7d7..153184f5999 100644 --- a/src/freedreno/vulkan/tu_private.h +++ b/src/freedreno/vulkan/tu_private.h @@ -427,6 +427,7 @@ enum tu_draw_state_group_id { TU_DRAW_STATE_PROGRAM, TU_DRAW_STATE_PROGRAM_BINNING, + TU_DRAW_STATE_TESS, TU_DRAW_STATE_VB, TU_DRAW_STATE_VI, TU_DRAW_STATE_VI_BINNING, @@ -1102,6 +1103,15 @@ struct tu_pipeline struct { + uint32_t patch_type; + uint32_t per_vertex_output_size; + uint32_t per_patch_output_size; + uint32_t hs_bo_regid; + uint32_t ds_bo_regid; + } tess; + + struct + { struct tu_cs_entry state_ib; } rast; |