diff options
Diffstat (limited to 'source/blender/gpu/opengl/gl_texture.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_texture.cc | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/source/blender/gpu/opengl/gl_texture.cc b/source/blender/gpu/opengl/gl_texture.cc index 070a86509ff..4f990b77bd0 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); } @@ -63,7 +63,7 @@ GLTexture::~GLTexture() } /* Return true on success. */ -bool GLTexture::init_internal(void) +bool GLTexture::init_internal() { if ((format_ == GPU_DEPTH24_STENCIL8) && GPU_depth_blitting_workaround()) { /* MacOS + Radeon Pro fails to blit depth on GPU_DEPTH24_STENCIL8 @@ -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); @@ -294,7 +294,7 @@ void GLTexture::update_sub( * WARNING: Depth textures are not populated but they have their mips correctly defined. * WARNING: This resets the mipmap range. */ -void GLTexture::generate_mipmap(void) +void GLTexture::generate_mipmap() { this->ensure_mipmaps(9999); /* Some drivers have bugs when using glGenerateMipmap with depth textures (see T56789). @@ -440,7 +440,7 @@ void GLTexture::mip_range_set(int min, int max) } } -struct GPUFrameBuffer *GLTexture::framebuffer_get(void) +struct GPUFrameBuffer *GLTexture::framebuffer_get() { if (framebuffer_) { return framebuffer_; @@ -461,7 +461,7 @@ struct GPUFrameBuffer *GLTexture::framebuffer_get(void) GLuint GLTexture::samplers_[GPU_SAMPLER_MAX] = {0}; -void GLTexture::samplers_init(void) +void GLTexture::samplers_init() { glGenSamplers(GPU_SAMPLER_MAX, samplers_); for (int i = 0; i <= GPU_SAMPLER_ICON - 1; i++) { @@ -517,7 +517,7 @@ void GLTexture::samplers_init(void) debug::object_label(GL_SAMPLER, icon_sampler, "icons"); } -void GLTexture::samplers_update(void) +void GLTexture::samplers_update() { if (!GLContext::texture_filter_anisotropic_support) { return; @@ -536,7 +536,7 @@ void GLTexture::samplers_update(void) } } -void GLTexture::samplers_free(void) +void GLTexture::samplers_free() { glDeleteSamplers(GPU_SAMPLER_MAX, samplers_); } @@ -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,15 @@ 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; } } @@ -649,7 +651,7 @@ bool GLTexture::proxy_check(int mip) /** \} */ -void GLTexture::check_feedback_loop(void) +void GLTexture::check_feedback_loop() { /* Recursive down sample workaround break this check. * See #recursive_downsample() for more information. */ @@ -679,7 +681,7 @@ void GLTexture::check_feedback_loop(void) } /* TODO(fclem): Legacy. Should be removed at some point. */ -uint GLTexture::gl_bindcode_get(void) const +uint GLTexture::gl_bindcode_get() const { return tex_id_; } |