mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
anv: Add initial support for texel buffers
This commit is contained in:
parent
fd944197f2
commit
c56186026f
5 changed files with 66 additions and 18 deletions
|
|
@ -730,6 +730,11 @@ anv_cmd_buffer_emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
|||
}
|
||||
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
surface_state = desc->buffer_view->surface_state;
|
||||
bo = desc->buffer_view->buffer->bo;
|
||||
bo_offset = desc->buffer_view->buffer->offset;
|
||||
break;
|
||||
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||
assert(!"Unsupported descriptor type");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -483,7 +483,15 @@ void anv_UpdateDescriptorSets(
|
|||
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||
anv_finishme("texel buffers not implemented");
|
||||
for (uint32_t j = 0; j < write->descriptorCount; j++) {
|
||||
ANV_FROM_HANDLE(anv_buffer_view, bview,
|
||||
write->pTexelBufferView[j]);
|
||||
|
||||
desc[j] = (struct anv_descriptor) {
|
||||
.type = write->descriptorType,
|
||||
.buffer_view = bview,
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
|
||||
|
|
|
|||
|
|
@ -1514,23 +1514,6 @@ anv_fill_buffer_surface_state(struct anv_device *device, void *state,
|
|||
}
|
||||
}
|
||||
|
||||
VkResult anv_CreateBufferView(
|
||||
VkDevice _device,
|
||||
const VkBufferViewCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkBufferView* pView)
|
||||
{
|
||||
stub_return(VK_ERROR_INCOMPATIBLE_DRIVER);
|
||||
}
|
||||
|
||||
void anv_DestroyBufferView(
|
||||
VkDevice _device,
|
||||
VkBufferView _bview,
|
||||
const VkAllocationCallbacks* pAllocator)
|
||||
{
|
||||
stub();
|
||||
}
|
||||
|
||||
void anv_DestroySampler(
|
||||
VkDevice _device,
|
||||
VkSampler _sampler,
|
||||
|
|
|
|||
|
|
@ -506,6 +506,50 @@ anv_DestroyImageView(VkDevice _device, VkImageView _iview,
|
|||
anv_free2(&device->alloc, pAllocator, iview);
|
||||
}
|
||||
|
||||
VkResult
|
||||
anv_CreateBufferView(VkDevice _device,
|
||||
const VkBufferViewCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkBufferView *pView)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_buffer, buffer, pCreateInfo->buffer);
|
||||
struct anv_buffer_view *view;
|
||||
|
||||
/* TODO: Storage texel buffers */
|
||||
|
||||
view = anv_alloc2(&device->alloc, pAllocator, sizeof(*view), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
if (!view)
|
||||
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
view->buffer = buffer;
|
||||
view->surface_state =
|
||||
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
|
||||
|
||||
const struct anv_format *format =
|
||||
anv_format_for_vk_format(pCreateInfo->format);
|
||||
|
||||
anv_fill_buffer_surface_state(device, view->surface_state.map, format,
|
||||
pCreateInfo->offset, pCreateInfo->range,
|
||||
format->isl_layout->bpb / 8);
|
||||
|
||||
*pView = anv_buffer_view_to_handle(view);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
anv_DestroyBufferView(VkDevice _device, VkBufferView bufferView,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
ANV_FROM_HANDLE(anv_device, device, _device);
|
||||
ANV_FROM_HANDLE(anv_buffer_view, view, bufferView);
|
||||
|
||||
anv_state_pool_free(&device->surface_state_pool, view->surface_state);
|
||||
anv_free2(&device->alloc, pAllocator, view);
|
||||
}
|
||||
|
||||
struct anv_surface *
|
||||
anv_image_get_surface_for_aspect_mask(struct anv_image *image, VkImageAspectFlags aspect_mask)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -851,6 +851,8 @@ struct anv_descriptor {
|
|||
struct anv_sampler *sampler;
|
||||
};
|
||||
|
||||
struct anv_buffer_view *buffer_view;
|
||||
|
||||
struct {
|
||||
struct anv_buffer *buffer;
|
||||
uint64_t offset;
|
||||
|
|
@ -1516,6 +1518,11 @@ gen9_image_view_init(struct anv_image_view *iview,
|
|||
const VkImageViewCreateInfo* pCreateInfo,
|
||||
struct anv_cmd_buffer *cmd_buffer);
|
||||
|
||||
struct anv_buffer_view {
|
||||
struct anv_buffer *buffer;
|
||||
struct anv_state surface_state;
|
||||
};
|
||||
|
||||
void anv_fill_buffer_surface_state(struct anv_device *device, void *state,
|
||||
const struct anv_format *format,
|
||||
uint32_t offset, uint32_t range,
|
||||
|
|
@ -1636,6 +1643,7 @@ ANV_DEFINE_HANDLE_CASTS(anv_queue, VkQueue)
|
|||
|
||||
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_cmd_pool, VkCommandPool)
|
||||
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer, VkBuffer)
|
||||
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_buffer_view, VkBufferView)
|
||||
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set, VkDescriptorSet)
|
||||
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_descriptor_set_layout, VkDescriptorSetLayout)
|
||||
ANV_DEFINE_NONDISP_HANDLE_CASTS(anv_device_memory, VkDeviceMemory)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue