pvr: Use vk_sampler base
Signed-off-by: Matt Coster <matt.coster@imgtec.com> Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25270>
This commit is contained in:
@@ -1132,10 +1132,10 @@ void pvr_border_color_table_finish(struct pvr_border_color_table *const table,
|
||||
|
||||
VkResult pvr_border_color_table_get_or_create_entry(
|
||||
UNUSED struct pvr_border_color_table *const table,
|
||||
const struct VkSamplerCreateInfo *const sampler_create_info,
|
||||
const struct pvr_sampler *const sampler,
|
||||
uint32_t *const index_out)
|
||||
{
|
||||
const VkBorderColor vk_type = sampler_create_info->borderColor;
|
||||
const VkBorderColor vk_type = sampler->vk.border_color;
|
||||
|
||||
if (vk_type <= PVR_BORDER_COLOR_TABLE_NR_BUILTIN_ENTRIES) {
|
||||
*index_out = vk_type;
|
||||
@@ -1143,5 +1143,5 @@ VkResult pvr_border_color_table_get_or_create_entry(
|
||||
}
|
||||
|
||||
pvr_finishme("VK_EXT_custom_border_color is currently unsupported.");
|
||||
return vk_error(NULL, VK_ERROR_EXTENSION_NOT_PRESENT);
|
||||
return vk_error(sampler, VK_ERROR_EXTENSION_NOT_PRESENT);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
(PVR_BORDER_COLOR_TABLE_NR_ENTRIES - \
|
||||
PVR_BORDER_COLOR_TABLE_NR_BUILTIN_ENTRIES)
|
||||
|
||||
/* Forward declaration from "pvr_common.h" */
|
||||
struct pvr_sampler;
|
||||
|
||||
/* Forward declaration from "pvr_bo.h" */
|
||||
struct pvr_bo;
|
||||
|
||||
@@ -61,10 +64,10 @@ VkResult pvr_border_color_table_init(struct pvr_border_color_table *table,
|
||||
void pvr_border_color_table_finish(struct pvr_border_color_table *table,
|
||||
struct pvr_device *device);
|
||||
|
||||
VkResult pvr_border_color_table_get_or_create_entry(
|
||||
struct pvr_border_color_table *table,
|
||||
const struct VkSamplerCreateInfo *sampler_create_info,
|
||||
uint32_t *index_out);
|
||||
VkResult
|
||||
pvr_border_color_table_get_or_create_entry(struct pvr_border_color_table *table,
|
||||
const struct pvr_sampler *sampler,
|
||||
uint32_t *index_out);
|
||||
|
||||
static inline bool pvr_border_color_table_is_index_valid(
|
||||
const struct pvr_border_color_table *const table,
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "util/list.h"
|
||||
#include "util/macros.h"
|
||||
#include "vk_object.h"
|
||||
#include "vk_sampler.h"
|
||||
#include "vk_sync.h"
|
||||
|
||||
#define VK_VENDOR_ID_IMAGINATION 0x1010
|
||||
@@ -238,7 +239,7 @@ CHECK_STRUCT_FIELD_SIZE(pvr_combined_image_sampler_descriptor,
|
||||
#undef CHECK_STRUCT_FIELD_SIZE
|
||||
|
||||
struct pvr_sampler {
|
||||
struct vk_object_base base;
|
||||
struct vk_sampler vk;
|
||||
|
||||
union pvr_sampler_descriptor descriptor;
|
||||
};
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
#include "vk_alloc.h"
|
||||
#include "vk_log.h"
|
||||
#include "vk_object.h"
|
||||
#include "vk_sampler.h"
|
||||
#include "vk_util.h"
|
||||
|
||||
#define PVR_GLOBAL_FREE_LIST_INITIAL_SIZE (2U * 1024U * 1024U)
|
||||
@@ -3138,10 +3139,8 @@ VkResult pvr_CreateSampler(VkDevice _device,
|
||||
STATIC_ASSERT(sizeof(((union pvr_sampler_descriptor *)NULL)->data) ==
|
||||
sizeof(((union pvr_sampler_descriptor *)NULL)->words));
|
||||
|
||||
sampler = vk_object_alloc(&device->vk,
|
||||
pAllocator,
|
||||
sizeof(*sampler),
|
||||
VK_OBJECT_TYPE_SAMPLER);
|
||||
sampler =
|
||||
vk_sampler_create(&device->vk, pCreateInfo, pAllocator, sizeof(*sampler));
|
||||
if (!sampler) {
|
||||
result = vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
goto err_out;
|
||||
@@ -3152,7 +3151,7 @@ VkResult pvr_CreateSampler(VkDevice _device,
|
||||
|
||||
result =
|
||||
pvr_border_color_table_get_or_create_entry(&device->border_color_table,
|
||||
pCreateInfo,
|
||||
sampler,
|
||||
&border_color_table_index);
|
||||
if (result != VK_SUCCESS)
|
||||
goto err_free_sampler;
|
||||
@@ -3285,7 +3284,7 @@ void pvr_DestroySampler(VkDevice _device,
|
||||
if (!sampler)
|
||||
return;
|
||||
|
||||
vk_object_free(&device->vk, pAllocator, sampler);
|
||||
vk_sampler_destroy(&device->vk, pAllocator, &sampler->vk);
|
||||
}
|
||||
|
||||
void pvr_GetBufferMemoryRequirements2(
|
||||
|
||||
@@ -1503,7 +1503,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_descriptor_pool,
|
||||
VkDescriptorPool,
|
||||
VK_OBJECT_TYPE_DESCRIPTOR_POOL)
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_sampler,
|
||||
base,
|
||||
vk.base,
|
||||
VkSampler,
|
||||
VK_OBJECT_TYPE_SAMPLER)
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_pipeline_layout,
|
||||
|
||||
Reference in New Issue
Block a user