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/intern/gpu_framebuffer.cc | |
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/intern/gpu_framebuffer.cc')
-rw-r--r-- | source/blender/gpu/intern/gpu_framebuffer.cc | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index a16856e0dec..dca1b169307 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -58,7 +58,7 @@ FrameBuffer::FrameBuffer(const char *name) dirty_state_ = true; for (int i = 0; i < ARRAY_SIZE(attachments_); i++) { - attachments_[i].tex = NULL; + attachments_[i].tex = nullptr; attachments_[i].mip = -1; attachments_[i].layer = -1; } @@ -67,7 +67,7 @@ FrameBuffer::FrameBuffer(const char *name) FrameBuffer::~FrameBuffer() { for (int i = 0; i < ARRAY_SIZE(attachments_); i++) { - if (attachments_[i].tex != NULL) { + if (attachments_[i].tex != nullptr) { reinterpret_cast<Texture *>(attachments_[i].tex)->detach_from(this); } } @@ -150,7 +150,7 @@ void FrameBuffer::recursive_downsample(int max_lvl, /* Replace attached mip-level for each attachment. */ for (int att = 0; att < ARRAY_SIZE(attachments_); att++) { Texture *tex = reinterpret_cast<Texture *>(attachments_[att].tex); - if (tex != NULL) { + if (tex != nullptr) { /* Some Intel HDXXX have issue with rendering to a mipmap that is below * the texture GL_TEXTURE_MAX_LEVEL. So even if it not correct, in this case * we allow GL_TEXTURE_MAX_LEVEL to be one level lower. In practice it does work! */ @@ -169,7 +169,7 @@ void FrameBuffer::recursive_downsample(int max_lvl, } for (int att = 0; att < ARRAY_SIZE(attachments_); att++) { - if (attachments_[att].tex != NULL) { + if (attachments_[att].tex != nullptr) { /* Reset mipmap level range. */ reinterpret_cast<Texture *>(attachments_[att].tex)->mip_range_set(0, max_lvl); /* Reset base level. NOTE: might not be the one bound at the start of this function. */ @@ -242,14 +242,14 @@ void GPU_framebuffer_restore(void) GPUFrameBuffer *GPU_framebuffer_active_get(void) { Context *ctx = Context::get(); - return wrap(ctx ? ctx->active_fb : NULL); + return wrap(ctx ? ctx->active_fb : nullptr); } /* Returns the default frame-buffer. Will always exists even if it's just a dummy. */ GPUFrameBuffer *GPU_framebuffer_back_get(void) { Context *ctx = Context::get(); - return wrap(ctx ? ctx->back_left : NULL); + return wrap(ctx ? ctx->back_left : nullptr); } bool GPU_framebuffer_bound(GPUFrameBuffer *gpu_fb) @@ -314,7 +314,7 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb, if (depth_attachment.mip == -1) { /* GPU_ATTACHMENT_LEAVE */ } - else if (depth_attachment.tex == NULL) { + else if (depth_attachment.tex == nullptr) { /* GPU_ATTACHMENT_NONE: Need to clear both targets. */ fb->attachment_set(GPU_FB_DEPTH_STENCIL_ATTACHMENT, depth_attachment); fb->attachment_set(GPU_FB_DEPTH_ATTACHMENT, depth_attachment); @@ -487,7 +487,7 @@ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb, static struct { GPUFrameBuffer *framebuffers[FRAMEBUFFER_STACK_DEPTH]; uint top; -} FrameBufferStack = {{0}}; +} FrameBufferStack = {{nullptr}}; static void gpuPushFrameBuffer(GPUFrameBuffer *fb) { @@ -526,7 +526,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs) BLI_assert(ctx); for (int i = 0; i < MAX_CTX_FB_LEN; i++) { - if (ofs->framebuffers[i].fb == NULL) { + if (ofs->framebuffers[i].fb == nullptr) { ofs->framebuffers[i].ctx = ctx; GPU_framebuffer_ensure_config(&ofs->framebuffers[i].fb, { @@ -552,7 +552,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs) for (int i = 0; i < MAX_CTX_FB_LEN; i++) { GPU_framebuffer_free(ofs->framebuffers[i].fb); - ofs->framebuffers[i].fb = NULL; + ofs->framebuffers[i].fb = nullptr; } return gpu_offscreen_fb_get(ofs); @@ -569,16 +569,16 @@ GPUOffScreen *GPU_offscreen_create( width = max_ii(1, width); ofs->color = GPU_texture_create_2d( - "ofs_color", width, height, 1, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, NULL); + "ofs_color", width, height, 1, (high_bitdepth) ? GPU_RGBA16F : GPU_RGBA8, nullptr); if (depth) { - ofs->depth = GPU_texture_create_2d("ofs_depth", width, height, 1, GPU_DEPTH24_STENCIL8, NULL); + ofs->depth = GPU_texture_create_2d("ofs_depth", width, height, 1, GPU_DEPTH24_STENCIL8, nullptr); } if ((depth && !ofs->depth) || !ofs->color) { BLI_snprintf(err_out, 256, "GPUTexture: Texture allocation failed."); GPU_offscreen_free(ofs); - return NULL; + return nullptr; } GPUFrameBuffer *fb = gpu_offscreen_fb_get(ofs); @@ -586,7 +586,7 @@ GPUOffScreen *GPU_offscreen_create( /* check validity at the very end! */ if (!GPU_framebuffer_check_valid(fb, err_out)) { GPU_offscreen_free(ofs); - return NULL; + return nullptr; } GPU_framebuffer_restore(); return ofs; @@ -620,7 +620,7 @@ void GPU_offscreen_bind(GPUOffScreen *ofs, bool save) void GPU_offscreen_unbind(GPUOffScreen *UNUSED(ofs), bool restore) { - GPUFrameBuffer *fb = NULL; + GPUFrameBuffer *fb = nullptr; if (restore) { fb = gpuPopFrameBuffer(); } |