Chromium Code Reviews| 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, | |
| 52 GLintptr, | |
| 53 DOMArrayBufferView*, | |
| 54 GLuint, | |
| 55 GLuint); | |
| 46 | 56 |
| 47 /* Framebuffer objects */ | 57 /* Framebuffer objects */ |
| 48 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer); | 58 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer); |
| 49 void blitFramebuffer(GLint, | 59 void blitFramebuffer(GLint, |
| 50 GLint, | 60 GLint, |
| 51 GLint, | 61 GLint, |
| 52 GLint, | 62 GLint, |
| 53 GLint, | 63 GLint, |
| 54 GLint, | 64 GLint, |
| 55 GLint, | 65 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. | 814 // 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 | 815 // Generate GL errors and return 0 if target is invalid or texture bound is |
| 806 // null. Otherwise, return the texture bound to the target. | 816 // null. Otherwise, return the texture bound to the target. |
| 807 WebGLTexture* validateTexture3DBinding(const char* functionName, | 817 WebGLTexture* validateTexture3DBinding(const char* functionName, |
| 808 GLenum target); | 818 GLenum target); |
| 809 | 819 |
| 810 WebGLBuffer* validateBufferDataTarget(const char* functionName, | 820 WebGLBuffer* validateBufferDataTarget(const char* functionName, |
| 811 GLenum target) override; | 821 GLenum target) override; |
| 812 bool validateBufferDataUsage(const char* functionName, GLenum usage) override; | 822 bool validateBufferDataUsage(const char* functionName, GLenum usage) override; |
| 813 | 823 |
| 824 const char* validateGetBufferSubData(const char*, | |
| 825 GLenum, | |
| 826 GLintptr, | |
| 827 DOMArrayBufferView*, | |
| 828 GLuint, | |
| 829 GLuint, | |
| 830 WebGLBuffer**, | |
| 831 void**, | |
| 832 long long*); | |
| 833 const char* validateGetBufferSubDataBounds(const char*, | |
| 834 WebGLBuffer*, | |
| 835 GLintptr, | |
| 836 long long); | |
| 837 | |
| 838 std::set<WebGLGetBufferSubDataAsyncCallback*> | |
|
esprehn
2016/10/18 01:44:16
Use HashSet, you don't need the ordering
Kai Ninomiya
2016/10/19 17:54:10
Done.
| |
| 839 m_getBufferSubDataAsyncCallbacks; | |
| 840 | |
| 841 friend class WebGLGetBufferSubDataAsyncCallback; | |
|
esprehn
2016/10/18 01:44:16
We usually discourage friends, can we add correct
Kai Ninomiya
2016/10/19 17:54:10
Done.
| |
| 842 void registerGetBufferSubDataAsyncCallback( | |
| 843 WebGLGetBufferSubDataAsyncCallback*); | |
| 844 void unregisterGetBufferSubDataAsyncCallback( | |
| 845 WebGLGetBufferSubDataAsyncCallback*); | |
| 846 | |
| 814 bool canUseTexImageByGPU(TexImageFunctionID, | 847 bool canUseTexImageByGPU(TexImageFunctionID, |
| 815 GLint internalformat, | 848 GLint internalformat, |
| 816 GLenum type) override; | 849 GLenum type) override; |
| 817 | 850 |
| 818 void removeBoundBuffer(WebGLBuffer*) override; | 851 void removeBoundBuffer(WebGLBuffer*) override; |
| 819 | 852 |
| 820 void resetUnpackParameters() override; | 853 void resetUnpackParameters() override; |
| 821 void restoreUnpackParameters() override; | 854 void restoreUnpackParameters() override; |
| 822 | 855 |
| 823 void visitChildDOMWrappers(v8::Isolate*, | 856 void visitChildDOMWrappers(v8::Isolate*, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 867 context, | 900 context, |
| 868 context->is3d() && | 901 context->is3d() && |
| 869 WebGLRenderingContextBase::getWebGLVersion(context) >= 2, | 902 WebGLRenderingContextBase::getWebGLVersion(context) >= 2, |
| 870 context.is3d() && | 903 context.is3d() && |
| 871 WebGLRenderingContextBase::getWebGLVersion(&context) >= | 904 WebGLRenderingContextBase::getWebGLVersion(&context) >= |
| 872 2); | 905 2); |
| 873 | 906 |
| 874 } // namespace blink | 907 } // namespace blink |
| 875 | 908 |
| 876 #endif | 909 #endif |
| OLD | NEW |