diff --git a/layers/10_cmdbufemu/emulate.cpp b/layers/10_cmdbufemu/emulate.cpp index d45c526..2fae532 100644 --- a/layers/10_cmdbufemu/emulate.cpp +++ b/layers/10_cmdbufemu/emulate.cpp @@ -1359,26 +1359,18 @@ typedef struct _cl_command_buffer_khr cl_int checkRecordErrors( cl_command_queue queue, cl_uint num_sync_points_in_wait_list, - const cl_sync_point_khr* sync_point_wait_list, - cl_mutable_command_khr* mutable_handle ) + const cl_sync_point_khr* sync_point_wait_list ) { if( State != CL_COMMAND_BUFFER_STATE_RECORDING_KHR ) { return CL_INVALID_OPERATION; } - if( queue != NULL ) + if( queue != nullptr ) { return CL_INVALID_COMMAND_QUEUE; } -// TODO: Change this to a runtime check? -#if !defined(cl_khr_command_buffer_mutable_dispatch) - if( mutable_handle != NULL ) - { - return CL_INVALID_VALUE; - } -#endif // !defined(cl_khr_command_buffer_mutable_dispatch) - if( ( sync_point_wait_list == NULL && num_sync_points_in_wait_list > 0 ) || - ( sync_point_wait_list != NULL && num_sync_points_in_wait_list == 0 ) ) + if( ( sync_point_wait_list == nullptr && num_sync_points_in_wait_list > 0 ) || + ( sync_point_wait_list != nullptr && num_sync_points_in_wait_list == 0 ) ) { return CL_INVALID_SYNC_POINT_WAIT_LIST_KHR; } @@ -1741,11 +1733,14 @@ cl_int CL_API_CALL clCommandBarrierWithWaitListKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( BarrierWithWaitList::create(cmdbuf, command_queue), @@ -1779,11 +1774,14 @@ cl_int CL_API_CALL clCommandCopyBufferKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( CopyBuffer::create( @@ -1828,11 +1826,14 @@ cl_int CL_API_CALL clCommandCopyBufferRectKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( CopyBufferRect::create( @@ -1877,11 +1878,14 @@ cl_int CL_API_CALL clCommandCopyBufferToImageKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( CopyBufferToImage::create( @@ -1922,11 +1926,14 @@ cl_int CL_API_CALL clCommandCopyImageKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( CopyImage::create( @@ -1967,11 +1974,14 @@ cl_int CL_API_CALL clCommandCopyImageToBufferKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( CopyImageToBuffer::create( @@ -2012,11 +2022,14 @@ cl_int CL_API_CALL clCommandFillBufferKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( FillBuffer::create( @@ -2056,11 +2069,14 @@ cl_int CL_API_CALL clCommandFillImageKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( FillImage::create( @@ -2098,11 +2114,14 @@ cl_int CL_API_CALL clCommandSVMMemcpyKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( SVMMemcpy::create( @@ -2140,11 +2159,14 @@ cl_int CL_API_CALL clCommandSVMMemFillKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } cmdbuf->addCommand( SVMMemFill::create( @@ -2185,11 +2207,16 @@ cl_int CL_API_CALL clCommandNDRangeKernelKHR_EMU( if( cl_int errorCode = cmdbuf->checkRecordErrors( command_queue, num_sync_points_in_wait_list, - sync_point_wait_list, - mutable_handle) ) + sync_point_wait_list) ) { return errorCode; } +#if !defined(cl_khr_command_buffer_mutable_dispatch) + if( mutable_handle != nullptr ) + { + return CL_INVALID_VALUE; + } +#endif // cl_khr_command_buffer_mutable_dispatch cl_int errorCode = CL_SUCCESS; auto command = NDRangeKernel::create(