| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_GL_RENDERER_H_ | 5 #ifndef CC_GL_RENDERER_H_ |
| 6 #define CC_GL_RENDERER_H_ | 6 #define CC_GL_RENDERER_H_ |
| 7 | 7 |
| 8 #include "cc/cc_export.h" | 8 #include "cc/cc_export.h" |
| 9 #include "cc/checkerboard_draw_quad.h" | 9 #include "cc/checkerboard_draw_quad.h" |
| 10 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
| 11 #include "cc/direct_renderer.h" | 11 #include "cc/direct_renderer.h" |
| 12 #include "cc/gl_renderer_draw_cache.h" | 12 #include "cc/gl_renderer_draw_cache.h" |
| 13 #include "cc/io_surface_draw_quad.h" | 13 #include "cc/io_surface_draw_quad.h" |
| 14 #include "cc/output_surface.h" |
| 14 #include "cc/render_pass_draw_quad.h" | 15 #include "cc/render_pass_draw_quad.h" |
| 15 #include "cc/renderer.h" | 16 #include "cc/renderer.h" |
| 16 #include "cc/solid_color_draw_quad.h" | 17 #include "cc/solid_color_draw_quad.h" |
| 17 #include "cc/tile_draw_quad.h" | 18 #include "cc/tile_draw_quad.h" |
| 18 #include "cc/yuv_video_draw_quad.h" | 19 #include "cc/yuv_video_draw_quad.h" |
| 19 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" | 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3
D.h" |
| 20 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsMemoryAl
location.h" | 21 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsMemoryAl
location.h" |
| 21 #include "ui/gfx/quad_f.h" | 22 #include "ui/gfx/quad_f.h" |
| 22 | 23 |
| 23 namespace WebKit { | |
| 24 class WebGraphicsContext3D; | |
| 25 } | |
| 26 | |
| 27 namespace cc { | 24 namespace cc { |
| 28 | 25 |
| 29 class ScopedResource; | 26 class ScopedResource; |
| 30 class StreamVideoDrawQuad; | 27 class StreamVideoDrawQuad; |
| 31 class TextureDrawQuad; | 28 class TextureDrawQuad; |
| 32 class GeometryBinding; | 29 class GeometryBinding; |
| 33 class ScopedEnsureFramebufferAllocation; | 30 class ScopedEnsureFramebufferAllocation; |
| 34 | 31 |
| 35 // Class that handles drawing of composited render layers using GL. | 32 // Class that handles drawing of composited render layers using GL. |
| 36 class CC_EXPORT GLRenderer : public DirectRenderer, | 33 class CC_EXPORT GLRenderer : public DirectRenderer, |
| 37 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM), | 34 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsSwapBuffersCompleteCallbackCHROMIUM), |
| 38 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM), | 35 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsMemoryAllocationChangedCallbackCHROMIUM), |
| 39 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsContextLostCallback) { | 36 public NON_EXPORTED_BASE(WebKit::WebGraphicsContext
3D::WebGraphicsContextLostCallback) { |
| 40 public: | 37 public: |
| 41 static scoped_ptr<GLRenderer> create(RendererClient*, ResourceProvider*); | 38 static scoped_ptr<GLRenderer> create(RendererClient*, OutputSurface*, Resour
ceProvider*); |
| 42 | 39 |
| 43 virtual ~GLRenderer(); | 40 virtual ~GLRenderer(); |
| 44 | 41 |
| 45 virtual const RendererCapabilities& capabilities() const OVERRIDE; | 42 virtual const RendererCapabilities& capabilities() const OVERRIDE; |
| 46 | 43 |
| 47 WebKit::WebGraphicsContext3D* context(); | 44 WebKit::WebGraphicsContext3D* context(); |
| 48 | 45 |
| 49 virtual void viewportChanged() OVERRIDE; | 46 virtual void viewportChanged() OVERRIDE; |
| 50 | 47 |
| 51 // waits for rendering to finish | 48 // waits for rendering to finish |
| 52 virtual void finish() OVERRIDE; | 49 virtual void finish() OVERRIDE; |
| 53 | 50 |
| 54 virtual void doNoOp() OVERRIDE; | 51 virtual void doNoOp() OVERRIDE; |
| 55 // puts backbuffer onscreen | 52 // puts backbuffer onscreen |
| 56 virtual bool swapBuffers() OVERRIDE; | 53 virtual bool swapBuffers() OVERRIDE; |
| 57 | 54 |
| 58 virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE; | 55 virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE; |
| 59 | 56 |
| 60 virtual bool isContextLost() OVERRIDE; | 57 virtual bool isContextLost() OVERRIDE; |
| 61 | 58 |
| 62 virtual void setVisible(bool) OVERRIDE; | 59 virtual void setVisible(bool) OVERRIDE; |
| 63 | 60 |
| 64 virtual void sendManagedMemoryStats(size_t bytesVisible, size_t bytesVisible
AndNearby, size_t bytesAllocated) OVERRIDE; | 61 virtual void sendManagedMemoryStats(size_t bytesVisible, size_t bytesVisible
AndNearby, size_t bytesAllocated) OVERRIDE; |
| 65 | 62 |
| 66 protected: | 63 protected: |
| 67 GLRenderer(RendererClient*, ResourceProvider*); | 64 GLRenderer(RendererClient*, OutputSurface*, ResourceProvider*); |
| 68 | 65 |
| 69 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); | 66 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); |
| 70 | 67 |
| 71 bool isBackbufferDiscarded() const { return m_isBackbufferDiscarded; } | 68 bool isBackbufferDiscarded() const { return m_isBackbufferDiscarded; } |
| 72 bool initialize(); | 69 bool initialize(); |
| 73 | 70 |
| 74 const gfx::QuadF& sharedGeometryQuad() const { return m_sharedGeometryQuad;
} | 71 const gfx::QuadF& sharedGeometryQuad() const { return m_sharedGeometryQuad;
} |
| 75 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } | 72 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } |
| 76 | 73 |
| 77 bool getFramebufferTexture(ScopedResource*, const gfx::Rect& deviceRect); | 74 bool getFramebufferTexture(ScopedResource*, const gfx::Rect& deviceRect); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 208 |
| 212 scoped_ptr<TextureProgram> m_textureProgram; | 209 scoped_ptr<TextureProgram> m_textureProgram; |
| 213 scoped_ptr<TextureProgramFlip> m_textureProgramFlip; | 210 scoped_ptr<TextureProgramFlip> m_textureProgramFlip; |
| 214 scoped_ptr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram; | 211 scoped_ptr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram; |
| 215 | 212 |
| 216 scoped_ptr<VideoYUVProgram> m_videoYUVProgram; | 213 scoped_ptr<VideoYUVProgram> m_videoYUVProgram; |
| 217 scoped_ptr<VideoStreamTextureProgram> m_videoStreamTextureProgram; | 214 scoped_ptr<VideoStreamTextureProgram> m_videoStreamTextureProgram; |
| 218 | 215 |
| 219 scoped_ptr<SolidColorProgram> m_solidColorProgram; | 216 scoped_ptr<SolidColorProgram> m_solidColorProgram; |
| 220 | 217 |
| 218 OutputSurface* m_outputSurface; |
| 221 WebKit::WebGraphicsContext3D* m_context; | 219 WebKit::WebGraphicsContext3D* m_context; |
| 222 | 220 |
| 223 gfx::Rect m_swapBufferRect; | 221 gfx::Rect m_swapBufferRect; |
| 224 gfx::Rect m_scissorRect; | 222 gfx::Rect m_scissorRect; |
| 225 bool m_isViewportChanged; | 223 bool m_isViewportChanged; |
| 226 bool m_isBackbufferDiscarded; | 224 bool m_isBackbufferDiscarded; |
| 227 bool m_discardBackbufferWhenNotVisible; | 225 bool m_discardBackbufferWhenNotVisible; |
| 228 bool m_isUsingBindUniform; | 226 bool m_isUsingBindUniform; |
| 229 bool m_visible; | 227 bool m_visible; |
| 230 bool m_isScissorEnabled; | 228 bool m_isScissorEnabled; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 246 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 244 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
| 247 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) | 245 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) |
| 248 #else | 246 #else |
| 249 #define GLC(context, x) (x) | 247 #define GLC(context, x) (x) |
| 250 #endif | 248 #endif |
| 251 | 249 |
| 252 | 250 |
| 253 } | 251 } |
| 254 | 252 |
| 255 #endif // CC_GL_RENDERER_H_ | 253 #endif // CC_GL_RENDERER_H_ |
| OLD | NEW |