mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
zink: Align descriptor buffers to descriptorBufferOffsetAlignment
Instead of aligning offsets, we just align the size every time we query it. This simplifies our offset and size calculations later since we can always just add up descriptor buffer sizes and know that we'll be okay. Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Fixes:7ab5c5d36d("zink: use EXT_descriptor_buffer with ZINK_DESCRIPTORS=db") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30580> (cherry picked from commit0f8f407e57)
This commit is contained in:
parent
4a0304c5ab
commit
23383aa41d
2 changed files with 6 additions and 5 deletions
|
|
@ -1864,7 +1864,7 @@
|
|||
"description": "zink: Align descriptor buffers to descriptorBufferOffsetAlignment",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "7ab5c5d36d2b988470ba85df9ebc7310b986147b",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ init_program_db(struct zink_screen *screen, struct zink_program *pg, enum zink_d
|
|||
{
|
||||
VkDeviceSize val;
|
||||
VKSCR(GetDescriptorSetLayoutSizeEXT)(screen->dev, dsl, &val);
|
||||
pg->dd.db_size[type] = val;
|
||||
pg->dd.db_size[type] = align64(val, screen->info.db_props.descriptorBufferOffsetAlignment);
|
||||
pg->dd.db_offset[type] = rzalloc_array(pg, uint32_t, num_bindings);
|
||||
for (unsigned i = 0; i < num_bindings; i++) {
|
||||
VKSCR(GetDescriptorSetLayoutBindingOffsetEXT)(screen->dev, dsl, bindings[i].binding, &val);
|
||||
|
|
@ -740,7 +740,7 @@ zink_descriptor_shader_init(struct zink_screen *screen, struct zink_shader *shad
|
|||
shader->precompile.num_bindings = num_bindings;
|
||||
VkDeviceSize val;
|
||||
VKSCR(GetDescriptorSetLayoutSizeEXT)(screen->dev, shader->precompile.dsl, &val);
|
||||
shader->precompile.db_size = val;
|
||||
shader->precompile.db_size = align64(val, screen->info.db_props.descriptorBufferOffsetAlignment);
|
||||
shader->precompile.db_offset = rzalloc_array(shader, uint32_t, num_bindings);
|
||||
for (unsigned i = 0; i < num_bindings; i++) {
|
||||
VKSCR(GetDescriptorSetLayoutBindingOffsetEXT)(screen->dev, shader->precompile.dsl, bindings[i].binding, &val);
|
||||
|
|
@ -1136,6 +1136,7 @@ update_separable(struct zink_context *ctx, struct zink_program *pg)
|
|||
}
|
||||
bs->dd.cur_db_offset[use_buffer] = bs->dd.db_offset;
|
||||
bs->dd.db_offset += zs->precompile.db_size;
|
||||
|
||||
/* TODO: maybe compile multiple variants for different set counts for compact mode? */
|
||||
int set_idx = screen->info.have_EXT_shader_object ? j : j == MESA_SHADER_FRAGMENT;
|
||||
VKCTX(CmdSetDescriptorBufferOffsetsEXT)(bs->cmdbuf, VK_PIPELINE_BIND_POINT_GRAPHICS, pg->layout, set_idx, 1, &use_buffer, &offset);
|
||||
|
|
@ -1642,7 +1643,7 @@ zink_descriptors_init(struct zink_context *ctx)
|
|||
VkDeviceSize val;
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
VKSCR(GetDescriptorSetLayoutSizeEXT)(screen->dev, ctx->dd.push_dsl[i]->layout, &val);
|
||||
ctx->dd.db_size[i] = val;
|
||||
ctx->dd.db_size[i] = align64(val, screen->info.db_props.descriptorBufferOffsetAlignment);
|
||||
}
|
||||
for (unsigned i = 0; i < ZINK_GFX_SHADER_COUNT; i++) {
|
||||
VKSCR(GetDescriptorSetLayoutBindingOffsetEXT)(screen->dev, ctx->dd.push_dsl[0]->layout, i, &val);
|
||||
|
|
@ -1718,7 +1719,7 @@ zink_descriptor_util_init_fbfetch(struct zink_context *ctx)
|
|||
if (zink_descriptor_mode == ZINK_DESCRIPTOR_MODE_DB) {
|
||||
VkDeviceSize val;
|
||||
VKSCR(GetDescriptorSetLayoutSizeEXT)(screen->dev, ctx->dd.push_dsl[0]->layout, &val);
|
||||
ctx->dd.db_size[0] = val;
|
||||
ctx->dd.db_size[0] = align64(val, screen->info.db_props.descriptorBufferOffsetAlignment);
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(ctx->dd.db_offset); i++) {
|
||||
VKSCR(GetDescriptorSetLayoutBindingOffsetEXT)(screen->dev, ctx->dd.push_dsl[0]->layout, i, &val);
|
||||
ctx->dd.db_offset[i] = val;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue