From bbe7f42e2a049a18070b70ac565a0ed83077b931 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 30 Jan 2023 20:11:46 -0600 Subject: [PATCH] nvk: Add stub implementation of VkSampler Part-of: --- src/nouveau/vulkan/meson.build | 2 ++ src/nouveau/vulkan/nvk_sampler.c | 33 +++++++++++++++++++++++++++++++++ src/nouveau/vulkan/nvk_sampler.h | 14 ++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/nouveau/vulkan/nvk_sampler.c create mode 100644 src/nouveau/vulkan/nvk_sampler.h diff --git a/src/nouveau/vulkan/meson.build b/src/nouveau/vulkan/meson.build index edbd971..eda127a 100644 --- a/src/nouveau/vulkan/meson.build +++ b/src/nouveau/vulkan/meson.build @@ -10,6 +10,8 @@ nvk_files = files( 'nvk_physical_device.c', 'nvk_physical_device.h', 'nvk_private.h', + 'nvk_sampler.c', + 'nvk_sampler.h', ) nouveau_icd = custom_target( diff --git a/src/nouveau/vulkan/nvk_sampler.c b/src/nouveau/vulkan/nvk_sampler.c new file mode 100644 index 0000000..affb61e --- /dev/null +++ b/src/nouveau/vulkan/nvk_sampler.c @@ -0,0 +1,33 @@ +#include "nvk_sampler.h" + +#include "nvk_device.h" + +VKAPI_ATTR VkResult VKAPI_CALL nvk_CreateSampler(VkDevice _device, + const VkSamplerCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSampler *pSampler) +{ + VK_FROM_HANDLE(nvk_device, device, _device); + struct nvk_sampler *sampler; + + sampler = vk_object_zalloc(&device->vk, pAllocator, sizeof(*sampler), VK_OBJECT_TYPE_SAMPLER); + if (!sampler) + return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); + + *pSampler = nvk_sampler_to_handle(sampler); + + return VK_SUCCESS; +} + +VKAPI_ATTR void VKAPI_CALL nvk_DestroySampler(VkDevice _device, + VkSampler _sampler, + const VkAllocationCallbacks *pAllocator) +{ + VK_FROM_HANDLE(nvk_device, device, _device); + VK_FROM_HANDLE(nvk_sampler, sampler, _sampler); + + if (!sampler) + return; + + vk_object_free(&device->vk, pAllocator, sampler); +} diff --git a/src/nouveau/vulkan/nvk_sampler.h b/src/nouveau/vulkan/nvk_sampler.h new file mode 100644 index 0000000..3e990e5 --- /dev/null +++ b/src/nouveau/vulkan/nvk_sampler.h @@ -0,0 +1,14 @@ +#ifndef NVK_SAMPLER +#define NVK_SAMPLER 1 + +#include "nvk_private.h" + +#include "vulkan/runtime/vk_object.h" + +struct nvk_sampler { + struct vk_object_base base; +}; + +VK_DEFINE_HANDLE_CASTS(nvk_sampler, base, VkSampler, VK_OBJECT_TYPE_SAMPLER) + +#endif -- 2.7.4