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 | 7 |
8 #if defined(ENABLE_GPU) | 8 #if defined(ENABLE_GPU) |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 27 matching lines...) Expand all Loading... |
38 using WebKit::WGC3Dsizeiptr; | 38 using WebKit::WGC3Dsizeiptr; |
39 | 39 |
40 namespace webkit { | 40 namespace webkit { |
41 namespace gpu { | 41 namespace gpu { |
42 | 42 |
43 class GLInProcessContext; | 43 class GLInProcessContext; |
44 | 44 |
45 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl | 45 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl |
46 : public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) { | 46 : public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) { |
47 public: | 47 public: |
| 48 static WebGraphicsContext3DInProcessCommandBufferImpl* |
| 49 CreateViewContext( |
| 50 const WebKit::WebGraphicsContext3D::Attributes& attributes, |
| 51 gfx::AcceleratedWidget window); |
48 | 52 |
49 explicit WebGraphicsContext3DInProcessCommandBufferImpl( | 53 static WebGraphicsContext3DInProcessCommandBufferImpl* |
50 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 54 CreateOffscreenContext( |
| 55 const WebKit::WebGraphicsContext3D::Attributes& attributes); |
| 56 |
51 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); | 57 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |
52 | 58 |
53 //---------------------------------------------------------------------- | 59 //---------------------------------------------------------------------- |
54 // WebGraphicsContext3D methods | 60 // WebGraphicsContext3D methods |
55 virtual bool makeContextCurrent(); | 61 virtual bool makeContextCurrent(); |
56 | 62 |
57 virtual int width(); | 63 virtual int width(); |
58 virtual int height(); | 64 virtual int height(); |
59 | 65 |
60 virtual bool isGLES2Compliant(); | 66 virtual bool isGLES2Compliant(); |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 WGC3Denum type, | 525 WGC3Denum type, |
520 const void* pixels); | 526 const void* pixels); |
521 virtual void waitAsyncTexImage2DCHROMIUM(WGC3Denum target); | 527 virtual void waitAsyncTexImage2DCHROMIUM(WGC3Denum target); |
522 | 528 |
523 virtual void drawBuffersEXT(WGC3Dsizei n, const WGC3Denum* bufs); | 529 virtual void drawBuffersEXT(WGC3Dsizei n, const WGC3Denum* bufs); |
524 | 530 |
525 protected: | 531 protected: |
526 virtual GrGLInterface* onCreateGrGLInterface(); | 532 virtual GrGLInterface* onCreateGrGLInterface(); |
527 | 533 |
528 private: | 534 private: |
| 535 WebGraphicsContext3DInProcessCommandBufferImpl( |
| 536 const WebKit::WebGraphicsContext3D::Attributes& attributes, |
| 537 bool is_offscreen, |
| 538 gfx::AcceleratedWidget window); |
| 539 |
529 // SwapBuffers callback. | 540 // SwapBuffers callback. |
530 void OnSwapBuffersComplete(); | 541 void OnSwapBuffersComplete(); |
531 virtual void OnContextLost(); | 542 virtual void OnContextLost(); |
532 | 543 |
533 bool MaybeInitializeGL(); | 544 bool MaybeInitializeGL(); |
534 | 545 |
535 // Used to try to find bugs in code that calls gl directly through the gl api | 546 // Used to try to find bugs in code that calls gl directly through the gl api |
536 // instead of going through WebGraphicsContext3D. | 547 // instead of going through WebGraphicsContext3D. |
537 void ClearContext(); | 548 void ClearContext(); |
538 | 549 |
| 550 |
| 551 bool is_offscreen_; |
| 552 // Only used when not offscreen. |
| 553 gfx::AcceleratedWidget window_; |
| 554 |
539 bool initialized_; | 555 bool initialized_; |
540 bool initialize_failed_; | 556 bool initialize_failed_; |
541 | 557 |
542 // The context we use for OpenGL rendering. | 558 // The context we use for OpenGL rendering. |
543 GLInProcessContext* context_; | 559 GLInProcessContext* context_; |
544 // The GLES2Implementation we use for OpenGL rendering. | 560 // The GLES2Implementation we use for OpenGL rendering. |
545 ::gpu::gles2::GLES2Implementation* gl_; | 561 ::gpu::gles2::GLES2Implementation* gl_; |
546 | 562 |
547 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | 563 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
548 WGC3Denum context_lost_reason_; | 564 WGC3Denum context_lost_reason_; |
(...skipping 11 matching lines...) Expand all Loading... |
560 void FlipVertically(uint8* framebuffer, | 576 void FlipVertically(uint8* framebuffer, |
561 unsigned int width, | 577 unsigned int width, |
562 unsigned int height); | 578 unsigned int height); |
563 }; | 579 }; |
564 | 580 |
565 } // namespace gpu | 581 } // namespace gpu |
566 } // namespace webkit | 582 } // namespace webkit |
567 | 583 |
568 #endif // defined(ENABLE_GPU) | 584 #endif // defined(ENABLE_GPU) |
569 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 585 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |