mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 02:10:12 +01:00
zink: store bufferview hash to bufferview struct
this lets us do a lot of things more precisely for bufferviews Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>
This commit is contained in:
parent
5acbba4e41
commit
473ee28cf3
2 changed files with 10 additions and 0 deletions
|
|
@ -558,6 +558,13 @@ sampler_aspect_from_format(enum pipe_format fmt)
|
|||
return VK_IMAGE_ASPECT_COLOR_BIT;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
hash_bufferview(void *bvci)
|
||||
{
|
||||
size_t offset = offsetof(VkBufferViewCreateInfo, flags);
|
||||
return _mesa_hash_data((char*)bvci + offset, sizeof(VkBufferViewCreateInfo) - offset);
|
||||
}
|
||||
|
||||
static struct zink_buffer_view *
|
||||
get_buffer_view(struct zink_context *ctx, struct zink_resource *res, enum pipe_format format, uint32_t offset, uint32_t range)
|
||||
{
|
||||
|
|
@ -571,6 +578,7 @@ get_buffer_view(struct zink_context *ctx, struct zink_resource *res, enum pipe_f
|
|||
bvci.offset = offset;
|
||||
bvci.range = range;
|
||||
|
||||
uint32_t hash = hash_bufferview(&bvci);
|
||||
VkBufferView view;
|
||||
if (vkCreateBufferView(screen->dev, &bvci, NULL, &view) != VK_SUCCESS)
|
||||
return NULL;
|
||||
|
|
@ -581,6 +589,7 @@ get_buffer_view(struct zink_context *ctx, struct zink_resource *res, enum pipe_f
|
|||
}
|
||||
pipe_reference_init(&buffer_view->reference, 1);
|
||||
buffer_view->buffer_view = view;
|
||||
buffer_view->hash = hash;
|
||||
return buffer_view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ struct zink_sampler_state {
|
|||
struct zink_buffer_view {
|
||||
struct pipe_reference reference;
|
||||
VkBufferView buffer_view;
|
||||
uint32_t hash;
|
||||
};
|
||||
|
||||
struct zink_sampler_view {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue