| 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 | 5 |
| 6 #ifndef CCRendererGL_h | 6 #ifndef CCRendererGL_h |
| 7 #define CCRendererGL_h | 7 #define CCRendererGL_h |
| 8 | 8 |
| 9 #if USE(ACCELERATED_COMPOSITING) | 9 #if USE(ACCELERATED_COMPOSITING) |
| 10 | 10 |
| 11 #include "CCCheckerboardDrawQuad.h" | 11 #include "CCCheckerboardDrawQuad.h" |
| 12 #include "CCDebugBorderDrawQuad.h" | 12 #include "CCDebugBorderDrawQuad.h" |
| 13 #include "CCDirectRenderer.h" | 13 #include "CCDirectRenderer.h" |
| 14 #include "CCIOSurfaceDrawQuad.h" | 14 #include "CCIOSurfaceDrawQuad.h" |
| 15 #include "CCRenderPassDrawQuad.h" | 15 #include "CCRenderPassDrawQuad.h" |
| 16 #include "CCRenderer.h" | 16 #include "CCRenderer.h" |
| 17 #include "CCSolidColorDrawQuad.h" | 17 #include "CCSolidColorDrawQuad.h" |
| 18 #include "CCStreamVideoDrawQuad.h" | 18 #include "CCStreamVideoDrawQuad.h" |
| 19 #include "CCTextureDrawQuad.h" | 19 #include "CCTextureDrawQuad.h" |
| 20 #include "CCTileDrawQuad.h" | 20 #include "CCTileDrawQuad.h" |
| 21 #include "CCYUVVideoDrawQuad.h" | 21 #include "CCYUVVideoDrawQuad.h" |
| 22 #include "Extensions3DChromium.h" | 22 #include "Extensions3DChromium.h" |
| 23 #include "TextureCopier.h" | |
| 24 #include <wtf/PassOwnPtr.h> | 23 #include <wtf/PassOwnPtr.h> |
| 25 | 24 |
| 26 namespace WebKit { | 25 namespace WebKit { |
| 27 class WebGraphicsContext3D; | 26 class WebGraphicsContext3D; |
| 28 } | 27 } |
| 29 | 28 |
| 30 namespace cc { | 29 namespace cc { |
| 31 | 30 |
| 32 class CCScopedTexture; | 31 class CCScopedTexture; |
| 33 class GeometryBinding; | 32 class GeometryBinding; |
| 34 class ScopedEnsureFramebufferAllocation; | 33 class ScopedEnsureFramebufferAllocation; |
| 35 | 34 |
| 36 // Class that handles drawing of composited render layers using GL. | 35 // Class that handles drawing of composited render layers using GL. |
| 37 class CCRendererGL : public CCDirectRenderer, | 36 class CCRendererGL : public CCDirectRenderer, |
| 38 public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffers
CompleteCallbackCHROMIUM, | 37 public WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffers
CompleteCallbackCHROMIUM, |
| 39 public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAlloc
ationChangedCallbackCHROMIUM , | 38 public WebKit::WebGraphicsContext3D::WebGraphicsMemoryAlloc
ationChangedCallbackCHROMIUM , |
| 40 public WebKit::WebGraphicsContext3D::WebGraphicsContextLost
Callback { | 39 public WebKit::WebGraphicsContext3D::WebGraphicsContextLost
Callback { |
| 41 WTF_MAKE_NONCOPYABLE(CCRendererGL); | 40 WTF_MAKE_NONCOPYABLE(CCRendererGL); |
| 42 public: | 41 public: |
| 43 static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider
*, TextureUploaderOption); | 42 static PassOwnPtr<CCRendererGL> create(CCRendererClient*, CCResourceProvider
*); |
| 44 | 43 |
| 45 virtual ~CCRendererGL(); | 44 virtual ~CCRendererGL(); |
| 46 | 45 |
| 47 virtual const RendererCapabilities& capabilities() const OVERRIDE { return m
_capabilities; } | 46 virtual const RendererCapabilities& capabilities() const OVERRIDE { return m
_capabilities; } |
| 48 | 47 |
| 49 WebKit::WebGraphicsContext3D* context(); | 48 WebKit::WebGraphicsContext3D* context(); |
| 50 | 49 |
| 51 virtual void viewportChanged() OVERRIDE; | 50 virtual void viewportChanged() OVERRIDE; |
| 52 | 51 |
| 53 const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; } | 52 const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; } |
| 54 | 53 |
| 55 // waits for rendering to finish | 54 // waits for rendering to finish |
| 56 virtual void finish() OVERRIDE; | 55 virtual void finish() OVERRIDE; |
| 57 | 56 |
| 58 virtual void doNoOp() OVERRIDE; | 57 virtual void doNoOp() OVERRIDE; |
| 59 // puts backbuffer onscreen | 58 // puts backbuffer onscreen |
| 60 virtual bool swapBuffers() OVERRIDE; | 59 virtual bool swapBuffers() OVERRIDE; |
| 61 | 60 |
| 62 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); | 61 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); |
| 63 | 62 |
| 64 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } | 63 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } |
| 65 | 64 |
| 66 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; | 65 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; |
| 67 bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect); | 66 bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect); |
| 68 | 67 |
| 69 virtual TextureCopier* textureCopier() const OVERRIDE { return m_textureCopi
er.get(); } | |
| 70 virtual TextureUploader* textureUploader() const OVERRIDE { return m_texture
Uploader.get(); } | |
| 71 | |
| 72 virtual bool isContextLost() OVERRIDE; | 68 virtual bool isContextLost() OVERRIDE; |
| 73 | 69 |
| 74 virtual void setVisible(bool) OVERRIDE; | 70 virtual void setVisible(bool) OVERRIDE; |
| 75 | 71 |
| 76 protected: | 72 protected: |
| 77 CCRendererGL(CCRendererClient*, CCResourceProvider*, TextureUploaderOption); | 73 CCRendererGL(CCRendererClient*, CCResourceProvider*); |
| 78 | 74 |
| 79 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } | 75 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } |
| 80 bool initialize(); | 76 bool initialize(); |
| 81 | 77 |
| 82 void releaseRenderPassTextures(); | 78 void releaseRenderPassTextures(); |
| 83 | 79 |
| 84 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; | 80 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; |
| 85 virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*,
const IntRect& framebufferRect) OVERRIDE; | 81 virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*,
const IntRect& framebufferRect) OVERRIDE; |
| 86 virtual void setDrawViewportSize(const IntSize&) OVERRIDE; | 82 virtual void setDrawViewportSize(const IntSize&) OVERRIDE; |
| 87 virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE; | 83 virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 199 |
| 204 OwnPtr<TextureProgram> m_textureProgram; | 200 OwnPtr<TextureProgram> m_textureProgram; |
| 205 OwnPtr<TextureProgramFlip> m_textureProgramFlip; | 201 OwnPtr<TextureProgramFlip> m_textureProgramFlip; |
| 206 OwnPtr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram; | 202 OwnPtr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram; |
| 207 | 203 |
| 208 OwnPtr<VideoYUVProgram> m_videoYUVProgram; | 204 OwnPtr<VideoYUVProgram> m_videoYUVProgram; |
| 209 OwnPtr<VideoStreamTextureProgram> m_videoStreamTextureProgram; | 205 OwnPtr<VideoStreamTextureProgram> m_videoStreamTextureProgram; |
| 210 | 206 |
| 211 OwnPtr<SolidColorProgram> m_solidColorProgram; | 207 OwnPtr<SolidColorProgram> m_solidColorProgram; |
| 212 | 208 |
| 213 OwnPtr<AcceleratedTextureCopier> m_textureCopier; | |
| 214 OwnPtr<TextureUploader> m_textureUploader; | |
| 215 | |
| 216 WebKit::WebGraphicsContext3D* m_context; | 209 WebKit::WebGraphicsContext3D* m_context; |
| 217 | 210 |
| 218 IntRect m_swapBufferRect; | 211 IntRect m_swapBufferRect; |
| 219 bool m_isViewportChanged; | 212 bool m_isViewportChanged; |
| 220 bool m_isFramebufferDiscarded; | 213 bool m_isFramebufferDiscarded; |
| 221 bool m_isUsingBindUniform; | 214 bool m_isUsingBindUniform; |
| 222 bool m_visible; | 215 bool m_visible; |
| 223 TextureUploaderOption m_textureUploaderSetting; | |
| 224 | 216 |
| 225 OwnPtr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; | 217 OwnPtr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; |
| 226 }; | 218 }; |
| 227 | 219 |
| 228 | 220 |
| 229 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL | 221 // 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 | 222 // call made by the compositor. Useful for debugging rendering issues but |
| 231 // will significantly degrade performance. | 223 // will significantly degrade performance. |
| 232 #define DEBUG_GL_CALLS 0 | 224 #define DEBUG_GL_CALLS 0 |
| 233 | 225 |
| 234 #if DEBUG_GL_CALLS && !defined ( NDEBUG ) | 226 #if DEBUG_GL_CALLS && !defined ( NDEBUG ) |
| 235 #define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, _
_LINE__)) | 227 #define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, _
_LINE__)) |
| 236 #else | 228 #else |
| 237 #define GLC(context, x) (x) | 229 #define GLC(context, x) (x) |
| 238 #endif | 230 #endif |
| 239 | 231 |
| 240 | 232 |
| 241 } | 233 } |
| 242 | 234 |
| 243 #endif // USE(ACCELERATED_COMPOSITING) | 235 #endif // USE(ACCELERATED_COMPOSITING) |
| 244 | 236 |
| 245 #endif | 237 #endif |
| OLD | NEW |