| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 private: | 124 private: |
| 125 gpu::gles2::GLES2Interface* m_contextGL; | 125 gpu::gles2::GLES2Interface* m_contextGL; |
| 126 GLboolean m_colorMask[4]; | 126 GLboolean m_colorMask[4]; |
| 127 const bool m_requiresEmulation; | 127 const bool m_requiresEmulation; |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext { | 130 class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext { |
| 131 public: | 131 public: |
| 132 ~WebGLRenderingContextBase() override; | 132 ~WebGLRenderingContextBase() override; |
| 133 | 133 |
| 134 virtual unsigned version() const = 0; | |
| 135 virtual String contextName() const = 0; | 134 virtual String contextName() const = 0; |
| 136 virtual void registerContextExtensions() = 0; | 135 virtual void registerContextExtensions() = 0; |
| 137 | 136 |
| 138 virtual void initializeNewContext(); | 137 virtual void initializeNewContext(); |
| 139 | 138 |
| 140 static unsigned getWebGLVersion(const CanvasRenderingContext*); | 139 static unsigned getWebGLVersion(const CanvasRenderingContext*); |
| 141 | 140 |
| 142 static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContex
t3DProvider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); | 141 static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContex
t3DProvider(HTMLCanvasElement*, WebGLContextAttributes, unsigned webGLVersion); |
| 143 static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContex
t3DProvider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion); | 142 static std::unique_ptr<WebGraphicsContext3DProvider> createWebGraphicsContex
t3DProvider(ScriptState*, WebGLContextAttributes, unsigned webGLVersion); |
| 144 static void forceNextWebGLContextCreationToFail(); | 143 static void forceNextWebGLContextCreationToFail(); |
| 145 | 144 |
| 145 unsigned version() const { return m_version; } |
| 146 |
| 146 int drawingBufferWidth() const; | 147 int drawingBufferWidth() const; |
| 147 int drawingBufferHeight() const; | 148 int drawingBufferHeight() const; |
| 148 | 149 |
| 149 void activeTexture(GLenum texture); | 150 void activeTexture(GLenum texture); |
| 150 void attachShader(ScriptState*, WebGLProgram*, WebGLShader*); | 151 void attachShader(ScriptState*, WebGLProgram*, WebGLShader*); |
| 151 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); | 152 void bindAttribLocation(WebGLProgram*, GLuint index, const String& name); |
| 152 void bindBuffer(ScriptState*, GLenum target, WebGLBuffer*); | 153 void bindBuffer(ScriptState*, GLenum target, WebGLBuffer*); |
| 153 virtual void bindFramebuffer(ScriptState*, GLenum target, WebGLFramebuffer*)
; | 154 virtual void bindFramebuffer(ScriptState*, GLenum target, WebGLFramebuffer*)
; |
| 154 void bindRenderbuffer(ScriptState*, GLenum target, WebGLRenderbuffer*); | 155 void bindRenderbuffer(ScriptState*, GLenum target, WebGLRenderbuffer*); |
| 155 void bindTexture(ScriptState*, GLenum target, WebGLTexture*); | 156 void bindTexture(ScriptState*, GLenum target, WebGLTexture*); |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 friend class WebGLCompressedTextureASTC; | 424 friend class WebGLCompressedTextureASTC; |
| 424 friend class WebGLCompressedTextureATC; | 425 friend class WebGLCompressedTextureATC; |
| 425 friend class WebGLCompressedTextureETC1; | 426 friend class WebGLCompressedTextureETC1; |
| 426 friend class WebGLCompressedTexturePVRTC; | 427 friend class WebGLCompressedTexturePVRTC; |
| 427 friend class WebGLCompressedTextureS3TC; | 428 friend class WebGLCompressedTextureS3TC; |
| 428 friend class WebGLRenderingContextErrorMessageCallback; | 429 friend class WebGLRenderingContextErrorMessageCallback; |
| 429 friend class WebGLVertexArrayObjectBase; | 430 friend class WebGLVertexArrayObjectBase; |
| 430 friend class ScopedTexture2DRestorer; | 431 friend class ScopedTexture2DRestorer; |
| 431 friend class ScopedFramebufferRestorer; | 432 friend class ScopedFramebufferRestorer; |
| 432 | 433 |
| 433 WebGLRenderingContextBase(HTMLCanvasElement*, std::unique_ptr<WebGraphicsCon
text3DProvider>, const WebGLContextAttributes&); | 434 WebGLRenderingContextBase(HTMLCanvasElement*, std::unique_ptr<WebGraphicsCon
text3DProvider>, const WebGLContextAttributes&, unsigned); |
| 434 WebGLRenderingContextBase(OffscreenCanvas*, std::unique_ptr<WebGraphicsConte
xt3DProvider>, const WebGLContextAttributes&); | 435 WebGLRenderingContextBase(OffscreenCanvas*, std::unique_ptr<WebGraphicsConte
xt3DProvider>, const WebGLContextAttributes&, unsigned); |
| 435 PassRefPtr<DrawingBuffer> createDrawingBuffer(std::unique_ptr<WebGraphicsCon
text3DProvider>); | 436 PassRefPtr<DrawingBuffer> createDrawingBuffer(std::unique_ptr<WebGraphicsCon
text3DProvider>); |
| 436 void setupFlags(); | 437 void setupFlags(); |
| 437 | 438 |
| 438 // CanvasRenderingContext implementation. | 439 // CanvasRenderingContext implementation. |
| 439 bool is3d() const override { return true; } | 440 bool is3d() const override { return true; } |
| 440 bool isAccelerated() const override { return true; } | 441 bool isAccelerated() const override { return true; } |
| 441 void setIsHidden(bool) override; | 442 void setIsHidden(bool) override; |
| 442 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override; | 443 bool paintRenderingResultsToCanvas(SourceDrawingBuffer) override; |
| 443 WebLayer* platformLayer() const override; | 444 WebLayer* platformLayer() const override; |
| 444 void stop() override; | 445 void stop() override; |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 // Helper functions for tex(Sub)Image2D && texSubImage3D | 1101 // Helper functions for tex(Sub)Image2D && texSubImage3D |
| 1101 void texImageHelperDOMArrayBufferView(TexImageFunctionID, GLenum, GLint, GLi
nt, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMAr
rayBufferView*); | 1102 void texImageHelperDOMArrayBufferView(TexImageFunctionID, GLenum, GLint, GLi
nt, GLsizei, GLsizei, GLint, GLenum, GLenum, GLsizei, GLint, GLint, GLint, DOMAr
rayBufferView*); |
| 1102 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint
, GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); | 1103 void texImageHelperImageData(TexImageFunctionID, GLenum, GLint, GLint, GLint
, GLenum, GLenum, GLsizei, GLint, GLint, GLint, ImageData*); |
| 1103 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint
, GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); | 1104 void texImageHelperHTMLImageElement(TexImageFunctionID, GLenum, GLint, GLint
, GLenum, GLenum, GLint, GLint, GLint, HTMLImageElement*, ExceptionState&); |
| 1104 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin
t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); | 1105 void texImageHelperHTMLCanvasElement(TexImageFunctionID, GLenum, GLint, GLin
t, GLenum, GLenum, GLint, GLint, GLint, HTMLCanvasElement*, ExceptionState&); |
| 1105 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint
, GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); | 1106 void texImageHelperHTMLVideoElement(TexImageFunctionID, GLenum, GLint, GLint
, GLenum, GLenum, GLint, GLint, GLint, HTMLVideoElement*, ExceptionState&); |
| 1106 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe
num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); | 1107 void texImageHelperImageBitmap(TexImageFunctionID, GLenum, GLint, GLint, GLe
num, GLenum, GLint, GLint, GLint, ImageBitmap*, ExceptionState&); |
| 1107 static const char* getTexImageFunctionName(TexImageFunctionID); | 1108 static const char* getTexImageFunctionName(TexImageFunctionID); |
| 1108 | 1109 |
| 1109 private: | 1110 private: |
| 1110 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_
ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&); | 1111 WebGLRenderingContextBase(HTMLCanvasElement*, OffscreenCanvas*, std::unique_
ptr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&, unsigned); |
| 1111 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderIn
ternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); | 1112 static std::unique_ptr<WebGraphicsContext3DProvider> createContextProviderIn
ternal(HTMLCanvasElement*, ScriptState*, WebGLContextAttributes, unsigned); |
| 1112 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint); | 1113 void texImageCanvasByGPU(HTMLCanvasElement*, GLuint, GLenum, GLenum, GLint); |
| 1113 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool); | 1114 void texImageBitmapByGPU(ImageBitmap*, GLuint, GLenum, GLenum, GLint, bool); |
| 1115 |
| 1116 const unsigned m_version; |
| 1114 }; | 1117 }; |
| 1115 | 1118 |
| 1116 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); | 1119 DEFINE_TYPE_CASTS(WebGLRenderingContextBase, CanvasRenderingContext, context, co
ntext->is3d(), context.is3d()); |
| 1117 | 1120 |
| 1118 } // namespace blink | 1121 } // namespace blink |
| 1119 | 1122 |
| 1120 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); | 1123 WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(blink::WebGLRenderingContextB
ase::TextureUnitState); |
| 1121 | 1124 |
| 1122 #endif // WebGLRenderingContextBase_h | 1125 #endif // WebGLRenderingContextBase_h |
| OLD | NEW |