mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-23 15:30:09 +00:00
zink: use dynamic prim type
this is part of dynamic state but wasn't used since it required actual work to effectively make use of it Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
This commit is contained in:
parent
3674839d11
commit
305966ca75
@ -677,8 +677,11 @@ zink_draw_vbo(struct pipe_context *pctx,
|
||||
zink_select_draw_vbo(ctx);
|
||||
}
|
||||
|
||||
if (HAS_DYNAMIC_STATE)
|
||||
if (HAS_DYNAMIC_STATE) {
|
||||
update_gfx_pipeline<BATCH_CHANGED>(ctx, batch->state, mode);
|
||||
if (BATCH_CHANGED || mode_changed)
|
||||
screen->vk.CmdSetPrimitiveTopologyEXT(batch->state->cmdbuf, zink_primitive_topology(mode));
|
||||
}
|
||||
|
||||
if (zink_program_has_descriptors(&ctx->curr_program->base))
|
||||
screen->descriptors_update(ctx, false);
|
||||
|
@ -185,6 +185,7 @@ zink_create_gfx_pipeline(struct zink_screen *screen,
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT;
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT;
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_FRONT_FACE_EXT;
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT;
|
||||
if (state->sample_locations_enabled)
|
||||
dynamicStateEnables[state_count++] = VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT;
|
||||
} else {
|
||||
|
@ -715,48 +715,6 @@ zink_destroy_compute_program(struct zink_screen *screen,
|
||||
ralloc_free(comp);
|
||||
}
|
||||
|
||||
static VkPrimitiveTopology
|
||||
primitive_topology(enum pipe_prim_type mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
|
||||
|
||||
case PIPE_PRIM_LINES:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
|
||||
case PIPE_PRIM_LINE_STRIP:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||
|
||||
case PIPE_PRIM_TRIANGLES:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_STRIP:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_FAN:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
|
||||
|
||||
case PIPE_PRIM_LINE_STRIP_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_LINES_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_TRIANGLES_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_PATCHES:
|
||||
return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST;
|
||||
|
||||
default:
|
||||
unreachable("unexpected enum pipe_prim_type");
|
||||
}
|
||||
}
|
||||
|
||||
VkPipeline
|
||||
zink_get_gfx_pipeline(struct zink_context *ctx,
|
||||
struct zink_gfx_program *prog,
|
||||
@ -769,7 +727,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
|
||||
(have_EXT_vertex_input_dynamic_state || !ctx->vertex_state_changed))
|
||||
return state->pipeline;
|
||||
|
||||
VkPrimitiveTopology vkmode = primitive_topology(mode);
|
||||
VkPrimitiveTopology vkmode = zink_primitive_topology(mode);
|
||||
assert(vkmode <= ARRAY_SIZE(prog->pipelines));
|
||||
|
||||
struct hash_entry *entry = NULL;
|
||||
|
@ -135,6 +135,48 @@ zink_desc_type_from_vktype(VkDescriptorType type)
|
||||
}
|
||||
}
|
||||
|
||||
static inline VkPrimitiveTopology
|
||||
zink_primitive_topology(enum pipe_prim_type mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case PIPE_PRIM_POINTS:
|
||||
return VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
|
||||
|
||||
case PIPE_PRIM_LINES:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST;
|
||||
|
||||
case PIPE_PRIM_LINE_STRIP:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP;
|
||||
|
||||
case PIPE_PRIM_TRIANGLES:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_STRIP:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_FAN:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN;
|
||||
|
||||
case PIPE_PRIM_LINE_STRIP_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_LINES_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_TRIANGLES_ADJACENCY:
|
||||
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY;
|
||||
|
||||
case PIPE_PRIM_PATCHES:
|
||||
return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST;
|
||||
|
||||
default:
|
||||
unreachable("unexpected enum pipe_prim_type");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
zink_delete_shader_state(struct pipe_context *pctx, void *cso);
|
||||
void *
|
||||
|
Loading…
Reference in New Issue
Block a user