OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsC
ontext3D.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | |
17 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
18 | 17 |
19 #if defined(USE_SKIA) | 18 #if defined(USE_SKIA) |
20 #define FLIP_FRAMEBUFFER_VERTICALLY | 19 #define FLIP_FRAMEBUFFER_VERTICALLY |
21 #endif | 20 #endif |
22 | 21 |
23 namespace gpu { | 22 namespace gpu { |
24 namespace gles2 { | 23 namespace gles2 { |
25 class GLES2Implementation; | 24 class GLES2Implementation; |
26 } | 25 } |
(...skipping 18 matching lines...) Expand all Loading... |
45 | 44 |
46 class GLInProcessContext; | 45 class GLInProcessContext; |
47 | 46 |
48 class WebGraphicsContext3DInProcessCommandBufferImpl | 47 class WebGraphicsContext3DInProcessCommandBufferImpl |
49 : public WebKit::WebGraphicsContext3D { | 48 : public WebKit::WebGraphicsContext3D { |
50 public: | 49 public: |
51 | 50 |
52 WebGraphicsContext3DInProcessCommandBufferImpl(); | 51 WebGraphicsContext3DInProcessCommandBufferImpl(); |
53 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); | 52 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |
54 | 53 |
| 54 bool Initialize(WebKit::WebGraphicsContext3D::Attributes attributes, |
| 55 WebKit::WebGraphicsContext3D* view_context); |
| 56 |
55 //---------------------------------------------------------------------- | 57 //---------------------------------------------------------------------- |
56 // WebGraphicsContext3D methods | 58 // WebGraphicsContext3D methods |
57 virtual bool initialize(WebGraphicsContext3D::Attributes attributes, | |
58 WebKit::WebView*, | |
59 bool renderDirectlyToWebView); | |
60 | |
61 virtual bool makeContextCurrent(); | 59 virtual bool makeContextCurrent(); |
62 | 60 |
63 virtual int width(); | 61 virtual int width(); |
64 virtual int height(); | 62 virtual int height(); |
65 | 63 |
66 virtual bool isGLES2Compliant(); | 64 virtual bool isGLES2Compliant(); |
67 | 65 |
68 virtual bool setParentContext(WebGraphicsContext3D* parent_context); | 66 virtual bool setParentContext(WebGraphicsContext3D* parent_context); |
69 | 67 |
70 virtual void reshape(int width, int height); | 68 virtual void reshape(int width, int height); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 | 473 |
476 // Used to try to find bugs in code that calls gl directly through the gl api | 474 // Used to try to find bugs in code that calls gl directly through the gl api |
477 // instead of going through WebGraphicsContext3D. | 475 // instead of going through WebGraphicsContext3D. |
478 void ClearContext(); | 476 void ClearContext(); |
479 | 477 |
480 // The context we use for OpenGL rendering. | 478 // The context we use for OpenGL rendering. |
481 GLInProcessContext* context_; | 479 GLInProcessContext* context_; |
482 // The GLES2Implementation we use for OpenGL rendering. | 480 // The GLES2Implementation we use for OpenGL rendering. |
483 ::gpu::gles2::GLES2Implementation* gl_; | 481 ::gpu::gles2::GLES2Implementation* gl_; |
484 | 482 |
485 // If rendering directly to WebView, weak pointer to it. | |
486 WebKit::WebView* web_view_; | |
487 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | 483 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
488 WGC3Denum context_lost_reason_; | 484 WGC3Denum context_lost_reason_; |
489 | 485 |
490 WebKit::WebGraphicsContext3D::Attributes attributes_; | 486 WebKit::WebGraphicsContext3D::Attributes attributes_; |
491 int cached_width_, cached_height_; | 487 int cached_width_, cached_height_; |
492 | 488 |
493 // For tracking which FBO is bound. | 489 // For tracking which FBO is bound. |
494 WebGLId bound_fbo_; | 490 WebGLId bound_fbo_; |
495 | 491 |
496 // Errors raised by synthesizeGLError(). | 492 // Errors raised by synthesizeGLError(). |
497 std::vector<WGC3Denum> synthetic_errors_; | 493 std::vector<WGC3Denum> synthetic_errors_; |
498 | 494 |
499 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 495 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
500 scoped_array<uint8> scanline_; | 496 scoped_array<uint8> scanline_; |
501 void FlipVertically(uint8* framebuffer, | 497 void FlipVertically(uint8* framebuffer, |
502 unsigned int width, | 498 unsigned int width, |
503 unsigned int height); | 499 unsigned int height); |
504 #endif | 500 #endif |
505 }; | 501 }; |
506 | 502 |
507 } // namespace gpu | 503 } // namespace gpu |
508 } // namespace webkit | 504 } // namespace webkit |
509 | 505 |
510 #endif // defined(ENABLE_GPU) | 506 #endif // defined(ENABLE_GPU) |
511 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 507 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |