Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Remove unused OffscreenTexture variant with depth render target
Browse files Browse the repository at this point in the history
  • Loading branch information
astojilj committed Jun 11, 2019
1 parent df062af commit d7fa18e
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 44 deletions.
5 changes: 0 additions & 5 deletions src/mbgl/gfx/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ class Context {
virtual std::unique_ptr<OffscreenTexture>
createOffscreenTexture(Size,
TextureChannelDataType = TextureChannelDataType::UnsignedByte) = 0;
virtual std::unique_ptr<OffscreenTexture>
createOffscreenTexture(Size,
Renderbuffer<RenderbufferPixelType::Depth>&,
TextureChannelDataType = TextureChannelDataType::UnsignedByte) = 0;

public:
// Creates an empty texture with the specified dimensions.
Texture createTexture(const Size size,
Expand Down
7 changes: 0 additions & 7 deletions src/mbgl/gl/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,6 @@ Context::createOffscreenTexture(const Size size, const gfx::TextureChannelDataTy
return std::make_unique<gl::OffscreenTexture>(*this, size, type);
}

std::unique_ptr<gfx::OffscreenTexture>
Context::createOffscreenTexture(const Size size,
gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>& depth,
gfx::TextureChannelDataType type) {
return std::make_unique<gl::OffscreenTexture>(*this, size, depth, type);
}

std::unique_ptr<gfx::DrawScopeResource> Context::createDrawScopeResource() {
return std::make_unique<gl::DrawScopeResource>(createVertexArray());
}
Expand Down
4 changes: 0 additions & 4 deletions src/mbgl/gl/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ class Context final : public gfx::Context {

std::unique_ptr<gfx::OffscreenTexture> createOffscreenTexture(
Size, gfx::TextureChannelDataType = gfx::TextureChannelDataType::UnsignedByte) override;
std::unique_ptr<gfx::OffscreenTexture> createOffscreenTexture(
Size,
gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>&,
gfx::TextureChannelDataType = gfx::TextureChannelDataType::UnsignedByte) override;

std::unique_ptr<gfx::TextureResource>
createTextureResource(Size, gfx::TexturePixelType, gfx::TextureChannelDataType) override;
Expand Down
24 changes: 1 addition & 23 deletions src/mbgl/gl/offscreen_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,11 @@ class OffscreenTextureResource final : public gl::RenderableResource {
assert(!size.isEmpty());
}

OffscreenTextureResource(gl::Context& context_,
const Size size_,
gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>& depth_,
const gfx::TextureChannelDataType type_)
: context(context_), size(size_), depth(&depth_), type(type_) {
assert(!size.isEmpty());
}

void bind() override {
if (!framebuffer) {
assert(!texture);
texture = context.createTexture(size, gfx::TexturePixelType::RGBA, type);
if (depth) {
framebuffer = context.createFramebuffer(*texture, *depth);
} else {
framebuffer = context.createFramebuffer(*texture);
}
framebuffer = context.createFramebuffer(*texture);
} else {
context.bindFramebuffer = framebuffer->framebuffer;
}
Expand All @@ -56,7 +44,6 @@ class OffscreenTextureResource final : public gl::RenderableResource {
gl::Context& context;
const Size size;
optional<gfx::Texture> texture;
gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>* depth = nullptr;
const gfx::TextureChannelDataType type;
optional<gl::Framebuffer> framebuffer;
};
Expand All @@ -67,15 +54,6 @@ OffscreenTexture::OffscreenTexture(gl::Context& context,
: gfx::OffscreenTexture(size, std::make_unique<OffscreenTextureResource>(context, size_, type)) {
}

OffscreenTexture::OffscreenTexture(
gl::Context& context,
const Size size_,
gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>& renderbuffer,
const gfx::TextureChannelDataType type)
: gfx::OffscreenTexture(
size, std::make_unique<OffscreenTextureResource>(context, size_, renderbuffer, type)) {
}

bool OffscreenTexture::isRenderable() {
try {
getResource<OffscreenTextureResource>().bind();
Expand Down
6 changes: 1 addition & 5 deletions src/mbgl/gl/offscreen_texture.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <mbgl/gfx/offscreen_texture.hpp>
#include <mbgl/gfx/renderbuffer.hpp>
#include <mbgl/gfx/types.hpp>

namespace mbgl {
namespace gl {
Expand All @@ -13,10 +13,6 @@ class OffscreenTexture final : public gfx::OffscreenTexture {
OffscreenTexture(gl::Context&,
Size size,
gfx::TextureChannelDataType type = gfx::TextureChannelDataType::UnsignedByte);
OffscreenTexture(gl::Context&,
Size size,
gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>&,
gfx::TextureChannelDataType type = gfx::TextureChannelDataType::UnsignedByte);

bool isRenderable() override;

Expand Down

0 comments on commit d7fa18e

Please sign in to comment.