diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 19:49:09 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-11-06 20:08:25 +0300 |
commit | 16732def37c5a66f3ea28dbe247b09cc6bca6677 (patch) | |
tree | 5d14f5c920a1411e336bd80b12becbb3f73de19a /source/blender/compositor/intern | |
parent | 88926375a0e4e45f72c87b9e487c060ddd3c9216 (diff) |
Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.
No functional changes.
Diffstat (limited to 'source/blender/compositor/intern')
13 files changed, 78 insertions, 78 deletions
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp index 26fe1ba0bc3..7ea12866148 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.cpp +++ b/source/blender/compositor/intern/COM_CPUDevice.cpp @@ -32,5 +32,5 @@ void CPUDevice::execute(WorkPackage *work) executionGroup->getOutputOperation()->executeRegion(&rect, chunkNumber); - executionGroup->finalizeChunkExecution(chunkNumber, NULL); + executionGroup->finalizeChunkExecution(chunkNumber, nullptr); } diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp index 3d55fcba086..52e705ffb79 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cpp +++ b/source/blender/compositor/intern/COM_CompositorContext.cpp @@ -22,13 +22,13 @@ CompositorContext::CompositorContext() { - this->m_scene = NULL; - this->m_rd = NULL; + this->m_scene = nullptr; + this->m_rd = nullptr; this->m_quality = COM_QUALITY_HIGH; this->m_hasActiveOpenCLDevices = false; this->m_fastCalculation = false; - this->m_viewSettings = NULL; - this->m_displaySettings = NULL; + this->m_viewSettings = nullptr; + this->m_displaySettings = nullptr; } int CompositorContext::getFramenumber() const diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index 15a52d10071..f7250de8566 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -133,11 +133,11 @@ bool Converter::is_fast_node(bNode *b_node) Node *Converter::convert(bNode *b_node) { - Node *node = NULL; + Node *node = nullptr; /* ignore undefined nodes with missing or invalid node data */ if (!nodeIsRegistered(b_node)) { - return NULL; + return nullptr; } switch (b_node->type) { @@ -439,7 +439,7 @@ NodeOperation *Converter::convertDataType(NodeOperationOutput *from, NodeOperati return new ConvertVectorToColorOperation(); } - return NULL; + return nullptr; } void Converter::convertResolution(NodeOperationBuilder &builder, @@ -498,8 +498,8 @@ void Converter::convertResolution(NodeOperationBuilder &builder, } if (doCenter) { - NodeOperation *first = NULL; - ScaleOperation *scaleOperation = NULL; + NodeOperation *first = nullptr; + ScaleOperation *scaleOperation = nullptr; if (doScale) { scaleOperation = new ScaleOperation(); scaleOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE); diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index ad980177ae5..27cec28f5d5 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -45,8 +45,8 @@ ExecutionGroup::ExecutionGroup() { this->m_isOutput = false; this->m_complex = false; - this->m_chunkExecutionStates = NULL; - this->m_bTree = NULL; + this->m_chunkExecutionStates = nullptr; + this->m_bTree = nullptr; this->m_height = 0; this->m_width = 0; this->m_cachedMaxReadBufferOffset = 0; @@ -121,13 +121,13 @@ NodeOperation *ExecutionGroup::getOutputOperation() const void ExecutionGroup::initExecution() { - if (this->m_chunkExecutionStates != NULL) { + if (this->m_chunkExecutionStates != nullptr) { MEM_freeN(this->m_chunkExecutionStates); } unsigned int index; determineNumberOfChunks(); - this->m_chunkExecutionStates = NULL; + this->m_chunkExecutionStates = nullptr; if (this->m_numberOfChunks != 0) { this->m_chunkExecutionStates = (ChunkExecutionState *)MEM_mallocN( sizeof(ChunkExecutionState) * this->m_numberOfChunks, __func__); @@ -152,15 +152,15 @@ void ExecutionGroup::initExecution() void ExecutionGroup::deinitExecution() { - if (this->m_chunkExecutionStates != NULL) { + if (this->m_chunkExecutionStates != nullptr) { MEM_freeN(this->m_chunkExecutionStates); - this->m_chunkExecutionStates = NULL; + this->m_chunkExecutionStates = nullptr; } this->m_numberOfChunks = 0; this->m_numberOfXChunks = 0; this->m_numberOfYChunks = 0; this->m_cachedReadOperations.clear(); - this->m_bTree = NULL; + this->m_bTree = nullptr; } void ExecutionGroup::determineResolution(unsigned int resolution[2]) { @@ -415,7 +415,7 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo MemoryBuffer *buffer = memoryBuffers[index]; if (buffer) { if (buffer->isTemporarily()) { - memoryBuffers[index] = NULL; + memoryBuffers[index] = nullptr; delete buffer; } } @@ -478,7 +478,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int /*chunkNumber*/, rcti *re MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect); return buffer; } - return NULL; + return nullptr; } bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area) @@ -562,7 +562,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChun determineDependingAreaOfInterest(&rect, readOperation, &area); ExecutionGroup *group = memoryProxy->getExecutor(); - if (group != NULL) { + if (group != nullptr) { if (!group->scheduleAreaWhenPossible(graph, &area)) { canBeExecuted = false; } diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index f58d7a768cc..a13db6bb09e 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -83,7 +83,7 @@ MemoryBuffer::MemoryBuffer(DataType dataType, rcti *rect) this->m_width = BLI_rcti_size_x(&this->m_rect); this->m_height = BLI_rcti_size_y(&this->m_rect); this->m_height = this->m_rect.ymax - this->m_rect.ymin; - this->m_memoryProxy = NULL; + this->m_memoryProxy = nullptr; this->m_chunkNumber = -1; this->m_num_channels = determine_num_channels(dataType); this->m_buffer = (float *)MEM_mallocN_aligned( @@ -145,7 +145,7 @@ MemoryBuffer::~MemoryBuffer() { if (this->m_buffer) { MEM_freeN(this->m_buffer); - this->m_buffer = NULL; + this->m_buffer = nullptr; } } diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cpp b/source/blender/compositor/intern/COM_MemoryProxy.cpp index b73bac469d0..7d590cd0ef6 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.cpp +++ b/source/blender/compositor/intern/COM_MemoryProxy.cpp @@ -20,8 +20,8 @@ MemoryProxy::MemoryProxy(DataType datatype) { - this->m_writeBufferOperation = NULL; - this->m_executor = NULL; + this->m_writeBufferOperation = nullptr; + this->m_executor = nullptr; this->m_datatype = datatype; } @@ -40,6 +40,6 @@ void MemoryProxy::free() { if (this->m_buffer) { delete this->m_buffer; - this->m_buffer = NULL; + this->m_buffer = nullptr; } } diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 30ebd7e0d4b..74aefaf0e6d 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -37,14 +37,14 @@ **************/ Node::Node(bNode *editorNode, bool create_sockets) - : m_editorNodeTree(NULL), + : m_editorNodeTree(nullptr), m_editorNode(editorNode), m_inActiveGroup(false), m_instanceKey(NODE_INSTANCE_KEY_NONE) { if (create_sockets) { bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first; - while (input != NULL) { + while (input != nullptr) { DataType dt = COM_DT_VALUE; if (input->type == SOCK_RGBA) { dt = COM_DT_COLOR; @@ -57,7 +57,7 @@ Node::Node(bNode *editorNode, bool create_sockets) input = input->next; } bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first; - while (output != NULL) { + while (output != nullptr) { DataType dt = COM_DT_VALUE; if (output->type == SOCK_RGBA) { dt = COM_DT_COLOR; @@ -86,7 +86,7 @@ Node::~Node() void Node::addInputSocket(DataType datatype) { - this->addInputSocket(datatype, NULL); + this->addInputSocket(datatype, nullptr); } void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket) @@ -97,7 +97,7 @@ void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket) void Node::addOutputSocket(DataType datatype) { - this->addOutputSocket(datatype, NULL); + this->addOutputSocket(datatype, nullptr); } void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket) { @@ -121,27 +121,27 @@ bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) { bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first; int index = 0; - while (bSock != NULL) { + while (bSock != nullptr) { if (index == editorNodeInputSocketIndex) { return bSock; } index++; bSock = bSock->next; } - return NULL; + return nullptr; } bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex) { bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->outputs.first; int index = 0; - while (bSock != NULL) { + while (bSock != nullptr) { if (index == editorNodeOutputSocketIndex) { return bSock; } index++; bSock = bSock->next; } - return NULL; + return nullptr; } /******************* @@ -149,7 +149,7 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex) *******************/ NodeInput::NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype) - : m_node(node), m_editorSocket(b_socket), m_datatype(datatype), m_link(NULL) + : m_node(node), m_editorSocket(b_socket), m_datatype(datatype), m_link(nullptr) { } diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp index fe680f61a90..b604b8ced88 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.cpp +++ b/source/blender/compositor/intern/COM_NodeGraph.cpp @@ -61,7 +61,7 @@ bNodeSocket *NodeGraph::find_b_node_input(bNode *b_node, const char *identifier) return b_sock; } } - return NULL; + return nullptr; } bNodeSocket *NodeGraph::find_b_node_output(bNode *b_node, const char *identifier) @@ -71,7 +71,7 @@ bNodeSocket *NodeGraph::find_b_node_output(bNode *b_node, const char *identifier return b_sock; } } - return NULL; + return nullptr; } void NodeGraph::add_node(Node *node, @@ -179,7 +179,7 @@ NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_s } } } - return NULL; + return nullptr; } void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink) diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp index 4e3c5d2df6c..0842721a9e5 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cpp +++ b/source/blender/compositor/intern/COM_NodeOperation.cpp @@ -36,7 +36,7 @@ NodeOperation::NodeOperation() this->m_height = 0; this->m_isResolutionSet = false; this->m_openCL = false; - this->m_btree = NULL; + this->m_btree = nullptr; } NodeOperation::~NodeOperation() @@ -146,7 +146,7 @@ NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex) return &input->getLink()->getOperation(); } - return NULL; + return nullptr; } void NodeOperation::getConnectedInputSockets(Inputs *sockets) @@ -199,7 +199,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, InputResizeMode resizeMode) - : m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(NULL) + : m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(nullptr) { } @@ -209,7 +209,7 @@ SocketReader *NodeOperationInput::getReader() return &m_link->getOperation(); } - return NULL; + return nullptr; } void NodeOperationInput::determineResolution(unsigned int resolution[2], diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp index 53a6d115e97..1237e728079 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cpp @@ -38,7 +38,7 @@ #include "COM_NodeOperationBuilder.h" /* own include */ NodeOperationBuilder::NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree) - : m_context(context), m_current_node(NULL), m_active_viewer(NULL) + : m_context(context), m_current_node(nullptr), m_active_viewer(nullptr) { m_graph.from_bNodeTree(*context, b_nodetree); } @@ -61,7 +61,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) node->convertToOperations(converter, *m_context); } - m_current_node = NULL; + m_current_node = nullptr; /* The input map constructed by nodes maps operation inputs to node inputs. * Inverting yields a map of node inputs to all connected operation inputs, @@ -168,7 +168,7 @@ void NodeOperationBuilder::removeInputLink(NodeOperationInput *to) Link &link = *it; if (link.to() == to) { /* unregister with the input */ - to->setLink(NULL); + to->setLink(nullptr); m_links.erase(it); return; @@ -203,15 +203,15 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const BLI_assert(m_current_node); if (!(m_current_node->getbNode()->flag & NODE_PREVIEW)) { - return NULL; + return nullptr; } /* previews only in the active group */ if (!m_current_node->isInActiveGroup()) { - return NULL; + return nullptr; } /* do not calculate previews of hidden nodes */ if (m_current_node->getbNode()->flag & NODE_HIDDEN) { - return NULL; + return nullptr; } bNodeInstanceHash *previews = m_context->getPreviewHash(); @@ -223,7 +223,7 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const return operation; } - return NULL; + return nullptr; } void NodeOperationBuilder::addPreview(NodeOperationOutput *output) @@ -476,7 +476,7 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation } } } - return NULL; + return nullptr; } void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/, @@ -526,13 +526,13 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, return; } - WriteBufferOperation *writeOperation = NULL; + WriteBufferOperation *writeOperation = nullptr; for (OpInputs::const_iterator it = targets.begin(); it != targets.end(); ++it) { NodeOperationInput *target = *it; /* try to find existing write buffer operation */ if (target->getOperation().isWriteBufferOperation()) { - BLI_assert(writeOperation == NULL); /* there should only be one write op connected */ + BLI_assert(writeOperation == nullptr); /* there should only be one write op connected */ writeOperation = (WriteBufferOperation *)(&target->getOperation()); } else { @@ -728,7 +728,7 @@ void NodeOperationBuilder::group_operations() ReadBufferOperation *read_op = (ReadBufferOperation *)op; MemoryProxy *memproxy = read_op->getMemoryProxy(); - if (memproxy->getExecutor() == NULL) { + if (memproxy->getExecutor() == nullptr) { ExecutionGroup *group = make_group(memproxy->getWriteBufferOperation()); memproxy->setExecutor(group); } diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index 2529637801d..35579bac925 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -41,7 +41,7 @@ OpenCLDevice::OpenCLDevice(cl_context context, this->m_device = device; this->m_context = context; this->m_program = program; - this->m_queue = NULL; + this->m_queue = nullptr; this->m_vendorID = vendorId; } @@ -196,7 +196,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo (size_t)outputMemoryBuffer->getHeight(), }; - error = clEnqueueNDRangeKernel(this->m_queue, kernel, 2, NULL, size, 0, 0, 0, NULL); + error = clEnqueueNDRangeKernel(this->m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -243,7 +243,7 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - error = clEnqueueNDRangeKernel(this->m_queue, kernel, 2, NULL, size, 0, 0, 0, NULL); + error = clEnqueueNDRangeKernel(this->m_queue, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp index 98239166860..5febf3802de 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cpp @@ -20,7 +20,7 @@ SingleThreadedOperation::SingleThreadedOperation() { - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; setComplex(true); } @@ -39,7 +39,7 @@ void SingleThreadedOperation::deinitExecution() deinitMutex(); if (this->m_cachedInstance) { delete this->m_cachedInstance; - this->m_cachedInstance = NULL; + this->m_cachedInstance = nullptr; } } void *SingleThreadedOperation::initializeTileData(rcti *rect) @@ -49,7 +49,7 @@ void *SingleThreadedOperation::initializeTileData(rcti *rect) } lockMutex(); - if (this->m_cachedInstance == NULL) { + if (this->m_cachedInstance == nullptr) { // this->m_cachedInstance = createMemoryBuffer(rect); } diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index 570e1eeba20..450b64eec5a 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -80,7 +80,7 @@ void *WorkScheduler::thread_execute_cpu(void *data) delete work; } - return NULL; + return nullptr; } void *WorkScheduler::thread_execute_gpu(void *data) @@ -93,7 +93,7 @@ void *WorkScheduler::thread_execute_gpu(void *data) delete work; } - return NULL; + return nullptr; } #endif @@ -166,13 +166,13 @@ void WorkScheduler::stop() BLI_thread_queue_nowait(g_cpuqueue); BLI_threadpool_end(&g_cputhreads); BLI_thread_queue_free(g_cpuqueue); - g_cpuqueue = NULL; + g_cpuqueue = nullptr; # ifdef COM_OPENCL_ENABLED if (g_openclActive) { BLI_thread_queue_nowait(g_gpuqueue); BLI_threadpool_end(&g_gputhreads); BLI_thread_queue_free(g_gpuqueue); - g_gpuqueue = NULL; + g_gpuqueue = nullptr; } # endif #endif @@ -234,8 +234,8 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) # ifdef COM_OPENCL_ENABLED /* deinitialize OpenCL GPU's */ if (use_opencl && !g_openclInitialized) { - g_context = NULL; - g_program = NULL; + g_context = nullptr; + g_program = nullptr; /* This will check for errors and skip if already initialized. */ if (clewInit() != CLEW_SUCCESS) { @@ -245,7 +245,7 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) if (clCreateContextFromType) { cl_uint numberOfPlatforms = 0; cl_int error; - error = clGetPlatformIDs(0, 0, &numberOfPlatforms); + error = clGetPlatformIDs(0, nullptr, &numberOfPlatforms); if (error == -1001) { } /* GPU not supported */ else if (error != CL_SUCCESS) { @@ -256,40 +256,40 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) } cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN( sizeof(cl_platform_id) * numberOfPlatforms, __func__); - error = clGetPlatformIDs(numberOfPlatforms, platforms, 0); + error = clGetPlatformIDs(numberOfPlatforms, platforms, nullptr); unsigned int indexPlatform; for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) { cl_platform_id platform = platforms[indexPlatform]; cl_uint numberOfDevices = 0; - clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices); + clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, nullptr, &numberOfDevices); if (numberOfDevices <= 0) { continue; } cl_device_id *cldevices = (cl_device_id *)MEM_mallocN( sizeof(cl_device_id) * numberOfDevices, __func__); - clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, 0); + clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, nullptr); g_context = clCreateContext( - NULL, numberOfDevices, cldevices, clContextError, NULL, &error); + nullptr, numberOfDevices, cldevices, clContextError, nullptr, &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - const char *cl_str[2] = {datatoc_COM_OpenCLKernels_cl, NULL}; - g_program = clCreateProgramWithSource(g_context, 1, cl_str, 0, &error); - error = clBuildProgram(g_program, numberOfDevices, cldevices, 0, 0, 0); + const char *cl_str[2] = {datatoc_COM_OpenCLKernels_cl, nullptr}; + g_program = clCreateProgramWithSource(g_context, 1, cl_str, nullptr, &error); + error = clBuildProgram(g_program, numberOfDevices, cldevices, nullptr, nullptr, nullptr); if (error != CL_SUCCESS) { cl_int error2; size_t ret_val_size = 0; printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); error2 = clGetProgramBuildInfo( - g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size); + g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, nullptr, &ret_val_size); if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } char *build_log = (char *)MEM_mallocN(sizeof(char) * ret_val_size + 1, __func__); error2 = clGetProgramBuildInfo( - g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL); + g_program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, nullptr); if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -303,7 +303,7 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads) cl_device_id device = cldevices[indexDevices]; cl_int vendorID = 0; cl_int error2 = clGetDeviceInfo( - device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, NULL); + device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, nullptr); if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error2, clewErrorString(error2)); } @@ -351,11 +351,11 @@ void WorkScheduler::deinitialize() } if (g_program) { clReleaseProgram(g_program); - g_program = NULL; + g_program = nullptr; } if (g_context) { clReleaseContext(g_context); - g_context = NULL; + g_context = nullptr; } g_openclInitialized = false; |