| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebGL2RenderingContextBase_h | 5 #ifndef WebGL2RenderingContextBase_h |
| 6 #define WebGL2RenderingContextBase_h | 6 #define WebGL2RenderingContextBase_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "modules/webgl/WebGLExtension.h" | 9 #include "modules/webgl/WebGLExtension.h" |
| 9 #include "modules/webgl/WebGLRenderingContextBase.h" | 10 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 10 #include <memory> | 11 #include <memory> |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 class WebGLTexture; | 15 class WebGLTexture; |
| 15 | 16 |
| 16 class WebGLActiveInfo; | 17 class WebGLActiveInfo; |
| 17 class WebGLBuffer; | 18 class WebGLBuffer; |
| 18 class WebGLProgram; | 19 class WebGLProgram; |
| 19 class WebGLQuery; | 20 class WebGLQuery; |
| 20 class WebGLSampler; | 21 class WebGLSampler; |
| 21 class WebGLSync; | 22 class WebGLSync; |
| 22 class WebGLTransformFeedback; | 23 class WebGLTransformFeedback; |
| 23 class WebGLUniformLocation; | 24 class WebGLUniformLocation; |
| 24 class WebGLVertexArrayObject; | 25 class WebGLVertexArrayObject; |
| 25 | 26 |
| 26 class WebGL2RenderingContextBase : public WebGLRenderingContextBase { | 27 class WebGL2RenderingContextBase : public WebGLRenderingContextBase { |
| 27 public: | 28 public: |
| 28 ~WebGL2RenderingContextBase() override; | 29 ~WebGL2RenderingContextBase() override; |
| 29 | 30 |
| 31 void destroyContext() override; |
| 32 |
| 30 /* Buffer objects */ | 33 /* Buffer objects */ |
| 31 void bufferData(GLenum, DOMArrayBufferView*, GLenum, GLuint, GLuint); | 34 void bufferData(GLenum, DOMArrayBufferView*, GLenum, GLuint, GLuint); |
| 32 void bufferSubData(GLenum, GLintptr, DOMArrayBufferView*, GLuint, GLuint); | 35 void bufferSubData(GLenum, GLintptr, DOMArrayBufferView*, GLuint, GLuint); |
| 33 // Have to re-declare/re-define the following buffer{Sub}Data functions from b
ase class. | 36 // Have to re-declare/re-define the following buffer{Sub}Data functions from b
ase class. |
| 34 // This is because the above buffer{Sub}Data() hides the name from base class. | 37 // This is because the above buffer{Sub}Data() hides the name from base class. |
| 35 void bufferData(GLenum target, long long size, GLenum usage); | 38 void bufferData(GLenum target, long long size, GLenum usage); |
| 36 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); | 39 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); |
| 37 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); | 40 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); |
| 38 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); | 41 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); |
| 39 void bufferSubData(GLenum target, | 42 void bufferSubData(GLenum target, |
| 40 long long offset, | 43 long long offset, |
| 41 const FlexibleArrayBufferView& data); | 44 const FlexibleArrayBufferView& data); |
| 42 | 45 |
| 43 void copyBufferSubData(GLenum, GLenum, long long, long long, long long); | 46 void copyBufferSubData(GLenum, GLenum, long long, long long, long long); |
| 44 void getBufferSubData(GLenum, long long, DOMArrayBufferView*, GLuint, GLuint); | 47 void getBufferSubData(GLenum, long long, DOMArrayBufferView*, GLuint, GLuint); |
| 48 ScriptPromise getBufferSubDataAsync(ScriptState*, |
| 49 GLenum, |
| 50 GLintptr, |
| 51 DOMArrayBufferView*, |
| 52 GLuint, |
| 53 GLuint); |
| 45 | 54 |
| 46 /* Framebuffer objects */ | 55 /* Framebuffer objects */ |
| 47 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer); | 56 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer); |
| 48 void blitFramebuffer(GLint, | 57 void blitFramebuffer(GLint, |
| 49 GLint, | 58 GLint, |
| 50 GLint, | 59 GLint, |
| 51 GLint, | 60 GLint, |
| 52 GLint, | 61 GLint, |
| 53 GLint, | 62 GLint, |
| 54 GLint, | 63 GLint, |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 // Helper function to check texture 3D target and texture bound to the target. | 809 // Helper function to check texture 3D target and texture bound to the target. |
| 801 // Generate GL errors and return 0 if target is invalid or texture bound is | 810 // Generate GL errors and return 0 if target is invalid or texture bound is |
| 802 // null. Otherwise, return the texture bound to the target. | 811 // null. Otherwise, return the texture bound to the target. |
| 803 WebGLTexture* validateTexture3DBinding(const char* functionName, | 812 WebGLTexture* validateTexture3DBinding(const char* functionName, |
| 804 GLenum target); | 813 GLenum target); |
| 805 | 814 |
| 806 WebGLBuffer* validateBufferDataTarget(const char* functionName, | 815 WebGLBuffer* validateBufferDataTarget(const char* functionName, |
| 807 GLenum target) override; | 816 GLenum target) override; |
| 808 bool validateBufferDataUsage(const char* functionName, GLenum usage) override; | 817 bool validateBufferDataUsage(const char* functionName, GLenum usage) override; |
| 809 | 818 |
| 819 class GetBufferSubDataAsyncCallback |
| 820 : public RefCounted<GetBufferSubDataAsyncCallback> { |
| 821 private: |
| 822 WeakPersistent<WebGL2RenderingContextBase> context; |
| 823 Persistent<DOMArrayBufferView> dstData; |
| 824 Persistent<ScriptPromiseResolver> resolver; |
| 825 void* subBaseAddress; |
| 826 void* mappedData; |
| 827 long long subByteLength; |
| 828 |
| 829 public: |
| 830 GetBufferSubDataAsyncCallback(WebGL2RenderingContextBase*, |
| 831 DOMArrayBufferView*, |
| 832 ScriptPromiseResolver*, |
| 833 void*, |
| 834 void*, |
| 835 long long); |
| 836 void destroy(); |
| 837 static void resolve(GetBufferSubDataAsyncCallback*); |
| 838 }; |
| 839 |
| 840 std::set<GetBufferSubDataAsyncCallback*> m_getBufferSubDataAsyncCallbacks; |
| 841 |
| 842 void registerGetBufferSubDataAsyncCallback(GetBufferSubDataAsyncCallback*); |
| 843 void unregisterGetBufferSubDataAsyncCallback(GetBufferSubDataAsyncCallback*); |
| 844 |
| 810 bool canUseTexImageByGPU(TexImageFunctionID, | 845 bool canUseTexImageByGPU(TexImageFunctionID, |
| 811 GLint internalformat, | 846 GLint internalformat, |
| 812 GLenum type) override; | 847 GLenum type) override; |
| 813 | 848 |
| 814 void removeBoundBuffer(WebGLBuffer*) override; | 849 void removeBoundBuffer(WebGLBuffer*) override; |
| 815 | 850 |
| 816 void resetUnpackParameters() override; | 851 void resetUnpackParameters() override; |
| 817 void restoreUnpackParameters() override; | 852 void restoreUnpackParameters() override; |
| 818 | 853 |
| 819 void visitChildDOMWrappers(v8::Isolate*, | 854 void visitChildDOMWrappers(v8::Isolate*, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 context, | 898 context, |
| 864 context->is3d() && | 899 context->is3d() && |
| 865 WebGLRenderingContextBase::getWebGLVersion(context) >= 2, | 900 WebGLRenderingContextBase::getWebGLVersion(context) >= 2, |
| 866 context.is3d() && | 901 context.is3d() && |
| 867 WebGLRenderingContextBase::getWebGLVersion(&context) >= | 902 WebGLRenderingContextBase::getWebGLVersion(&context) >= |
| 868 2); | 903 2); |
| 869 | 904 |
| 870 } // namespace blink | 905 } // namespace blink |
| 871 | 906 |
| 872 #endif | 907 #endif |
| OLD | NEW |