mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
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:
parent
59aae6db9f
commit
bf4fac51ee
3 changed files with 17 additions and 7 deletions
|
|
@ -707,9 +707,15 @@ zink_draw_vbo(struct pipe_context *pctx,
|
||||||
|
|
||||||
zink_bind_vertex_buffers(batch, ctx);
|
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)
|
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,
|
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]);
|
&ctx->tess_levels[0]);
|
||||||
|
|
||||||
zink_query_update_gs_states(ctx);
|
zink_query_update_gs_states(ctx);
|
||||||
|
|
|
||||||
|
|
@ -163,12 +163,15 @@ create_gfx_pipeline_layout(VkDevice dev, VkDescriptorSetLayout dsl)
|
||||||
plci.setLayoutCount = 1;
|
plci.setLayoutCount = 1;
|
||||||
|
|
||||||
|
|
||||||
VkPushConstantRange pcr = {};
|
VkPushConstantRange pcr[2] = {};
|
||||||
pcr.stageFlags = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
|
pcr[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
|
||||||
pcr.offset = 0;
|
pcr[0].offset = offsetof(struct zink_push_constant, draw_mode_is_indexed);
|
||||||
pcr.size = sizeof(float) * 6;
|
pcr[0].size = sizeof(unsigned);
|
||||||
plci.pushConstantRangeCount = 1;
|
pcr[1].stageFlags = VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT;
|
||||||
plci.pPushConstantRanges = &pcr;
|
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;
|
VkPipelineLayout layout;
|
||||||
if (vkCreatePipelineLayout(dev, &plci, NULL, &layout) != VK_SUCCESS) {
|
if (vkCreatePipelineLayout(dev, &plci, NULL, &layout) != VK_SUCCESS) {
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ struct hash_table;
|
||||||
struct set;
|
struct set;
|
||||||
|
|
||||||
struct zink_push_constant {
|
struct zink_push_constant {
|
||||||
|
unsigned draw_mode_is_indexed;
|
||||||
float default_inner_level[2];
|
float default_inner_level[2];
|
||||||
float default_outer_level[4];
|
float default_outer_level[4];
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue