Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: cc/output/gl_renderer.h

Issue 998023002: Revert of Splitting of layers for correct intersections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/geometry_binding.cc ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_OUTPUT_GL_RENDERER_H_ 5 #ifndef CC_OUTPUT_GL_RENDERER_H_
6 #define CC_OUTPUT_GL_RENDERER_H_ 6 #define CC_OUTPUT_GL_RENDERER_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
10 #include "cc/base/scoped_ptr_deque.h" 10 #include "cc/base/scoped_ptr_deque.h"
(...skipping 21 matching lines...) Expand all
32 32
33 namespace cc { 33 namespace cc {
34 34
35 class GLRendererShaderTest; 35 class GLRendererShaderTest;
36 class OutputSurface; 36 class OutputSurface;
37 class PictureDrawQuad; 37 class PictureDrawQuad;
38 class ScopedResource; 38 class ScopedResource;
39 class StreamVideoDrawQuad; 39 class StreamVideoDrawQuad;
40 class TextureDrawQuad; 40 class TextureDrawQuad;
41 class TextureMailboxDeleter; 41 class TextureMailboxDeleter;
42 class StaticGeometryBinding; 42 class GeometryBinding;
43 class DynamicGeometryBinding;
44 class ScopedEnsureFramebufferAllocation; 43 class ScopedEnsureFramebufferAllocation;
45 44
46 // Class that handles drawing of composited render layers using GL. 45 // Class that handles drawing of composited render layers using GL.
47 class CC_EXPORT GLRenderer : public DirectRenderer { 46 class CC_EXPORT GLRenderer : public DirectRenderer {
48 public: 47 public:
49 class ScopedUseGrContext; 48 class ScopedUseGrContext;
50 49
51 static scoped_ptr<GLRenderer> Create( 50 static scoped_ptr<GLRenderer> Create(
52 RendererClient* client, 51 RendererClient* client,
53 const RendererSettings* settings, 52 const RendererSettings* settings,
(...skipping 25 matching lines...) Expand all
79 OutputSurface* output_surface, 78 OutputSurface* output_surface,
80 ResourceProvider* resource_provider, 79 ResourceProvider* resource_provider,
81 TextureMailboxDeleter* texture_mailbox_deleter, 80 TextureMailboxDeleter* texture_mailbox_deleter,
82 int highp_threshold_min); 81 int highp_threshold_min);
83 82
84 void DidChangeVisibility() override; 83 void DidChangeVisibility() override;
85 84
86 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } 85 bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; }
87 86
88 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } 87 const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; }
89 const StaticGeometryBinding* SharedGeometry() const { 88 const GeometryBinding* SharedGeometry() const {
90 return shared_geometry_.get(); 89 return shared_geometry_.get();
91 } 90 }
92 91
93 void GetFramebufferPixelsAsync(const DrawingFrame* frame, 92 void GetFramebufferPixelsAsync(const DrawingFrame* frame,
94 const gfx::Rect& rect, 93 const gfx::Rect& rect,
95 scoped_ptr<CopyOutputRequest> request); 94 scoped_ptr<CopyOutputRequest> request);
96 void GetFramebufferTexture(unsigned texture_id, 95 void GetFramebufferTexture(unsigned texture_id,
97 ResourceFormat texture_format, 96 ResourceFormat texture_format,
98 const gfx::Rect& device_rect); 97 const gfx::Rect& device_rect);
99 void ReleaseRenderPassTextures(); 98 void ReleaseRenderPassTextures();
100 enum BoundGeometry { NO_BINDING, SHARED_BINDING, CLIPPED_BINDING }; 99
101 void PrepareGeometry(BoundGeometry geometry_to_bind);
102 void SetStencilEnabled(bool enabled); 100 void SetStencilEnabled(bool enabled);
103 bool stencil_enabled() const { return stencil_shadow_; } 101 bool stencil_enabled() const { return stencil_shadow_; }
104 void SetBlendEnabled(bool enabled); 102 void SetBlendEnabled(bool enabled);
105 bool blend_enabled() const { return blend_shadow_; } 103 bool blend_enabled() const { return blend_shadow_; }
106 104
107 void BindFramebufferToOutputSurface(DrawingFrame* frame) override; 105 void BindFramebufferToOutputSurface(DrawingFrame* frame) override;
108 bool BindFramebufferToTexture(DrawingFrame* frame, 106 bool BindFramebufferToTexture(DrawingFrame* frame,
109 const ScopedResource* resource, 107 const ScopedResource* resource,
110 const gfx::Rect& target_rect) override; 108 const gfx::Rect& target_rect) override;
111 void SetDrawViewport(const gfx::Rect& window_space_viewport) override; 109 void SetDrawViewport(const gfx::Rect& window_space_viewport) override;
112 void SetScissorTestRect(const gfx::Rect& scissor_rect) override; 110 void SetScissorTestRect(const gfx::Rect& scissor_rect) override;
113 void DiscardPixels(bool has_external_stencil_test, 111 void DiscardPixels(bool has_external_stencil_test,
114 bool draw_rect_covers_full_surface) override; 112 bool draw_rect_covers_full_surface) override;
115 void ClearFramebuffer(DrawingFrame* frame, 113 void ClearFramebuffer(DrawingFrame* frame,
116 bool has_external_stencil_test) override; 114 bool has_external_stencil_test) override;
117 void DoDrawQuad(DrawingFrame* frame, 115 void DoDrawQuad(DrawingFrame* frame, const class DrawQuad*) override;
118 const class DrawQuad*,
119 const gfx::QuadF* draw_region) override;
120 void BeginDrawingFrame(DrawingFrame* frame) override; 116 void BeginDrawingFrame(DrawingFrame* frame) override;
121 void FinishDrawingFrame(DrawingFrame* frame) override; 117 void FinishDrawingFrame(DrawingFrame* frame) override;
122 bool FlippedFramebuffer(const DrawingFrame* frame) const override; 118 bool FlippedFramebuffer(const DrawingFrame* frame) const override;
123 bool FlippedRootFramebuffer() const; 119 bool FlippedRootFramebuffer() const;
124 void EnsureScissorTestEnabled() override; 120 void EnsureScissorTestEnabled() override;
125 void EnsureScissorTestDisabled() override; 121 void EnsureScissorTestDisabled() override;
126 void CopyCurrentRenderPassToBitmap( 122 void CopyCurrentRenderPassToBitmap(
127 DrawingFrame* frame, 123 DrawingFrame* frame,
128 scoped_ptr<CopyOutputRequest> request) override; 124 scoped_ptr<CopyOutputRequest> request) override;
129 void FinishDrawingQuadList() override; 125 void FinishDrawingQuadList() override;
130 126
131 // Returns true if quad requires antialiasing and false otherwise. 127 // Returns true if quad requires antialiasing and false otherwise.
132 static bool ShouldAntialiasQuad(const gfx::Transform& device_transform, 128 static bool ShouldAntialiasQuad(const gfx::Transform& device_transform,
133 const DrawQuad* quad, 129 const DrawQuad* quad,
134 bool force_antialiasing); 130 bool force_antialiasing);
135 131
136 // Inflate the quad and fill edge array for fragment shader. 132 // Inflate the quad and fill edge array for fragment shader.
137 // |local_quad| is set to inflated quad. |edge| array is filled with 133 // |local_quad| is set to inflated quad. |edge| array is filled with
138 // inflated quad's edge data. 134 // inflated quad's edge data.
139 static void SetupQuadForClippingAndAntialiasing( 135 static void SetupQuadForAntialiasing(const gfx::Transform& device_transform,
140 const gfx::Transform& device_transform, 136 const DrawQuad* quad,
141 const DrawQuad* quad, 137 gfx::QuadF* local_quad,
142 bool use_aa, 138 float edge[24]);
143 const gfx::QuadF* clip_region,
144 gfx::QuadF* local_quad,
145 float edge[24]);
146 139
147 private: 140 private:
148 friend class GLRendererShaderPixelTest; 141 friend class GLRendererShaderPixelTest;
149 friend class GLRendererShaderTest; 142 friend class GLRendererShaderTest;
150 143
151 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform); 144 static void ToGLMatrix(float* gl_matrix, const gfx::Transform& transform);
152 145
153 void DrawCheckerboardQuad(const DrawingFrame* frame, 146 void DrawCheckerboardQuad(const DrawingFrame* frame,
154 const CheckerboardDrawQuad* quad, 147 const CheckerboardDrawQuad* quad);
155 const gfx::QuadF* clip_region);
156 void DrawDebugBorderQuad(const DrawingFrame* frame, 148 void DrawDebugBorderQuad(const DrawingFrame* frame,
157 const DebugBorderDrawQuad* quad); 149 const DebugBorderDrawQuad* quad);
158 static bool IsDefaultBlendMode(SkXfermode::Mode blend_mode) { 150 static bool IsDefaultBlendMode(SkXfermode::Mode blend_mode) {
159 return blend_mode == SkXfermode::kSrcOver_Mode; 151 return blend_mode == SkXfermode::kSrcOver_Mode;
160 } 152 }
161 bool CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); 153 bool CanApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode);
162 void ApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode); 154 void ApplyBlendModeUsingBlendFunc(SkXfermode::Mode blend_mode);
163 void RestoreBlendFuncToDefault(SkXfermode::Mode blend_mode); 155 void RestoreBlendFuncToDefault(SkXfermode::Mode blend_mode);
164 156
165 gfx::Rect GetBackdropBoundingBoxForRenderPassQuad( 157 gfx::Rect GetBackdropBoundingBoxForRenderPassQuad(
166 DrawingFrame* frame, 158 DrawingFrame* frame,
167 const RenderPassDrawQuad* quad, 159 const RenderPassDrawQuad* quad,
168 const gfx::Transform& contents_device_transform, 160 const gfx::Transform& contents_device_transform,
169 const gfx::QuadF* clip_region,
170 bool use_aa); 161 bool use_aa);
171 scoped_ptr<ScopedResource> GetBackdropTexture(const gfx::Rect& bounding_rect); 162 scoped_ptr<ScopedResource> GetBackdropTexture(const gfx::Rect& bounding_rect);
172 163
173 static bool ShouldApplyBackgroundFilters(DrawingFrame* frame, 164 static bool ShouldApplyBackgroundFilters(DrawingFrame* frame,
174 const RenderPassDrawQuad* quad); 165 const RenderPassDrawQuad* quad);
175 skia::RefPtr<SkImage> ApplyBackgroundFilters( 166 skia::RefPtr<SkImage> ApplyBackgroundFilters(
176 DrawingFrame* frame, 167 DrawingFrame* frame,
177 const RenderPassDrawQuad* quad, 168 const RenderPassDrawQuad* quad,
178 ScopedResource* background_texture); 169 ScopedResource* background_texture);
179 170
180 void DrawRenderPassQuad(DrawingFrame* frame, 171 void DrawRenderPassQuad(DrawingFrame* frame, const RenderPassDrawQuad* quad);
181 const RenderPassDrawQuad* quadi,
182 const gfx::QuadF* clip_region);
183 void DrawSolidColorQuad(const DrawingFrame* frame, 172 void DrawSolidColorQuad(const DrawingFrame* frame,
184 const SolidColorDrawQuad* quad, 173 const SolidColorDrawQuad* quad);
185 const gfx::QuadF* clip_region);
186 void DrawStreamVideoQuad(const DrawingFrame* frame, 174 void DrawStreamVideoQuad(const DrawingFrame* frame,
187 const StreamVideoDrawQuad* quad, 175 const StreamVideoDrawQuad* quad);
188 const gfx::QuadF* clip_region);
189 void DrawTextureQuad(const DrawingFrame* frame,
190 const TextureDrawQuad* quad,
191 const gfx::QuadF* clip_region);
192 void EnqueueTextureQuad(const DrawingFrame* frame, 176 void EnqueueTextureQuad(const DrawingFrame* frame,
193 const TextureDrawQuad* quad, 177 const TextureDrawQuad* quad);
194 const gfx::QuadF* clip_region); 178 void FlushTextureQuadCache();
195 void FlushTextureQuadCache(BoundGeometry flush_binding);
196 void DrawIOSurfaceQuad(const DrawingFrame* frame, 179 void DrawIOSurfaceQuad(const DrawingFrame* frame,
197 const IOSurfaceDrawQuad* quad, 180 const IOSurfaceDrawQuad* quad);
198 const gfx::QuadF* clip_region); 181 void DrawTileQuad(const DrawingFrame* frame, const TileDrawQuad* quad);
199 void DrawTileQuad(const DrawingFrame* frame,
200 const TileDrawQuad* quad,
201 const gfx::QuadF* clip_region);
202 void DrawContentQuad(const DrawingFrame* frame, 182 void DrawContentQuad(const DrawingFrame* frame,
203 const ContentDrawQuadBase* quad, 183 const ContentDrawQuadBase* quad,
204 ResourceProvider::ResourceId resource_id, 184 ResourceProvider::ResourceId resource_id);
205 const gfx::QuadF* clip_region);
206 void DrawContentQuadAA(const DrawingFrame* frame, 185 void DrawContentQuadAA(const DrawingFrame* frame,
207 const ContentDrawQuadBase* quad, 186 const ContentDrawQuadBase* quad,
208 ResourceProvider::ResourceId resource_id, 187 ResourceProvider::ResourceId resource_id,
209 const gfx::Transform& device_transform, 188 const gfx::Transform& device_transform);
210 const gfx::QuadF* clip_region);
211 void DrawContentQuadNoAA(const DrawingFrame* frame, 189 void DrawContentQuadNoAA(const DrawingFrame* frame,
212 const ContentDrawQuadBase* quad, 190 const ContentDrawQuadBase* quad,
213 ResourceProvider::ResourceId resource_id, 191 ResourceProvider::ResourceId resource_id);
214 const gfx::QuadF* clip_region);
215 void DrawYUVVideoQuad(const DrawingFrame* frame, 192 void DrawYUVVideoQuad(const DrawingFrame* frame,
216 const YUVVideoDrawQuad* quad, 193 const YUVVideoDrawQuad* quad);
217 const gfx::QuadF* clip_region);
218 void DrawPictureQuad(const DrawingFrame* frame, 194 void DrawPictureQuad(const DrawingFrame* frame,
219 const PictureDrawQuad* quad, 195 const PictureDrawQuad* quad);
220 const gfx::QuadF* clip_region);
221 196
222 void SetShaderOpacity(float opacity, int alpha_location); 197 void SetShaderOpacity(float opacity, int alpha_location);
223 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); 198 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location);
224 void DrawQuadGeometryClippedByQuadF(const DrawingFrame* frame,
225 const gfx::Transform& draw_transform,
226 const gfx::RectF& quad_rect,
227 const gfx::QuadF& clipping_region_quad,
228 int matrix_location,
229 const float uv[8]);
230 void DrawQuadGeometry(const DrawingFrame* frame, 199 void DrawQuadGeometry(const DrawingFrame* frame,
231 const gfx::Transform& draw_transform, 200 const gfx::Transform& draw_transform,
232 const gfx::RectF& quad_rect, 201 const gfx::RectF& quad_rect,
233 int matrix_location); 202 int matrix_location);
234 void SetUseProgram(unsigned program); 203 void SetUseProgram(unsigned program);
235 204
236 bool UseScopedTexture(DrawingFrame* frame, 205 bool UseScopedTexture(DrawingFrame* frame,
237 const ScopedResource* resource, 206 const ScopedResource* resource,
238 const gfx::Rect& viewport_rect); 207 const gfx::Rect& viewport_rect);
239 208
(...skipping 21 matching lines...) Expand all
261 230
262 typedef ScopedPtrVector<ResourceProvider::ScopedReadLockGL> 231 typedef ScopedPtrVector<ResourceProvider::ScopedReadLockGL>
263 OverlayResourceLockList; 232 OverlayResourceLockList;
264 OverlayResourceLockList pending_overlay_resources_; 233 OverlayResourceLockList pending_overlay_resources_;
265 OverlayResourceLockList in_use_overlay_resources_; 234 OverlayResourceLockList in_use_overlay_resources_;
266 235
267 RendererCapabilitiesImpl capabilities_; 236 RendererCapabilitiesImpl capabilities_;
268 237
269 unsigned offscreen_framebuffer_id_; 238 unsigned offscreen_framebuffer_id_;
270 239
271 scoped_ptr<StaticGeometryBinding> shared_geometry_; 240 scoped_ptr<GeometryBinding> shared_geometry_;
272 scoped_ptr<DynamicGeometryBinding> clipped_geometry_;
273 gfx::QuadF shared_geometry_quad_; 241 gfx::QuadF shared_geometry_quad_;
274 242
275 // This block of bindings defines all of the programs used by the compositor 243 // This block of bindings defines all of the programs used by the compositor
276 // itself. Add any new programs here to GLRendererShaderTest. 244 // itself. Add any new programs here to GLRendererShaderTest.
277 245
278 // Tiled layer shaders. 246 // Tiled layer shaders.
279 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlpha> 247 typedef ProgramBinding<VertexShaderTile, FragmentShaderRGBATexAlpha>
280 TileProgram; 248 TileProgram;
281 typedef ProgramBinding<VertexShaderTileAA, FragmentShaderRGBATexClampAlphaAA> 249 typedef ProgramBinding<VertexShaderTileAA, FragmentShaderRGBATexClampAlphaAA>
282 TileProgramAA; 250 TileProgramAA;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 class SyncQuery; 464 class SyncQuery;
497 ScopedPtrDeque<SyncQuery> pending_sync_queries_; 465 ScopedPtrDeque<SyncQuery> pending_sync_queries_;
498 ScopedPtrDeque<SyncQuery> available_sync_queries_; 466 ScopedPtrDeque<SyncQuery> available_sync_queries_;
499 scoped_ptr<SyncQuery> current_sync_query_; 467 scoped_ptr<SyncQuery> current_sync_query_;
500 bool use_sync_query_; 468 bool use_sync_query_;
501 bool use_blend_equation_advanced_; 469 bool use_blend_equation_advanced_;
502 bool use_blend_equation_advanced_coherent_; 470 bool use_blend_equation_advanced_coherent_;
503 471
504 SkBitmap on_demand_tile_raster_bitmap_; 472 SkBitmap on_demand_tile_raster_bitmap_;
505 ResourceProvider::ResourceId on_demand_tile_raster_resource_id_; 473 ResourceProvider::ResourceId on_demand_tile_raster_resource_id_;
506 BoundGeometry bound_geometry_; 474
507 DISALLOW_COPY_AND_ASSIGN(GLRenderer); 475 DISALLOW_COPY_AND_ASSIGN(GLRenderer);
508 }; 476 };
509 477
510 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL 478 // Setting DEBUG_GL_CALLS to 1 will call glGetError() after almost every GL
511 // call made by the compositor. Useful for debugging rendering issues but 479 // call made by the compositor. Useful for debugging rendering issues but
512 // will significantly degrade performance. 480 // will significantly degrade performance.
513 #define DEBUG_GL_CALLS 0 481 #define DEBUG_GL_CALLS 0
514 482
515 #if DEBUG_GL_CALLS && !defined(NDEBUG) 483 #if DEBUG_GL_CALLS && !defined(NDEBUG)
516 #define GLC(context, x) \ 484 #define GLC(context, x) \
517 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) 485 (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__))
518 #else 486 #else
519 #define GLC(context, x) (x) 487 #define GLC(context, x) (x)
520 #endif 488 #endif
521 489
522 } // namespace cc 490 } // namespace cc
523 491
524 #endif // CC_OUTPUT_GL_RENDERER_H_ 492 #endif // CC_OUTPUT_GL_RENDERER_H_
OLDNEW
« no previous file with comments | « cc/output/geometry_binding.cc ('k') | cc/output/gl_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698