diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 11:33:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 13:17:08 +0300 |
commit | f68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch) | |
tree | 2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/gpu/opengl | |
parent | c7b247a118e302a3afc6473797e53b6af28b69e2 (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/gpu/opengl')
-rw-r--r-- | source/blender/gpu/opengl/gl_context.cc | 8 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_framebuffer.cc | 4 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_shader.cc | 2 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_shader_interface.cc | 4 | ||||
-rw-r--r-- | source/blender/gpu/opengl/gl_vertex_array.cc | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/source/blender/gpu/opengl/gl_context.cc b/source/blender/gpu/opengl/gl_context.cc index 31bd7e0c4dd..375194c09f3 100644 --- a/source/blender/gpu/opengl/gl_context.cc +++ b/source/blender/gpu/opengl/gl_context.cc @@ -191,11 +191,11 @@ void GLSharedOrphanLists::orphans_clear() lists_mutex.lock(); if (!buffers.is_empty()) { - glDeleteBuffers((uint)buffers.size(), buffers.data()); + glDeleteBuffers(uint(buffers.size()), buffers.data()); buffers.clear(); } if (!textures.is_empty()) { - glDeleteTextures((uint)textures.size(), textures.data()); + glDeleteTextures(uint(textures.size()), textures.data()); textures.clear(); } lists_mutex.unlock(); @@ -208,11 +208,11 @@ void GLContext::orphans_clear() lists_mutex_.lock(); if (!orphaned_vertarrays_.is_empty()) { - glDeleteVertexArrays((uint)orphaned_vertarrays_.size(), orphaned_vertarrays_.data()); + glDeleteVertexArrays(uint(orphaned_vertarrays_.size()), orphaned_vertarrays_.data()); orphaned_vertarrays_.clear(); } if (!orphaned_framebuffers_.is_empty()) { - glDeleteFramebuffers((uint)orphaned_framebuffers_.size(), orphaned_framebuffers_.data()); + glDeleteFramebuffers(uint(orphaned_framebuffers_.size()), orphaned_framebuffers_.data()); orphaned_framebuffers_.clear(); } lists_mutex_.unlock(); diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index 1ab22a16df4..e94f5b66b97 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -352,7 +352,7 @@ void GLFrameBuffer::clear_attachment(GPUAttachmentType type, if (type == GPU_FB_DEPTH_STENCIL_ATTACHMENT) { BLI_assert(data_format == GPU_DATA_UINT_24_8); - float depth = ((*(uint32_t *)clear_value) & 0x00FFFFFFu) / (float)0x00FFFFFFu; + float depth = ((*(uint32_t *)clear_value) & 0x00FFFFFFu) / float(0x00FFFFFFu); int stencil = ((*(uint32_t *)clear_value) >> 24); glClearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil); } @@ -361,7 +361,7 @@ void GLFrameBuffer::clear_attachment(GPUAttachmentType type, glClearBufferfv(GL_DEPTH, 0, (GLfloat *)clear_value); } else if (data_format == GPU_DATA_UINT) { - float depth = *(uint32_t *)clear_value / (float)0xFFFFFFFFu; + float depth = *(uint32_t *)clear_value / float(0xFFFFFFFFu); glClearBufferfv(GL_DEPTH, 0, &depth); } else { diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index 1f2ef36716e..a1570735723 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -1138,7 +1138,7 @@ void GLShader::uniform_int(int location, int comp_len, int array_size, const int int GLShader::program_handle_get() const { - return (int)this->shader_program_; + return int(this->shader_program_); } /** \} */ diff --git a/source/blender/gpu/opengl/gl_shader_interface.cc b/source/blender/gpu/opengl/gl_shader_interface.cc index b230706b020..c9432fca561 100644 --- a/source/blender/gpu/opengl/gl_shader_interface.cc +++ b/source/blender/gpu/opengl/gl_shader_interface.cc @@ -295,7 +295,7 @@ GLShaderInterface::GLShaderInterface(GLuint program) enabled_attr_mask_ |= (1 << input->location); /* Used in `GPU_shader_get_attribute_info`. */ - attr_types_[input->location] = (uint8_t)gpu_type_from_gl_type(type); + attr_types_[input->location] = uint8_t(gpu_type_from_gl_type(type)); } /* Uniform Blocks */ @@ -457,7 +457,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI enabled_attr_mask_ |= (1 << input->location); /* Used in `GPU_shader_get_attribute_info`. */ - attr_types_[input->location] = (uint8_t)attr.type; + attr_types_[input->location] = uint8_t(attr.type); } input++; diff --git a/source/blender/gpu/opengl/gl_vertex_array.cc b/source/blender/gpu/opengl/gl_vertex_array.cc index 6897ac9f4a2..9a6df38cb05 100644 --- a/source/blender/gpu/opengl/gl_vertex_array.cc +++ b/source/blender/gpu/opengl/gl_vertex_array.cc @@ -47,7 +47,7 @@ static uint16_t vbo_bind(const ShaderInterface *interface, } /* This is in fact an offset in memory. */ - const GLvoid *pointer = (const GLubyte *)(intptr_t)(offset + v_first * stride); + const GLvoid *pointer = (const GLubyte *)intptr_t(offset + v_first * stride); const GLenum type = to_gl(static_cast<GPUVertCompType>(a->comp_type)); for (uint n_idx = 0; n_idx < a->name_len; n_idx++) { @@ -137,7 +137,7 @@ void GLVertArray::update_bindings(const GLuint vao, GLContext *ctx = GLContext::get(); /* This replaces glVertexAttrib4f(a, 0.0f, 0.0f, 0.0f, 1.0f); with a more modern style. * Fix issues for some drivers (see T75069). */ - glBindVertexBuffer(a, ctx->default_attr_vbo_, (intptr_t)0, (intptr_t)0); + glBindVertexBuffer(a, ctx->default_attr_vbo_, intptr_t(0), intptr_t(0)); glEnableVertexAttribArray(a); glVertexAttribFormat(a, 4, GL_FLOAT, GL_FALSE, 0); glVertexAttribBinding(a, a); |