diff options
Diffstat (limited to 'chromium/cc/output/gl_renderer.h')
-rw-r--r-- | chromium/cc/output/gl_renderer.h | 78 |
1 files changed, 35 insertions, 43 deletions
diff --git a/chromium/cc/output/gl_renderer.h b/chromium/cc/output/gl_renderer.h index cf672f0afa4..b798d55b27f 100644 --- a/chromium/cc/output/gl_renderer.h +++ b/chromium/cc/output/gl_renderer.h @@ -7,6 +7,7 @@ #include "base/cancelable_callback.h" #include "cc/base/cc_export.h" +#include "cc/base/scoped_ptr_deque.h" #include "cc/base/scoped_ptr_vector.h" #include "cc/output/direct_renderer.h" #include "cc/output/gl_renderer_draw_cache.h" @@ -23,8 +24,6 @@ class SkBitmap; -namespace blink { class WebGraphicsContext3D; } - namespace gpu { namespace gles2 { class GLES2Interface; @@ -46,6 +45,8 @@ class ScopedEnsureFramebufferAllocation; // Class that handles drawing of composited render layers using GL. class CC_EXPORT GLRenderer : public DirectRenderer { public: + class ScopedUseGrContext; + static scoped_ptr<GLRenderer> Create( RendererClient* client, const LayerTreeSettings* settings, @@ -56,9 +57,7 @@ class CC_EXPORT GLRenderer : public DirectRenderer { virtual ~GLRenderer(); - virtual const RendererCapabilities& Capabilities() const OVERRIDE; - - blink::WebGraphicsContext3D* Context(); + virtual const RendererCapabilitiesImpl& Capabilities() const OVERRIDE; // Waits for rendering to finish. virtual void Finish() OVERRIDE; @@ -66,16 +65,8 @@ class CC_EXPORT GLRenderer : public DirectRenderer { virtual void DoNoOp() OVERRIDE; virtual void SwapBuffers(const CompositorFrameMetadata& metadata) OVERRIDE; - virtual void GetFramebufferPixels(void* pixels, gfx::Rect rect) OVERRIDE; - virtual bool IsContextLost() OVERRIDE; - virtual void SetVisible(bool visible) OVERRIDE; - - virtual void SendManagedMemoryStats(size_t bytes_visible, - size_t bytes_visible_and_nearby, - size_t bytes_allocated) OVERRIDE; - static void DebugGLCall(gpu::gles2::GLES2Interface* gl, const char* command, const char* file, @@ -89,19 +80,20 @@ class CC_EXPORT GLRenderer : public DirectRenderer { TextureMailboxDeleter* texture_mailbox_deleter, int highp_threshold_min); + virtual void DidChangeVisibility() OVERRIDE; + bool IsBackbufferDiscarded() const { return is_backbuffer_discarded_; } - void InitializeGrContext(); const gfx::QuadF& SharedGeometryQuad() const { return shared_geometry_quad_; } const GeometryBinding* SharedGeometry() const { return shared_geometry_.get(); } - void GetFramebufferPixelsAsync(gfx::Rect rect, + void GetFramebufferPixelsAsync(const gfx::Rect& rect, scoped_ptr<CopyOutputRequest> request); void GetFramebufferTexture(unsigned texture_id, ResourceFormat texture_format, - gfx::Rect device_rect); + const gfx::Rect& device_rect); void ReleaseRenderPassTextures(); void SetStencilEnabled(bool enabled); @@ -112,9 +104,9 @@ class CC_EXPORT GLRenderer : public DirectRenderer { virtual void BindFramebufferToOutputSurface(DrawingFrame* frame) OVERRIDE; virtual bool BindFramebufferToTexture(DrawingFrame* frame, const ScopedResource* resource, - gfx::Rect target_rect) OVERRIDE; - virtual void SetDrawViewport(gfx::Rect window_space_viewport) OVERRIDE; - virtual void SetScissorTestRect(gfx::Rect scissor_rect) OVERRIDE; + const gfx::Rect& target_rect) OVERRIDE; + virtual void SetDrawViewport(const gfx::Rect& window_space_viewport) OVERRIDE; + virtual void SetScissorTestRect(const gfx::Rect& scissor_rect) OVERRIDE; virtual void DiscardPixels(bool has_external_stencil_test, bool draw_rect_covers_full_surface) OVERRIDE; virtual void ClearFramebuffer(DrawingFrame* frame, @@ -186,13 +178,13 @@ class CC_EXPORT GLRenderer : public DirectRenderer { void CopyTextureToFramebuffer(const DrawingFrame* frame, int texture_id, - gfx::Rect rect, + const gfx::Rect& rect, const gfx::Transform& draw_matrix, bool flip_vertically); bool UseScopedTexture(DrawingFrame* frame, const ScopedResource* resource, - gfx::Rect viewport_rect); + const gfx::Rect& viewport_rect); bool MakeContextCurrent(); @@ -202,28 +194,26 @@ class CC_EXPORT GLRenderer : public DirectRenderer { typedef base::Callback<void(scoped_ptr<CopyOutputRequest> copy_request, bool success)> AsyncGetFramebufferPixelsCleanupCallback; - void DoGetFramebufferPixels( - uint8* pixels, - gfx::Rect window_rect, - const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback); - void FinishedReadback( - const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, - unsigned source_buffer, - unsigned query, - uint8_t* dest_pixels, - gfx::Size size); - void PassOnSkBitmap(scoped_ptr<SkBitmap> bitmap, - scoped_ptr<SkAutoLockPixels> lock, - scoped_ptr<CopyOutputRequest> request, - bool success); + void FinishedReadback(unsigned source_buffer, + unsigned query, + const gfx::Size& size); void ReinitializeGLState(); + void RestoreGLState(); + void RestoreFramebuffer(DrawingFrame* frame); virtual void DiscardBackbuffer() OVERRIDE; virtual void EnsureBackbuffer() OVERRIDE; void EnforceMemoryPolicy(); - RendererCapabilities capabilities_; + void ScheduleOverlays(DrawingFrame* frame); + + typedef ScopedPtrVector<ResourceProvider::ScopedReadLockGL> + OverlayResourceLockList; + OverlayResourceLockList pending_overlay_resources_; + OverlayResourceLockList in_use_overlay_resources_; + + RendererCapabilitiesImpl capabilities_; unsigned offscreen_framebuffer_id_; @@ -289,10 +279,10 @@ class CC_EXPORT GLRenderer : public DirectRenderer { // Video shaders. typedef ProgramBinding<VertexShaderVideoTransform, FragmentShaderRGBATex> VideoStreamTextureProgram; - typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVVideo> - VideoYUVProgram; - typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVAVideo> - VideoYUVAProgram; + typedef ProgramBinding<VertexShaderPosTexYUVStretchOffset, + FragmentShaderYUVVideo> VideoYUVProgram; + typedef ProgramBinding<VertexShaderPosTexYUVStretchOffset, + FragmentShaderYUVAVideo> VideoYUVAProgram; // Special purpose / effects shaders. typedef ProgramBinding<VertexShaderPos, FragmentShaderColor> @@ -399,7 +389,6 @@ class CC_EXPORT GLRenderer : public DirectRenderer { SolidColorProgram solid_color_program_; SolidColorProgramAA solid_color_program_aa_; - blink::WebGraphicsContext3D* context_; gpu::gles2::GLES2Interface* gl_; gpu::ContextSupport* context_support_; @@ -413,7 +402,6 @@ class CC_EXPORT GLRenderer : public DirectRenderer { gfx::Rect viewport_; bool is_backbuffer_discarded_; bool is_using_bind_uniform_; - bool visible_; bool is_scissor_enabled_; bool scissor_rect_needs_reset_; bool stencil_shadow_; @@ -428,7 +416,11 @@ class CC_EXPORT GLRenderer : public DirectRenderer { scoped_ptr<ResourceProvider::ScopedWriteLockGL> current_framebuffer_lock_; - scoped_refptr<ResourceProvider::Fence> last_swap_fence_; + class SyncQuery; + ScopedPtrDeque<SyncQuery> pending_sync_queries_; + ScopedPtrDeque<SyncQuery> available_sync_queries_; + scoped_ptr<SyncQuery> current_sync_query_; + bool use_sync_query_; SkBitmap on_demand_tile_raster_bitmap_; ResourceProvider::ResourceId on_demand_tile_raster_resource_id_; |