| 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; |
| 19 class WebGLGetBufferSubDataAsyncCallback; |
| 18 class WebGLProgram; | 20 class WebGLProgram; |
| 19 class WebGLQuery; | 21 class WebGLQuery; |
| 20 class WebGLSampler; | 22 class WebGLSampler; |
| 21 class WebGLSync; | 23 class WebGLSync; |
| 22 class WebGLTransformFeedback; | 24 class WebGLTransformFeedback; |
| 23 class WebGLUniformLocation; | 25 class WebGLUniformLocation; |
| 24 class WebGLVertexArrayObject; | 26 class WebGLVertexArrayObject; |
| 25 | 27 |
| 26 class WebGL2RenderingContextBase : public WebGLRenderingContextBase { | 28 class WebGL2RenderingContextBase : public WebGLRenderingContextBase { |
| 27 public: | 29 public: |
| 28 ~WebGL2RenderingContextBase() override; | 30 ~WebGL2RenderingContextBase() override; |
| 29 | 31 |
| 32 void destroyContext() override; |
| 33 |
| 30 /* Buffer objects */ | 34 /* Buffer objects */ |
| 31 void bufferData(GLenum, DOMArrayBufferView*, GLenum, GLuint, GLuint); | 35 void bufferData(GLenum, DOMArrayBufferView*, GLenum, GLuint, GLuint); |
| 32 void bufferSubData(GLenum, GLintptr, DOMArrayBufferView*, GLuint, GLuint); | 36 void bufferSubData(GLenum, GLintptr, DOMArrayBufferView*, GLuint, GLuint); |
| 33 // Have to re-declare/re-define the following buffer{Sub}Data functions from | 37 // Have to re-declare/re-define the following buffer{Sub}Data functions from |
| 34 // base class. This is because the above buffer{Sub}Data() hides the name | 38 // base class. This is because the above buffer{Sub}Data() hides the name |
| 35 // from base class. | 39 // from base class. |
| 36 void bufferData(GLenum target, long long size, GLenum usage); | 40 void bufferData(GLenum target, long long size, GLenum usage); |
| 37 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); | 41 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); |
| 38 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); | 42 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); |
| 39 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); | 43 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); |
| 40 void bufferSubData(GLenum target, | 44 void bufferSubData(GLenum target, |
| 41 long long offset, | 45 long long offset, |
| 42 const FlexibleArrayBufferView& data); | 46 const FlexibleArrayBufferView& data); |
| 43 | 47 |
| 44 void copyBufferSubData(GLenum, GLenum, long long, long long, long long); | 48 void copyBufferSubData(GLenum, GLenum, long long, long long, long long); |
| 45 void getBufferSubData(GLenum, long long, DOMArrayBufferView*, GLuint, GLuint); | 49 void getBufferSubData(GLenum, long long, DOMArrayBufferView*, GLuint, GLuint); |
| 50 ScriptPromise getBufferSubDataAsync(ScriptState*, |
| 51 GLenum target, |
| 52 GLintptr srcByteOffset, |
| 53 DOMArrayBufferView*, |
| 54 GLuint dstOffset, |
| 55 GLuint length); |
| 56 |
| 57 void registerGetBufferSubDataAsyncCallback( |
| 58 WebGLGetBufferSubDataAsyncCallback*); |
| 59 void unregisterGetBufferSubDataAsyncCallback( |
| 60 WebGLGetBufferSubDataAsyncCallback*); |
| 46 | 61 |
| 47 /* Framebuffer objects */ | 62 /* Framebuffer objects */ |
| 48 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer); | 63 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer); |
| 49 void blitFramebuffer(GLint, | 64 void blitFramebuffer(GLint, |
| 50 GLint, | 65 GLint, |
| 51 GLint, | 66 GLint, |
| 52 GLint, | 67 GLint, |
| 53 GLint, | 68 GLint, |
| 54 GLint, | 69 GLint, |
| 55 GLint, | 70 GLint, |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 // Helper function to check texture 3D target and texture bound to the target. | 819 // Helper function to check texture 3D target and texture bound to the target. |
| 805 // Generate GL errors and return 0 if target is invalid or texture bound is | 820 // Generate GL errors and return 0 if target is invalid or texture bound is |
| 806 // null. Otherwise, return the texture bound to the target. | 821 // null. Otherwise, return the texture bound to the target. |
| 807 WebGLTexture* validateTexture3DBinding(const char* functionName, | 822 WebGLTexture* validateTexture3DBinding(const char* functionName, |
| 808 GLenum target); | 823 GLenum target); |
| 809 | 824 |
| 810 WebGLBuffer* validateBufferDataTarget(const char* functionName, | 825 WebGLBuffer* validateBufferDataTarget(const char* functionName, |
| 811 GLenum target) override; | 826 GLenum target) override; |
| 812 bool validateBufferDataUsage(const char* functionName, GLenum usage) override; | 827 bool validateBufferDataUsage(const char* functionName, GLenum usage) override; |
| 813 | 828 |
| 829 const char* validateGetBufferSubData(const char* functionName, |
| 830 GLenum target, |
| 831 GLintptr sourceByteOffset, |
| 832 DOMArrayBufferView*, |
| 833 GLuint destinationOffset, |
| 834 GLuint length, |
| 835 WebGLBuffer**, |
| 836 void** outDestinationDataPtr, |
| 837 long long* outDestinationByteLength); |
| 838 const char* validateGetBufferSubDataBounds(const char* functionName, |
| 839 WebGLBuffer*, |
| 840 GLintptr sourceByteOffset, |
| 841 long long destinationByteLength); |
| 842 |
| 814 bool canUseTexImageByGPU(TexImageFunctionID, | 843 bool canUseTexImageByGPU(TexImageFunctionID, |
| 815 GLint internalformat, | 844 GLint internalformat, |
| 816 GLenum type) override; | 845 GLenum type) override; |
| 817 | 846 |
| 818 void removeBoundBuffer(WebGLBuffer*) override; | 847 void removeBoundBuffer(WebGLBuffer*) override; |
| 819 | 848 |
| 820 void resetUnpackParameters() override; | 849 void resetUnpackParameters() override; |
| 821 void restoreUnpackParameters() override; | 850 void restoreUnpackParameters() override; |
| 822 | 851 |
| 823 void visitChildDOMWrappers(v8::Isolate*, | 852 void visitChildDOMWrappers(v8::Isolate*, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 853 HeapVector<Member<WebGLSampler>> m_samplerUnits; | 882 HeapVector<Member<WebGLSampler>> m_samplerUnits; |
| 854 | 883 |
| 855 GLint m_packRowLength; | 884 GLint m_packRowLength; |
| 856 GLint m_packSkipPixels; | 885 GLint m_packSkipPixels; |
| 857 GLint m_packSkipRows; | 886 GLint m_packSkipRows; |
| 858 GLint m_unpackRowLength; | 887 GLint m_unpackRowLength; |
| 859 GLint m_unpackImageHeight; | 888 GLint m_unpackImageHeight; |
| 860 GLint m_unpackSkipPixels; | 889 GLint m_unpackSkipPixels; |
| 861 GLint m_unpackSkipRows; | 890 GLint m_unpackSkipRows; |
| 862 GLint m_unpackSkipImages; | 891 GLint m_unpackSkipImages; |
| 892 |
| 893 HeapHashSet<Member<WebGLGetBufferSubDataAsyncCallback>> |
| 894 m_getBufferSubDataAsyncCallbacks; |
| 863 }; | 895 }; |
| 864 | 896 |
| 865 DEFINE_TYPE_CASTS(WebGL2RenderingContextBase, | 897 DEFINE_TYPE_CASTS(WebGL2RenderingContextBase, |
| 866 CanvasRenderingContext, | 898 CanvasRenderingContext, |
| 867 context, | 899 context, |
| 868 context->is3d() && | 900 context->is3d() && |
| 869 WebGLRenderingContextBase::getWebGLVersion(context) >= 2, | 901 WebGLRenderingContextBase::getWebGLVersion(context) >= 2, |
| 870 context.is3d() && | 902 context.is3d() && |
| 871 WebGLRenderingContextBase::getWebGLVersion(&context) >= | 903 WebGLRenderingContextBase::getWebGLVersion(&context) >= |
| 872 2); | 904 2); |
| 873 | 905 |
| 874 } // namespace blink | 906 } // namespace blink |
| 875 | 907 |
| 876 #endif | 908 #endif |
| OLD | NEW |