Cleanup: replace C-style casts with functional casts for numeric types
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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_);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -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++;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user