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/gpu/opengl | |
parent | 88926375a0e4e45f72c87b9e487c060ddd3c9216 (diff) |
Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code.
No functional changes.
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r-- | source/blender/gpu/opengl/gl_batch.cc | 18 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_debug.cc | 18 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_drawlist.cc | 18 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_framebuffer.cc | 10 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_immediate.cc | 8 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_shader.cc | 8 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_shader_interface.cc | 4 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_texture.cc | 32 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_uniform_buffer.cc | 4 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_vertex_array.cc | 2 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_vertex_buffer.cc | 8 |
11 files changed, 65 insertions, 65 deletions
diff --git a/source/blender/gpu/opengl/gl_batch.cc b/source/blender/gpu/opengl/gl_batch.cc index b81c2d69122..89486b73b05 100644 --- a/source/blender/gpu/opengl/gl_batch.cc +++ b/source/blender/gpu/opengl/gl_batch.cc @@ -62,11 +62,11 @@ GLVaoCache::~GLVaoCache() void GLVaoCache::init() { - context_ = NULL; - interface_ = NULL; + context_ = nullptr; + interface_ = nullptr; is_dynamic_vao_count = false; for (int i = 0; i < GPU_VAO_STATIC_LEN; i++) { - static_vaos.interfaces[i] = NULL; + static_vaos.interfaces[i] = nullptr; static_vaos.vao_ids[i] = 0; } vao_base_instance_ = 0; @@ -93,7 +93,7 @@ void GLVaoCache::insert(const GLShaderInterface *interface, GLuint vao) else { /* Erase previous entries, they will be added back if drawn again. */ for (int i = 0; i < GPU_VAO_STATIC_LEN; i++) { - if (static_vaos.interfaces[i] != NULL) { + if (static_vaos.interfaces[i] != nullptr) { const_cast<GLShaderInterface *>(static_vaos.interfaces[i])->ref_remove(this); context_->vao_free(static_vaos.vao_ids[i]); } @@ -143,7 +143,7 @@ void GLVaoCache::remove(const GLShaderInterface *interface) if (interfaces[i] == interface) { context_->vao_free(vaos[i]); vaos[i] = 0; - interfaces[i] = NULL; + interfaces[i] = nullptr; break; /* cannot have duplicates */ } } @@ -157,7 +157,7 @@ void GLVaoCache::clear() const GLShaderInterface **interfaces = (is_dynamic_vao_count) ? dynamic_vaos.interfaces : static_vaos.interfaces; /* Early out, nothing to free. */ - if (context_ == NULL) { + if (context_ == nullptr) { return; } @@ -174,7 +174,7 @@ void GLVaoCache::clear() } for (int i = 0; i < count; i++) { - if (interfaces[i] != NULL) { + if (interfaces[i] != nullptr) { const_cast<GLShaderInterface *>(interfaces[i])->ref_remove(this); } } @@ -213,7 +213,7 @@ void GLVaoCache::context_check() BLI_assert(ctx); if (context_ != ctx) { - if (context_ != NULL) { + if (context_ != nullptr) { /* IMPORTANT: Trying to draw a batch in multiple different context will trash the VAO cache. * This has major performance impact and should be avoided in most cases. */ context_->vao_cache_unregister(this); @@ -307,7 +307,7 @@ void GLBatch::bind(int i_first) #if GPU_TRACK_INDEX_RANGE /* Can be removed if GL 4.3 is required. */ - if (!GLContext::fixed_restart_index_support && (elem != NULL)) { + if (!GLContext::fixed_restart_index_support && (elem != nullptr)) { glPrimitiveRestartIndex(this->elem_()->restart_index()); } #endif diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc index 3737321ed90..4e45ff11fc7 100644 --- a/source/blender/gpu/opengl/gl_debug.cc +++ b/source/blender/gpu/opengl/gl_debug.cc @@ -152,8 +152,8 @@ void init_gl_callbacks() SNPRINTF(msg, format, GLEW_VERSION_4_3 ? "OpenGL 4.3" : "KHR_debug extension"); glEnable(GL_DEBUG_OUTPUT); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glDebugMessageCallback((GLDEBUGPROC)debug_callback, NULL); - glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); + glDebugMessageCallback((GLDEBUGPROC)debug_callback, nullptr); + glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE); glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 0, @@ -164,8 +164,8 @@ void init_gl_callbacks() else if (GLEW_ARB_debug_output) { SNPRINTF(msg, format, "ARB_debug_output"); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); - glDebugMessageCallbackARB((GLDEBUGPROCARB)debug_callback, NULL); - glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); + glDebugMessageCallbackARB((GLDEBUGPROCARB)debug_callback, nullptr); + glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, nullptr, GL_TRUE); glDebugMessageInsertARB(GL_DEBUG_SOURCE_APPLICATION_ARB, GL_DEBUG_TYPE_OTHER_ARB, 0, @@ -213,7 +213,7 @@ void check_gl_error(const char *info) default: char msg[256]; SNPRINTF(msg, "Unknown GL error: %x : %s", error, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); break; } } @@ -250,7 +250,7 @@ void check_gl_resources(const char *info) const char *sh_name = ctx->shader->name_get(); char msg[256]; SNPRINTF(msg, "Missing UBO bind at slot %d : %s > %s : %s", i, sh_name, ubo_name, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); } } @@ -262,7 +262,7 @@ void check_gl_resources(const char *info) const char *sh_name = ctx->shader->name_get(); char msg[256]; SNPRINTF(msg, "Missing Texture bind at slot %d : %s > %s : %s", i, sh_name, tex_name, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); } } @@ -274,14 +274,14 @@ void check_gl_resources(const char *info) const char *sh_name = ctx->shader->name_get(); char msg[256]; SNPRINTF(msg, "Missing Image bind at slot %d : %s > %s : %s", i, sh_name, tex_name, info); - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, msg, nullptr); } } } void raise_gl_error(const char *info) { - debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, info, NULL); + debug_callback(0, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH, 0, info, nullptr); } /** \} */ diff --git a/source/blender/gpu/opengl/gl_drawlist.cc b/source/blender/gpu/opengl/gl_drawlist.cc index b0a8af5b482..aecadc4d14a 100644 --- a/source/blender/gpu/opengl/gl_drawlist.cc +++ b/source/blender/gpu/opengl/gl_drawlist.cc @@ -65,13 +65,13 @@ typedef struct GLDrawCommandIndexed { GLDrawList::GLDrawList(int length) { BLI_assert(length > 0); - batch_ = NULL; + batch_ = nullptr; buffer_id_ = 0; command_len_ = 0; command_offset_ = 0; data_offset_ = 0; data_size_ = 0; - data_ = NULL; + data_ = nullptr; if (GLContext::multi_draw_indirect_support) { /* Alloc the biggest possible command list, which is indexed. */ @@ -92,8 +92,8 @@ void GLDrawList::init() { BLI_assert(GLContext::get()); BLI_assert(MDI_ENABLED); - BLI_assert(data_ == NULL); - batch_ = NULL; + BLI_assert(data_ == nullptr); + batch_ = nullptr; command_len_ = 0; if (buffer_id_ == 0) { @@ -105,7 +105,7 @@ void GLDrawList::init() glBindBuffer(GL_DRAW_INDIRECT_BUFFER, buffer_id_); /* If buffer is full, orphan buffer data and start fresh. */ // if (command_offset_ >= data_size_) { - glBufferData(GL_DRAW_INDIRECT_BUFFER, buffer_size_, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_DRAW_INDIRECT_BUFFER, buffer_size_, nullptr, GL_DYNAMIC_DRAW); data_offset_ = 0; // } /* Map the remaining range. */ @@ -123,7 +123,7 @@ void GLDrawList::append(GPUBatch *gpu_batch, int i_first, int i_count) return; } - if (data_ == NULL) { + if (data_ == nullptr) { this->init(); } @@ -177,7 +177,7 @@ void GLDrawList::submit() /* Something's wrong if we get here without MDI support. */ BLI_assert(MDI_ENABLED); BLI_assert(data_); - BLI_assert(GLContext::get()->shader != NULL); + BLI_assert(GLContext::get()->shader != nullptr); /* Only do multi-draw indirect if doing more than 2 drawcall. This avoids the overhead of * buffer mapping if scene is not very instance friendly. BUT we also need to take into @@ -190,7 +190,7 @@ void GLDrawList::submit() glBindBuffer(GL_DRAW_INDIRECT_BUFFER, buffer_id_); glFlushMappedBufferRange(GL_DRAW_INDIRECT_BUFFER, 0, command_offset_); glUnmapBuffer(GL_DRAW_INDIRECT_BUFFER); - data_ = NULL; /* Unmapped */ + data_ = nullptr; /* Unmapped */ data_offset_ += command_offset_; batch_->bind(0); @@ -227,7 +227,7 @@ void GLDrawList::submit() /* Do not submit this buffer again. */ command_len_ = 0; /* Avoid keeping reference to the batch. */ - batch_ = NULL; + batch_ = nullptr; } /** \} */ diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index 661b976771f..cbb332388dc 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -72,7 +72,7 @@ GLFrameBuffer::GLFrameBuffer( GLFrameBuffer::~GLFrameBuffer() { - if (context_ == NULL) { + if (context_ == nullptr) { return; } @@ -176,7 +176,7 @@ void GLFrameBuffer::update_attachments() first_attachment = (attach.tex) ? type : first_attachment; } - if (attach.tex == NULL) { + if (attach.tex == nullptr) { glFramebufferTexture(GL_FRAMEBUFFER, gl_attachment, 0, 0); continue; } @@ -208,7 +208,7 @@ void GLFrameBuffer::update_attachments() for (int i = ARRAY_SIZE(gl_attachments_) - 1; i >= 0; --i) { GPUAttachmentType type = GPU_FB_COLOR_ATTACHMENT0 + i; GPUAttachment &attach = attachments_[type]; - if (attach.tex != NULL) { + if (attach.tex != nullptr) { gl_tex = static_cast<GLTexture *>(unwrap(attach.tex))->tex_id_; } else if (gl_tex != 0) { @@ -232,7 +232,7 @@ void GLFrameBuffer::update_attachments() glDrawBuffers(ARRAY_SIZE(gl_attachments_), gl_attachments_); if (G.debug & G_DEBUG_GPU) { - BLI_assert(this->check(NULL)); + BLI_assert(this->check(nullptr)); } } @@ -410,7 +410,7 @@ void GLFrameBuffer::clear_multi(const float (*clear_cols)[4]) * TODO(fclem): fix this insecurity? */ int type = GPU_FB_COLOR_ATTACHMENT0; for (int i = 0; type < GPU_FB_MAX_ATTACHMENT; i++, type++) { - if (attachments_[type].tex != NULL) { + if (attachments_[type].tex != nullptr) { this->clear_attachment(GPU_FB_COLOR_ATTACHMENT0 + i, GPU_DATA_FLOAT, clear_cols[i]); } } diff --git a/source/blender/gpu/opengl/gl_immediate.cc b/source/blender/gpu/opengl/gl_immediate.cc index 4350902de73..63e3162944d 100644 --- a/source/blender/gpu/opengl/gl_immediate.cc +++ b/source/blender/gpu/opengl/gl_immediate.cc @@ -50,12 +50,12 @@ GLImmediate::GLImmediate() buffer.buffer_size = DEFAULT_INTERNAL_BUFFER_SIZE; glGenBuffers(1, &buffer.vbo_id); glBindBuffer(GL_ARRAY_BUFFER, buffer.vbo_id); - glBufferData(GL_ARRAY_BUFFER, buffer.buffer_size, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, buffer.buffer_size, nullptr, GL_DYNAMIC_DRAW); buffer_strict.buffer_size = DEFAULT_INTERNAL_BUFFER_SIZE; glGenBuffers(1, &buffer_strict.vbo_id); glBindBuffer(GL_ARRAY_BUFFER, buffer_strict.vbo_id); - glBufferData(GL_ARRAY_BUFFER, buffer_strict.buffer_size, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, buffer_strict.buffer_size, nullptr, GL_DYNAMIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); @@ -112,7 +112,7 @@ uchar *GLImmediate::begin() } else { /* orphan this buffer & start with a fresh one */ - glBufferData(GL_ARRAY_BUFFER, buffer_size(), NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, buffer_size(), nullptr, GL_DYNAMIC_DRAW); buffer_offset() = 0; } @@ -129,7 +129,7 @@ uchar *GLImmediate::begin() access |= GL_MAP_FLUSH_EXPLICIT_BIT; } void *data = glMapBufferRange(GL_ARRAY_BUFFER, buffer_offset(), bytes_needed, access); - BLI_assert(data != NULL); + BLI_assert(data != nullptr); bytes_mapped_ = bytes_needed; return (uchar *)data; diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index 57b9cac3f83..cc5f83228d6 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -123,14 +123,14 @@ GLuint GLShader::create_shader_stage(GLenum gl_stage, MutableSpan<const char *> /* Patch the shader code using the first source slot. */ sources[0] = glsl_patch_get(); - glShaderSource(shader, sources.size(), sources.data(), NULL); + glShaderSource(shader, sources.size(), sources.data(), nullptr); glCompileShader(shader); GLint status; glGetShaderiv(shader, GL_COMPILE_STATUS, &status); if (!status || (G.debug & G_DEBUG_GPU)) { char log[5000] = ""; - glGetShaderInfoLog(shader, sizeof(log), NULL, log); + glGetShaderInfoLog(shader, sizeof(log), nullptr, log); if (log[0] != '\0') { switch (gl_stage) { case GL_VERTEX_SHADER: @@ -184,7 +184,7 @@ bool GLShader::finalize() glGetProgramiv(shader_program_, GL_LINK_STATUS, &status); if (!status) { char log[5000]; - glGetProgramInfoLog(shader_program_, sizeof(log), NULL, log); + glGetProgramInfoLog(shader_program_, sizeof(log), nullptr, log); Span<const char *> sources; this->print_log(sources, log, "Linking", true); return false; @@ -409,7 +409,7 @@ void GLShader::vertformat_from_shader(GPUVertFormat *format) const char name[256]; GLenum gl_type; GLint size; - glGetActiveAttrib(shader_program_, i, sizeof(name), NULL, &size, &gl_type, name); + glGetActiveAttrib(shader_program_, i, sizeof(name), nullptr, &size, &gl_type, name); /* Ignore OpenGL names like `gl_BaseInstanceARB`, `gl_InstanceID` and `gl_VertexID`. */ if (glGetAttribLocation(shader_program_, name) == -1) { diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index 2d55c222e9c..9533639b133 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -267,7 +267,7 @@ GLShaderInterface::GLShaderInterface(GLuint program) for (int32_t u_int = 0; u_int < GPU_NUM_UNIFORM_BLOCKS; u_int++) { GPUUniformBlockBuiltin u = static_cast<GPUUniformBlockBuiltin>(u_int); const ShaderInput *block = this->ubo_get(builtin_uniform_block_name(u)); - builtin_blocks_[u] = (block != NULL) ? block->binding : -1; + builtin_blocks_[u] = (block != nullptr) ? block->binding : -1; } MEM_freeN(uniforms_from_blocks); @@ -285,7 +285,7 @@ GLShaderInterface::GLShaderInterface(GLuint program) GLShaderInterface::~GLShaderInterface() { for (auto *ref : refs_) { - if (ref != NULL) { + if (ref != nullptr) { ref->remove(this); } } diff --git a/source/blender/gpu/opengl/gl_texture.cc b/source/blender/gpu/opengl/gl_texture.cc index 993bb56612c..021376aaea6 100644 --- a/source/blender/gpu/opengl/gl_texture.cc +++ b/source/blender/gpu/opengl/gl_texture.cc @@ -44,7 +44,7 @@ namespace blender::gpu { GLTexture::GLTexture(const char *name) : Texture(name) { - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); glGenTextures(1, &tex_id_); } @@ -55,7 +55,7 @@ GLTexture::~GLTexture() GPU_framebuffer_free(framebuffer_); } GLContext *ctx = GLContext::get(); - if (ctx != NULL && is_bound_) { + if (ctx != nullptr && is_bound_) { /* This avoid errors when the texture is still inside the bound texture array. */ ctx->state_manager->texture_unbind(this); } @@ -148,7 +148,7 @@ void GLTexture::ensure_mipmaps(int miplvl) if (type_ == GPU_TEXTURE_CUBE) { for (int i = 0; i < d; i++) { GLenum target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; - glTexImage2D(target, mip, internal_format, w, h, 0, gl_format, gl_type, NULL); + glTexImage2D(target, mip, internal_format, w, h, 0, gl_format, gl_type, nullptr); } } else if (format_flag_ & GPU_FORMAT_COMPRESSED) { @@ -156,13 +156,13 @@ void GLTexture::ensure_mipmaps(int miplvl) switch (dimensions) { default: case 1: - glCompressedTexImage1D(target_, mip, internal_format, w, 0, size, NULL); + glCompressedTexImage1D(target_, mip, internal_format, w, 0, size, nullptr); break; case 2: - glCompressedTexImage2D(target_, mip, internal_format, w, h, 0, size, NULL); + glCompressedTexImage2D(target_, mip, internal_format, w, h, 0, size, nullptr); break; case 3: - glCompressedTexImage3D(target_, mip, internal_format, w, h, d, 0, size, NULL); + glCompressedTexImage3D(target_, mip, internal_format, w, h, d, 0, size, nullptr); break; } } @@ -170,13 +170,13 @@ void GLTexture::ensure_mipmaps(int miplvl) switch (dimensions) { default: case 1: - glTexImage1D(target_, mip, internal_format, w, 0, gl_format, gl_type, NULL); + glTexImage1D(target_, mip, internal_format, w, 0, gl_format, gl_type, nullptr); break; case 2: - glTexImage2D(target_, mip, internal_format, w, h, 0, gl_format, gl_type, NULL); + glTexImage2D(target_, mip, internal_format, w, h, 0, gl_format, gl_type, nullptr); break; case 3: - glTexImage3D(target_, mip, internal_format, w, h, d, 0, gl_format, gl_type, NULL); + glTexImage3D(target_, mip, internal_format, w, h, d, 0, gl_format, gl_type, nullptr); break; } } @@ -231,7 +231,7 @@ void GLTexture::update_sub( int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) { BLI_assert(validate_data_format(format_, type)); - BLI_assert(data != NULL); + BLI_assert(data != nullptr); this->ensure_mipmaps(mip); @@ -617,13 +617,13 @@ bool GLTexture::proxy_check(int mip) switch (dimensions) { default: case 1: - glCompressedTexImage1D(gl_proxy, mip, size[0], 0, gl_format, img_size, NULL); + glCompressedTexImage1D(gl_proxy, mip, size[0], 0, gl_format, img_size, nullptr); break; case 2: - glCompressedTexImage2D(gl_proxy, mip, UNPACK2(size), 0, gl_format, img_size, NULL); + glCompressedTexImage2D(gl_proxy, mip, UNPACK2(size), 0, gl_format, img_size, nullptr); break; case 3: - glCompressedTexImage3D(gl_proxy, mip, UNPACK3(size), 0, gl_format, img_size, NULL); + glCompressedTexImage3D(gl_proxy, mip, UNPACK3(size), 0, gl_format, img_size, nullptr); break; } } @@ -631,13 +631,13 @@ bool GLTexture::proxy_check(int mip) switch (dimensions) { default: case 1: - glTexImage1D(gl_proxy, mip, internal_format, size[0], 0, gl_format, gl_type, NULL); + glTexImage1D(gl_proxy, mip, internal_format, size[0], 0, gl_format, gl_type, nullptr); break; case 2: - glTexImage2D(gl_proxy, mip, internal_format, UNPACK2(size), 0, gl_format, gl_type, NULL); + glTexImage2D(gl_proxy, mip, internal_format, UNPACK2(size), 0, gl_format, gl_type, nullptr); break; case 3: - glTexImage3D(gl_proxy, mip, internal_format, UNPACK3(size), 0, gl_format, gl_type, NULL); + glTexImage3D(gl_proxy, mip, internal_format, UNPACK3(size), 0, gl_format, gl_type, nullptr); break; } } diff --git a/source/blender/gpu/opengl/gl_uniform_buffer.cc b/source/blender/gpu/opengl/gl_uniform_buffer.cc index 7f404880092..ecb233f2e5a 100644 --- a/source/blender/gpu/opengl/gl_uniform_buffer.cc +++ b/source/blender/gpu/opengl/gl_uniform_buffer.cc @@ -61,7 +61,7 @@ void GLUniformBuf::init() glGenBuffers(1, &ubo_id_); glBindBuffer(GL_UNIFORM_BUFFER, ubo_id_); - glBufferData(GL_UNIFORM_BUFFER, size_in_bytes_, NULL, GL_DYNAMIC_DRAW); + glBufferData(GL_UNIFORM_BUFFER, size_in_bytes_, nullptr, GL_DYNAMIC_DRAW); debug::object_label(GL_UNIFORM_BUFFER, ubo_id_, name_); } @@ -97,7 +97,7 @@ void GLUniformBuf::bind(int slot) this->init(); } - if (data_ != NULL) { + if (data_ != nullptr) { this->update(data_); MEM_SAFE_FREE(data_); } diff --git a/source/blender/gpu/opengl/gl_vertex_array.cc b/source/blender/gpu/opengl/gl_vertex_array.cc index 7585a327b3b..ea2770f099d 100644 --- a/source/blender/gpu/opengl/gl_vertex_array.cc +++ b/source/blender/gpu/opengl/gl_vertex_array.cc @@ -70,7 +70,7 @@ static uint16_t vbo_bind(const ShaderInterface *interface, const char *name = GPU_vertformat_attr_name_get(format, a, n_idx); const ShaderInput *input = interface->attr_get(name); - if (input == NULL) { + if (input == nullptr) { continue; } diff --git a/source/blender/gpu/opengl/gl_vertex_buffer.cc b/source/blender/gpu/opengl/gl_vertex_buffer.cc index 74640162a0b..a56d5269fde 100644 --- a/source/blender/gpu/opengl/gl_vertex_buffer.cc +++ b/source/blender/gpu/opengl/gl_vertex_buffer.cc @@ -52,7 +52,7 @@ void GLVertBuf::release_data() void GLVertBuf::duplicate_data(VertBuf *dst_) { - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); GLVertBuf *src = this; GLVertBuf *dst = static_cast<GLVertBuf *>(dst_); @@ -61,7 +61,7 @@ void GLVertBuf::duplicate_data(VertBuf *dst_) glGenBuffers(1, &dst->vbo_id_); glBindBuffer(GL_COPY_WRITE_BUFFER, dst->vbo_id_); - glBufferData(GL_COPY_WRITE_BUFFER, dst->vbo_size_, NULL, to_gl(dst->usage_)); + glBufferData(GL_COPY_WRITE_BUFFER, dst->vbo_size_, nullptr, to_gl(dst->usage_)); glBindBuffer(GL_COPY_READ_BUFFER, src->vbo_id_); @@ -82,7 +82,7 @@ void GLVertBuf::upload_data() void GLVertBuf::bind() { - BLI_assert(GLContext::get() != NULL); + BLI_assert(GLContext::get() != nullptr); if (vbo_id_ == 0) { glGenBuffers(1, &vbo_id_); @@ -93,7 +93,7 @@ void GLVertBuf::bind() if (flag & GPU_VERTBUF_DATA_DIRTY) { vbo_size_ = this->size_used_get(); /* Orphan the vbo to avoid sync then upload data. */ - glBufferData(GL_ARRAY_BUFFER, vbo_size_, NULL, to_gl(usage_)); + glBufferData(GL_ARRAY_BUFFER, vbo_size_, nullptr, to_gl(usage_)); glBufferSubData(GL_ARRAY_BUFFER, 0, vbo_size_, data); memory_usage += vbo_size_; |