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