Clean more legacy code (#3478)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -7,8 +7,6 @@
|
||||
#include <mbgl/gl/enum.hpp>
|
||||
#include <mbgl/gl/renderer_backend.hpp>
|
||||
#include <mbgl/gl/renderbuffer_resource.hpp>
|
||||
#include <mbgl/gl/texture_resource.hpp>
|
||||
#include <mbgl/gl/texture.hpp>
|
||||
#include <mbgl/gl/offscreen_texture.hpp>
|
||||
#include <mbgl/gl/debugging_extension.hpp>
|
||||
#include <mbgl/gl/timestamp_query_extension.hpp>
|
||||
@@ -295,29 +293,6 @@ UniqueFramebuffer Context::createFramebuffer() {
|
||||
return UniqueFramebuffer{std::move(id), {this}};
|
||||
}
|
||||
|
||||
std::unique_ptr<gfx::TextureResource> Context::createTextureResource(const Size size,
|
||||
const gfx::TexturePixelType format,
|
||||
const gfx::TextureChannelDataType type) {
|
||||
MLN_TRACE_FUNC();
|
||||
|
||||
auto obj = createUniqueTexture(size, format, type);
|
||||
std::unique_ptr<gfx::TextureResource> resource = std::make_unique<gl::TextureResource>(std::move(obj));
|
||||
|
||||
// Always use texture unit 0 for manipulating it.
|
||||
activeTextureUnit = 0;
|
||||
texture[0] = static_cast<gl::TextureResource&>(*resource).texture;
|
||||
|
||||
// We are using clamp to edge here since OpenGL ES doesn't allow GL_REPEAT
|
||||
// on NPOT textures. We use those when the pixelRatio isn't a power of two,
|
||||
// e.g. on iPhone 6 Plus.
|
||||
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
|
||||
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
|
||||
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
|
||||
MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
std::unique_ptr<gfx::RenderbufferResource> Context::createRenderbufferResource(const gfx::RenderbufferPixelType type,
|
||||
const Size size) {
|
||||
MLN_TRACE_FUNC();
|
||||
@@ -449,51 +424,6 @@ Framebuffer Context::createFramebuffer(const gfx::Renderbuffer<gfx::Renderbuffer
|
||||
return {color.getSize(), std::move(fbo)};
|
||||
}
|
||||
|
||||
Framebuffer Context::createFramebuffer(
|
||||
const gfx::Texture& color, const gfx::Renderbuffer<gfx::RenderbufferPixelType::DepthStencil>& depthStencil) {
|
||||
MLN_TRACE_FUNC();
|
||||
|
||||
if (color.size != depthStencil.getSize()) {
|
||||
throw std::runtime_error("Renderbuffer size mismatch");
|
||||
}
|
||||
auto fbo = createFramebuffer();
|
||||
bindFramebuffer = fbo;
|
||||
MBGL_CHECK_ERROR(glFramebufferTexture2D(
|
||||
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color.getResource<gl::TextureResource>().texture, 0));
|
||||
bindDepthStencilRenderbuffer(depthStencil);
|
||||
checkFramebuffer();
|
||||
return {color.size, std::move(fbo)};
|
||||
}
|
||||
|
||||
Framebuffer Context::createFramebuffer(const gfx::Texture& color) {
|
||||
MLN_TRACE_FUNC();
|
||||
|
||||
auto fbo = createFramebuffer();
|
||||
bindFramebuffer = fbo;
|
||||
MBGL_CHECK_ERROR(glFramebufferTexture2D(
|
||||
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color.getResource<gl::TextureResource>().texture, 0));
|
||||
checkFramebuffer();
|
||||
return {color.size, std::move(fbo)};
|
||||
}
|
||||
|
||||
Framebuffer Context::createFramebuffer(const gfx::Texture& color,
|
||||
const gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>& depth) {
|
||||
MLN_TRACE_FUNC();
|
||||
if (color.size != depth.getSize()) {
|
||||
throw std::runtime_error("Renderbuffer size mismatch");
|
||||
}
|
||||
auto fbo = createFramebuffer();
|
||||
bindFramebuffer = fbo;
|
||||
MBGL_CHECK_ERROR(glFramebufferTexture2D(
|
||||
GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color.getResource<gl::TextureResource>().texture, 0));
|
||||
|
||||
auto& depthResource = depth.getResource<gl::RenderbufferResource>();
|
||||
MBGL_CHECK_ERROR(
|
||||
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthResource.renderbuffer));
|
||||
checkFramebuffer();
|
||||
return {depth.getSize(), std::move(fbo)};
|
||||
}
|
||||
|
||||
std::unique_ptr<gfx::OffscreenTexture> Context::createOffscreenTexture(const Size size,
|
||||
const gfx::TextureChannelDataType type) {
|
||||
MLN_TRACE_FUNC();
|
||||
|
||||
Reference in New Issue
Block a user