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 "cc/checkerboard_draw_quad.h" | 8 #include "cc/checkerboard_draw_quad.h" |
9 #include "cc/debug_border_draw_quad.h" | 9 #include "cc/debug_border_draw_quad.h" |
10 #include "cc/direct_renderer.h" | 10 #include "cc/direct_renderer.h" |
11 #include "cc/io_surface_draw_quad.h" | 11 #include "cc/io_surface_draw_quad.h" |
12 #include "cc/render_pass_draw_quad.h" | 12 #include "cc/render_pass_draw_quad.h" |
13 #include "cc/renderer.h" | 13 #include "cc/renderer.h" |
14 #include "cc/solid_color_draw_quad.h" | 14 #include "cc/solid_color_draw_quad.h" |
15 #include "cc/tile_draw_quad.h" | 15 #include "cc/tile_draw_quad.h" |
16 #include "cc/yuv_video_draw_quad.h" | 16 #include "cc/yuv_video_draw_quad.h" |
| 17 #include "ui/gfx/quad_f.h" |
17 | 18 |
18 namespace WebKit { | 19 namespace WebKit { |
19 class WebGraphicsContext3D; | 20 class WebGraphicsContext3D; |
20 } | 21 } |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
23 | 24 |
24 class ScopedTexture; | 25 class ScopedTexture; |
25 class StreamVideoDrawQuad; | 26 class StreamVideoDrawQuad; |
26 class TextureDrawQuad; | 27 class TextureDrawQuad; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 virtual void sendManagedMemoryStats(size_t bytesVisible, size_t bytesVisible
AndNearby, size_t bytesAllocated) OVERRIDE; | 60 virtual void sendManagedMemoryStats(size_t bytesVisible, size_t bytesVisible
AndNearby, size_t bytesAllocated) OVERRIDE; |
60 | 61 |
61 protected: | 62 protected: |
62 GLRenderer(RendererClient*, ResourceProvider*); | 63 GLRenderer(RendererClient*, ResourceProvider*); |
63 | 64 |
64 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); | 65 static void debugGLCall(WebKit::WebGraphicsContext3D*, const char* command,
const char* file, int line); |
65 | 66 |
66 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } | 67 bool isFramebufferDiscarded() const { return m_isFramebufferDiscarded; } |
67 bool initialize(); | 68 bool initialize(); |
68 | 69 |
69 const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; } | 70 const gfx::QuadF& sharedGeometryQuad() const { return m_sharedGeometryQuad;
} |
70 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } | 71 const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(
); } |
71 | 72 |
72 bool getFramebufferTexture(ScopedTexture*, const gfx::Rect& deviceRect); | 73 bool getFramebufferTexture(ScopedTexture*, const gfx::Rect& deviceRect); |
73 void releaseRenderPassTextures(); | 74 void releaseRenderPassTextures(); |
74 | 75 |
75 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; | 76 virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE; |
76 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedTexture*, c
onst gfx::Rect& framebufferRect) OVERRIDE; | 77 virtual bool bindFramebufferToTexture(DrawingFrame&, const ScopedTexture*, c
onst gfx::Rect& framebufferRect) OVERRIDE; |
77 virtual void setDrawViewportSize(const gfx::Size&) OVERRIDE; | 78 virtual void setDrawViewportSize(const gfx::Size&) OVERRIDE; |
78 virtual void enableScissorTestRect(const gfx::Rect& scissorRect) OVERRIDE; | 79 virtual void enableScissorTestRect(const gfx::Rect& scissorRect) OVERRIDE; |
79 virtual void disableScissorTest() OVERRIDE; | 80 virtual void disableScissorTest() OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
92 scoped_ptr<ScopedTexture> drawBackgroundFilters(DrawingFrame&, const RenderP
assDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformatio
nMatrix& deviceTransform); | 93 scoped_ptr<ScopedTexture> drawBackgroundFilters(DrawingFrame&, const RenderP
assDrawQuad*, const WebKit::WebFilterOperations&, const WebKit::WebTransformatio
nMatrix& deviceTransform); |
93 void drawRenderPassQuad(DrawingFrame&, const RenderPassDrawQuad*); | 94 void drawRenderPassQuad(DrawingFrame&, const RenderPassDrawQuad*); |
94 void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); | 95 void drawSolidColorQuad(const DrawingFrame&, const SolidColorDrawQuad*); |
95 void drawStreamVideoQuad(const DrawingFrame&, const StreamVideoDrawQuad*); | 96 void drawStreamVideoQuad(const DrawingFrame&, const StreamVideoDrawQuad*); |
96 void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); | 97 void drawTextureQuad(const DrawingFrame&, const TextureDrawQuad*); |
97 void drawIOSurfaceQuad(const DrawingFrame&, const IOSurfaceDrawQuad*); | 98 void drawIOSurfaceQuad(const DrawingFrame&, const IOSurfaceDrawQuad*); |
98 void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); | 99 void drawTileQuad(const DrawingFrame&, const TileDrawQuad*); |
99 void drawYUVVideoQuad(const DrawingFrame&, const YUVVideoDrawQuad*); | 100 void drawYUVVideoQuad(const DrawingFrame&, const YUVVideoDrawQuad*); |
100 | 101 |
101 void setShaderOpacity(float opacity, int alphaLocation); | 102 void setShaderOpacity(float opacity, int alphaLocation); |
102 void setShaderFloatQuad(const FloatQuad&, int quadLocation); | 103 void setShaderQuadF(const gfx::QuadF&, int quadLocation); |
103 void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMa
trix& drawTransform, const gfx::RectF& quadRect, int matrixLocation); | 104 void drawQuadGeometry(const DrawingFrame&, const WebKit::WebTransformationMa
trix& drawTransform, const gfx::RectF& quadRect, int matrixLocation); |
104 | 105 |
105 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx:
:Rect&, const WebKit::WebTransformationMatrix& drawMatrix); | 106 void copyTextureToFramebuffer(const DrawingFrame&, int textureId, const gfx:
:Rect&, const WebKit::WebTransformationMatrix& drawMatrix); |
106 | 107 |
107 bool useScopedTexture(DrawingFrame&, const ScopedTexture*, const gfx::Rect&
viewportRect); | 108 bool useScopedTexture(DrawingFrame&, const ScopedTexture*, const gfx::Rect&
viewportRect); |
108 | 109 |
109 bool makeContextCurrent(); | 110 bool makeContextCurrent(); |
110 | 111 |
111 bool initializeSharedObjects(); | 112 bool initializeSharedObjects(); |
112 void cleanupSharedObjects(); | 113 void cleanupSharedObjects(); |
113 | 114 |
114 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM
IUM implementation. | 115 // WebKit::WebGraphicsContext3D::WebGraphicsSwapBuffersCompleteCallbackCHROM
IUM implementation. |
115 virtual void onSwapBuffersComplete() OVERRIDE; | 116 virtual void onSwapBuffersComplete() OVERRIDE; |
116 | 117 |
117 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. | 118 // WebKit::WebGraphicsContext3D::WebGraphicsMemoryAllocationChangedCallbackC
HROMIUM implementation. |
118 virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation)
OVERRIDE; | 119 virtual void onMemoryAllocationChanged(WebKit::WebGraphicsMemoryAllocation)
OVERRIDE; |
119 void onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocati
on); | 120 void onMemoryAllocationChangedOnImplThread(WebKit::WebGraphicsMemoryAllocati
on); |
120 void discardFramebuffer(); | 121 void discardFramebuffer(); |
121 void ensureFramebuffer(); | 122 void ensureFramebuffer(); |
122 void enforceMemoryPolicy(); | 123 void enforceMemoryPolicy(); |
123 | 124 |
124 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. | 125 // WebGraphicsContext3D::WebGraphicsContextLostCallback implementation. |
125 virtual void onContextLost() OVERRIDE; | 126 virtual void onContextLost() OVERRIDE; |
126 | 127 |
127 RendererCapabilities m_capabilities; | 128 RendererCapabilities m_capabilities; |
128 | 129 |
129 unsigned m_offscreenFramebufferId; | 130 unsigned m_offscreenFramebufferId; |
130 | 131 |
131 scoped_ptr<GeometryBinding> m_sharedGeometry; | 132 scoped_ptr<GeometryBinding> m_sharedGeometry; |
132 FloatQuad m_sharedGeometryQuad; | 133 gfx::QuadF m_sharedGeometryQuad; |
133 | 134 |
134 // This block of bindings defines all of the programs used by the compositor
itself. | 135 // This block of bindings defines all of the programs used by the compositor
itself. |
135 | 136 |
136 // Tiled layer shaders. | 137 // Tiled layer shaders. |
137 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlpha> TilePro
gram; | 138 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlpha> TilePro
gram; |
138 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampAlphaAA>
TileProgramAA; | 139 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampAlphaAA>
TileProgramAA; |
139 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampSwizzleAl
phaAA> TileProgramSwizzleAA; | 140 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexClampSwizzleAl
phaAA> TileProgramSwizzleAA; |
140 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexOpaque> TilePr
ogramOpaque; | 141 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexOpaque> TilePr
ogramOpaque; |
141 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlpha>
TileProgramSwizzle; | 142 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleAlpha>
TileProgramSwizzle; |
142 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleOpaque>
TileProgramSwizzleOpaque; | 143 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexSwizzleOpaque>
TileProgramSwizzleOpaque; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 #if DEBUG_GL_CALLS && !defined(NDEBUG) | 228 #if DEBUG_GL_CALLS && !defined(NDEBUG) |
228 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) | 229 #define GLC(context, x) (x, GLRenderer::debugGLCall(&*context, #x, __FILE__, __L
INE__)) |
229 #else | 230 #else |
230 #define GLC(context, x) (x) | 231 #define GLC(context, x) (x) |
231 #endif | 232 #endif |
232 | 233 |
233 | 234 |
234 } | 235 } |
235 | 236 |
236 #endif | 237 #endif |
OLD | NEW |