anv: split sampler from anv_device.c

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30285>
This commit is contained in:
Lionel Landwerlin
2024-07-21 11:40:16 +03:00
committed by Marge Bot
parent 543c726781
commit f5af56528b
3 changed files with 50 additions and 44 deletions

View File

@@ -1893,50 +1893,6 @@ void anv_GetDeviceMemoryCommitment(
*pCommittedMemoryInBytes = 0;
}
VkResult anv_GetSamplerOpaqueCaptureDescriptorDataEXT(
VkDevice _device,
const VkSamplerCaptureDescriptorDataInfoEXT* pInfo,
void* pData)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_sampler, sampler, pInfo->sampler);
if (sampler->custom_border_color.alloc_size != 0) {
*((uint32_t *)pData) =
anv_state_reserved_array_pool_state_index(
&device->custom_border_colors,
sampler->custom_border_color);
} else {
*((uint32_t *)pData) = 0;
}
return VK_SUCCESS;
}
void anv_DestroySampler(
VkDevice _device,
VkSampler _sampler,
const VkAllocationCallbacks* pAllocator)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_sampler, sampler, _sampler);
if (!sampler)
return;
if (sampler->bindless_state.map) {
anv_state_pool_free(&device->dynamic_state_pool,
sampler->bindless_state);
}
if (sampler->custom_border_color.map) {
anv_state_reserved_array_pool_free(&device->custom_border_colors,
sampler->custom_border_color);
}
vk_sampler_destroy(&device->vk, pAllocator, &sampler->vk);
}
static inline clockid_t
anv_get_default_cpu_clock_id(void)
{

View File

@@ -0,0 +1,49 @@
/* Copyright © 2024 Intel Corporation
* SPDX-License-Identifier: MIT
*/
#include "anv_private.h"
VkResult anv_GetSamplerOpaqueCaptureDescriptorDataEXT(
VkDevice _device,
const VkSamplerCaptureDescriptorDataInfoEXT* pInfo,
void* pData)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_sampler, sampler, pInfo->sampler);
if (sampler->custom_border_color.alloc_size != 0) {
*((uint32_t *)pData) =
anv_state_reserved_array_pool_state_index(
&device->custom_border_colors,
sampler->custom_border_color);
} else {
*((uint32_t *)pData) = 0;
}
return VK_SUCCESS;
}
void anv_DestroySampler(
VkDevice _device,
VkSampler _sampler,
const VkAllocationCallbacks* pAllocator)
{
ANV_FROM_HANDLE(anv_device, device, _device);
ANV_FROM_HANDLE(anv_sampler, sampler, _sampler);
if (!sampler)
return;
if (sampler->bindless_state.map) {
anv_state_pool_free(&device->dynamic_state_pool,
sampler->bindless_state);
}
if (sampler->custom_border_color.map) {
anv_state_reserved_array_pool_free(&device->custom_border_colors,
sampler->custom_border_color);
}
vk_sampler_destroy(&device->vk, pAllocator, &sampler->vk);
}

View File

@@ -180,6 +180,7 @@ libanv_files = files(
'anv_queue.c',
'anv_rmv.c',
'anv_rmv.h',
'anv_sampler.c',
'anv_sparse.c',
'anv_util.c',
'anv_utrace.c',