turnip: Define structs for transform feedback
authorHyunjun Ko <zzoon@igalia.com>
Thu, 20 Feb 2020 05:54:35 +0000 (14:54 +0900)
committerMarge Bot <eric+marge@anholt.net>
Thu, 12 Mar 2020 03:10:16 +0000 (03:10 +0000)
Define new structures for streamout buffers and state.
Most members of the state struct are taken from freedreno driver.

v2. Use IR3_MAX_SO_* and avoid using magic values.

v3. Remove the state of stream-output in tu_cmd_state and use one in
tu_pipeline and split out reset and enabled fields.

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3942>

src/freedreno/vulkan/tu_private.h

index dd0107bb6f51ebc2fcc77a45c519d55d4f05d2bd..d04fe99aad1f2805986bcc2437a335d4b529aeb1 100644 (file)
@@ -841,6 +841,7 @@ enum tu_cmd_dirty_bits
    TU_CMD_DIRTY_VERTEX_BUFFERS = 1 << 2,
    TU_CMD_DIRTY_DESCRIPTOR_SETS = 1 << 3,
    TU_CMD_DIRTY_PUSH_CONSTANTS = 1 << 4,
+   TU_CMD_DIRTY_STREAMOUT_BUFFERS = 1 << 5,
 
    TU_CMD_DIRTY_DYNAMIC_LINE_WIDTH = 1 << 16,
    TU_CMD_DIRTY_DYNAMIC_STENCIL_COMPARE_MASK = 1 << 17,
@@ -848,6 +849,14 @@ enum tu_cmd_dirty_bits
    TU_CMD_DIRTY_DYNAMIC_STENCIL_REFERENCE = 1 << 19,
 };
 
+struct tu_streamout_state {
+   uint16_t stride[IR3_MAX_SO_BUFFERS];
+   uint32_t ncomp[IR3_MAX_SO_BUFFERS];
+   uint32_t prog[IR3_MAX_SO_OUTPUTS * 2];
+   uint32_t prog_count;
+   uint32_t vpc_so_buf_cntl;
+};
+
 struct tu_cmd_state
 {
    uint32_t dirty;
@@ -864,6 +873,17 @@ struct tu_cmd_state
 
    struct tu_dynamic_state dynamic;
 
+   /* Stream output buffers */
+   struct
+   {
+      struct tu_buffer *buffers[IR3_MAX_SO_BUFFERS];
+      VkDeviceSize offsets[IR3_MAX_SO_BUFFERS];
+      VkDeviceSize sizes[IR3_MAX_SO_BUFFERS];
+   } streamout_buf;
+
+   uint8_t streamout_reset;
+   uint8_t streamout_enabled;
+
    /* Index buffer */
    struct tu_buffer *index_buffer;
    uint64_t index_offset;
@@ -1152,6 +1172,8 @@ struct tu_pipeline
    bool need_indirect_descriptor_sets;
    VkShaderStageFlags active_stages;
 
+   struct tu_streamout_state streamout;
+
    struct
    {
       struct tu_bo binary_bo;