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

Commit

Permalink
Simplify OffscreenTexture: use DepthComponent (as defined by preproce…
Browse files Browse the repository at this point in the history
…ssor conditional in types.hpp) in all cases
  • Loading branch information
Lauren Budorick committed Apr 26, 2017
1 parent 72278bf commit 086fa8d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 20 deletions.
4 changes: 0 additions & 4 deletions src/mbgl/gl/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ void Context::initializeExtensions(const std::function<gl::ProcAddress(const cha
programBinary = std::make_unique<extension::ProgramBinary>(fn);
#endif

#if MBGL_USE_GLES2
supportsDepth24 = strstr(extensions, "GL_OES_depth24") != nullptr;
#endif

if (!supportsVertexArrays()) {
Log::Warning(Event::OpenGL, "Not using Vertex Array Objects");
}
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 @@ -64,10 +64,6 @@ class Context : private util::noncopyable {
#endif
optional<std::pair<BinaryProgramFormat, std::string>> getBinaryProgram(ProgramID) const;

#if MBGL_USE_GLES2
bool supportsDepth24 = false;
#endif

template <class Vertex, class DrawMode>
VertexBuffer<Vertex, DrawMode> createVertexBuffer(VertexVector<Vertex, DrawMode>&& v) {
return VertexBuffer<Vertex, DrawMode> {
Expand Down
12 changes: 0 additions & 12 deletions src/mbgl/util/offscreen_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,8 @@ class OffscreenTexture::Impl {
void bindRenderbuffers(gl::TextureUnit unit) {
if (!framebuffer) {
texture = context.createTexture(size, gl::TextureFormat::RGBA, unit);

#if MBGL_USE_GLES2
if (context.supportsDepth24) {
gl::Renderbuffer<gl::RenderbufferType::DepthComponent> depthTarget = context.createRenderbuffer<gl::RenderbufferType::DepthComponent>(size);
framebuffer = context.createFramebuffer(*texture, depthTarget);
} else {
// We don't actually need the stencil bits here, but we need the depth resolution provided by this buffer if the implementation doesn't support 24-bit depth buffers
gl::Renderbuffer<gl::RenderbufferType::DepthStencil> depthTarget = context.createRenderbuffer<gl::RenderbufferType::DepthStencil>(size);
framebuffer = context.createFramebuffer(*texture, depthTarget);
}
#else
gl::Renderbuffer<gl::RenderbufferType::DepthComponent> depthTarget = context.createRenderbuffer<gl::RenderbufferType::DepthComponent>(size);
framebuffer = context.createFramebuffer(*texture, depthTarget);
#endif // MBGL_USE_GLES2

} else {
context.bindFramebuffer = framebuffer->framebuffer;
Expand Down

0 comments on commit 086fa8d

Please sign in to comment.