mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 16:18:06 +02:00
lavapipe: Re-use auto-generated vk_cmd_enqueue entrypoints
Re-use auto-generated vk_cmd_enqueue entrypoints instead of generating our own version doing the same thing. In order to effectively do this, we also add an allow-list of which entrypoints lavapipe actually handles to avoid issues where the autogenerated one stomps a vkCmdFoo2 wrapper. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
This commit is contained in:
parent
66cb64c8ad
commit
b98cfe9cb4
7 changed files with 130 additions and 186 deletions
|
|
@ -47,9 +47,6 @@ static VkResult lvp_create_cmd_buffer(
|
|||
cmd_buffer->device = device;
|
||||
cmd_buffer->pool = pool;
|
||||
|
||||
cmd_buffer->queue.alloc = &pool->vk.alloc;
|
||||
list_inithead(&cmd_buffer->queue.cmds);
|
||||
|
||||
cmd_buffer->status = LVP_CMD_BUFFER_STATUS_INITIAL;
|
||||
if (pool) {
|
||||
list_addtail(&cmd_buffer->pool_link, &pool->cmd_buffers);
|
||||
|
|
@ -68,8 +65,6 @@ static VkResult lvp_reset_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer)
|
|||
{
|
||||
vk_command_buffer_reset(&cmd_buffer->vk);
|
||||
|
||||
vk_free_queue(&cmd_buffer->queue);
|
||||
list_inithead(&cmd_buffer->queue.cmds);
|
||||
cmd_buffer->status = LVP_CMD_BUFFER_STATUS_INITIAL;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
@ -123,8 +118,6 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_AllocateCommandBuffers(
|
|||
static void
|
||||
lvp_cmd_buffer_destroy(struct lvp_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
vk_free_queue(&cmd_buffer->queue);
|
||||
list_del(&cmd_buffer->pool_link);
|
||||
vk_command_buffer_finish(&cmd_buffer->vk);
|
||||
vk_free(&cmd_buffer->pool->vk.alloc, cmd_buffer);
|
||||
}
|
||||
|
|
@ -278,19 +271,19 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiEXT(
|
|||
{
|
||||
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*cmd), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
if (!cmd)
|
||||
return;
|
||||
|
||||
cmd->type = VK_CMD_DRAW_MULTI_EXT;
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->queue.cmds);
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
|
||||
|
||||
cmd->u.draw_multi_ext.draw_count = drawCount;
|
||||
if (pVertexInfo) {
|
||||
unsigned i = 0;
|
||||
cmd->u.draw_multi_ext.vertex_info = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
cmd->u.draw_multi_ext.vertex_info = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*cmd->u.draw_multi_ext.vertex_info) * drawCount,
|
||||
8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
|
@ -313,20 +306,20 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiIndexedEXT(
|
|||
{
|
||||
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*cmd), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
if (!cmd)
|
||||
return;
|
||||
|
||||
cmd->type = VK_CMD_DRAW_MULTI_INDEXED_EXT;
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->queue.cmds);
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
|
||||
|
||||
cmd->u.draw_multi_indexed_ext.draw_count = drawCount;
|
||||
|
||||
if (pIndexInfo) {
|
||||
unsigned i = 0;
|
||||
cmd->u.draw_multi_indexed_ext.index_info = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
cmd->u.draw_multi_indexed_ext.index_info = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*cmd->u.draw_multi_indexed_ext.index_info) * drawCount,
|
||||
8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
|
@ -343,7 +336,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdDrawMultiIndexedEXT(
|
|||
cmd->u.draw_multi_indexed_ext.stride = stride;
|
||||
|
||||
if (pVertexOffset) {
|
||||
cmd->u.draw_multi_indexed_ext.vertex_offset = vk_zalloc(cmd_buffer->queue.alloc, sizeof(*cmd->u.draw_multi_indexed_ext.vertex_offset), 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
cmd->u.draw_multi_indexed_ext.vertex_offset = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc, sizeof(*cmd->u.draw_multi_indexed_ext.vertex_offset), 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
memcpy(cmd->u.draw_multi_indexed_ext.vertex_offset, pVertexOffset, sizeof(*cmd->u.draw_multi_indexed_ext.vertex_offset));
|
||||
}
|
||||
}
|
||||
|
|
@ -359,7 +352,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetKHR(
|
|||
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
struct vk_cmd_push_descriptor_set_khr *pds;
|
||||
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*cmd), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
if (!cmd)
|
||||
|
|
@ -368,7 +361,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetKHR(
|
|||
pds = &cmd->u.push_descriptor_set_khr;
|
||||
|
||||
cmd->type = VK_CMD_PUSH_DESCRIPTOR_SET_KHR;
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->queue.cmds);
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
|
||||
|
||||
pds->pipeline_bind_point = pipelineBindPoint;
|
||||
pds->layout = layout;
|
||||
|
|
@ -376,7 +369,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetKHR(
|
|||
pds->descriptor_write_count = descriptorWriteCount;
|
||||
|
||||
if (pDescriptorWrites) {
|
||||
pds->descriptor_writes = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
pds->descriptor_writes = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*pds->descriptor_writes) * descriptorWriteCount,
|
||||
8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
|
@ -391,7 +384,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetKHR(
|
|||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
||||
case VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT:
|
||||
pds->descriptor_writes[i].pImageInfo = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
pds->descriptor_writes[i].pImageInfo = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(VkDescriptorImageInfo) * pds->descriptor_writes[i].descriptorCount,
|
||||
8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
|
@ -401,7 +394,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetKHR(
|
|||
break;
|
||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||
pds->descriptor_writes[i].pTexelBufferView = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
pds->descriptor_writes[i].pTexelBufferView = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(VkBufferView) * pds->descriptor_writes[i].descriptorCount,
|
||||
8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
|
@ -414,7 +407,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetKHR(
|
|||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
||||
default:
|
||||
pds->descriptor_writes[i].pBufferInfo = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
pds->descriptor_writes[i].pBufferInfo = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(VkDescriptorBufferInfo) * pds->descriptor_writes[i].descriptorCount,
|
||||
8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
|
@ -437,7 +430,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetWithTemplateKHR(
|
|||
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
LVP_FROM_HANDLE(lvp_descriptor_update_template, templ, descriptorUpdateTemplate);
|
||||
size_t info_size = 0;
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*cmd), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
if (!cmd)
|
||||
|
|
@ -445,7 +438,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetWithTemplateKHR(
|
|||
|
||||
cmd->type = VK_CMD_PUSH_DESCRIPTOR_SET_WITH_TEMPLATE_KHR;
|
||||
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->queue.cmds);
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
|
||||
|
||||
cmd->u.push_descriptor_set_with_template_khr.descriptor_update_template = descriptorUpdateTemplate;
|
||||
cmd->u.push_descriptor_set_with_template_khr.layout = layout;
|
||||
|
|
@ -476,7 +469,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdPushDescriptorSetWithTemplateKHR(
|
|||
}
|
||||
}
|
||||
|
||||
cmd->u.push_descriptor_set_with_template_khr.data = vk_zalloc(cmd_buffer->queue.alloc, info_size, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
cmd->u.push_descriptor_set_with_template_khr.data = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc, info_size, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
||||
uint64_t offset = 0;
|
||||
for (unsigned i = 0; i < templ->entry_count; i++) {
|
||||
|
|
@ -522,17 +515,17 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdBindDescriptorSets(
|
|||
{
|
||||
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
LVP_FROM_HANDLE(lvp_pipeline_layout, layout, _layout);
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->queue.alloc,
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc,
|
||||
sizeof(*cmd), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
if (!cmd)
|
||||
return;
|
||||
|
||||
cmd->type = VK_CMD_BIND_DESCRIPTOR_SETS;
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->queue.cmds);
|
||||
list_addtail(&cmd->cmd_link, &cmd_buffer->vk.cmd_queue.cmds);
|
||||
|
||||
/* _layout could have been destroyed by when this command executes */
|
||||
struct lvp_descriptor_set_layout **set_layout = vk_zalloc(cmd_buffer->queue.alloc, sizeof(*set_layout) * layout->num_sets, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
struct lvp_descriptor_set_layout **set_layout = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc, sizeof(*set_layout) * layout->num_sets, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
cmd->driver_data = set_layout;
|
||||
for (unsigned i = 0; i < layout->num_sets; i++)
|
||||
set_layout[i] = layout->set[i].layout;
|
||||
|
|
@ -541,12 +534,12 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdBindDescriptorSets(
|
|||
cmd->u.bind_descriptor_sets.first_set = firstSet;
|
||||
cmd->u.bind_descriptor_sets.descriptor_set_count = descriptorSetCount;
|
||||
if (pDescriptorSets) {
|
||||
cmd->u.bind_descriptor_sets.descriptor_sets = vk_zalloc(cmd_buffer->queue.alloc, sizeof(*cmd->u.bind_descriptor_sets.descriptor_sets) * descriptorSetCount, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
cmd->u.bind_descriptor_sets.descriptor_sets = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc, sizeof(*cmd->u.bind_descriptor_sets.descriptor_sets) * descriptorSetCount, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
memcpy(( VkDescriptorSet* )cmd->u.bind_descriptor_sets.descriptor_sets, pDescriptorSets, sizeof(*cmd->u.bind_descriptor_sets.descriptor_sets) * descriptorSetCount);
|
||||
}
|
||||
cmd->u.bind_descriptor_sets.dynamic_offset_count = dynamicOffsetCount;
|
||||
if (pDynamicOffsets) {
|
||||
cmd->u.bind_descriptor_sets.dynamic_offsets = vk_zalloc(cmd_buffer->queue.alloc, sizeof(*cmd->u.bind_descriptor_sets.dynamic_offsets) * dynamicOffsetCount, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
cmd->u.bind_descriptor_sets.dynamic_offsets = vk_zalloc(cmd_buffer->vk.cmd_queue.alloc, sizeof(*cmd->u.bind_descriptor_sets.dynamic_offsets) * dynamicOffsetCount, 8, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
memcpy(( uint32_t* )cmd->u.bind_descriptor_sets.dynamic_offsets, pDynamicOffsets, sizeof(*cmd->u.bind_descriptor_sets.dynamic_offsets) * dynamicOffsetCount);
|
||||
}
|
||||
}
|
||||
|
|
@ -557,7 +550,7 @@ VKAPI_ATTR void VKAPI_CALL lvp_CmdBeginRendering(VkCommandBuffer
|
|||
)
|
||||
{
|
||||
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
struct vk_cmd_queue *queue = &cmd_buffer->queue;
|
||||
struct vk_cmd_queue *queue = &cmd_buffer->vk.cmd_queue;
|
||||
struct vk_cmd_queue_entry *cmd = vk_zalloc(queue->alloc,
|
||||
sizeof(*cmd), 8,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "pipe-loader/pipe_loader.h"
|
||||
#include "git_sha1.h"
|
||||
#include "vk_cmd_enqueue_entrypoints.h"
|
||||
#include "vk_util.h"
|
||||
#include "pipe/p_config.h"
|
||||
#include "pipe/p_defines.h"
|
||||
|
|
@ -1472,6 +1473,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDevice(
|
|||
struct vk_device_dispatch_table dispatch_table;
|
||||
vk_device_dispatch_table_from_entrypoints(&dispatch_table,
|
||||
&lvp_device_entrypoints, true);
|
||||
lvp_add_enqueue_cmd_entrypoints(&dispatch_table);
|
||||
vk_device_dispatch_table_from_entrypoints(&dispatch_table,
|
||||
&wsi_device_entrypoints, false);
|
||||
VkResult result = vk_device_init(&device->vk,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "util/format/u_format_zs.h"
|
||||
#include "util/ptralloc.h"
|
||||
|
||||
#include "vk_cmd_enqueue_entrypoints.h"
|
||||
#include "vk_util.h"
|
||||
|
||||
#define VK_PROTOTYPES
|
||||
|
|
@ -3850,6 +3851,106 @@ static void handle_set_color_write_enable(struct vk_cmd_queue_entry *cmd,
|
|||
state->color_write_disables = disable_mask;
|
||||
}
|
||||
|
||||
void lvp_add_enqueue_cmd_entrypoints(struct vk_device_dispatch_table *disp)
|
||||
{
|
||||
struct vk_device_dispatch_table cmd_enqueue_dispatch;
|
||||
vk_device_dispatch_table_from_entrypoints(&cmd_enqueue_dispatch,
|
||||
&vk_cmd_enqueue_device_entrypoints, true);
|
||||
|
||||
#define ENQUEUE_CMD(CmdName) \
|
||||
assert(cmd_enqueue_dispatch.CmdName != NULL); \
|
||||
disp->CmdName = cmd_enqueue_dispatch.CmdName;
|
||||
|
||||
/* This list needs to match what's in lvp_execute_cmd_buffer exactly */
|
||||
ENQUEUE_CMD(CmdBindPipeline)
|
||||
ENQUEUE_CMD(CmdSetViewport)
|
||||
ENQUEUE_CMD(CmdSetViewportWithCount)
|
||||
ENQUEUE_CMD(CmdSetScissor)
|
||||
ENQUEUE_CMD(CmdSetScissorWithCount)
|
||||
ENQUEUE_CMD(CmdSetLineWidth)
|
||||
ENQUEUE_CMD(CmdSetDepthBias)
|
||||
ENQUEUE_CMD(CmdSetBlendConstants)
|
||||
ENQUEUE_CMD(CmdSetDepthBounds)
|
||||
ENQUEUE_CMD(CmdSetStencilCompareMask)
|
||||
ENQUEUE_CMD(CmdSetStencilWriteMask)
|
||||
ENQUEUE_CMD(CmdSetStencilReference)
|
||||
// ENQUEUE_CMD(CmdBindDescriptorSets)
|
||||
ENQUEUE_CMD(CmdBindIndexBuffer)
|
||||
ENQUEUE_CMD(CmdBindVertexBuffers)
|
||||
ENQUEUE_CMD(CmdBindVertexBuffers2)
|
||||
ENQUEUE_CMD(CmdDraw)
|
||||
// ENQUEUE_CMD(CmdDrawMultiEXT)
|
||||
ENQUEUE_CMD(CmdDrawIndexed)
|
||||
ENQUEUE_CMD(CmdDrawIndirect)
|
||||
ENQUEUE_CMD(CmdDrawIndexedIndirect)
|
||||
// ENQUEUE_CMD(CmdDrawMultiIndexedEXT)
|
||||
ENQUEUE_CMD(CmdDispatch)
|
||||
ENQUEUE_CMD(CmdDispatchBase)
|
||||
ENQUEUE_CMD(CmdDispatchIndirect)
|
||||
ENQUEUE_CMD(CmdCopyBuffer2)
|
||||
ENQUEUE_CMD(CmdCopyImage2)
|
||||
ENQUEUE_CMD(CmdBlitImage2)
|
||||
ENQUEUE_CMD(CmdCopyBufferToImage2)
|
||||
ENQUEUE_CMD(CmdCopyImageToBuffer2)
|
||||
ENQUEUE_CMD(CmdUpdateBuffer)
|
||||
ENQUEUE_CMD(CmdFillBuffer)
|
||||
ENQUEUE_CMD(CmdClearColorImage)
|
||||
ENQUEUE_CMD(CmdClearDepthStencilImage)
|
||||
ENQUEUE_CMD(CmdClearAttachments)
|
||||
ENQUEUE_CMD(CmdResolveImage2)
|
||||
ENQUEUE_CMD(CmdSetEvent)
|
||||
ENQUEUE_CMD(CmdResetEvent)
|
||||
ENQUEUE_CMD(CmdWaitEvents)
|
||||
ENQUEUE_CMD(CmdPipelineBarrier)
|
||||
ENQUEUE_CMD(CmdBeginQueryIndexedEXT)
|
||||
ENQUEUE_CMD(CmdEndQueryIndexedEXT)
|
||||
ENQUEUE_CMD(CmdBeginQuery)
|
||||
ENQUEUE_CMD(CmdEndQuery)
|
||||
ENQUEUE_CMD(CmdResetQueryPool)
|
||||
ENQUEUE_CMD(CmdWriteTimestamp)
|
||||
ENQUEUE_CMD(CmdCopyQueryPoolResults)
|
||||
ENQUEUE_CMD(CmdPushConstants)
|
||||
ENQUEUE_CMD(CmdBeginRenderPass)
|
||||
ENQUEUE_CMD(CmdBeginRenderPass2)
|
||||
ENQUEUE_CMD(CmdNextSubpass)
|
||||
ENQUEUE_CMD(CmdNextSubpass2)
|
||||
ENQUEUE_CMD(CmdEndRenderPass)
|
||||
ENQUEUE_CMD(CmdEndRenderPass2)
|
||||
ENQUEUE_CMD(CmdExecuteCommands)
|
||||
ENQUEUE_CMD(CmdDrawIndirectCount)
|
||||
ENQUEUE_CMD(CmdDrawIndexedIndirectCount)
|
||||
// ENQUEUE_CMD(CmdPushDescriptorSetKHR)
|
||||
// ENQUEUE_CMD(CmdPushDescriptorSetWithTemplateKHR)
|
||||
ENQUEUE_CMD(CmdBindTransformFeedbackBuffersEXT)
|
||||
ENQUEUE_CMD(CmdBeginTransformFeedbackEXT)
|
||||
ENQUEUE_CMD(CmdEndTransformFeedbackEXT)
|
||||
ENQUEUE_CMD(CmdDrawIndirectByteCountEXT)
|
||||
ENQUEUE_CMD(CmdBeginConditionalRenderingEXT)
|
||||
ENQUEUE_CMD(CmdEndConditionalRenderingEXT)
|
||||
ENQUEUE_CMD(CmdSetVertexInputEXT)
|
||||
ENQUEUE_CMD(CmdSetCullMode)
|
||||
ENQUEUE_CMD(CmdSetFrontFace)
|
||||
ENQUEUE_CMD(CmdSetPrimitiveTopology)
|
||||
ENQUEUE_CMD(CmdSetDepthTestEnable)
|
||||
ENQUEUE_CMD(CmdSetDepthWriteEnable)
|
||||
ENQUEUE_CMD(CmdSetDepthCompareOp)
|
||||
ENQUEUE_CMD(CmdSetDepthBoundsTestEnable)
|
||||
ENQUEUE_CMD(CmdSetStencilTestEnable)
|
||||
ENQUEUE_CMD(CmdSetStencilOp)
|
||||
ENQUEUE_CMD(CmdSetLineStippleEXT)
|
||||
ENQUEUE_CMD(CmdSetDepthBiasEnable)
|
||||
ENQUEUE_CMD(CmdSetLogicOpEXT)
|
||||
ENQUEUE_CMD(CmdSetPatchControlPointsEXT)
|
||||
ENQUEUE_CMD(CmdSetPrimitiveRestartEnable)
|
||||
ENQUEUE_CMD(CmdSetRasterizerDiscardEnable)
|
||||
ENQUEUE_CMD(CmdSetColorWriteEnableEXT)
|
||||
// ENQUEUE_CMD(CmdBeginRendering)
|
||||
ENQUEUE_CMD(CmdEndRendering)
|
||||
ENQUEUE_CMD(CmdSetDeviceMask)
|
||||
|
||||
#undef ENQUEUE_CMD
|
||||
}
|
||||
|
||||
static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer,
|
||||
struct rendering_state *state)
|
||||
{
|
||||
|
|
@ -3857,7 +3958,7 @@ static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer,
|
|||
bool first = true;
|
||||
bool did_flush = false;
|
||||
|
||||
LIST_FOR_EACH_ENTRY(cmd, &cmd_buffer->queue.cmds, cmd_link) {
|
||||
LIST_FOR_EACH_ENTRY(cmd, &cmd_buffer->vk.cmd_queue.cmds, cmd_link) {
|
||||
switch (cmd->type) {
|
||||
case VK_CMD_BIND_PIPELINE:
|
||||
handle_pipeline(cmd, state);
|
||||
|
|
@ -3989,7 +4090,7 @@ static void lvp_execute_cmd_buffer(struct lvp_cmd_buffer *cmd_buffer,
|
|||
/* skip flushes since every cmdbuf does a flush
|
||||
after iterating its cmds and so this is redundant
|
||||
*/
|
||||
if (first || did_flush || cmd->cmd_link.next == &cmd_buffer->queue.cmds)
|
||||
if (first || did_flush || cmd->cmd_link.next == &cmd_buffer->vk.cmd_queue.cmds)
|
||||
continue;
|
||||
handle_pipeline_barrier(cmd, state);
|
||||
did_flush = true;
|
||||
|
|
|
|||
|
|
@ -580,8 +580,6 @@ struct lvp_cmd_buffer {
|
|||
struct lvp_cmd_pool * pool;
|
||||
struct list_head pool_link;
|
||||
|
||||
struct vk_cmd_queue queue;
|
||||
|
||||
uint8_t push_constants[MAX_PUSH_CONSTANTS_SIZE];
|
||||
};
|
||||
|
||||
|
|
@ -656,6 +654,8 @@ struct lvp_cmd_push_descriptor_set {
|
|||
union lvp_descriptor_info *infos;
|
||||
};
|
||||
|
||||
void lvp_add_enqueue_cmd_entrypoints(struct vk_device_dispatch_table *disp);
|
||||
|
||||
VkResult lvp_execute_cmds(struct lvp_device *device,
|
||||
struct lvp_queue *queue,
|
||||
struct lvp_cmd_buffer *cmd_buffer);
|
||||
|
|
|
|||
|
|
@ -10,17 +10,6 @@ lvp_entrypoints = custom_target(
|
|||
depend_files : vk_entrypoints_gen_depend_files,
|
||||
)
|
||||
|
||||
lvp_commands = custom_target(
|
||||
'lvp_commands',
|
||||
input : [vk_commands_gen, vk_api_xml],
|
||||
output : ['lvp_commands.c'],
|
||||
command : [
|
||||
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
||||
'--out-c', '@OUTPUT0@', '--prefix', 'lvp',
|
||||
],
|
||||
depend_files : vk_commands_gen_depend_files,
|
||||
)
|
||||
|
||||
liblvp_files = files(
|
||||
'lvp_device.c',
|
||||
'lvp_cmd_buffer.c',
|
||||
|
|
@ -51,7 +40,7 @@ endif
|
|||
|
||||
liblavapipe_st = static_library(
|
||||
'lavapipe_st',
|
||||
[liblvp_files, lvp_entrypoints, lvp_commands, sha1_h],
|
||||
[liblvp_files, lvp_entrypoints, sha1_h],
|
||||
c_args : [ c_msvc_compat_args, lvp_flags ],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [ inc_include, inc_src, inc_util, inc_gallium, inc_compiler, inc_gallium_aux ],
|
||||
|
|
|
|||
|
|
@ -46,16 +46,11 @@ vk_cmd_queue_gen_depend_files = [
|
|||
files('vk_entrypoints.py'),
|
||||
vk_entrypoints_depend_files,
|
||||
]
|
||||
vk_commands_gen_depend_files = [
|
||||
files('vk_entrypoints.py'),
|
||||
vk_entrypoints_depend_files,
|
||||
]
|
||||
|
||||
vk_entrypoints_gen = files('vk_entrypoints_gen.py')
|
||||
vk_extensions_gen = files('vk_extensions_gen.py')
|
||||
vk_icd_gen = files('vk_icd_gen.py')
|
||||
vk_cmd_queue_gen = files('vk_cmd_queue_gen.py')
|
||||
vk_commands_gen = files('vk_commands_gen.py')
|
||||
vk_dispatch_trampolines_gen = files('vk_dispatch_trampolines_gen.py')
|
||||
|
||||
files_vulkan_util = files(
|
||||
|
|
|
|||
|
|
@ -1,136 +0,0 @@
|
|||
COPYRIGHT=u"""
|
||||
/* Copyright © 2015-2021 Intel Corporation
|
||||
* Copyright © 2021 Collabora, Ltd.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import xml.etree.ElementTree as et
|
||||
|
||||
from mako.template import Template
|
||||
|
||||
# Mesa-local imports must be declared in meson variable
|
||||
# '{file_without_suffix}_depend_files'.
|
||||
from vk_entrypoints import get_entrypoints_from_xml, EntrypointParam
|
||||
|
||||
MANUAL_COMMANDS = ['CmdPushDescriptorSetKHR', # This script doesn't know how to copy arrays in structs in arrays
|
||||
'CmdPushDescriptorSetWithTemplateKHR', # pData's size cannot be calculated from the xml
|
||||
'CmdDrawMultiEXT', # The size of the elements is specified in a stride param
|
||||
'CmdDrawMultiIndexedEXT', # The size of the elements is specified in a stride param
|
||||
'CmdBindDescriptorSets', # The VkPipelineLayout object could be released before the command is executed
|
||||
'CmdCopyImageToBuffer', # There are wrappers that implement these in terms of the newer variants
|
||||
'CmdCopyImage',
|
||||
'CmdCopyBuffer',
|
||||
'CmdCopyBufferToImage',
|
||||
'CmdBlitImage',
|
||||
'CmdResolveImage',
|
||||
'CmdBeginRendering',
|
||||
'CmdBeginRenderingKHR',
|
||||
'CmdSetPerformanceMarkerINTEL',
|
||||
'CmdSetPerformanceStreamMarkerINTEL',
|
||||
'CmdSetPerformanceOverrideINTEL',
|
||||
]
|
||||
|
||||
TEMPLATE_C = Template(COPYRIGHT + """
|
||||
/* This file generated from ${filename}, don't edit directly. */
|
||||
|
||||
#define VK_PROTOTYPES
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include "lvp_private.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "vk_util.h"
|
||||
|
||||
% for c in commands:
|
||||
% if c.name in manual_commands:
|
||||
<% continue %>
|
||||
% endif
|
||||
% if c.guard is not None:
|
||||
#ifdef ${c.guard}
|
||||
% endif
|
||||
VKAPI_ATTR void VKAPI_CALL lvp_${c.name}(${c.decl_params()})
|
||||
{
|
||||
LVP_FROM_HANDLE(lvp_cmd_buffer, cmd_buffer, commandBuffer);
|
||||
|
||||
% if len(c.params) == 1:
|
||||
vk_enqueue_${to_underscore(c.name)}(&cmd_buffer->queue);
|
||||
% else:
|
||||
vk_enqueue_${to_underscore(c.name)}(&cmd_buffer->queue,
|
||||
${c.call_params(start=1)});
|
||||
% endif
|
||||
}
|
||||
% if c.guard is not None:
|
||||
#endif // ${c.guard}
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
""", output_encoding='utf-8')
|
||||
|
||||
def remove_prefix(text, prefix):
|
||||
if text.startswith(prefix):
|
||||
return text[len(prefix):]
|
||||
return text
|
||||
|
||||
def to_underscore(name):
|
||||
return remove_prefix(re.sub('([A-Z]+)', r'_\1', name).lower(), '_')
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--out-c', required=True, help='Output C file.')
|
||||
parser.add_argument('--xml',
|
||||
help='Vulkan API XML file.',
|
||||
required=True, action='append', dest='xml_files')
|
||||
parser.add_argument('--prefix',
|
||||
help='Prefix to use for all dispatch tables.',
|
||||
action='append', default=[], dest='prefixes')
|
||||
args = parser.parse_args()
|
||||
|
||||
commands = []
|
||||
for e in get_entrypoints_from_xml(args.xml_files):
|
||||
if e.name.startswith('Cmd') and \
|
||||
not e.alias:
|
||||
commands.append(e)
|
||||
|
||||
environment = {
|
||||
'commands': commands,
|
||||
'filename': os.path.basename(__file__),
|
||||
'to_underscore': to_underscore,
|
||||
'manual_commands': MANUAL_COMMANDS,
|
||||
}
|
||||
|
||||
try:
|
||||
with open(args.out_c, 'wb') as f:
|
||||
f.write(TEMPLATE_C.render(**environment))
|
||||
except Exception:
|
||||
# In the event there's an error, this imports some helpers from mako
|
||||
# to print a useful stack trace and prints it, then exits with
|
||||
# status 1, if python is run with debug; otherwise it just raises
|
||||
# the exception
|
||||
import sys
|
||||
from mako import exceptions
|
||||
print(exceptions.text_error_template().render(), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Loading…
Add table
Reference in a new issue