vkr: remove manual command buffer validation

The decoder makes sure the command buffer pointer is non-NULL since
0f12c460 ("vkr: make sure the first dispatchable handle is non-NULL").
And vkr_cs_decoder_lookup_object is just fixed to validate the object
type.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
macos/master
Chia-I Wu 3 years ago
parent 71ccab4f27
commit df558bba34
  1. 77
      src/venus/vkr_command_buffer.c

@ -509,15 +509,10 @@ vkr_dispatch_vkCmdDispatchBase(UNUSED struct vn_dispatch_context *dispatch,
}
static void
vkr_dispatch_vkCmdBeginRenderPass2(struct vn_dispatch_context *dispatch,
vkr_dispatch_vkCmdBeginRenderPass2(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdBeginRenderPass2 *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdBeginRenderPass2_args_handle(args);
cmd->device->CmdBeginRenderPass2(args->commandBuffer, args->pRenderPassBegin,
@ -525,15 +520,10 @@ vkr_dispatch_vkCmdBeginRenderPass2(struct vn_dispatch_context *dispatch,
}
static void
vkr_dispatch_vkCmdNextSubpass2(struct vn_dispatch_context *dispatch,
vkr_dispatch_vkCmdNextSubpass2(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdNextSubpass2 *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdNextSubpass2_args_handle(args);
cmd->device->CmdNextSubpass2(args->commandBuffer, args->pSubpassBeginInfo,
@ -541,30 +531,20 @@ vkr_dispatch_vkCmdNextSubpass2(struct vn_dispatch_context *dispatch,
}
static void
vkr_dispatch_vkCmdEndRenderPass2(struct vn_dispatch_context *dispatch,
vkr_dispatch_vkCmdEndRenderPass2(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdEndRenderPass2 *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdEndRenderPass2_args_handle(args);
cmd->device->CmdEndRenderPass2(args->commandBuffer, args->pSubpassEndInfo);
}
static void
vkr_dispatch_vkCmdDrawIndirectCount(struct vn_dispatch_context *dispatch,
vkr_dispatch_vkCmdDrawIndirectCount(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdDrawIndirectCount *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdDrawIndirectCount_args_handle(args);
cmd->device->CmdDrawIndirectCount(args->commandBuffer, args->buffer, args->offset,
@ -574,15 +554,10 @@ vkr_dispatch_vkCmdDrawIndirectCount(struct vn_dispatch_context *dispatch,
static void
vkr_dispatch_vkCmdDrawIndexedIndirectCount(
struct vn_dispatch_context *dispatch,
UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdDrawIndexedIndirectCount *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdDrawIndexedIndirectCount_args_handle(args);
cmd->device->CmdDrawIndexedIndirectCount(
@ -592,15 +567,10 @@ vkr_dispatch_vkCmdDrawIndexedIndirectCount(
static void
vkr_dispatch_vkCmdBindTransformFeedbackBuffersEXT(
struct vn_dispatch_context *dispatch,
UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdBindTransformFeedbackBuffersEXT *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdBindTransformFeedbackBuffersEXT_args_handle(args);
cmd->device->cmd_bind_transform_feedback_buffers(
@ -610,15 +580,10 @@ vkr_dispatch_vkCmdBindTransformFeedbackBuffersEXT(
static void
vkr_dispatch_vkCmdBeginTransformFeedbackEXT(
struct vn_dispatch_context *dispatch,
UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdBeginTransformFeedbackEXT *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdBeginTransformFeedbackEXT_args_handle(args);
cmd->device->cmd_begin_transform_feedback(
@ -628,15 +593,10 @@ vkr_dispatch_vkCmdBeginTransformFeedbackEXT(
static void
vkr_dispatch_vkCmdEndTransformFeedbackEXT(
struct vn_dispatch_context *dispatch,
UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdEndTransformFeedbackEXT *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdEndTransformFeedbackEXT_args_handle(args);
cmd->device->cmd_end_transform_feedback(
@ -645,15 +605,10 @@ vkr_dispatch_vkCmdEndTransformFeedbackEXT(
}
static void
vkr_dispatch_vkCmdBeginQueryIndexedEXT(struct vn_dispatch_context *dispatch,
vkr_dispatch_vkCmdBeginQueryIndexedEXT(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdBeginQueryIndexedEXT *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdBeginQueryIndexedEXT_args_handle(args);
cmd->device->cmd_begin_query_indexed(args->commandBuffer, args->queryPool, args->query,
@ -661,15 +616,10 @@ vkr_dispatch_vkCmdBeginQueryIndexedEXT(struct vn_dispatch_context *dispatch,
}
static void
vkr_dispatch_vkCmdEndQueryIndexedEXT(struct vn_dispatch_context *dispatch,
vkr_dispatch_vkCmdEndQueryIndexedEXT(UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdEndQueryIndexedEXT *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdEndQueryIndexedEXT_args_handle(args);
cmd->device->cmd_end_query_indexed(args->commandBuffer, args->queryPool, args->query,
@ -678,15 +628,10 @@ vkr_dispatch_vkCmdEndQueryIndexedEXT(struct vn_dispatch_context *dispatch,
static void
vkr_dispatch_vkCmdDrawIndirectByteCountEXT(
struct vn_dispatch_context *dispatch,
UNUSED struct vn_dispatch_context *dispatch,
struct vn_command_vkCmdDrawIndirectByteCountEXT *args)
{
struct vkr_context *ctx = dispatch->data;
struct vkr_command_buffer *cmd = (struct vkr_command_buffer *)args->commandBuffer;
if (!cmd || cmd->base.type != VK_OBJECT_TYPE_COMMAND_BUFFER) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return;
}
vn_replace_vkCmdDrawIndirectByteCountEXT_args_handle(args);
cmd->device->cmd_draw_indirect_byte_count(

Loading…
Cancel
Save