Skip to content

Commit

Permalink
validate command buffer creation flags (#110)
Browse files Browse the repository at this point in the history
This is needed to pass the new command buffer negative tests.
  • Loading branch information
bashbaug committed Mar 12, 2024
1 parent b877c98 commit 7b0f181
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions layers/10_cmdbufemu/emulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7b0f181

Please sign in to comment.