diff options
author | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 20:41:06 +0000 |
---|---|---|
committer | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-01 20:41:06 +0000 |
commit | 532ebc9414b736f61633b723cdc25fb8bc001c85 (patch) | |
tree | 054d60696bd1bdf5901e36c2cdccad4b13f3b7ee /o3d/core | |
parent | 10db9c6727f141487be79c89d00b6f9bf4d978dd (diff) | |
download | chromium_src-532ebc9414b736f61633b723cdc25fb8bc001c85.zip chromium_src-532ebc9414b736f61633b723cdc25fb8bc001c85.tar.gz chromium_src-532ebc9414b736f61633b723cdc25fb8bc001c85.tar.bz2 |
linux: add an option to disable FBO support for platforms that don't have it.
Review URL: http://codereview.chromium.org/551218
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r-- | o3d/core/core.gyp | 5 | ||||
-rw-r--r-- | o3d/core/cross/gles2/render_surface_gles2.cc | 5 | ||||
-rw-r--r-- | o3d/core/cross/gles2/renderer_gles2.cc | 14 |
3 files changed, 21 insertions, 3 deletions
diff --git a/o3d/core/core.gyp b/o3d/core/core.gyp index f324884..218a010 100644 --- a/o3d/core/core.gyp +++ b/o3d/core/core.gyp @@ -60,6 +60,11 @@ ], }, ], + ['disable_fbo == 1', { + 'defines': [ + 'DISABLE_FBO', + ], + }], ], }, 'includes': [ diff --git a/o3d/core/cross/gles2/render_surface_gles2.cc b/o3d/core/cross/gles2/render_surface_gles2.cc index 5263828..ee0aff9 100644 --- a/o3d/core/cross/gles2/render_surface_gles2.cc +++ b/o3d/core/cross/gles2/render_surface_gles2.cc @@ -85,6 +85,7 @@ RenderDepthStencilSurfaceGLES2::RenderDepthStencilSurfaceGLES2( int height) : RenderDepthStencilSurface(service_locator, width, height) { +#ifndef DISABLE_FBO // If packed depth stencil is supported, create only one buffer for both // depth and stencil. if (GLEW_EXT_packed_depth_stencil) { @@ -112,15 +113,17 @@ RenderDepthStencilSurfaceGLES2::RenderDepthStencilSurfaceGLES2( height); CHECK_GL_ERROR(); } +#endif } RenderDepthStencilSurfaceGLES2::~RenderDepthStencilSurfaceGLES2() { +#ifndef DISABLE_FBO if (GLEW_EXT_packed_depth_stencil) { glDeleteRenderbuffersEXT(1, render_buffers_); } else { glDeleteRenderbuffersEXT(2, render_buffers_); } +#endif } } // end namespace o3d - diff --git a/o3d/core/cross/gles2/renderer_gles2.cc b/o3d/core/cross/gles2/renderer_gles2.cc index 6d012e2..7a0d3b7 100644 --- a/o3d/core/cross/gles2/renderer_gles2.cc +++ b/o3d/core/cross/gles2/renderer_gles2.cc @@ -33,7 +33,6 @@ // This file contains the definition of the RendererGLES2 class that // implements the abstract Renderer API using OpenGLES2. - #include "core/cross/gles2/renderer_gles2.h" #include "core/cross/error.h" @@ -168,6 +167,7 @@ GLenum ConvertStencilOp(State::StencilOperation stencil_func) { return GL_KEEP; } +#ifndef DISABLE_FBO // Helper routine that will bind the surfaces stored in the RenderSurface and // RenderDepthStencilSurface arguments to the current OpenGLES2 context. // Returns true upon success. @@ -241,6 +241,7 @@ bool InstallFramebufferObjects(const RenderSurface* surface, CHECK_GL_ERROR(); return true; } +#endif // Helper routine that returns a pointer to the non-NULL entry in the renderer's // stack of bound surfaces. @@ -687,10 +688,12 @@ Renderer::InitStatus RendererGLES2::InitCommonGLES2() { return GPU_NOT_UP_TO_SPEC; } +#ifndef DISABLE_FBO if (!GLEW_EXT_framebuffer_object) { DLOG(ERROR) << "GLES2 drivers do not support framebuffer objects."; return GPU_NOT_UP_TO_SPEC; } +#endif SetSupportsNPOT(GLEW_ARB_texture_non_power_of_two != 0); @@ -732,8 +735,10 @@ Renderer::InitStatus RendererGLES2::InitCommonGLES2() { SetClientSize(viewport[2], viewport[3]); CHECK_GL_ERROR(); +#ifndef DISABLE_FBO ::glGenFramebuffersEXT(1, &render_surface_framebuffer_); CHECK_GL_ERROR(); +#endif return SUCCESS; } @@ -741,9 +746,11 @@ Renderer::InitStatus RendererGLES2::InitCommonGLES2() { // platform neutral destruction code void RendererGLES2::DestroyCommonGLES2() { MakeCurrentLazy(); +#ifndef DISABLE_FBO if (render_surface_framebuffer_) { ::glDeleteFramebuffersEXT(1, &render_surface_framebuffer_); } +#endif } #ifdef OS_WIN @@ -1283,12 +1290,14 @@ void RendererGLES2::SetRenderSurfacesPlatformSpecific( // of framebuffer objects with different attachment characterists and // switch between them here. MakeCurrentLazy(); +#ifndef DISABLE_FBO ::glBindFramebufferEXT(GL_FRAMEBUFFER, render_surface_framebuffer_); if (!InstallFramebufferObjects(surface, surface_depth)) { O3D_ERROR(service_locator()) << "Failed to bind OpenGLES2 render target objects:" << surface->name() <<", "<< surface_depth->name(); } +#endif // RenderSurface rendering is performed with an inverted Y, so the front // face winding must be changed to clock-wise. See comments for // UpdateHelperConstant. @@ -1297,8 +1306,10 @@ void RendererGLES2::SetRenderSurfacesPlatformSpecific( void RendererGLES2::SetBackBufferPlatformSpecific() { MakeCurrentLazy(); +#ifndef DISABLE_FBO // Bind the default context, and restore the default front-face winding. ::glBindFramebufferEXT(GL_FRAMEBUFFER, 0); +#endif glFrontFace(GL_CCW); } @@ -1529,4 +1540,3 @@ Renderer* Renderer::CreateDefaultRenderer(ServiceLocator* service_locator) { } } // namespace o3d - |