| 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 CCRendererGL_h | 5 #ifndef CCRendererGL_h |
| 6 #define CCRendererGL_h | 6 #define CCRendererGL_h |
| 7 | 7 |
| 8 #include "CCCheckerboardDrawQuad.h" | 8 #include "CCCheckerboardDrawQuad.h" |
| 9 #include "CCDebugBorderDrawQuad.h" | 9 #include "CCDebugBorderDrawQuad.h" |
| 10 #include "CCDirectRenderer.h" | 10 #include "CCDirectRenderer.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 static scoped_ptr<CCRendererGL> create(CCRendererClient*, CCResourceProvider
*); | 36 static scoped_ptr<CCRendererGL> create(CCRendererClient*, CCResourceProvider
*); |
| 37 | 37 |
| 38 virtual ~CCRendererGL(); | 38 virtual ~CCRendererGL(); |
| 39 | 39 |
| 40 virtual const RendererCapabilities& capabilities() const OVERRIDE; | 40 virtual const RendererCapabilities& capabilities() const OVERRIDE; |
| 41 | 41 |
| 42 WebKit::WebGraphicsContext3D* context(); | 42 WebKit::WebGraphicsContext3D* context(); |
| 43 | 43 |
| 44 virtual void viewportChanged() OVERRIDE; | 44 virtual void viewportChanged() OVERRIDE; |
| 45 | 45 |
| 46 const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; } | |
| 47 | |
| 48 // waits for rendering to finish | 46 // waits for rendering to finish |
| 49 virtual void finish() OVERRIDE; | 47 virtual void finish() OVERRIDE; |
| 50 | 48 |
| 51 virtual void doNoOp() OVERRIDE; | 49 virtual void doNoOp() OVERRIDE; |
| 52 // puts backbuffer onscreen | 50 // puts backbuffer onscreen |
| 53 virtual bool swapBuffers() OVERRIDE; | 51 virtual bool swapBuffers() OVERRIDE; |
| 54 | 52 |
| 55 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); | |
| 56 | |
| 57 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } | |
| 58 | |
| 59 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; | 53 virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE; |
| 60 bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect); | |
| 61 | 54 |
| 62 virtual bool isContextLost() OVERRIDE; | 55 virtual bool isContextLost() OVERRIDE; |
| 63 | 56 |
| 64 virtual void setVisible(bool) OVERRIDE; | 57 virtual void setVisible(bool) OVERRIDE; |
| 65 | 58 |
| 66 protected: | 59 protected: |
| 67 CCRendererGL(CCRendererClient*, CCResourceProvider*); | 60 CCRendererGL(CCRendererClient*, CCResourceProvider*); |
| 68 | 61 |
| 62 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); |
| 63 |
| 69 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } | 64 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } |
| 70 bool initialize(); | 65 bool initialize(); |
| 71 | 66 |
| 67 const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; } |
| 68 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } |
| 69 |
| 70 bool getFramebufferTexture(CCScopedTexture*, const IntRect& deviceRect); |
| 72 void releaseRenderPassTextures(); | 71 void releaseRenderPassTextures(); |
| 73 | 72 |
| 74 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; | 73 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; |
| 75 virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*,
const IntRect& framebufferRect) OVERRIDE; | 74 virtual bool bindFramebufferToTexture(DrawingFrame&, const CCScopedTexture*,
const gfx::Rect& framebufferRect) OVERRIDE; |
| 76 virtual void setDrawViewportSize(const IntSize&) OVERRIDE; | 75 virtual void setDrawViewportSize(const gfx::Size&) OVERRIDE; |
| 77 virtual void enableScissorTestRect(const IntRect& scissorRect) OVERRIDE; | 76 virtual void enableScissorTestRect(const gfx::Rect& scissorRect) OVERRIDE; |
| 78 virtual void disableScissorTest() OVERRIDE; | 77 virtual void disableScissorTest() OVERRIDE; |
| 79 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; | 78 virtual void clearFramebuffer(DrawingFrame&) OVERRIDE; |
| 80 virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE; | 79 virtual void drawQuad(DrawingFrame&, const CCDrawQuad*) OVERRIDE; |
| 81 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; | 80 virtual void beginDrawingFrame(DrawingFrame&) OVERRIDE; |
| 82 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; | 81 virtual void finishDrawingFrame(DrawingFrame&) OVERRIDE; |
| 83 virtual bool flippedFramebuffer() const OVERRIDE; | 82 virtual bool flippedFramebuffer() const OVERRIDE; |
| 84 | 83 |
| 85 private: | 84 private: |
| 86 static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); | 85 static void toGLMatrix(float*, const WebKit::WebTransformationMatrix&); |
| 87 | 86 |
| 88 void drawCheckerboardQuad(const DrawingFrame&, const CCCheckerboardDrawQuad*
); | 87 void drawCheckerboardQuad(const DrawingFrame&, const CCCheckerboardDrawQuad*
); |
| 89 void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*); | 88 void drawDebugBorderQuad(const DrawingFrame&, const CCDebugBorderDrawQuad*); |
| 90 scoped_ptr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRen
derPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransform
ationMatrix& deviceTransform); | 89 scoped_ptr<CCScopedTexture> drawBackgroundFilters(DrawingFrame&, const CCRen
derPassDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransform
ationMatrix& deviceTransform); |
| 91 void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*); | 90 void drawRenderPassQuad(DrawingFrame&, const CCRenderPassDrawQuad*); |
| 92 void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*); | 91 void drawSolidColorQuad(const DrawingFrame&, const CCSolidColorDrawQuad*); |
| 93 void drawStreamVideoQuad(const DrawingFrame&, const CCStreamVideoDrawQuad*); | 92 void drawStreamVideoQuad(const DrawingFrame&, const CCStreamVideoDrawQuad*); |
| 94 void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*); | 93 void drawTextureQuad(const DrawingFrame&, const CCTextureDrawQuad*); |
| 95 void drawIOSurfaceQuad(const DrawingFrame&, const CCIOSurfaceDrawQuad*); | 94 void drawIOSurfaceQuad(const DrawingFrame&, const CCIOSurfaceDrawQuad*); |
| 96 void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*); | 95 void drawTileQuad(const DrawingFrame&, const CCTileDrawQuad*); |
| 97 void drawYUVVideoQuad(const DrawingFrame&, const CCYUVVideoDrawQuad*); | 96 void drawYUVVideoQuad(const DrawingFrame&, const CCYUVVideoDrawQuad*); |
| 98 | 97 |
| 99 void setShaderOpacity(float opacity, int alphaLocation); | 98 void setShaderOpacity(float opacity, int alphaLocation); |
| 100 void setShaderFloatQuad(const FloatQuad&, int quadLocation); | 99 void setShaderFloatQuad(const FloatQuad&, int quadLocation); |
| 101 void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMa
trix& drawTransform, const FloatRect& quadRect, int matrixLocation); | 100 void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMa
trix& drawTransform, const gfx::RectF& quadRect, int matrixLocation); |
| 102 | 101 |
| 103 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const IntR
ect&, const WebKit::WebTransformationMatrix& drawMatrix); | 102 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx:
:Rect&, const WebKit::WebTransformationMatrix& drawMatrix); |
| 104 | 103 |
| 105 bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const IntRect&
viewportRect); | 104 bool useScopedTexture(DrawingFrame&, const CCScopedTexture*, const gfx::Rect
& viewportRect); |
| 106 | 105 |
| 107 bool makeContextCurrent(); | 106 bool makeContextCurrent(); |
| 108 | 107 |
| 109 bool initializeSharedObjects(); | 108 bool initializeSharedObjects(); |
| 110 void cleanupSharedObjects(); | 109 void cleanupSharedObjects(); |
| 111 | 110 |
| 112 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM
IUM implementation. | 111 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM
IUM implementation. |
| 113 virtual void onSwapBuffersComplete() OVERRIDE; | 112 virtual void onSwapBuffersComplete() OVERRIDE; |
| 114 | 113 |
| 115 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. | 114 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 scoped_ptr<TextureProgramFlip> m_textureProgramFlip; | 196 scoped_ptr<TextureProgramFlip> m_textureProgramFlip; |
| 198 scoped_ptr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram; | 197 scoped_ptr<TextureIOSurfaceProgram> m_textureIOSurfaceProgram; |
| 199 | 198 |
| 200 scoped_ptr<VideoYUVProgram> m_videoYUVProgram; | 199 scoped_ptr<VideoYUVProgram> m_videoYUVProgram; |
| 201 scoped_ptr<VideoStreamTextureProgram> m_videoStreamTextureProgram; | 200 scoped_ptr<VideoStreamTextureProgram> m_videoStreamTextureProgram; |
| 202 | 201 |
| 203 scoped_ptr<SolidColorProgram> m_solidColorProgram; | 202 scoped_ptr<SolidColorProgram> m_solidColorProgram; |
| 204 | 203 |
| 205 WebKit::WebGraphicsContext3D* m_context; | 204 WebKit::WebGraphicsContext3D* m_context; |
| 206 | 205 |
| 207 IntRect m_swapBufferRect; | 206 gfx::Rect m_swapBufferRect; |
| 208 bool m_isViewportChanged; | 207 bool m_isViewportChanged; |
| 209 bool m_isFramebufferDiscarded; | 208 bool m_isFramebufferDiscarded; |
| 210 bool m_discardFramebufferWhenNotVisible; | 209 bool m_discardFramebufferWhenNotVisible; |
| 211 bool m_isUsingBindUniform; | 210 bool m_isUsingBindUniform; |
| 212 bool m_visible; | 211 bool m_visible; |
| 213 | 212 |
| 214 scoped_ptr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; | 213 scoped_ptr<CCResourceProvider::ScopedWriteLockGL> m_currentFramebufferLock; |
| 215 | 214 |
| 216 DISALLOW_COPY_AND_ASSIGN(CCRendererGL); | 215 DISALLOW_COPY_AND_ASSIGN(CCRendererGL); |
| 217 }; | 216 }; |
| 218 | 217 |
| 219 | 218 |
| 220 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL | 219 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL |
| 221 // call made by the compositor. Useful for debugging rendering issues but | 220 // call made by the compositor. Useful for debugging rendering issues but |
| 222 // will significantly degrade performance. | 221 // will significantly degrade performance. |
| 223 #define DEBUG_GL_CALLS 0 | 222 #define DEBUG_GL_CALLS 0 |
| 224 | 223 |
| 225 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 224 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
| 226 #define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, _
_LINE__)) | 225 #define GLC(context, x) (x, CCRendererGL::debugGLCall(&*context, #x, __FILE__, _
_LINE__)) |
| 227 #else | 226 #else |
| 228 #define GLC(context, x) (x) | 227 #define GLC(context, x) (x) |
| 229 #endif | 228 #endif |
| 230 | 229 |
| 231 | 230 |
| 232 } | 231 } |
| 233 | 232 |
| 234 #endif | 233 #endif |
| OLD | NEW |