Drawable Renderer (#1570), warnings

This commit is contained in:
Tim Sylvester
2023-06-30 23:01:17 +00:00
committed by Bart Louwers
parent 869df68773
commit e631bc3c42
2 changed files with 22 additions and 19 deletions

View File

@@ -34,13 +34,13 @@ namespace mbgl {
using namespace style;
static RendererObserver& nullObserver() {
namespace {
RendererObserver& nullObserver() {
static RendererObserver observer;
return observer;
}
namespace {
class LayerRenderItem final : public RenderItem {
public:
LayerRenderItem(RenderLayer& layer_, RenderSource* source_, uint32_t index_)
@@ -378,8 +378,8 @@ std::unique_ptr<RenderTree> RenderOrchestrator::createRenderTree(
#if MLN_DRAWABLE_RENDERER
// Mark layers included in the renderable set as renderable
// @TODO: Optimize this logic, combine with the above
for (size_t i = 0; i < orderedLayers.size(); ++i) {
RenderLayer& layer = orderedLayers[i];
for (auto orderedLayer : orderedLayers) {
RenderLayer& layer = orderedLayer;
layer.markLayerRenderable(
layerRenderItems.find(LayerRenderItem(layer, nullptr, static_cast<uint32_t>(layer.getLayerIndex()))) !=
layerRenderItems.end(),

View File

@@ -13,7 +13,9 @@
namespace mbgl {
namespace gl {
static gfx::AttributeDataType mapType(platform::GLenum attrType) {
namespace {
gfx::AttributeDataType mapType(platform::GLenum attrType) {
using T = gfx::AttributeDataType;
switch (attrType) {
case GL_FLOAT:
@@ -67,6 +69,20 @@ static gfx::AttributeDataType mapType(platform::GLenum attrType) {
}
}
using namespace platform;
void addAttr(VertexAttributeArrayGL& attrs, const char* name, GLint index, GLsizei length, GLint count, GLenum glType) {
const auto elementType = mapType(glType);
if (elementType != gfx::AttributeDataType::Invalid && length > 0) {
if (const auto& newAttr = attrs.add(name, index, elementType, count)) {
const auto& glAttr = static_cast<VertexAttributeGL*>(newAttr.get());
glAttr->setGLType(glType);
}
}
}
} // namespace
ShaderProgramGL::ShaderProgramGL(UniqueProgram&& glProgram_)
: ShaderProgramBase(),
glProgram(std::move(glProgram_)) {}
@@ -85,19 +101,6 @@ ShaderProgramGL::ShaderProgramGL(ShaderProgramGL&& other)
uniformBlocks(std::move(other.uniformBlocks)),
vertexAttributes(std::move(other.vertexAttributes)) {}
using namespace platform;
static void addAttr(
VertexAttributeArrayGL& attrs, const char* name, GLint index, GLsizei length, GLint count, GLenum glType) {
const auto elementType = mapType(glType);
if (elementType != gfx::AttributeDataType::Invalid && length > 0) {
if (const auto& newAttr = attrs.add(name, index, elementType, count)) {
const auto& glAttr = static_cast<VertexAttributeGL*>(newAttr.get());
glAttr->setGLType(glType);
}
}
}
std::optional<uint32_t> ShaderProgramGL::getSamplerLocation(const std::string_view name) const {
GLint sampler_location = MBGL_CHECK_ERROR(glGetUniformLocation(glProgram, name.data()));
return (sampler_location == -1) ? std::optional<uint32_t>{} : sampler_location;