Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alasram committed Aug 26, 2024
1 parent 50414c0 commit c676779
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
3 changes: 0 additions & 3 deletions src/mbgl/gl/drawable_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ void DrawableGL::issueUpload(gfx::UploadPass& uploadPass) {
MLN_TRACE_FUNC();

assert(impl);
auto& context = uploadPass.getContext();
auto& glContext = static_cast<gl::Context&>(context);
auto& backend = glContext.getBackend();

impl->buildVertexArray = vertexAttributes &&
(vertexAttributes->isModifiedAfter(attributeUpdateTime) ||
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/gl/drawable_gl_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ class DrawableGL::Impl final {

if (!glSeg.getVertexArray().isValid()) {
auto vertexArray = context.createVertexArray();
const auto& indexBuffer = static_cast<IndexBufferGL&>(*indexes->getBuffer());
vertexArray.bind(context, *indexBuffer.buffer, std::move(attributeBindings));
const auto& idxBuffer = static_cast<const IndexBufferGL&>(*indexes->getBuffer());
vertexArray.bind(context, *idxBuffer.buffer, std::move(attributeBindings));
assert(vertexArray.isValid());
if (vertexArray.isValid()) {
glSeg.setVertexArray(std::move(vertexArray));
Expand Down
8 changes: 6 additions & 2 deletions src/mbgl/gl/fence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,13 @@ void Fence::cpuWait() const {
Log::Error(
Event::OpenGL,
"glClientWaitSync timeout after " + std::to_string(i * timeout / oneSecInNanoSec) + " seconds");
case GL_WAIT_FAILED:
throw std::runtime_error("glClientWaitSync failed. " + glErrors());
break;
case GL_WAIT_FAILED: {
auto err = "glClientWaitSync failed. " + glErrors();
Log::Error(Event::OpenGL, err);
throw std::runtime_error(err);
return;
}
default:
assert(false); // unreachable
return;
Expand Down
28 changes: 14 additions & 14 deletions src/mbgl/gl/upload_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ std::unique_ptr<gfx::VertexBufferResource> UploadPass::createVertexBufferResourc

if (backend.supportFreeThreadedUpload()) {
auto result = std::make_unique<gl::VertexBufferResource>(
[&](int size, gfx::BufferUsageType usage, const void* data) {
return createUniqueBuffer(ctx, data, size, usage, bufferGlTarget);
[&](int size_, gfx::BufferUsageType usage_, const void* data_) {
return createUniqueBuffer(ctx, data_, size_, usage_, bufferGlTarget);
},
[&](const UniqueBuffer& buffer, int size, const void* data) {
updateUniqueBuffer(buffer, data, size, bufferGlTarget);
[&](const UniqueBuffer& buffer, int size_, const void* data_) {
updateUniqueBuffer(buffer, data_, size_, bufferGlTarget);
},
size);
result->asyncAlloc(backend.getResourceUploadThreadPool(), size, usage, data);
static_cast<int>(size));
result->asyncAlloc(backend.getResourceUploadThreadPool(), static_cast<int>(size), usage, data);
return result;

} else {
Expand All @@ -111,7 +111,7 @@ void UploadPass::updateVertexBufferResource(gfx::VertexBufferResource& resource,
// This also happens is an uploaded resource in a previous frame has not been used
glResource.wait();
}
glResource.asyncUpdate(backend.getResourceUploadThreadPool(), size, data);
glResource.asyncUpdate(backend.getResourceUploadThreadPool(), static_cast<int>(size), data);
} else {
const UniqueBuffer& buffer = glResource.pickBuffer();
ctx.vertexBuffer = buffer;
Expand All @@ -134,14 +134,14 @@ std::unique_ptr<gfx::IndexBufferResource> UploadPass::createIndexBufferResource(

if (backend.supportFreeThreadedUpload()) {
auto result = std::make_unique<gl::IndexBufferResource>(
[&](int size, gfx::BufferUsageType usage, const void* data) {
return createUniqueBuffer(ctx, data, size, usage, bufferGlTarget);
[&](int size_, gfx::BufferUsageType usage_, const void* data_) {
return createUniqueBuffer(ctx, data_, size_, usage_, bufferGlTarget);
},
[&](const UniqueBuffer& buffer, int size, const void* data) {
updateUniqueBuffer(buffer, data, size, bufferGlTarget);
[&](const UniqueBuffer& buffer, int size_, const void* data_) {
updateUniqueBuffer(buffer, data_, size_, bufferGlTarget);
},
size);
result->asyncAlloc(backend.getResourceUploadThreadPool(), size, usage, data);
static_cast<int>(size));
result->asyncAlloc(backend.getResourceUploadThreadPool(), static_cast<int>(size), usage, data);
return result;

} else {
Expand All @@ -168,7 +168,7 @@ void UploadPass::updateIndexBufferResource(gfx::IndexBufferResource& resource, c
// This also happens is an uploaded resource in a previous frame has not been used
glResource.wait();
}
glResource.asyncUpdate(backend.getResourceUploadThreadPool(), size, data);
glResource.asyncUpdate(backend.getResourceUploadThreadPool(), static_cast<int>(size), data);
} else {
const UniqueBuffer& buffer = glResource.pickBuffer();
// Be sure to unbind any existing vertex array object before binding the
Expand Down

0 comments on commit c676779

Please sign in to comment.