| 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/io_surface_draw_quad.h" | 13 #include "cc/io_surface_draw_quad.h" |
| 13 #include "cc/render_pass_draw_quad.h" | 14 #include "cc/render_pass_draw_quad.h" |
| 14 #include "cc/renderer.h" | 15 #include "cc/renderer.h" |
| 15 #include "cc/solid_color_draw_quad.h" | 16 #include "cc/solid_color_draw_quad.h" |
| 16 #include "cc/tile_draw_quad.h" | 17 #include "cc/tile_draw_quad.h" |
| 17 #include "cc/yuv_video_draw_quad.h" | 18 #include "cc/yuv_video_draw_quad.h" |
| 18 #include "ui/gfx/quad_f.h" | 19 #include "ui/gfx/quad_f.h" |
| 19 | 20 |
| 20 namespace WebKit { | 21 namespace WebKit { |
| 21 class WebGraphicsContext3D; | 22 class WebGraphicsContext3D; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedResource*,
const gfx::Rect& framebufferRect) OVERRIDE; | 79 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedResource*,
const gfx::Rect& framebufferRect) OVERRIDE; |
| 79 virtual void setDrawViewportSize(const gfx::Size&) OVERRIDE; | 80 virtual void setDrawViewportSize(const gfx::Size&) OVERRIDE; |
| 80 virtual void setScissorTestRect(const gfx::Rect& scissorRect) OVERRIDE; | 81 virtual void setScissorTestRect(const gfx::Rect& scissorRect) OVERRIDE; |
| 81 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; | 82 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; |
| 82 virtual void drawQuad(DrawingFrame&, const DrawQuad*) OVERRIDE; | 83 virtual void drawQuad(DrawingFrame&, const DrawQuad*) OVERRIDE; |
| 83 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; | 84 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; |
| 84 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; | 85 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; |
| 85 virtual bool flippedFramebuffer() const OVERRIDE; | 86 virtual bool flippedFramebuffer() const OVERRIDE; |
| 86 virtual void ensureScissorTestEnabled() OVERRIDE; | 87 virtual void ensureScissorTestEnabled() OVERRIDE; |
| 87 virtual void ensureScissorTestDisabled() OVERRIDE; | 88 virtual void ensureScissorTestDisabled() OVERRIDE; |
| 89 virtual void finishDrawingQuadList() OVERRIDE; |
| 88 | 90 |
| 89 private: | 91 private: |
| 90 static void toGLMatrix(float*, const gfx::Transform&); | 92 static void toGLMatrix(float*, const gfx::Transform&); |
| 91 static int priorityCutoffValue(WebKit::WebGraphicsMemoryAllocation::Priority
Cutoff); | 93 static int priorityCutoffValue(WebKit::WebGraphicsMemoryAllocation::Priority
Cutoff); |
| 92 | 94 |
| 93 void drawCheckerboardQuad(const DrawingFrame&, const CheckerboardDrawQuad*); | 95 void drawCheckerboardQuad(const DrawingFrame&, const CheckerboardDrawQuad*); |
| 94 void drawDebugBorderQuad(const DrawingFrame&, const DebugBorderDrawQuad*); | 96 void drawDebugBorderQuad(const DrawingFrame&, const DebugBorderDrawQuad*); |
| 95 scoped_ptr<ScopedResource> drawBackgroundFilters( | 97 scoped_ptr<ScopedResource> drawBackgroundFilters( |
| 96 DrawingFrame&, const RenderPassDrawQuad*, const WebKit::WebFilterOperati
ons&, | 98 DrawingFrame&, const RenderPassDrawQuad*, const WebKit::WebFilterOperati
ons&, |
| 97 const gfx::Transform& contentsDeviceTransform, | 99 const gfx::Transform& contentsDeviceTransform, |
| 98 const gfx::Transform& contentsDeviceTransformInverse); | 100 const gfx::Transform& contentsDeviceTransformInverse); |
| 99 void drawRenderPassQuad(DrawingFrame&, const RenderPassDrawQuad*); | 101 void drawRenderPassQuad(DrawingFrame&, const RenderPassDrawQuad*); |
| 100 void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); | 102 void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); |
| 101 void drawStreamVideoQuad(const DrawingFrame&, const StreamVideoDrawQuad*); | 103 void drawStreamVideoQuad(const DrawingFrame&, const StreamVideoDrawQuad*); |
| 102 void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); | 104 void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); |
| 105 void enqueueTextureQuad(const DrawingFrame&, const TextureDrawQuad*); |
| 106 void flushTextureQuadCache(); |
| 103 void drawIOSurfaceQuad(const DrawingFrame&, const IOSurfaceDrawQuad*); | 107 void drawIOSurfaceQuad(const DrawingFrame&, const IOSurfaceDrawQuad*); |
| 104 void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); | 108 void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); |
| 105 void drawYUVVideoQuad(const DrawingFrame&, const YUVVideoDrawQuad*); | 109 void drawYUVVideoQuad(const DrawingFrame&, const YUVVideoDrawQuad*); |
| 106 | 110 |
| 107 void setShaderOpacity(float opacity, int alphaLocation); | 111 void setShaderOpacity(float opacity, int alphaLocation); |
| 108 void setShaderQuadF(const gfx::QuadF&, int quadLocation); | 112 void setShaderQuadF(const gfx::QuadF&, int quadLocation); |
| 109 void drawQuadGeometry(const DrawingFrame&, const gfx::Transform& drawTransfo
rm, const gfx::RectF& quadRect, int matrixLocation); | 113 void drawQuadGeometry(const DrawingFrame&, const gfx::Transform& drawTransfo
rm, const gfx::RectF& quadRect, int matrixLocation); |
| 114 void setBlendEnabled(bool enabled); |
| 115 void setUseProgram(unsigned program); |
| 110 | 116 |
| 111 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx:
:Rect&, const gfx::Transform& drawMatrix); | 117 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx:
:Rect&, const gfx::Transform& drawMatrix); |
| 112 | 118 |
| 113 bool useScopedTexture(DrawingFrame&, const ScopedResource*, const gfx::Rect&
viewportRect); | 119 bool useScopedTexture(DrawingFrame&, const ScopedResource*, const gfx::Rect&
viewportRect); |
| 114 | 120 |
| 115 bool makeContextCurrent(); | 121 bool makeContextCurrent(); |
| 116 | 122 |
| 117 bool initializeSharedObjects(); | 123 bool initializeSharedObjects(); |
| 118 void cleanupSharedObjects(); | 124 void cleanupSharedObjects(); |
| 119 | 125 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 WebKit::WebGraphicsContext3D* m_context; | 218 WebKit::WebGraphicsContext3D* m_context; |
| 213 | 219 |
| 214 gfx::Rect m_swapBufferRect; | 220 gfx::Rect m_swapBufferRect; |
| 215 gfx::Rect m_scissorRect; | 221 gfx::Rect m_scissorRect; |
| 216 bool m_isViewportChanged; | 222 bool m_isViewportChanged; |
| 217 bool m_isFramebufferDiscarded; | 223 bool m_isFramebufferDiscarded; |
| 218 bool m_discardFramebufferWhenNotVisible; | 224 bool m_discardFramebufferWhenNotVisible; |
| 219 bool m_isUsingBindUniform; | 225 bool m_isUsingBindUniform; |
| 220 bool m_visible; | 226 bool m_visible; |
| 221 bool m_isScissorEnabled; | 227 bool m_isScissorEnabled; |
| 228 bool m_blendShadow; |
| 229 unsigned m_programShadow; |
| 230 TexturedQuadDrawCache m_drawCache; |
| 222 | 231 |
| 223 scoped_ptr<ResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; | 232 scoped_ptr<ResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; |
| 224 | 233 |
| 225 DISALLOW_COPY_AND_ASSIGN(GLRenderer); | 234 DISALLOW_COPY_AND_ASSIGN(GLRenderer); |
| 226 }; | 235 }; |
| 227 | 236 |
| 228 | 237 |
| 229 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL | 238 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL |
| 230 // call made by the compositor. Useful for debugging rendering issues but | 239 // call made by the compositor. Useful for debugging rendering issues but |
| 231 // will significantly degrade performance. | 240 // will significantly degrade performance. |
| 232 #define DEBUG_GL_CALLS 0 | 241 #define DEBUG_GL_CALLS 0 |
| 233 | 242 |
| 234 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 243 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
| 235 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) | 244 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) |
| 236 #else | 245 #else |
| 237 #define GLC(context, x) (x) | 246 #define GLC(context, x) (x) |
| 238 #endif | 247 #endif |
| 239 | 248 |
| 240 | 249 |
| 241 } | 250 } |
| 242 | 251 |
| 243 #endif // CC_GL_RENDERER_H_ | 252 #endif // CC_GL_RENDERER_H_ |
| OLD | NEW |