zink: add push constant value to indicate whether the current draw is indexed

due to semantic differences between gl and vk variables, this is going to be
necessary for gl_BaseVertex

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
This commit is contained in:
Mike Blumenkrantz 2020-08-19 17:58:22 -04:00 committed by Marge Bot
parent 59aae6db9f
commit bf4fac51ee
3 changed files with 17 additions and 7 deletions

View File

@ -707,9 +707,15 @@ zink_draw_vbo(struct pipe_context *pctx,
zink_bind_vertex_buffers(batch, ctx);
if (BITSET_TEST(ctx->gfx_stages[PIPE_SHADER_VERTEX]->nir->info.system_values_read, SYSTEM_VALUE_BASE_VERTEX)) {
unsigned draw_mode_is_indexed = dinfo->index_size > 0;
vkCmdPushConstants(batch->cmdbuf, gfx_program->layout, VK_SHADER_STAGE_VERTEX_BIT,
offsetof(struct zink_push_constant, draw_mode_is_indexed), sizeof(unsigned),
&draw_mode_is_indexed);
}
if (gfx_program->shaders[PIPE_SHADER_TESS_CTRL] && gfx_program->shaders[PIPE_SHADER_TESS_CTRL]->is_generated)
vkCmdPushConstants(batch->cmdbuf, gfx_program->layout, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT,
0, sizeof(float) * 6,
offsetof(struct zink_push_constant, default_inner_level), sizeof(float) * 6,
&ctx->tess_levels[0]);
zink_query_update_gs_states(ctx);

View File

@ -163,12 +163,15 @@ create_gfx_pipeline_layout(VkDevice dev, VkDescriptorSetLayout dsl)
plci.setLayoutCount = 1;
VkPushConstantRange pcr = {};
pcr.stageFlags = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
pcr.offset = 0;
pcr.size = sizeof(float) * 6;
plci.pushConstantRangeCount = 1;
plci.pPushConstantRanges = &pcr;
VkPushConstantRange pcr[2] = {};
pcr[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
pcr[0].offset = offsetof(struct zink_push_constant, draw_mode_is_indexed);
pcr[0].size = sizeof(unsigned);
pcr[1].stageFlags = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
pcr[1].offset = offsetof(struct zink_push_constant, default_inner_level);
pcr[1].size = sizeof(float) * 6;
plci.pushConstantRangeCount = 2;
plci.pPushConstantRanges = &pcr[0];
VkPipelineLayout layout;
if (vkCreatePipelineLayout(dev, &plci, NULL, &layout) != VK_SUCCESS) {

View File

@ -41,6 +41,7 @@ struct hash_table;
struct set;
struct zink_push_constant {
unsigned draw_mode_is_indexed;
float default_inner_level[2];
float default_outer_level[4];
};