| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebGL2RenderingContextBase_h |
| 6 #define WebGL2RenderingContextBase_h |
| 7 |
| 8 #include "core/html/canvas/WebGLExtension.h" |
| 9 #include "core/html/canvas/WebGLRenderingContextBase.h" |
| 10 #include "wtf/PassRefPtr.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class WebGLTexture; |
| 15 |
| 16 class WebGLActiveInfo; |
| 17 class WebGLBuffer; |
| 18 class WebGLProgram; |
| 19 class WebGLQuery; |
| 20 class WebGLSampler; |
| 21 class WebGLSync; |
| 22 class WebGLTransformFeedback; |
| 23 class WebGLUniformLocation; |
| 24 class WebGLVertexArrayObject; |
| 25 |
| 26 class WebGL2RenderingContextBase : public WebGLRenderingContextBase { |
| 27 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WebGL2RenderingContextBase); |
| 28 public: |
| 29 virtual ~WebGL2RenderingContextBase(); |
| 30 |
| 31 /* Buffer objects */ |
| 32 void copyBufferSubData(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr); |
| 33 void getBufferSubData(GLenum target, GLintptr offset, DOMArrayBuffer* return
edData); |
| 34 |
| 35 /* Framebuffer objects */ |
| 36 void blitFramebuffer(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint,
GLbitfield, GLenum); |
| 37 void framebufferTextureLayer(GLenum, GLenum, const WebGLTexture*, GLint, GLi
nt); |
| 38 ScriptValue getInternalformatParameter(ScriptState*, GLenum, GLenum, GLenum)
; |
| 39 void invalidateFramebuffer(GLenum, Vector<GLenum>&); |
| 40 void invalidateSubFramebuffer(GLenum, Vector<GLenum>&, GLint, GLint, GLsizei
, GLsizei); |
| 41 void readBuffer(GLenum); |
| 42 |
| 43 /* Renderbuffer objects */ |
| 44 void renderbufferStorageMultisample(GLenum, GLsizei, GLenum, GLsizei, GLsize
i); |
| 45 |
| 46 /* Texture objects */ |
| 47 void texStorage2D(GLenum, GLsizei, GLenum, GLsizei, GLsizei); |
| 48 void texStorage3D(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei); |
| 49 void texImage3D(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLen
um, GLenum, DOMArrayBufferView*); |
| 50 void texSubImage3D(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLs
izei, GLenum, GLenum, DOMArrayBufferView*); |
| 51 void texSubImage3D(GLenum, GLint, GLint, GLint, GLint, GLenum, GLenum, Image
Data*); |
| 52 void texSubImage3D(GLenum, GLint, GLint, GLint, GLint, GLenum, GLenum, HTMLI
mageElement*); |
| 53 void texSubImage3D(GLenum, GLint, GLint, GLint, GLint, GLenum, GLenum, HTMLC
anvasElement*); |
| 54 void texSubImage3D(GLenum, GLint, GLint, GLint, GLint, GLenum, GLenum, HTMLV
ideoElement*); |
| 55 void copyTexSubImage3D(GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLs
izei, GLsizei); |
| 56 void compressedTexImage3D(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei,
GLint, GLsizei, DOMArrayBufferView*); |
| 57 void compressedTexSubImage3D(GLenum, GLint, GLint, GLint, GLint, GLsizei, GL
sizei, GLsizei, GLenum, GLsizei, DOMArrayBufferView*); |
| 58 |
| 59 /* Programs and shaders */ |
| 60 GLint getFragDataLocation(WebGLProgram*, const String&); |
| 61 |
| 62 /* Uniforms and attributes */ |
| 63 void uniform1ui(const WebGLUniformLocation*, GLuint); |
| 64 void uniform2ui(const WebGLUniformLocation*, GLuint, GLuint); |
| 65 void uniform3ui(const WebGLUniformLocation*, GLuint, GLuint, GLuint); |
| 66 void uniform4ui(const WebGLUniformLocation*, GLuint, GLuint, GLuint, GLuint)
; |
| 67 void uniform1uiv(const WebGLUniformLocation*, Vector<GLuint>&); |
| 68 void uniform2uiv(const WebGLUniformLocation*, Vector<GLuint>&); |
| 69 void uniform3uiv(const WebGLUniformLocation*, Vector<GLuint>&); |
| 70 void uniform4uiv(const WebGLUniformLocation*, Vector<GLuint>&); |
| 71 void uniformMatrix2x3fv(const WebGLUniformLocation*, GLboolean, DOMFloat32Ar
ray*); |
| 72 void uniformMatrix2x3fv(const WebGLUniformLocation*, GLboolean, Vector<GLflo
at>&); |
| 73 void uniformMatrix3x2fv(const WebGLUniformLocation*, GLboolean, DOMFloat32Ar
ray*); |
| 74 void uniformMatrix3x2fv(const WebGLUniformLocation*, GLboolean, Vector<GLflo
at>&); |
| 75 void uniformMatrix2x4fv(const WebGLUniformLocation*, GLboolean, DOMFloat32Ar
ray*); |
| 76 void uniformMatrix2x4fv(const WebGLUniformLocation*, GLboolean, Vector<GLflo
at>&); |
| 77 void uniformMatrix4x2fv(const WebGLUniformLocation*, GLboolean, DOMFloat32Ar
ray*); |
| 78 void uniformMatrix4x2fv(const WebGLUniformLocation*, GLboolean, Vector<GLflo
at>&); |
| 79 void uniformMatrix3x4fv(const WebGLUniformLocation*, GLboolean, DOMFloat32Ar
ray*); |
| 80 void uniformMatrix3x4fv(const WebGLUniformLocation*, GLboolean, Vector<GLflo
at>&); |
| 81 void uniformMatrix4x3fv(const WebGLUniformLocation*, GLboolean, DOMFloat32Ar
ray*); |
| 82 void uniformMatrix4x3fv(const WebGLUniformLocation*, GLboolean, Vector<GLflo
at>&); |
| 83 |
| 84 void vertexAttribI4i(GLuint, GLint, GLint, GLint, GLint); |
| 85 void vertexAttribI4iv(GLuint, const Vector<GLint>&); |
| 86 void vertexAttribI4ui(GLuint, GLuint, GLuint, GLuint, GLuint); |
| 87 void vertexAttribI4uiv(GLuint, const Vector<GLuint>&); |
| 88 void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei str
ide, GLintptr offset); |
| 89 |
| 90 /* Writing to the drawing buffer */ |
| 91 void vertexAttribDivisor(GLuint, GLuint); |
| 92 void drawArraysInstanced(GLenum, GLint, GLsizei, GLsizei); |
| 93 void drawElementsInstanced(GLenum, GLsizei, GLenum, GLintptr, GLsizei); |
| 94 void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
GLenum type, GLintptr offset); |
| 95 |
| 96 /* Multiple Render Targets */ |
| 97 void drawBuffers(const Vector<GLenum>&); |
| 98 void clearBufferiv(GLenum, GLint, DOMInt32Array*); |
| 99 void clearBufferiv(GLenum, GLint, const Vector<GLint>&); |
| 100 void clearBufferuiv(GLenum, GLint, DOMUint32Array*); |
| 101 void clearBufferuiv(GLenum, GLint, const Vector<GLuint>&); |
| 102 void clearBufferfv(GLenum, GLint, DOMFloat32Array*); |
| 103 void clearBufferfv(GLenum, GLint, const Vector<GLfloat>&); |
| 104 void clearBufferfi(GLenum, GLint, GLfloat, GLint); |
| 105 |
| 106 /* Query Objects */ |
| 107 PassRefPtr<WebGLQuery> createQuery(); |
| 108 void deleteQuery(WebGLQuery*); |
| 109 GLboolean isQuery(WebGLQuery*); |
| 110 void beginQuery(GLenum, WebGLQuery*); |
| 111 void endQuery(GLenum); |
| 112 PassRefPtr<WebGLQuery> getQuery(GLenum, GLenum); |
| 113 ScriptValue getQueryParameter(ScriptState*, WebGLQuery*, GLenum); |
| 114 |
| 115 /* Sampler Objects */ |
| 116 PassRefPtr<WebGLSampler> createSampler(); |
| 117 void deleteSampler(WebGLSampler*); |
| 118 GLboolean isSampler(WebGLSampler*); |
| 119 void bindSampler(GLuint, WebGLSampler*); |
| 120 void samplerParameteri(WebGLSampler*, GLenum, GLint); |
| 121 void samplerParameterf(WebGLSampler*, GLenum, GLfloat); |
| 122 ScriptValue getSamplerParameter(ScriptState*, WebGLSampler*, GLenum); |
| 123 |
| 124 /* Sync objects */ |
| 125 PassRefPtr<WebGLSync> fenceSync(GLenum, GLbitfield); |
| 126 GLboolean isSync(WebGLSync*); |
| 127 void deleteSync(WebGLSync*); |
| 128 GLenum clientWaitSync(WebGLSync*, GLbitfield, GLuint); |
| 129 void waitSync(WebGLSync*, GLbitfield, GLuint); |
| 130 |
| 131 ScriptValue getSyncParameter(ScriptState*, WebGLSync*, GLenum); |
| 132 |
| 133 /* Transform Feedback */ |
| 134 PassRefPtr<WebGLTransformFeedback> createTransformFeedback(); |
| 135 void deleteTransformFeedback(WebGLTransformFeedback*); |
| 136 GLboolean isTransformFeedback(WebGLTransformFeedback*); |
| 137 void bindTransformFeedback(GLenum, WebGLTransformFeedback*); |
| 138 void beginTransformFeedback(GLenum); |
| 139 void endTransformFeedback(); |
| 140 void transformFeedbackVaryings(WebGLProgram*, const Vector<String>&, GLenum)
; |
| 141 PassRefPtr<WebGLActiveInfo> getTransformFeedbackVarying(WebGLProgram*, GLuin
t); |
| 142 void pauseTransformFeedback(); |
| 143 void resumeTransformFeedback(); |
| 144 |
| 145 /* Uniform Buffer Objects and Transform Feedback Buffers */ |
| 146 void bindBufferBase(GLenum, GLuint, WebGLBuffer*); |
| 147 void bindBufferRange(GLenum, GLuint, WebGLBuffer*, GLintptr, GLsizeiptr); |
| 148 ScriptValue getIndexedParameter(ScriptState*, GLenum, GLuint); |
| 149 Vector<GLuint> getUniformIndices(WebGLProgram*, const Vector<String>&); |
| 150 Vector<GLint> getActiveUniforms(WebGLProgram*, const Vector<GLuint>&, GLenum
); |
| 151 GLuint getUniformBlockIndex(WebGLProgram*, const String&); |
| 152 ScriptValue getActiveUniformBlockParameter(ScriptState*, WebGLProgram*, GLui
nt, GLenum); |
| 153 String getActiveUniformBlockName(WebGLProgram*, GLuint); |
| 154 void uniformBlockBinding(WebGLProgram*, GLuint, GLuint); |
| 155 |
| 156 /* Vertex Array Objects */ |
| 157 PassRefPtr<WebGLVertexArrayObjectOES> createVertexArray(); |
| 158 void deleteVertexArray(WebGLVertexArrayObjectOES*); |
| 159 GLboolean isVertexArray(WebGLVertexArrayObjectOES*); |
| 160 void bindVertexArray(WebGLVertexArrayObjectOES*); |
| 161 |
| 162 void trace(Visitor*) override; |
| 163 |
| 164 protected: |
| 165 WebGL2RenderingContextBase(HTMLCanvasElement*, PassOwnPtr<blink::WebGraphics
Context3D>, const WebGLContextAttributes& requestedAttributes); |
| 166 |
| 167 bool validateClearBuffer(const char* functionName, GLenum buffer, GLsizei le
ngth); |
| 168 }; |
| 169 |
| 170 DEFINE_TYPE_CASTS(WebGL2RenderingContextBase, CanvasRenderingContext, context, |
| 171 context->is3d() && WebGLRenderingContextBase::getWebGLVersion(context) >= 2, |
| 172 context.is3d() && WebGLRenderingContextBase::getWebGLVersion(&context) >= 2)
; |
| 173 |
| 174 } // namespace blink |
| 175 |
| 176 #endif |
| OLD | NEW |