| 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_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_ | 5 #ifndef GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_ |
| 6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_ | 6 #define GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "gpu/blink/gpu_blink_export.h" |
| 13 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 14 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 14 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
| 15 #include "webkit/common/gpu/webkit_gpu_export.h" | 16 |
| 17 // TODO(tfarina): Remove these 'using' declarations. crbug.com/438860 |
| 18 using blink::WGC3Dbitfield; |
| 19 using blink::WGC3Dboolean; |
| 20 using blink::WGC3Dbyte; |
| 21 using blink::WGC3Dchar; |
| 22 using blink::WGC3Dclampf; |
| 23 using blink::WGC3Denum; |
| 24 using blink::WGC3Dfloat; |
| 25 using blink::WGC3Dint; |
| 26 using blink::WGC3Dintptr; |
| 27 using blink::WGC3Dsizei; |
| 28 using blink::WGC3Dsizeiptr; |
| 29 using blink::WGC3Duint; |
| 30 using blink::WebGLId; |
| 16 | 31 |
| 17 namespace gpu { | 32 namespace gpu { |
| 18 | 33 |
| 19 namespace gles2 { | 34 namespace gles2 { |
| 20 class GLES2Interface; | 35 class GLES2Interface; |
| 21 class GLES2ImplementationErrorMessageCallback; | 36 class GLES2ImplementationErrorMessageCallback; |
| 22 struct ContextCreationAttribHelper; | 37 struct ContextCreationAttribHelper; |
| 23 } | 38 } |
| 24 } | 39 } |
| 25 | 40 |
| 26 using blink::WebGLId; | 41 namespace gpu_blink { |
| 27 | |
| 28 using blink::WGC3Dbyte; | |
| 29 using blink::WGC3Dchar; | |
| 30 using blink::WGC3Denum; | |
| 31 using blink::WGC3Dboolean; | |
| 32 using blink::WGC3Dbitfield; | |
| 33 using blink::WGC3Dint; | |
| 34 using blink::WGC3Dsizei; | |
| 35 using blink::WGC3Duint; | |
| 36 using blink::WGC3Dfloat; | |
| 37 using blink::WGC3Dclampf; | |
| 38 using blink::WGC3Dintptr; | |
| 39 using blink::WGC3Dsizeiptr; | |
| 40 | |
| 41 namespace webkit { | |
| 42 namespace gpu { | |
| 43 | 42 |
| 44 class WebGraphicsContext3DErrorMessageCallback; | 43 class WebGraphicsContext3DErrorMessageCallback; |
| 45 | 44 |
| 46 class WEBKIT_GPU_EXPORT WebGraphicsContext3DImpl | 45 class GPU_BLINK_EXPORT WebGraphicsContext3DImpl |
| 47 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) { | 46 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) { |
| 48 public: | 47 public: |
| 49 virtual ~WebGraphicsContext3DImpl(); | 48 virtual ~WebGraphicsContext3DImpl(); |
| 50 | 49 |
| 51 //---------------------------------------------------------------------- | 50 //---------------------------------------------------------------------- |
| 52 // WebGraphicsContext3D methods | 51 // WebGraphicsContext3D methods |
| 53 | 52 |
| 54 virtual uint32_t lastFlushID(); | 53 virtual uint32_t lastFlushID(); |
| 55 | 54 |
| 56 virtual unsigned int insertSyncPoint(); | 55 virtual unsigned int insertSyncPoint(); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 WGC3Denum textarget, | 558 WGC3Denum textarget, |
| 560 WebGLId texture, | 559 WebGLId texture, |
| 561 WGC3Dint level, | 560 WGC3Dint level, |
| 562 WGC3Dsizei samples); | 561 WGC3Dsizei samples); |
| 563 virtual void renderbufferStorageMultisampleEXT( | 562 virtual void renderbufferStorageMultisampleEXT( |
| 564 WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, | 563 WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, |
| 565 WGC3Dsizei width, WGC3Dsizei height); | 564 WGC3Dsizei width, WGC3Dsizei height); |
| 566 | 565 |
| 567 virtual GrGLInterface* createGrGLInterface(); | 566 virtual GrGLInterface* createGrGLInterface(); |
| 568 | 567 |
| 569 ::gpu::gles2::GLES2Interface* GetGLInterface() { | 568 gpu::gles2::GLES2Interface* GetGLInterface() { |
| 570 return gl_; | 569 return gl_; |
| 571 } | 570 } |
| 572 | 571 |
| 573 // Convert WebGL context creation attributes into command buffer / EGL size | 572 // Convert WebGL context creation attributes into command buffer / EGL size |
| 574 // requests. | 573 // requests. |
| 575 static void ConvertAttributes( | 574 static void ConvertAttributes( |
| 576 const blink::WebGraphicsContext3D::Attributes& attributes, | 575 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 577 ::gpu::gles2::ContextCreationAttribHelper* output_attribs); | 576 gpu::gles2::ContextCreationAttribHelper* output_attribs); |
| 578 | 577 |
| 579 protected: | 578 protected: |
| 580 friend class WebGraphicsContext3DErrorMessageCallback; | 579 friend class WebGraphicsContext3DErrorMessageCallback; |
| 581 | 580 |
| 582 WebGraphicsContext3DImpl(); | 581 WebGraphicsContext3DImpl(); |
| 583 | 582 |
| 584 ::gpu::gles2::GLES2ImplementationErrorMessageCallback* | 583 gpu::gles2::GLES2ImplementationErrorMessageCallback* |
| 585 getErrorMessageCallback(); | 584 getErrorMessageCallback(); |
| 586 virtual void OnErrorMessage(const std::string& message, int id); | 585 virtual void OnErrorMessage(const std::string& message, int id); |
| 587 | 586 |
| 588 void setGLInterface(::gpu::gles2::GLES2Interface* gl) { | 587 void setGLInterface(gpu::gles2::GLES2Interface* gl) { |
| 589 gl_ = gl; | 588 gl_ = gl; |
| 590 } | 589 } |
| 591 | 590 |
| 592 bool initialized_; | 591 bool initialized_; |
| 593 bool initialize_failed_; | 592 bool initialize_failed_; |
| 594 | 593 |
| 595 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | 594 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
| 596 WGC3Denum context_lost_reason_; | 595 WGC3Denum context_lost_reason_; |
| 597 | 596 |
| 598 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* | 597 WebGraphicsContext3D::WebGraphicsErrorMessageCallback* |
| 599 error_message_callback_; | 598 error_message_callback_; |
| 600 scoped_ptr<WebGraphicsContext3DErrorMessageCallback> | 599 scoped_ptr<WebGraphicsContext3DErrorMessageCallback> |
| 601 client_error_message_callback_; | 600 client_error_message_callback_; |
| 602 | 601 |
| 603 // Errors raised by synthesizeGLError(). | 602 // Errors raised by synthesizeGLError(). |
| 604 std::vector<WGC3Denum> synthetic_errors_; | 603 std::vector<WGC3Denum> synthetic_errors_; |
| 605 | 604 |
| 606 ::gpu::gles2::GLES2Interface* gl_; | 605 gpu::gles2::GLES2Interface* gl_; |
| 607 bool lose_context_when_out_of_memory_; | 606 bool lose_context_when_out_of_memory_; |
| 608 uint32_t flush_id_; | 607 uint32_t flush_id_; |
| 609 }; | 608 }; |
| 610 | 609 |
| 611 } // namespace gpu | 610 } // namespace gpu_blink |
| 612 } // namespace webkit | |
| 613 | 611 |
| 614 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IMPL_H_ | 612 #endif // GPU_BLINK_WEBGRAPHICSCONTEXT3D_IMPL_H_ |
| OLD | NEW |