nvk: Add a stub implementation of VkBuffer

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
This commit is contained in:
Faith Ekstrand
2023-01-30 20:11:46 -06:00
committed by Marge Bot
parent bbe7f42e2a
commit 89d7ce0fda
3 changed files with 49 additions and 0 deletions

View File

@@ -1,4 +1,6 @@
nvk_files = files(
'nvk_buffer.c',
'nvk_buffer.h',
'nvk_device.c',
'nvk_device.h',
'nvk_image.c',

View File

@@ -0,0 +1,33 @@
#include "nvk_buffer.h"
#include "nvk_device.h"
VKAPI_ATTR VkResult VKAPI_CALL nvk_CreateBuffer(VkDevice _device,
const VkBufferCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkBuffer *pBuffer)
{
VK_FROM_HANDLE(nvk_device, device, _device);
struct nvk_buffer *buffer;
buffer = vk_buffer_create(&device->vk, pCreateInfo, pAllocator, sizeof(*buffer));
if (!buffer)
return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
*pBuffer = nvk_buffer_to_handle(buffer);
return VK_SUCCESS;
}
VKAPI_ATTR void VKAPI_CALL nvk_DestroyBuffer(VkDevice _device,
VkBuffer _buffer,
const VkAllocationCallbacks *pAllocator)
{
VK_FROM_HANDLE(nvk_device, device, _device);
VK_FROM_HANDLE(nvk_buffer, buffer, _buffer);
if (!buffer)
return;
vk_buffer_destroy(&device->vk, pAllocator, &buffer->vk);
}

View File

@@ -0,0 +1,14 @@
#ifndef NVK_IMAGE
#define NVK_IMAGE 1
#include "nvk_private.h"
#include "vulkan/runtime/vk_buffer.h"
struct nvk_buffer {
struct vk_buffer vk;
};
VK_DEFINE_HANDLE_CASTS(nvk_buffer, vk.base, VkBuffer, VK_OBJECT_TYPE_BUFFER)
#endif