From 64e0e820a182b949c1f4318944e0a49d5d417da3 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Tue, 12 Mar 2024 10:50:37 -0700 Subject: [PATCH] validate command buffer creation flags This is needed to pass the new command buffer negative tests. --- layers/10_cmdbufemu/emulate.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/layers/10_cmdbufemu/emulate.cpp b/layers/10_cmdbufemu/emulate.cpp index 2fae532..e465ab7 100644 --- a/layers/10_cmdbufemu/emulate.cpp +++ b/layers/10_cmdbufemu/emulate.cpp @@ -1197,6 +1197,7 @@ typedef struct _cl_command_buffer_khr { found_CL_COMMAND_BUFFER_FLAGS_KHR = true; flags = ((const cl_command_buffer_flags_khr*)(check + 1))[0]; + errorCode = validateCreateCommandBufferFlags( flags ); check += 2; } break; @@ -1246,6 +1247,19 @@ typedef struct _cl_command_buffer_khr return cmdbuf && cmdbuf->Magic == cMagic; } + static cl_int validateCreateCommandBufferFlags( + cl_command_buffer_flags_khr flags ) + { + const cl_command_buffer_flags_khr allFlags = + CL_COMMAND_BUFFER_SIMULTANEOUS_USE_KHR; + if( flags & ~allFlags ) + { + return CL_INVALID_VALUE; + } + + return CL_SUCCESS; + } + cl_int retain() { RefCount.fetch_add(1, std::memory_order_relaxed);