v3dv/pipeline: move topology to pipeline

So now we only store it once per pipeline, instead of once per
pipeline stage.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9403>
This commit is contained in:
Alejandro Piñeiro 2021-03-10 14:23:33 +01:00 committed by Marge Bot
parent dd72c99d77
commit ebb2297a91
3 changed files with 11 additions and 17 deletions

View File

@ -4134,7 +4134,7 @@ cmd_buffer_emit_draw(struct v3dv_cmd_buffer *cmd_buffer,
assert(pipeline);
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
if (info->first_instance > 0) {
v3dv_cl_ensure_space_with_branch(
@ -4404,7 +4404,7 @@ v3dv_CmdDrawIndexed(VkCommandBuffer commandBuffer,
assert(job);
const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
uint8_t index_type = ffs(cmd_buffer->state.index_buffer.index_size) - 1;
uint32_t index_offset = firstIndex * cmd_buffer->state.index_buffer.index_size;
@ -4467,7 +4467,7 @@ v3dv_CmdDrawIndirect(VkCommandBuffer commandBuffer,
assert(job);
const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
v3dv_cl_ensure_space_with_branch(
&job->bcl, cl_packet_length(INDIRECT_VERTEX_ARRAY_INSTANCED_PRIMS));
@ -4502,7 +4502,7 @@ v3dv_CmdDrawIndexedIndirect(VkCommandBuffer commandBuffer,
assert(job);
const struct v3dv_pipeline *pipeline = cmd_buffer->state.gfx.pipeline;
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->vs->topology);
uint32_t hw_prim_type = v3d_hw_prim_type(pipeline->topology);
uint8_t index_type = ffs(cmd_buffer->state.index_buffer.index_size) - 1;
v3dv_cl_ensure_space_with_branch(

View File

@ -1740,13 +1740,6 @@ pipeline_compile_vertex_shader(struct v3dv_pipeline *pipeline,
if (pipeline->vs_bin == NULL)
return VK_ERROR_OUT_OF_HOST_MEMORY;
/* FIXME: likely this to be moved to a gather info method to a full
* struct inside pipeline_stage
*/
const VkPipelineInputAssemblyStateCreateInfo *ia_info =
pCreateInfo->pInputAssemblyState;
pipeline->vs->topology = vk_to_pipe_prim_type[ia_info->topology];
struct v3d_vs_key *key = &pipeline->vs->key.vs;
pipeline_populate_v3d_vs_key(key, pCreateInfo, pipeline->vs);
VkResult vk_result;
@ -2449,7 +2442,7 @@ pack_shader_state_record(struct v3dv_pipeline *pipeline)
shader.enable_clipping = true;
shader.point_size_in_shaded_vertex_data =
pipeline->vs->topology == PIPE_PRIM_POINTS;
pipeline->topology == PIPE_PRIM_POINTS;
/* Must be set if the shader modifies Z, discards, or modifies
* the sample mask. For any of these cases, the fragment
@ -2749,6 +2742,10 @@ pipeline_init(struct v3dv_pipeline *pipeline,
pipeline->pass = render_pass;
pipeline->subpass = &render_pass->subpasses[pCreateInfo->subpass];
const VkPipelineInputAssemblyStateCreateInfo *ia_info =
pCreateInfo->pInputAssemblyState;
pipeline->topology = vk_to_pipe_prim_type[ia_info->topology];
/* If rasterization is not enabled, various CreateInfo structs must be
* ignored.
*/

View File

@ -1378,11 +1378,6 @@ struct v3dv_pipeline_stage {
} key;
struct v3dv_shader_variant*current_variant;
/* FIXME: only make sense on vs, so perhaps a v3dv key like radv? or a kind
* of pipe_draw_info
*/
enum pipe_prim_type topology;
};
/* FIXME: although the full vpm_config is not required at this point, as we
@ -1654,6 +1649,8 @@ struct v3dv_pipeline {
} va[MAX_VERTEX_ATTRIBS];
uint32_t va_count;
enum pipe_prim_type topology;
struct v3dv_descriptor_map ubo_map;
struct v3dv_descriptor_map ssbo_map;