mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
It implements enough WebGL spec to draw a triangle
This commit is contained in:
parent
a346f95e68
commit
79b8e7aa34
17 changed files with 741 additions and 70 deletions
|
@ -1,4 +1,3 @@
|
|||
// AUTOGENERATED FILE -- DO NOT EDIT -- SEE Makefile
|
||||
//
|
||||
// WebGL IDL definitions scraped from the Khronos specification:
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/
|
||||
|
@ -34,30 +33,15 @@ dictionary WebGLContextAttributes {
|
|||
GLboolean failIfMajorPerformanceCaveat = false;
|
||||
};
|
||||
|
||||
//interface WebGLObject {
|
||||
//};
|
||||
|
||||
//interface WebGLBuffer : WebGLObject {
|
||||
//};
|
||||
|
||||
//interface WebGLFramebuffer : WebGLObject {
|
||||
//};
|
||||
|
||||
//interface WebGLProgram : WebGLObject {
|
||||
//};
|
||||
|
||||
//interface WebGLRenderbuffer : WebGLObject {
|
||||
//};
|
||||
|
||||
//interface WebGLShader : WebGLObject {
|
||||
//};
|
||||
|
||||
//interface WebGLTexture : WebGLObject {
|
||||
//};
|
||||
|
||||
//interface WebGLUniformLocation {
|
||||
//};
|
||||
|
||||
//interface WebGLActiveInfo {
|
||||
// readonly attribute GLint size;
|
||||
// readonly attribute GLenum type;
|
||||
|
@ -75,18 +59,18 @@ interface WebGLRenderingContextBase
|
|||
{
|
||||
|
||||
/* ClearBufferMask */
|
||||
//const GLenum DEPTH_BUFFER_BIT = 0x00000100;
|
||||
//const GLenum STENCIL_BUFFER_BIT = 0x00000400;
|
||||
const GLenum DEPTH_BUFFER_BIT = 0x00000100;
|
||||
const GLenum STENCIL_BUFFER_BIT = 0x00000400;
|
||||
const GLenum COLOR_BUFFER_BIT = 0x00004000;
|
||||
|
||||
/* BeginMode */
|
||||
//const GLenum POINTS = 0x0000;
|
||||
//const GLenum LINES = 0x0001;
|
||||
//const GLenum LINE_LOOP = 0x0002;
|
||||
//const GLenum LINE_STRIP = 0x0003;
|
||||
//const GLenum TRIANGLES = 0x0004;
|
||||
//const GLenum TRIANGLE_STRIP = 0x0005;
|
||||
//const GLenum TRIANGLE_FAN = 0x0006;
|
||||
const GLenum POINTS = 0x0000;
|
||||
const GLenum LINES = 0x0001;
|
||||
const GLenum LINE_LOOP = 0x0002;
|
||||
const GLenum LINE_STRIP = 0x0003;
|
||||
const GLenum TRIANGLES = 0x0004;
|
||||
const GLenum TRIANGLE_STRIP = 0x0005;
|
||||
const GLenum TRIANGLE_FAN = 0x0006;
|
||||
|
||||
/* AlphaFunction (not supported in ES20) */
|
||||
/* NEVER */
|
||||
|
@ -141,14 +125,14 @@ interface WebGLRenderingContextBase
|
|||
//const GLenum BLEND_COLOR = 0x8005;
|
||||
|
||||
/* Buffer Objects */
|
||||
//const GLenum ARRAY_BUFFER = 0x8892;
|
||||
//const GLenum ELEMENT_ARRAY_BUFFER = 0x8893;
|
||||
//const GLenum ARRAY_BUFFER_BINDING = 0x8894;
|
||||
//const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
|
||||
const GLenum ARRAY_BUFFER = 0x8892;
|
||||
const GLenum ELEMENT_ARRAY_BUFFER = 0x8893;
|
||||
const GLenum ARRAY_BUFFER_BINDING = 0x8894;
|
||||
const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
|
||||
|
||||
//const GLenum STREAM_DRAW = 0x88E0;
|
||||
//const GLenum STATIC_DRAW = 0x88E4;
|
||||
//const GLenum DYNAMIC_DRAW = 0x88E8;
|
||||
const GLenum STREAM_DRAW = 0x88E0;
|
||||
const GLenum STATIC_DRAW = 0x88E4;
|
||||
const GLenum DYNAMIC_DRAW = 0x88E8;
|
||||
|
||||
//const GLenum BUFFER_SIZE = 0x8764;
|
||||
//const GLenum BUFFER_USAGE = 0x8765;
|
||||
|
@ -260,13 +244,13 @@ interface WebGLRenderingContextBase
|
|||
//const GLenum GENERATE_MIPMAP_HINT = 0x8192;
|
||||
|
||||
/* DataType */
|
||||
//const GLenum BYTE = 0x1400;
|
||||
//const GLenum UNSIGNED_BYTE = 0x1401;
|
||||
//const GLenum SHORT = 0x1402;
|
||||
//const GLenum UNSIGNED_SHORT = 0x1403;
|
||||
//const GLenum INT = 0x1404;
|
||||
//const GLenum UNSIGNED_INT = 0x1405;
|
||||
//const GLenum FLOAT = 0x1406;
|
||||
const GLenum BYTE = 0x1400;
|
||||
const GLenum UNSIGNED_BYTE = 0x1401;
|
||||
const GLenum SHORT = 0x1402;
|
||||
const GLenum UNSIGNED_SHORT = 0x1403;
|
||||
const GLenum INT = 0x1404;
|
||||
const GLenum UNSIGNED_INT = 0x1405;
|
||||
const GLenum FLOAT = 0x1406;
|
||||
|
||||
/* PixelFormat */
|
||||
//const GLenum DEPTH_COMPONENT = 0x1902;
|
||||
|
@ -283,8 +267,8 @@ interface WebGLRenderingContextBase
|
|||
//const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363;
|
||||
|
||||
/* Shaders */
|
||||
//const GLenum FRAGMENT_SHADER = 0x8B30;
|
||||
//const GLenum VERTEX_SHADER = 0x8B31;
|
||||
const GLenum FRAGMENT_SHADER = 0x8B30;
|
||||
const GLenum VERTEX_SHADER = 0x8B31;
|
||||
//const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
|
||||
//const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
|
||||
//const GLenum MAX_VARYING_VECTORS = 0x8DFC;
|
||||
|
@ -430,7 +414,7 @@ interface WebGLRenderingContextBase
|
|||
//const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
|
||||
|
||||
/* Shader Source */
|
||||
//const GLenum COMPILE_STATUS = 0x8B81;
|
||||
const GLenum COMPILE_STATUS = 0x8B81;
|
||||
|
||||
/* Shader Precision-Specified Types */
|
||||
//const GLenum LOW_FLOAT = 0x8DF0;
|
||||
|
@ -504,9 +488,9 @@ interface WebGLRenderingContextBase
|
|||
//object? getExtension(DOMString name);
|
||||
|
||||
//void activeTexture(GLenum texture);
|
||||
//void attachShader(WebGLProgram? program, WebGLShader? shader);
|
||||
void attachShader(WebGLProgram? program, WebGLShader? shader);
|
||||
//void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
|
||||
//void bindBuffer(GLenum target, WebGLBuffer? buffer);
|
||||
void bindBuffer(GLenum target, WebGLBuffer? buffer);
|
||||
//void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
|
||||
//void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
|
||||
//void bindTexture(GLenum target, WebGLTexture? texture);
|
||||
|
@ -517,9 +501,13 @@ interface WebGLRenderingContextBase
|
|||
//void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
|
||||
// GLenum srcAlpha, GLenum dstAlpha);
|
||||
|
||||
//typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
|
||||
// typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
|
||||
//void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
|
||||
//void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
|
||||
// FIXME(dmarcos) The function below is the original function in the webIdl:
|
||||
// void bufferData(GLenum target, BufferDataSource? data, GLenum usage);
|
||||
// The Code genearator doesn't handle BufferDataSource so we're using 'optional object'
|
||||
// in the meantime
|
||||
void bufferData(GLenum target, optional object data, GLenum usage);
|
||||
//void bufferSubData(GLenum target, GLintptr offset, BufferDataSource? data);
|
||||
|
||||
//[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
|
||||
|
@ -528,7 +516,7 @@ interface WebGLRenderingContextBase
|
|||
//void clearDepth(GLclampf depth);
|
||||
//void clearStencil(GLint s);
|
||||
//void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
|
||||
//void compileShader(WebGLShader? shader);
|
||||
void compileShader(WebGLShader? shader);
|
||||
|
||||
//void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
|
||||
// GLsizei width, GLsizei height, GLint border,
|
||||
|
@ -544,11 +532,11 @@ interface WebGLRenderingContextBase
|
|||
//void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
|
||||
// GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
//WebGLBuffer? createBuffer();
|
||||
WebGLBuffer? createBuffer();
|
||||
//WebGLFramebuffer? createFramebuffer();
|
||||
//WebGLProgram? createProgram();
|
||||
WebGLProgram? createProgram();
|
||||
//WebGLRenderbuffer? createRenderbuffer();
|
||||
//WebGLShader? createShader(GLenum type);
|
||||
WebGLShader? createShader(GLenum type);
|
||||
//WebGLTexture? createTexture();
|
||||
|
||||
//void cullFace(GLenum mode);
|
||||
|
@ -566,11 +554,11 @@ interface WebGLRenderingContextBase
|
|||
//void detachShader(WebGLProgram? program, WebGLShader? shader);
|
||||
//void disable(GLenum cap);
|
||||
//void disableVertexAttribArray(GLuint index);
|
||||
//void drawArrays(GLenum mode, GLint first, GLsizei count);
|
||||
void drawArrays(GLenum mode, GLint first, GLsizei count);
|
||||
//void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
|
||||
|
||||
//void enable(GLenum cap);
|
||||
//void enableVertexAttribArray(GLuint index);
|
||||
void enableVertexAttribArray(GLuint index);
|
||||
//void finish();
|
||||
//void flush();
|
||||
//void framebufferRenderbuffer(GLenum target, GLenum attachment,
|
||||
|
@ -586,7 +574,7 @@ interface WebGLRenderingContextBase
|
|||
//WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
|
||||
//sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
|
||||
|
||||
//[WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name);
|
||||
[WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name);
|
||||
|
||||
//any getBufferParameter(GLenum target, GLenum pname);
|
||||
//any getParameter(GLenum pname);
|
||||
|
@ -598,9 +586,9 @@ interface WebGLRenderingContextBase
|
|||
//any getProgramParameter(WebGLProgram? program, GLenum pname);
|
||||
//DOMString? getProgramInfoLog(WebGLProgram? program);
|
||||
//any getRenderbufferParameter(GLenum target, GLenum pname);
|
||||
//any getShaderParameter(WebGLShader? shader, GLenum pname);
|
||||
any getShaderParameter(WebGLShader? shader, GLenum pname);
|
||||
//WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
|
||||
//DOMString? getShaderInfoLog(WebGLShader? shader);
|
||||
DOMString? getShaderInfoLog(WebGLShader? shader);
|
||||
|
||||
//DOMString? getShaderSource(WebGLShader? shader);
|
||||
|
||||
|
@ -608,7 +596,7 @@ interface WebGLRenderingContextBase
|
|||
|
||||
//any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
|
||||
|
||||
//WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
|
||||
WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
|
||||
|
||||
//any getVertexAttrib(GLuint index, GLenum pname);
|
||||
|
||||
|
@ -623,7 +611,7 @@ interface WebGLRenderingContextBase
|
|||
//[WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
|
||||
//[WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
|
||||
//void lineWidth(GLfloat width);
|
||||
//void linkProgram(WebGLProgram? program);
|
||||
void linkProgram(WebGLProgram? program);
|
||||
//void pixelStorei(GLenum pname, GLint param);
|
||||
//void polygonOffset(GLfloat factor, GLfloat units);
|
||||
|
||||
|
@ -635,7 +623,7 @@ interface WebGLRenderingContextBase
|
|||
//void sampleCoverage(GLclampf value, GLboolean invert);
|
||||
//void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
//void shaderSource(WebGLShader? shader, DOMString source);
|
||||
void shaderSource(WebGLShader? shader, DOMString source);
|
||||
|
||||
//void stencilFunc(GLenum func, GLint ref, GLuint mask);
|
||||
//void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
|
||||
|
@ -682,7 +670,11 @@ interface WebGLRenderingContextBase
|
|||
//void uniform3iv(WebGLUniformLocation? location, Int32Array v);
|
||||
//void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
|
||||
//void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
//void uniform4fv(WebGLUniformLocation? location, Float32Array v);
|
||||
// FIXME(dmarcos) The function below is the original function in the webIdl:
|
||||
// void uniform4fv(WebGLUniformLocation? location, Float32Array v);
|
||||
// The Code genearator doesn't handle BufferDataSource so we're using 'optional object'
|
||||
// in the meantime
|
||||
void uniform4fv(WebGLUniformLocation? location, optional object v);
|
||||
//void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
|
||||
//void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
|
||||
//void uniform4iv(WebGLUniformLocation? location, Int32Array v);
|
||||
|
@ -701,7 +693,7 @@ interface WebGLRenderingContextBase
|
|||
//void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
|
||||
// sequence<GLfloat> value);
|
||||
|
||||
//void useProgram(WebGLProgram? program);
|
||||
void useProgram(WebGLProgram? program);
|
||||
//void validateProgram(WebGLProgram? program);
|
||||
|
||||
//void vertexAttrib1f(GLuint indx, GLfloat x);
|
||||
|
@ -716,10 +708,10 @@ interface WebGLRenderingContextBase
|
|||
//void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
//void vertexAttrib4fv(GLuint indx, Float32Array values);
|
||||
//void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
|
||||
//void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
|
||||
// GLboolean normalized, GLsizei stride, GLintptr offset);
|
||||
void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
|
||||
GLboolean normalized, GLsizei stride, GLintptr offset);
|
||||
|
||||
//void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
};
|
||||
|
||||
interface WebGLRenderingContext
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue