pvr: Use vk_buffer_view base

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31679>
This commit is contained in:
Matt Coster
2023-09-21 12:13:14 +01:00
committed by Marge Bot
parent 1dc37f650a
commit 13e85fa911
3 changed files with 14 additions and 19 deletions
+1 -1
View File
@@ -1683,7 +1683,7 @@ static void pvr_write_buffer_descriptor(const struct pvr_device_info *dev_info,
* compiler change to allow us to skip the range check.
*/
secondary[PVR_DESC_IMAGE_SECONDARY_OFFSET_WIDTH(dev_info)] =
(uint32_t)(bview->range / vk_format_get_blocksize(bview->format));
(uint32_t)(bview->vk.elements);
secondary[PVR_DESC_IMAGE_SECONDARY_OFFSET_HEIGHT(dev_info)] = 1;
}
}
+10 -13
View File
@@ -433,30 +433,27 @@ VkResult pvr_CreateBufferView(VkDevice _device,
struct pvr_buffer_view *bview;
VkResult result;
bview = vk_object_alloc(&device->vk,
pAllocator,
sizeof(*bview),
VK_OBJECT_TYPE_BUFFER_VIEW);
bview = vk_buffer_view_create(&device->vk,
pCreateInfo,
pAllocator,
sizeof(*bview));
if (!bview)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
bview->format = pCreateInfo->format;
bview->range =
vk_buffer_range(&buffer->vk, pCreateInfo->offset, pCreateInfo->range);
/* If the remaining size of the buffer is not a multiple of the element
* size of the format, the nearest smaller multiple is used.
*/
bview->range -= bview->range % vk_format_get_blocksize(bview->format);
bview->vk.range -=
bview->vk.range % vk_format_get_blocksize(bview->vk.format);
/* The range of the buffer view shouldn't be smaller than one texel. */
assert(bview->range >= vk_format_get_blocksize(bview->format));
assert(bview->vk.range >= vk_format_get_blocksize(bview->vk.format));
info.base_level = 0U;
info.mip_levels = 1U;
info.mipmaps_present = false;
info.extent.width = 8192U;
info.extent.height = bview->range / vk_format_get_blocksize(bview->format);
info.extent.height = bview->vk.elements;
info.extent.height = DIV_ROUND_UP(info.extent.height, info.extent.width);
info.extent.depth = 0U;
info.sample_count = 1U;
@@ -467,7 +464,7 @@ VkResult pvr_CreateBufferView(VkDevice _device,
info.is_cube = false;
info.type = VK_IMAGE_VIEW_TYPE_2D;
info.tex_state_type = PVR_TEXTURE_STATE_SAMPLE;
info.format = bview->format;
info.format = bview->vk.format;
info.flags = PVR_TEXFLAGS_INDEX_LOOKUP;
info.aspect_mask = VK_IMAGE_ASPECT_COLOR_BIT;
@@ -501,5 +498,5 @@ void pvr_DestroyBufferView(VkDevice _device,
if (!bview)
return;
vk_object_free(&device->vk, pAllocator, bview);
vk_buffer_view_destroy(&device->vk, pAllocator, &bview->vk);
}
+3 -5
View File
@@ -61,6 +61,7 @@
#include "util/u_dynarray.h"
#include "util/u_math.h"
#include "vk_buffer.h"
#include "vk_buffer_view.h"
#include "vk_command_buffer.h"
#include "vk_device.h"
#include "vk_enum_to_str.h"
@@ -344,10 +345,7 @@ struct pvr_image_view {
};
struct pvr_buffer_view {
struct vk_object_base base;
uint64_t range;
VkFormat format;
struct vk_buffer_view vk;
/* Prepacked Texture dword 0 and 1. It will be copied to the descriptor
* during pvr_UpdateDescriptorSets().
@@ -1485,7 +1483,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_image_view,
VkImageView,
VK_OBJECT_TYPE_IMAGE_VIEW)
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_buffer_view,
base,
vk.base,
VkBufferView,
VK_OBJECT_TYPE_BUFFER_VIEW)
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_descriptor_set_layout,