mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 02:28:10 +02:00
lavapipe: VK_KHR_copy_memory_indirect
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37589>
This commit is contained in:
parent
010cd37e50
commit
b3b2daa28d
2 changed files with 72 additions and 0 deletions
|
|
@ -121,6 +121,7 @@ static const struct vk_device_extension_table lvp_device_extensions_supported =
|
|||
.KHR_create_renderpass2 = true,
|
||||
.KHR_compute_shader_derivatives = true,
|
||||
.KHR_copy_commands2 = true,
|
||||
.KHR_copy_memory_indirect = true,
|
||||
.KHR_dedicated_allocation = true,
|
||||
.KHR_deferred_host_operations = true,
|
||||
.KHR_depth_stencil_resolve = true,
|
||||
|
|
@ -769,6 +770,10 @@ lvp_get_features(const struct lvp_physical_device *pdevice,
|
|||
.shaderImageInt64Atomics = true,
|
||||
.sparseImageInt64Atomics = true,
|
||||
|
||||
/* VK_KHR_copy_memory_indirect */
|
||||
.indirectMemoryCopy = true,
|
||||
.indirectMemoryToImageCopy = true,
|
||||
|
||||
/* VK_EXT_memory_priority */
|
||||
.memoryPriority = true,
|
||||
|
||||
|
|
@ -1317,6 +1322,9 @@ lvp_get_properties(const struct lvp_physical_device *device, struct vk_propertie
|
|||
/* VK_EXT_host_image_copy */
|
||||
lvp_device_get_cache_uuid(p->optimalTilingLayoutUUID);
|
||||
|
||||
/* VK_KHR_copy_memory_indirect */
|
||||
p->supportedQueues = 0xffffffff;
|
||||
|
||||
/* maintenance7 */
|
||||
p->robustFragmentShadingRateAttachmentAccess = false;
|
||||
p->separateDepthStencilAttachmentAccess = true;
|
||||
|
|
|
|||
|
|
@ -2153,6 +2153,48 @@ static void handle_copy_image_to_buffer2(struct vk_cmd_queue_entry *cmd,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_copy_memory_to_image_indirect(struct vk_cmd_queue_entry *cmd,
|
||||
struct rendering_state *state)
|
||||
{
|
||||
const VkCopyMemoryToImageIndirectInfoKHR *copycmd = cmd->u.copy_memory_to_image_indirect_khr.copy_memory_to_image_indirect_info;
|
||||
LVP_FROM_HANDLE(lvp_image, image, copycmd->dstImage);
|
||||
|
||||
for (uint32_t i = 0; i < copycmd->copyCount; i++) {
|
||||
uint8_t *ptr = (void*)(uintptr_t)copycmd->copyAddressRange.address;
|
||||
VkCopyMemoryToImageIndirectCommandKHR *copy = (void*)(ptr + i * copycmd->copyAddressRange.stride);
|
||||
VkImageSubresourceLayers sub = copy->imageSubresource;
|
||||
VkOffset3D off = copy->imageOffset;
|
||||
VkExtent3D ext = copy->imageExtent;
|
||||
if (image->vk.image_type == VK_IMAGE_TYPE_3D) {
|
||||
off.z = sub.baseArrayLayer;
|
||||
ext.depth = sub.layerCount;
|
||||
sub.baseArrayLayer = 0;
|
||||
sub.layerCount = 1;
|
||||
}
|
||||
VkMemoryToImageCopy copyregion = {
|
||||
VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT,
|
||||
NULL,
|
||||
(void*)(uintptr_t)copy->srcAddress,
|
||||
copy->bufferRowLength,
|
||||
copy->bufferImageHeight,
|
||||
sub,
|
||||
off,
|
||||
ext,
|
||||
};
|
||||
VkCopyMemoryToImageInfoEXT hiccopy = {
|
||||
VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT,
|
||||
NULL,
|
||||
0,
|
||||
copycmd->dstImage,
|
||||
VK_IMAGE_LAYOUT_GENERAL,
|
||||
1,
|
||||
©region
|
||||
};
|
||||
state->device->vk.dispatch_table.CopyMemoryToImageEXT(lvp_device_to_handle(state->device), &hiccopy);
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_copy_buffer_to_image(struct vk_cmd_queue_entry *cmd,
|
||||
struct rendering_state *state)
|
||||
{
|
||||
|
|
@ -2348,6 +2390,20 @@ static void handle_copy_image(struct vk_cmd_queue_entry *cmd,
|
|||
}
|
||||
}
|
||||
|
||||
static void handle_copy_memory_indirect(struct vk_cmd_queue_entry *cmd,
|
||||
struct rendering_state *state)
|
||||
{
|
||||
const VkCopyMemoryIndirectInfoKHR *copycmd = cmd->u.copy_memory_indirect_khr.copy_memory_indirect_info;
|
||||
|
||||
for (uint32_t i = 0; i < copycmd->copyCount; i++) {
|
||||
uint8_t *ptr = (void*)(uintptr_t)copycmd->copyAddressRange.address;
|
||||
VkCopyMemoryIndirectCommandKHR *copy = (void*)(ptr + i * copycmd->copyAddressRange.stride);
|
||||
void *src = (void*)(uintptr_t)copy->srcAddress;
|
||||
void *dst = (void*)(uintptr_t)copy->dstAddress;
|
||||
memcpy(dst, src, copycmd->copyAddressRange.size);
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_copy_buffer(struct vk_cmd_queue_entry *cmd,
|
||||
struct rendering_state *state)
|
||||
{
|
||||
|
|
@ -4716,6 +4772,8 @@ void lvp_add_enqueue_cmd_entrypoints(struct vk_device_dispatch_table *disp)
|
|||
ENQUEUE_CMD(CmdClearDepthStencilImage)
|
||||
ENQUEUE_CMD(CmdClearAttachments)
|
||||
ENQUEUE_CMD(CmdResolveImage2)
|
||||
ENQUEUE_CMD(CmdCopyMemoryIndirectKHR)
|
||||
ENQUEUE_CMD(CmdCopyMemoryToImageIndirectKHR)
|
||||
ENQUEUE_CMD(CmdBeginQueryIndexedEXT)
|
||||
ENQUEUE_CMD(CmdEndQueryIndexedEXT)
|
||||
ENQUEUE_CMD(CmdBeginQuery)
|
||||
|
|
@ -5163,6 +5221,12 @@ static void lvp_execute_cmd_buffer(struct list_head *cmds,
|
|||
case VK_CMD_BIND_SHADERS_EXT:
|
||||
handle_shaders(cmd, state);
|
||||
break;
|
||||
case VK_CMD_COPY_MEMORY_INDIRECT_KHR:
|
||||
handle_copy_memory_indirect(cmd, state);
|
||||
break;
|
||||
case VK_CMD_COPY_MEMORY_TO_IMAGE_INDIRECT_KHR:
|
||||
handle_copy_memory_to_image_indirect(cmd, state);
|
||||
break;
|
||||
case VK_CMD_SET_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT:
|
||||
break;
|
||||
case VK_CMD_DRAW_MESH_TASKS_EXT:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue