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_IMPL_H_ | 5 #ifndef WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ |
6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ | 6 #define WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // requires the sandbox to be disabled, which is strongly discouraged. | 50 // requires the sandbox to be disabled, which is strongly discouraged. |
51 // It is provided for support of test_shell and any Chromium ports | 51 // It is provided for support of test_shell and any Chromium ports |
52 // where an in-renderer WebGL implementation would be helpful. | 52 // where an in-renderer WebGL implementation would be helpful. |
53 | 53 |
54 class WebGraphicsContext3DInProcessImpl : public WebGraphicsContext3D { | 54 class WebGraphicsContext3DInProcessImpl : public WebGraphicsContext3D { |
55 public: | 55 public: |
56 // Creates a WebGraphicsContext3DInProcessImpl for a given window. If window | 56 // Creates a WebGraphicsContext3DInProcessImpl for a given window. If window |
57 // is gfx::kNullPluginWindow, then it creates an offscreen context. | 57 // is gfx::kNullPluginWindow, then it creates an offscreen context. |
58 // share_group is the group this context shares namespaces with. It's only | 58 // share_group is the group this context shares namespaces with. It's only |
59 // used for window-bound countexts. | 59 // used for window-bound countexts. |
60 WebGraphicsContext3DInProcessImpl(gfx::AcceleratedWidget window, | 60 WebGraphicsContext3DInProcessImpl(gfx::GLSurface* surface, |
61 gfx::GLShareGroup* share_group); | 61 gfx::GLContext* context, |
| 62 bool render_directly_to_webview); |
62 virtual ~WebGraphicsContext3DInProcessImpl(); | 63 virtual ~WebGraphicsContext3DInProcessImpl(); |
| 64 static WebGraphicsContext3DInProcessImpl* CreateForWebView( |
| 65 WebGraphicsContext3D::Attributes attributes, |
| 66 WebView* web_view, |
| 67 bool render_directly_to_webview); |
| 68 static WebGraphicsContext3DInProcessImpl* CreateForWindow( |
| 69 WebGraphicsContext3D::Attributes attributes, |
| 70 gfx::AcceleratedWidget window, |
| 71 gfx::GLShareGroup* share_group); |
63 | 72 |
64 //---------------------------------------------------------------------- | 73 //---------------------------------------------------------------------- |
65 // WebGraphicsContext3D methods | 74 // WebGraphicsContext3D methods |
66 virtual bool initialize( | |
67 WebGraphicsContext3D::Attributes attributes, WebView*, bool); | |
68 virtual bool makeContextCurrent(); | 75 virtual bool makeContextCurrent(); |
69 | 76 |
70 virtual int width(); | 77 virtual int width(); |
71 virtual int height(); | 78 virtual int height(); |
72 | 79 |
73 virtual bool isGLES2Compliant(); | 80 virtual bool isGLES2Compliant(); |
74 | 81 |
75 virtual bool setParentContext(WebGraphicsContext3D* parent_context); | 82 virtual bool setParentContext(WebGraphicsContext3D* parent_context); |
76 | 83 |
77 virtual void reshape(int width, int height); | 84 virtual void reshape(int width, int height); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 virtual void texStorage2DEXT( | 456 virtual void texStorage2DEXT( |
450 WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, | 457 WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, |
451 WGC3Dint width, WGC3Dint height); | 458 WGC3Dint width, WGC3Dint height); |
452 | 459 |
453 protected: | 460 protected: |
454 #if WEBKIT_USING_SKIA | 461 #if WEBKIT_USING_SKIA |
455 virtual GrGLInterface* onCreateGrGLInterface(); | 462 virtual GrGLInterface* onCreateGrGLInterface(); |
456 #endif | 463 #endif |
457 | 464 |
458 private: | 465 private: |
| 466 bool Initialize(Attributes attributes); |
| 467 |
459 // ANGLE related. | 468 // ANGLE related. |
460 struct ShaderSourceEntry; | 469 struct ShaderSourceEntry; |
461 | 470 |
462 typedef base::hash_map<WebGLId, ShaderSourceEntry*> ShaderSourceMap; | 471 typedef base::hash_map<WebGLId, ShaderSourceEntry*> ShaderSourceMap; |
463 | 472 |
464 bool AllocateOffscreenFrameBuffer(int width, int height); | 473 bool AllocateOffscreenFrameBuffer(int width, int height); |
465 void ClearRenderTarget(); | 474 void ClearRenderTarget(); |
466 | 475 |
467 #ifdef FLIP_FRAMEBUFFER_VERTICALLY | 476 #ifdef FLIP_FRAMEBUFFER_VERTICALLY |
468 void FlipVertically(unsigned char* framebuffer, | 477 void FlipVertically(unsigned char* framebuffer, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 std::list<WGC3Denum> synthetic_errors_list_; | 524 std::list<WGC3Denum> synthetic_errors_list_; |
516 std::set<WGC3Denum> synthetic_errors_set_; | 525 std::set<WGC3Denum> synthetic_errors_set_; |
517 | 526 |
518 scoped_refptr<gfx::GLContext> gl_context_; | 527 scoped_refptr<gfx::GLContext> gl_context_; |
519 scoped_refptr<gfx::GLSurface> gl_surface_; | 528 scoped_refptr<gfx::GLSurface> gl_surface_; |
520 | 529 |
521 ShaderSourceMap shader_source_map_; | 530 ShaderSourceMap shader_source_map_; |
522 | 531 |
523 ShHandle fragment_compiler_; | 532 ShHandle fragment_compiler_; |
524 ShHandle vertex_compiler_; | 533 ShHandle vertex_compiler_; |
525 gfx::AcceleratedWidget window_; | |
526 scoped_refptr<gfx::GLShareGroup> share_group_; | |
527 }; | 534 }; |
528 | 535 |
529 } // namespace gpu | 536 } // namespace gpu |
530 } // namespace webkit | 537 } // namespace webkit |
531 | 538 |
532 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ | 539 #endif // WEBKIT_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_IMPL_H_ |
OLD | NEW |