Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h

Issue 2379203002: implement getBufferSubDataAsync prototype (Closed)
Patch Set: rebase + clean up some XXXs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 // 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 37 // base class. This is because the above buffer{Sub}Data() hides the name
35 // from base class. 38 // from base class.
36 void bufferData(GLenum target, long long size, GLenum usage); 39 void bufferData(GLenum target, long long size, GLenum usage);
37 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage); 40 void bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage);
38 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage); 41 void bufferData(GLenum target, DOMArrayBufferView* data, GLenum usage);
39 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data); 42 void bufferSubData(GLenum target, long long offset, DOMArrayBuffer* data);
40 void bufferSubData(GLenum target, 43 void bufferSubData(GLenum target,
41 long long offset, 44 long long offset,
42 const FlexibleArrayBufferView& data); 45 const FlexibleArrayBufferView& data);
43 46
44 void copyBufferSubData(GLenum, GLenum, long long, long long, long long); 47 void copyBufferSubData(GLenum, GLenum, long long, long long, long long);
45 void getBufferSubData(GLenum, long long, DOMArrayBufferView*, GLuint, GLuint); 48 void getBufferSubData(GLenum, long long, DOMArrayBufferView*, GLuint, GLuint);
49 ScriptPromise getBufferSubDataAsync(ScriptState*,
50 GLenum,
51 GLintptr,
52 DOMArrayBufferView*,
53 GLuint,
54 GLuint);
46 55
47 /* Framebuffer objects */ 56 /* Framebuffer objects */
48 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer); 57 bool validateTexFuncLayer(const char*, GLenum texTarget, GLint layer);
49 void blitFramebuffer(GLint, 58 void blitFramebuffer(GLint,
50 GLint, 59 GLint,
51 GLint, 60 GLint,
52 GLint, 61 GLint,
53 GLint, 62 GLint,
54 GLint, 63 GLint,
55 GLint, 64 GLint,
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 // Helper function to check texture 3D target and texture bound to the target. 813 // 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 814 // Generate GL errors and return 0 if target is invalid or texture bound is
806 // null. Otherwise, return the texture bound to the target. 815 // null. Otherwise, return the texture bound to the target.
807 WebGLTexture* validateTexture3DBinding(const char* functionName, 816 WebGLTexture* validateTexture3DBinding(const char* functionName,
808 GLenum target); 817 GLenum target);
809 818
810 WebGLBuffer* validateBufferDataTarget(const char* functionName, 819 WebGLBuffer* validateBufferDataTarget(const char* functionName,
811 GLenum target) override; 820 GLenum target) override;
812 bool validateBufferDataUsage(const char* functionName, GLenum usage) override; 821 bool validateBufferDataUsage(const char* functionName, GLenum usage) override;
813 822
823 class GetBufferSubDataAsyncCallback
824 : public RefCounted<GetBufferSubDataAsyncCallback> {
esprehn 2016/10/08 03:02:49 Does this need to be a nested class?
Kai Ninomiya 2016/10/11 01:34:14 I'll simplify this.
825 private:
Ken Russell (switch to Gerrit) 2016/10/10 22:21:30 Per the Google C++ style guide at https://google.g
Kai Ninomiya 2016/10/11 01:34:14 Done.
826 WeakPersistent<WebGL2RenderingContextBase> context;
827 Persistent<DOMArrayBufferView> dstData;
esprehn 2016/10/08 03:02:49 We don't generally abbreviate in blink, does the s
Kai Ninomiya 2016/10/11 01:34:14 Yes, the spec uses "dst." However, it does not nee
828 Persistent<ScriptPromiseResolver> resolver;
829 void* subBaseAddress;
Ken Russell (switch to Gerrit) 2016/10/10 22:21:30 These variables could use some comments. Also, ple
830 void* mappedData;
831 long long subByteLength;
esprehn 2016/10/08 03:02:49 Very few things in blink can actually handle somet
Ken Russell (switch to Gerrit) 2016/10/10 22:21:30 It represents the amount of data read back from th
Kai Ninomiya 2016/10/11 01:34:14 esprehn: Excellent point, I agree. If it's alright
832
833 public:
834 GetBufferSubDataAsyncCallback(WebGL2RenderingContextBase*,
835 DOMArrayBufferView*,
836 ScriptPromiseResolver*,
837 void*,
838 void*,
839 long long);
840 void destroy();
841 static void resolve(GetBufferSubDataAsyncCallback*);
842 };
843
844 std::set<GetBufferSubDataAsyncCallback*> m_getBufferSubDataAsyncCallbacks;
845
846 void registerGetBufferSubDataAsyncCallback(GetBufferSubDataAsyncCallback*);
847 void unregisterGetBufferSubDataAsyncCallback(GetBufferSubDataAsyncCallback*);
848
814 bool canUseTexImageByGPU(TexImageFunctionID, 849 bool canUseTexImageByGPU(TexImageFunctionID,
815 GLint internalformat, 850 GLint internalformat,
816 GLenum type) override; 851 GLenum type) override;
817 852
818 void removeBoundBuffer(WebGLBuffer*) override; 853 void removeBoundBuffer(WebGLBuffer*) override;
819 854
820 void resetUnpackParameters() override; 855 void resetUnpackParameters() override;
821 void restoreUnpackParameters() override; 856 void restoreUnpackParameters() override;
822 857
823 void visitChildDOMWrappers(v8::Isolate*, 858 void visitChildDOMWrappers(v8::Isolate*,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 context, 902 context,
868 context->is3d() && 903 context->is3d() &&
869 WebGLRenderingContextBase::getWebGLVersion(context) >= 2, 904 WebGLRenderingContextBase::getWebGLVersion(context) >= 2,
870 context.is3d() && 905 context.is3d() &&
871 WebGLRenderingContextBase::getWebGLVersion(&context) >= 906 WebGLRenderingContextBase::getWebGLVersion(&context) >=
872 2); 907 2);
873 908
874 } // namespace blink 909 } // namespace blink
875 910
876 #endif 911 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698