vkr: bad resource should be fatal

There is no valid reason for the guest to pass bad resource ids.
Because resource creation failures are not propagated back to the guest,
they are the most common reason for the guest to pass bad resource ids.
When that happens, failing earlier makes things easier to debug.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
macos/master
Chia-I Wu 4 years ago
parent eb3705ef65
commit 6d77374d6d
  1. 12
      src/vkr_renderer.c

@ -432,8 +432,10 @@ vkr_dispatch_vkSetReplyCommandStreamMESA(
att = util_hash_table_get(ctx->resource_table, att = util_hash_table_get(ctx->resource_table,
uintptr_to_pointer(args->pStream->resourceId)); uintptr_to_pointer(args->pStream->resourceId));
if (!att) if (!att) {
vkr_cs_decoder_set_fatal(&ctx->decoder);
return; return;
}
vkr_cs_encoder_set_stream(&ctx->encoder, att->resource->iov, att->resource->iov_count, vkr_cs_encoder_set_stream(&ctx->encoder, att->resource->iov, att->resource->iov_count,
args->pStream->offset, args->pStream->size); args->pStream->offset, args->pStream->size);
@ -1959,8 +1961,8 @@ vkr_dispatch_vkAllocateMemory(struct vn_dispatch_context *dispatch,
uint32_t res_id = import_resource_info->resourceId; uint32_t res_id = import_resource_info->resourceId;
struct vkr_resource_attachment *att = struct vkr_resource_attachment *att =
util_hash_table_get(ctx->resource_table, uintptr_to_pointer(res_id)); util_hash_table_get(ctx->resource_table, uintptr_to_pointer(res_id));
if (!att || !att->resource) { if (!att) {
args->ret = VK_ERROR_INVALID_EXTERNAL_HANDLE; vkr_cs_decoder_set_fatal(&ctx->decoder);
return; return;
} }
@ -3840,8 +3842,8 @@ vkr_dispatch_vkGetMemoryResourcePropertiesMESA(
struct vkr_resource_attachment *att = struct vkr_resource_attachment *att =
util_hash_table_get(ctx->resource_table, uintptr_to_pointer(args->resourceId)); util_hash_table_get(ctx->resource_table, uintptr_to_pointer(args->resourceId));
if (!att || !att->resource) { if (!att) {
args->ret = VK_ERROR_INVALID_EXTERNAL_HANDLE; vkr_cs_decoder_set_fatal(&ctx->decoder);
return; return;
} }

Loading…
Cancel
Save