| 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_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
| 6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ | 6 #define WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 12 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 13 #include "third_party/WebKit/public/platform/WebString.h" | 13 #include "third_party/WebKit/public/platform/WebString.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "webkit/common/gpu/webkit_gpu_export.h" | 15 #include "webkit/common/gpu/webkit_gpu_export.h" |
| 16 | 16 |
| 17 namespace gpu { | 17 namespace gpu { |
| 18 class ContextSupport; | 18 class ContextSupport; |
| 19 | 19 |
| 20 namespace gles2 { | 20 namespace gles2 { |
| 21 class GLES2Implementation; | 21 class GLES2Implementation; |
| 22 } | 22 } |
| 23 } | 23 } |
| 24 | 24 |
| 25 using WebKit::WebGLId; | 25 using blink::WebGLId; |
| 26 | 26 |
| 27 using WebKit::WGC3Dbyte; | 27 using blink::WGC3Dbyte; |
| 28 using WebKit::WGC3Dchar; | 28 using blink::WGC3Dchar; |
| 29 using WebKit::WGC3Denum; | 29 using blink::WGC3Denum; |
| 30 using WebKit::WGC3Dboolean; | 30 using blink::WGC3Dboolean; |
| 31 using WebKit::WGC3Dbitfield; | 31 using blink::WGC3Dbitfield; |
| 32 using WebKit::WGC3Dint; | 32 using blink::WGC3Dint; |
| 33 using WebKit::WGC3Dsizei; | 33 using blink::WGC3Dsizei; |
| 34 using WebKit::WGC3Duint; | 34 using blink::WGC3Duint; |
| 35 using WebKit::WGC3Dfloat; | 35 using blink::WGC3Dfloat; |
| 36 using WebKit::WGC3Dclampf; | 36 using blink::WGC3Dclampf; |
| 37 using WebKit::WGC3Dintptr; | 37 using blink::WGC3Dintptr; |
| 38 using WebKit::WGC3Dsizeiptr; | 38 using blink::WGC3Dsizeiptr; |
| 39 | 39 |
| 40 namespace gpu { | 40 namespace gpu { |
| 41 class GLInProcessContext; | 41 class GLInProcessContext; |
| 42 struct GLInProcessContextAttribs; | 42 struct GLInProcessContextAttribs; |
| 43 } | 43 } |
| 44 | 44 |
| 45 namespace webkit { | 45 namespace webkit { |
| 46 namespace gpu { | 46 namespace gpu { |
| 47 | 47 |
| 48 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl | 48 class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl |
| 49 : public NON_EXPORTED_BASE(WebKit::WebGraphicsContext3D) { | 49 : public NON_EXPORTED_BASE(blink::WebGraphicsContext3D) { |
| 50 public: | 50 public: |
| 51 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 51 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 52 CreateViewContext( | 52 CreateViewContext( |
| 53 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 53 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 54 gfx::AcceleratedWidget window); | 54 gfx::AcceleratedWidget window); |
| 55 | 55 |
| 56 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 56 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 57 CreateOffscreenContext( | 57 CreateOffscreenContext( |
| 58 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 58 const blink::WebGraphicsContext3D::Attributes& attributes); |
| 59 | 59 |
| 60 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> | 60 static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 61 WrapContext( | 61 WrapContext( |
| 62 scoped_ptr< ::gpu::GLInProcessContext> context, | 62 scoped_ptr< ::gpu::GLInProcessContext> context, |
| 63 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 63 const blink::WebGraphicsContext3D::Attributes& attributes); |
| 64 | 64 |
| 65 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); | 65 virtual ~WebGraphicsContext3DInProcessCommandBufferImpl(); |
| 66 | 66 |
| 67 // Convert WebGL context creation attributes into GLInProcessContext / EGL | 67 // Convert WebGL context creation attributes into GLInProcessContext / EGL |
| 68 // size requests. | 68 // size requests. |
| 69 static void ConvertAttributes( | 69 static void ConvertAttributes( |
| 70 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 70 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 71 ::gpu::GLInProcessContextAttribs* output_attribs); | 71 ::gpu::GLInProcessContextAttribs* output_attribs); |
| 72 | 72 |
| 73 //---------------------------------------------------------------------- | 73 //---------------------------------------------------------------------- |
| 74 // WebGraphicsContext3D methods | 74 // WebGraphicsContext3D methods |
| 75 virtual bool makeContextCurrent(); | 75 virtual bool makeContextCurrent(); |
| 76 | 76 |
| 77 virtual uint32_t lastFlushID(); | 77 virtual uint32_t lastFlushID(); |
| 78 | 78 |
| 79 virtual void reshapeWithScaleFactor(int width, int height, float scaleFactor); | 79 virtual void reshapeWithScaleFactor(int width, int height, float scaleFactor); |
| 80 | 80 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, | 208 virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, |
| 209 WGC3Denum attachment, | 209 WGC3Denum attachment, |
| 210 WGC3Denum pname, | 210 WGC3Denum pname, |
| 211 WGC3Dint* value); | 211 WGC3Dint* value); |
| 212 | 212 |
| 213 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value); | 213 virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value); |
| 214 | 214 |
| 215 virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value); | 215 virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value); |
| 216 | 216 |
| 217 virtual WebKit::WebString getProgramInfoLog(WebGLId program); | 217 virtual blink::WebString getProgramInfoLog(WebGLId program); |
| 218 | 218 |
| 219 virtual void getRenderbufferParameteriv(WGC3Denum target, | 219 virtual void getRenderbufferParameteriv(WGC3Denum target, |
| 220 WGC3Denum pname, | 220 WGC3Denum pname, |
| 221 WGC3Dint* value); | 221 WGC3Dint* value); |
| 222 | 222 |
| 223 virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value); | 223 virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value); |
| 224 | 224 |
| 225 virtual WebKit::WebString getShaderInfoLog(WebGLId shader); | 225 virtual blink::WebString getShaderInfoLog(WebGLId shader); |
| 226 | 226 |
| 227 virtual void getShaderPrecisionFormat(WGC3Denum shadertype, | 227 virtual void getShaderPrecisionFormat(WGC3Denum shadertype, |
| 228 WGC3Denum precisiontype, | 228 WGC3Denum precisiontype, |
| 229 WGC3Dint* range, | 229 WGC3Dint* range, |
| 230 WGC3Dint* precision); | 230 WGC3Dint* precision); |
| 231 | 231 |
| 232 virtual WebKit::WebString getShaderSource(WebGLId shader); | 232 virtual blink::WebString getShaderSource(WebGLId shader); |
| 233 virtual WebKit::WebString getString(WGC3Denum name); | 233 virtual blink::WebString getString(WGC3Denum name); |
| 234 | 234 |
| 235 virtual void getTexParameterfv(WGC3Denum target, | 235 virtual void getTexParameterfv(WGC3Denum target, |
| 236 WGC3Denum pname, | 236 WGC3Denum pname, |
| 237 WGC3Dfloat* value); | 237 WGC3Dfloat* value); |
| 238 virtual void getTexParameteriv(WGC3Denum target, | 238 virtual void getTexParameteriv(WGC3Denum target, |
| 239 WGC3Denum pname, | 239 WGC3Denum pname, |
| 240 WGC3Dint* value); | 240 WGC3Dint* value); |
| 241 | 241 |
| 242 virtual void getUniformfv(WebGLId program, | 242 virtual void getUniformfv(WebGLId program, |
| 243 WGC3Dint location, | 243 WGC3Dint location, |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 WGC3Dsizei numAttachments, | 444 WGC3Dsizei numAttachments, |
| 445 const WGC3Denum* attachments); | 445 const WGC3Denum* attachments); |
| 446 virtual void discardBackbufferCHROMIUM(); | 446 virtual void discardBackbufferCHROMIUM(); |
| 447 virtual void ensureBackbufferCHROMIUM(); | 447 virtual void ensureBackbufferCHROMIUM(); |
| 448 | 448 |
| 449 virtual void copyTextureToParentTextureCHROMIUM( | 449 virtual void copyTextureToParentTextureCHROMIUM( |
| 450 WebGLId texture, WebGLId parentTexture); | 450 WebGLId texture, WebGLId parentTexture); |
| 451 | 451 |
| 452 virtual void rateLimitOffscreenContextCHROMIUM(); | 452 virtual void rateLimitOffscreenContextCHROMIUM(); |
| 453 | 453 |
| 454 virtual WebKit::WebString getRequestableExtensionsCHROMIUM(); | 454 virtual blink::WebString getRequestableExtensionsCHROMIUM(); |
| 455 virtual void requestExtensionCHROMIUM(const char*); | 455 virtual void requestExtensionCHROMIUM(const char*); |
| 456 | 456 |
| 457 virtual void blitFramebufferCHROMIUM( | 457 virtual void blitFramebufferCHROMIUM( |
| 458 WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, | 458 WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, |
| 459 WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, | 459 WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, |
| 460 WGC3Dbitfield mask, WGC3Denum filter); | 460 WGC3Dbitfield mask, WGC3Denum filter); |
| 461 virtual void renderbufferStorageMultisampleCHROMIUM( | 461 virtual void renderbufferStorageMultisampleCHROMIUM( |
| 462 WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, | 462 WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, |
| 463 WGC3Dsizei width, WGC3Dsizei height); | 463 WGC3Dsizei width, WGC3Dsizei height); |
| 464 | 464 |
| 465 virtual WebKit::WebString getTranslatedShaderSourceANGLE(WebGLId shader); | 465 virtual blink::WebString getTranslatedShaderSourceANGLE(WebGLId shader); |
| 466 | 466 |
| 467 virtual void setContextLostCallback( | 467 virtual void setContextLostCallback( |
| 468 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); | 468 WebGraphicsContext3D::WebGraphicsContextLostCallback* callback); |
| 469 virtual WGC3Denum getGraphicsResetStatusARB(); | 469 virtual WGC3Denum getGraphicsResetStatusARB(); |
| 470 | 470 |
| 471 virtual void texImageIOSurface2DCHROMIUM( | 471 virtual void texImageIOSurface2DCHROMIUM( |
| 472 WGC3Denum target, WGC3Dint width, WGC3Dint height, | 472 WGC3Denum target, WGC3Dint width, WGC3Dint height, |
| 473 WGC3Duint ioSurfaceId, WGC3Duint plane); | 473 WGC3Duint ioSurfaceId, WGC3Duint plane); |
| 474 | 474 |
| 475 virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId); | 475 virtual void bindTexImage2DCHROMIUM(WGC3Denum target, WGC3Dint imageId); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 551 |
| 552 virtual void loseContextCHROMIUM(WGC3Denum current, WGC3Denum other); | 552 virtual void loseContextCHROMIUM(WGC3Denum current, WGC3Denum other); |
| 553 | 553 |
| 554 virtual GrGLInterface* createGrGLInterface(); | 554 virtual GrGLInterface* createGrGLInterface(); |
| 555 | 555 |
| 556 ::gpu::ContextSupport* GetContextSupport(); | 556 ::gpu::ContextSupport* GetContextSupport(); |
| 557 | 557 |
| 558 private: | 558 private: |
| 559 WebGraphicsContext3DInProcessCommandBufferImpl( | 559 WebGraphicsContext3DInProcessCommandBufferImpl( |
| 560 scoped_ptr< ::gpu::GLInProcessContext> context, | 560 scoped_ptr< ::gpu::GLInProcessContext> context, |
| 561 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 561 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 562 bool is_offscreen, | 562 bool is_offscreen, |
| 563 gfx::AcceleratedWidget window); | 563 gfx::AcceleratedWidget window); |
| 564 | 564 |
| 565 // SwapBuffers callback. | 565 // SwapBuffers callback. |
| 566 void OnSwapBuffersComplete(); | 566 void OnSwapBuffersComplete(); |
| 567 virtual void OnContextLost(); | 567 virtual void OnContextLost(); |
| 568 | 568 |
| 569 bool MaybeInitializeGL(); | 569 bool MaybeInitializeGL(); |
| 570 | 570 |
| 571 // Used to try to find bugs in code that calls gl directly through the gl api | 571 // Used to try to find bugs in code that calls gl directly through the gl api |
| 572 // instead of going through WebGraphicsContext3D. | 572 // instead of going through WebGraphicsContext3D. |
| 573 void ClearContext(); | 573 void ClearContext(); |
| 574 | 574 |
| 575 bool is_offscreen_; | 575 bool is_offscreen_; |
| 576 // Only used when not offscreen. | 576 // Only used when not offscreen. |
| 577 gfx::AcceleratedWidget window_; | 577 gfx::AcceleratedWidget window_; |
| 578 | 578 |
| 579 bool initialized_; | 579 bool initialized_; |
| 580 bool initialize_failed_; | 580 bool initialize_failed_; |
| 581 | 581 |
| 582 // The context we use for OpenGL rendering. | 582 // The context we use for OpenGL rendering. |
| 583 scoped_ptr< ::gpu::GLInProcessContext> context_; | 583 scoped_ptr< ::gpu::GLInProcessContext> context_; |
| 584 // The GLES2Implementation we use for OpenGL rendering. | 584 // The GLES2Implementation we use for OpenGL rendering. |
| 585 ::gpu::gles2::GLES2Implementation* gl_; | 585 ::gpu::gles2::GLES2Implementation* gl_; |
| 586 | 586 |
| 587 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; | 587 WebGraphicsContext3D::WebGraphicsContextLostCallback* context_lost_callback_; |
| 588 WGC3Denum context_lost_reason_; | 588 WGC3Denum context_lost_reason_; |
| 589 | 589 |
| 590 WebKit::WebGraphicsContext3D::Attributes attributes_; | 590 blink::WebGraphicsContext3D::Attributes attributes_; |
| 591 | 591 |
| 592 // Errors raised by synthesizeGLError(). | 592 // Errors raised by synthesizeGLError(). |
| 593 std::vector<WGC3Denum> synthetic_errors_; | 593 std::vector<WGC3Denum> synthetic_errors_; |
| 594 | 594 |
| 595 uint32_t flush_id_; | 595 uint32_t flush_id_; |
| 596 }; | 596 }; |
| 597 | 597 |
| 598 } // namespace gpu | 598 } // namespace gpu |
| 599 } // namespace webkit | 599 } // namespace webkit |
| 600 | 600 |
| 601 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ | 601 #endif // WEBKIT_COMMON_GPU_WEBGRAPHICSCONTEXT3D_IN_PROCESS_COMMAND_BUFFER_IMPL
_H_ |
| OLD | NEW |