Implement various WebGL functions

This commit is contained in:
David Zbarsky 2015-11-28 18:38:14 -08:00
parent a1fb12616a
commit 0f4d6d58aa
15 changed files with 530 additions and 190 deletions

View file

@ -38,5 +38,5 @@ git = "https://github.com/servo/ipc-channel"
cssparser = { version = "0.4", features = [ "serde-serialization" ] }
log = "0.3"
num = "0.1.24"
gleam = "0.1"
gleam = "0.2"
euclid = {version = "0.4", features = ["plugins"]}

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use canvas_traits::{CanvasCommonMsg, CanvasMsg, CanvasWebGLMsg, FromLayoutMsg, FromPaintMsg};
use canvas_traits::{WebGLFramebufferBindingRequest, WebGLShaderParameter};
use canvas_traits::{WebGLError, WebGLFramebufferBindingRequest, WebGLParameter, WebGLResult};
use core::nonzero::NonZero;
use euclid::size::Size2D;
use gleam::gl;
@ -57,6 +57,10 @@ impl WebGLPaintTask {
self.context_attributes(sender),
CanvasWebGLMsg::ActiveTexture(target) =>
gl::active_texture(target),
CanvasWebGLMsg::AttachShader(program_id, shader_id) =>
gl::attach_shader(program_id, shader_id),
CanvasWebGLMsg::BindAttribLocation(program_id, index, name) =>
gl::bind_attrib_location(program_id, index, &name),
CanvasWebGLMsg::BlendColor(r, g, b, a) =>
gl::blend_color(r, g, b, a),
CanvasWebGLMsg::BlendEquation(mode) =>
@ -67,8 +71,6 @@ impl WebGLPaintTask {
gl::blend_func(src, dest),
CanvasWebGLMsg::BlendFuncSeparate(src_rgb, dest_rgb, src_alpha, dest_alpha) =>
gl::blend_func_separate(src_rgb, dest_rgb, src_alpha, dest_alpha),
CanvasWebGLMsg::AttachShader(program_id, shader_id) =>
gl::attach_shader(program_id, shader_id),
CanvasWebGLMsg::BufferData(buffer_type, data, usage) =>
gl::buffer_data(buffer_type, &data, usage),
CanvasWebGLMsg::BufferSubData(buffer_type, offset, data) =>
@ -99,6 +101,8 @@ impl WebGLPaintTask {
gl::front_face(mode),
CanvasWebGLMsg::DrawArrays(mode, first, count) =>
gl::draw_arrays(mode, first, count),
CanvasWebGLMsg::DrawElements(mode, count, type_, offset) =>
gl::draw_elements(mode, count, type_, offset as u32),
CanvasWebGLMsg::Hint(name, val) =>
gl::hint(name, val),
CanvasWebGLMsg::LineWidth(width) =>
@ -111,6 +115,12 @@ impl WebGLPaintTask {
gl::enable_vertex_attrib_array(attrib_id),
CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) =>
self.attrib_location(program_id, name, chan),
CanvasWebGLMsg::GetBufferParameter(target, param_id, chan) =>
self.buffer_parameter(target, param_id, chan),
CanvasWebGLMsg::GetParameter(param_id, chan) =>
self.parameter(param_id, chan),
CanvasWebGLMsg::GetProgramParameter(program_id, param_id, chan) =>
self.program_parameter(program_id, param_id, chan),
CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) =>
self.shader_parameter(shader_id, param_id, chan),
CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) =>
@ -155,6 +165,8 @@ impl WebGLPaintTask {
gl::uniform_4f(uniform_id, data[0], data[1], data[2], data[3]),
CanvasWebGLMsg::UseProgram(program_id) =>
gl::use_program(program_id),
CanvasWebGLMsg::VertexAttrib(attrib_id, x, y, z, w) =>
gl::vertex_attrib_4f(attrib_id, x, y, z, w),
CanvasWebGLMsg::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset) =>
gl::vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset as u32),
CanvasWebGLMsg::Viewport(x, y, width, height) =>
@ -319,16 +331,173 @@ impl WebGLPaintTask {
chan.send(attrib_location).unwrap();
}
fn parameter(&self,
param_id: u32,
chan: IpcSender<WebGLResult<WebGLParameter>>) {
let result = match param_id {
gl::ACTIVE_TEXTURE |
gl::ALPHA_BITS |
gl::BLEND_DST_ALPHA |
gl::BLEND_DST_RGB |
gl::BLEND_EQUATION_ALPHA |
gl::BLEND_EQUATION_RGB |
gl::BLEND_SRC_ALPHA |
gl::BLEND_SRC_RGB |
gl::BLUE_BITS |
gl::CULL_FACE_MODE |
gl::DEPTH_BITS |
gl::DEPTH_FUNC |
gl::FRONT_FACE |
gl::GENERATE_MIPMAP_HINT |
gl::GREEN_BITS |
//gl::IMPLEMENTATION_COLOR_READ_FORMAT |
//gl::IMPLEMENTATION_COLOR_READ_TYPE |
gl::MAX_COMBINED_TEXTURE_IMAGE_UNITS |
gl::MAX_CUBE_MAP_TEXTURE_SIZE |
//gl::MAX_FRAGMENT_UNIFORM_VECTORS |
gl::MAX_RENDERBUFFER_SIZE |
gl::MAX_TEXTURE_IMAGE_UNITS |
gl::MAX_TEXTURE_SIZE |
//gl::MAX_VARYING_VECTORS |
gl::MAX_VERTEX_ATTRIBS |
gl::MAX_VERTEX_TEXTURE_IMAGE_UNITS |
//gl::MAX_VERTEX_UNIFORM_VECTORS |
gl::PACK_ALIGNMENT |
gl::RED_BITS |
gl::SAMPLE_BUFFERS |
gl::SAMPLES |
gl::STENCIL_BACK_FAIL |
gl::STENCIL_BACK_FUNC |
gl::STENCIL_BACK_PASS_DEPTH_FAIL |
gl::STENCIL_BACK_PASS_DEPTH_PASS |
gl::STENCIL_BACK_REF |
gl::STENCIL_BACK_VALUE_MASK |
gl::STENCIL_BACK_WRITEMASK |
gl::STENCIL_BITS |
gl::STENCIL_CLEAR_VALUE |
gl::STENCIL_FAIL |
gl::STENCIL_FUNC |
gl::STENCIL_PASS_DEPTH_FAIL |
gl::STENCIL_PASS_DEPTH_PASS |
gl::STENCIL_REF |
gl::STENCIL_VALUE_MASK |
gl::STENCIL_WRITEMASK |
gl::SUBPIXEL_BITS |
gl::UNPACK_ALIGNMENT =>
//gl::UNPACK_COLORSPACE_CONVERSION_WEBGL =>
Ok(WebGLParameter::Int(gl::get_integer_v(param_id))),
gl::BLEND |
gl::CULL_FACE |
gl::DEPTH_TEST |
gl::DEPTH_WRITEMASK |
gl::DITHER |
gl::POLYGON_OFFSET_FILL |
gl::SAMPLE_COVERAGE_INVERT |
gl::STENCIL_TEST =>
//gl::UNPACK_FLIP_Y_WEBGL |
//gl::UNPACK_PREMULTIPLY_ALPHA_WEBGL =>
Ok(WebGLParameter::Bool(gl::get_boolean_v(param_id) != 0)),
gl::DEPTH_CLEAR_VALUE |
gl::LINE_WIDTH |
gl::POLYGON_OFFSET_FACTOR |
gl::POLYGON_OFFSET_UNITS |
gl::SAMPLE_COVERAGE_VALUE =>
Ok(WebGLParameter::Float(gl::get_float_v(param_id))),
gl::VERSION => Ok(WebGLParameter::String("WebGL 1.0".to_owned())),
gl::RENDERER |
gl::VENDOR => Ok(WebGLParameter::String("Mozilla/Servo".to_owned())),
gl::SHADING_LANGUAGE_VERSION => Ok(WebGLParameter::String("WebGL GLSL ES 1.0".to_owned())),
// TODO(zbarsky, ecoal95): Implement support for the following valid parameters
// Float32Array
gl::ALIASED_LINE_WIDTH_RANGE |
gl::ALIASED_POINT_SIZE_RANGE |
//gl::BLEND_COLOR |
gl::COLOR_CLEAR_VALUE |
gl::DEPTH_RANGE |
// WebGLBuffer
gl::ARRAY_BUFFER_BINDING |
gl::ELEMENT_ARRAY_BUFFER_BINDING |
// WebGLFrameBuffer
gl::FRAMEBUFFER_BINDING |
// WebGLRenderBuffer
gl::RENDERBUFFER_BINDING |
// WebGLProgram
gl::CURRENT_PROGRAM |
// WebGLTexture
gl::TEXTURE_BINDING_2D |
gl::TEXTURE_BINDING_CUBE_MAP |
// sequence<GlBoolean>
gl::COLOR_WRITEMASK |
// Uint32Array
gl::COMPRESSED_TEXTURE_FORMATS |
// Int32Array
gl::MAX_VIEWPORT_DIMS |
gl::SCISSOR_BOX |
gl::VIEWPORT => Err(WebGLError::InvalidEnum),
// Invalid parameters
_ => Err(WebGLError::InvalidEnum)
};
chan.send(result).unwrap();
}
fn buffer_parameter(&self,
target: u32,
param_id: u32,
chan: IpcSender<WebGLResult<WebGLParameter>>) {
let result = match param_id {
gl::BUFFER_SIZE |
gl::BUFFER_USAGE =>
Ok(WebGLParameter::Int(gl::get_buffer_parameter_iv(target, param_id))),
_ => Err(WebGLError::InvalidEnum),
};
chan.send(result).unwrap();
}
fn program_parameter(&self,
program_id: u32,
param_id: u32,
chan: IpcSender<WebGLResult<WebGLParameter>>) {
let result = match param_id {
gl::DELETE_STATUS |
gl::LINK_STATUS |
gl::VALIDATE_STATUS =>
Ok(WebGLParameter::Bool(gl::get_program_iv(program_id, param_id) != 0)),
gl::ATTACHED_SHADERS |
gl::ACTIVE_ATTRIBUTES |
gl::ACTIVE_UNIFORMS =>
Ok(WebGLParameter::Int(gl::get_program_iv(program_id, param_id))),
_ => Err(WebGLError::InvalidEnum),
};
chan.send(result).unwrap();
}
fn shader_parameter(&self,
shader_id: u32,
param_id: u32,
chan: IpcSender<WebGLShaderParameter>) {
shader_id: u32,
param_id: u32,
chan: IpcSender<WebGLResult<WebGLParameter>>) {
let result = match param_id {
gl::SHADER_TYPE =>
WebGLShaderParameter::Int(gl::get_shader_iv(shader_id, param_id)),
gl::DELETE_STATUS | gl::COMPILE_STATUS =>
WebGLShaderParameter::Bool(gl::get_shader_iv(shader_id, param_id) != 0),
_ => panic!("Unexpected shader parameter type"),
Ok(WebGLParameter::Int(gl::get_shader_iv(shader_id, param_id))),
gl::DELETE_STATUS |
gl::COMPILE_STATUS =>
Ok(WebGLParameter::Bool(gl::get_shader_iv(shader_id, param_id) != 0)),
_ => Err(WebGLError::InvalidEnum),
};
chan.send(result).unwrap();

View file

@ -133,7 +133,8 @@ pub enum CanvasWebGLMsg {
BlendFunc(u32, u32),
BlendFuncSeparate(u32, u32, u32, u32),
AttachShader(u32, u32),
BufferData(u32, Vec<u8>, u32),
BindAttribLocation(u32, u32, String),
BufferData(u32, Vec<f32>, u32),
BufferSubData(u32, isize, Vec<u8>),
Clear(u32),
ClearColor(f32, f32, f32, f32),
@ -165,8 +166,12 @@ pub enum CanvasWebGLMsg {
BindRenderbuffer(u32, u32),
BindTexture(u32, u32),
DrawArrays(u32, i32, i32),
DrawElements(u32, i32, u32, i64),
EnableVertexAttribArray(u32),
GetShaderParameter(u32, u32, IpcSender<WebGLShaderParameter>),
GetBufferParameter(u32, u32, IpcSender<WebGLResult<WebGLParameter>>),
GetParameter(u32, IpcSender<WebGLResult<WebGLParameter>>),
GetProgramParameter(u32, u32, IpcSender<WebGLResult<WebGLParameter>>),
GetShaderParameter(u32, u32, IpcSender<WebGLResult<WebGLParameter>>),
GetAttribLocation(u32, String, IpcSender<Option<i32>>),
GetUniformLocation(u32, String, IpcSender<Option<i32>>),
PolygonOffset(f32, f32),
@ -176,6 +181,7 @@ pub enum CanvasWebGLMsg {
LinkProgram(u32),
Uniform4fv(i32, Vec<f32>),
UseProgram(u32),
VertexAttrib(u32, f32, f32, f32, f32),
VertexAttribPointer2f(u32, i32, bool, i32, u32),
Viewport(i32, i32, i32, i32),
TexImage2D(u32, i32, i32, i32, i32, u32, u32, Vec<u8>),
@ -203,9 +209,11 @@ pub enum WebGLFramebufferBindingRequest {
}
#[derive(Clone, Deserialize, Serialize)]
pub enum WebGLShaderParameter {
pub enum WebGLParameter {
Int(i32),
Bool(bool),
String(String),
Float(f32),
Invalid,
}

View file

@ -74,7 +74,7 @@ libc = "0.2"
log = "0.3"
num = "0.1.24"
time = "0.1.17"
gleam = "0.1"
gleam = "0.2"
euclid = {version = "0.4", features = ["plugins"]}
serde = "0.6"
serde_macros = "0.6"

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLError, WebGLResult};
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLError, WebGLResult, WebGLParameter};
use dom::bindings::codegen::Bindings::WebGLProgramBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::global::GlobalRef;
@ -94,6 +94,23 @@ impl WebGLProgram {
Ok(())
}
/// glBindAttribLocation
pub fn bind_attrib_location(&self, index: u32, name: DOMString) -> WebGLResult<()> {
if name.len() > MAX_UNIFORM_AND_ATTRIBUTE_LEN {
return Err(WebGLError::InvalidValue);
}
// Check if the name is reserved
if name.starts_with("webgl") || name.starts_with("_webgl_") {
return Err(WebGLError::InvalidOperation);
}
self.renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BindAttribLocation(self.id, index, String::from(name))))
.unwrap();
Ok(())
}
/// glGetAttribLocation
pub fn get_attrib_location(&self, name: DOMString) -> WebGLResult<Option<i32>> {
if name.len() > MAX_UNIFORM_AND_ATTRIBUTE_LEN {
@ -129,6 +146,13 @@ impl WebGLProgram {
.unwrap();
Ok(receiver.recv().unwrap())
}
/// glGetProgramParameter
pub fn parameter(&self, param_id: u32) -> WebGLResult<WebGLParameter> {
let (sender, receiver) = ipc::channel().unwrap();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetProgramParameter(self.id, param_id, sender))).unwrap();
receiver.recv().unwrap()
}
}
impl Drop for WebGLProgram {

View file

@ -4,7 +4,7 @@
use canvas_traits::WebGLError::*;
use canvas_traits::{CanvasCommonMsg, CanvasMsg, CanvasWebGLMsg, WebGLError};
use canvas_traits::{WebGLFramebufferBindingRequest, WebGLShaderParameter};
use canvas_traits::{WebGLFramebufferBindingRequest, WebGLParameter};
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{WebGLRenderingContextMethods};
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes};
@ -30,7 +30,7 @@ use euclid::size::Size2D;
use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{JSContext, JSObject, RootedValue};
use js::jsapi::{JS_GetFloat32ArrayData, JS_GetObjectAsArrayBufferView};
use js::jsval::{BooleanValue, Int32Value, JSVal, NullValue, UndefinedValue};
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue};
use net_traits::image::base::PixelFormat;
use net_traits::image_cache_task::ImageResponse;
use offscreen_gl_context::GLContextAttributes;
@ -145,18 +145,43 @@ impl WebGLRenderingContext {
}
}
pub fn bound_texture_for(&self, target: u32) -> Option<Root<WebGLTexture>> {
match target {
fn tex_parameter(&self, target: u32, name: u32, value: TexParameterValue) {
let texture = match target {
constants::TEXTURE_2D => self.bound_texture_2d.get(),
constants::TEXTURE_CUBE_MAP => self.bound_texture_cube_map.get(),
_ => unreachable!(),
_ => return self.webgl_error(InvalidEnum),
};
if let Some(texture) = texture {
handle_potential_webgl_error!(self, texture.tex_parameter(target, name, value));
} else {
return self.webgl_error(InvalidOperation);
}
}
fn mark_as_dirty(&self) {
self.canvas.upcast::<Node>().dirty(NodeDamage::OtherNodeDamage);
}
#[allow(unsafe_code)]
fn float32_array_to_slice(&self, data: *mut JSObject) -> Option<Vec<f32>> {
unsafe {
let mut length = 0;
let mut ptr = ptr::null_mut();
let buffer_data = JS_GetObjectAsArrayBufferView(data, &mut length, &mut ptr);
if buffer_data.is_null() {
self.webgl_error(InvalidValue); // https://github.com/servo/servo/issues/5014
return None;
}
let data_f32 = JS_GetFloat32ArrayData(data, ptr::null());
Some(slice::from_raw_parts(data_f32, length as usize).to_vec())
}
}
fn vertex_attrib(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) {
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::VertexAttrib(indx, x, y, z, w)))
.unwrap();
}
}
impl Drop for WebGLRenderingContext {
@ -189,21 +214,41 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
receiver.recv().unwrap()
}
#[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn GetBufferParameter(&self, _cx: *mut JSContext, target: u32, parameter: u32) -> JSVal {
let (sender, receiver) = ipc::channel().unwrap();
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetBufferParameter(target, parameter, sender)))
.unwrap();
match handle_potential_webgl_error!(self, receiver.recv().unwrap(), WebGLParameter::Invalid) {
WebGLParameter::Int(val) => Int32Value(val),
WebGLParameter::Bool(_) => panic!("Buffer parameter should not be bool"),
WebGLParameter::Float(_) => panic!("Buffer parameter should not be float"),
WebGLParameter::String(_) => panic!("Buffer parameter should not be string"),
WebGLParameter::Invalid => NullValue(),
}
}
#[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn GetParameter(&self, cx: *mut JSContext, parameter: u32) -> JSVal {
// TODO(ecoal95): Implement the missing parameters from the spec
unsafe {
let mut rval = RootedValue::new(cx, UndefinedValue());
match parameter {
constants::VERSION =>
"WebGL 1.0".to_jsval(cx, rval.handle_mut()),
constants::RENDERER |
constants::VENDOR =>
"Mozilla/Servo".to_jsval(cx, rval.handle_mut()),
_ => rval.ptr = NullValue(),
let (sender, receiver) = ipc::channel().unwrap();
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetParameter(parameter, sender)))
.unwrap();
match handle_potential_webgl_error!(self, receiver.recv().unwrap(), WebGLParameter::Invalid) {
WebGLParameter::Int(val) => Int32Value(val),
WebGLParameter::Bool(val) => BooleanValue(val),
WebGLParameter::Float(val) => DoubleValue(val as f64),
WebGLParameter::String(val) => {
let mut rval = RootedValue::new(cx, UndefinedValue());
unsafe {
val.to_jsval(cx, rval.handle_mut());
}
rval.ptr
}
rval.ptr
WebGLParameter::Invalid => NullValue(),
}
}
@ -303,6 +348,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn BindAttribLocation(&self, program: Option<&WebGLProgram>,
index: u32, name: DOMString) {
if let Some(program) = program {
handle_potential_webgl_error!(self, program.bind_attrib_location(index, name));
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn BindBuffer(&self, target: u32, buffer: Option<&WebGLBuffer>) {
match target {
@ -393,18 +446,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
Some(data) => data,
None => return self.webgl_error(InvalidValue),
};
let data_vec = unsafe {
let mut length = 0;
let mut ptr = ptr::null_mut();
let buffer_data = JS_GetObjectAsArrayBufferView(data, &mut length, &mut ptr);
if buffer_data.is_null() {
return self.webgl_error(InvalidValue) // https://github.com/servo/servo/issues/5014
}
slice::from_raw_parts(ptr, length as usize).to_vec()
};
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BufferData(target, data_vec, usage)))
.unwrap()
if let Some(data_vec) = self.float32_array_to_slice(data) {
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::BufferData(target, data_vec, usage)))
.unwrap()
}
}
#[allow(unsafe_code)]
@ -669,6 +715,44 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
fn DrawElements(&self, mode: u32, count: i32, type_: u32, offset: i64) {
let type_size = match type_ {
constants::BYTE | constants::UNSIGNED_BYTE => 1,
constants::SHORT | constants::UNSIGNED_SHORT => 2,
constants::INT | constants::UNSIGNED_INT | constants::FLOAT => 4,
_ => return self.webgl_error(InvalidEnum),
};
if offset % type_size != 0 {
return self.webgl_error(InvalidOperation);
}
if count <= 0 {
return self.webgl_error(InvalidOperation);
}
if offset < 0 {
return self.webgl_error(InvalidValue);
}
// TODO ensure a non-null WebGLBuffer must be bound to the ELEMENT_ARRAY_BUFFER
// TODO(ecoal95): Check the CURRENT_PROGRAM when we keep track of it, and if it's
// null generate an InvalidOperation error
match mode {
constants::POINTS | constants::LINE_STRIP |
constants::LINE_LOOP | constants::LINES |
constants::TRIANGLE_STRIP | constants::TRIANGLE_FAN |
constants::TRIANGLES => {
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::DrawElements(mode, count, type_, offset)))
.unwrap();
self.mark_as_dirty();
},
_ => self.webgl_error(InvalidEnum),
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn EnableVertexAttribArray(&self, attrib_id: u32) {
self.ipc_renderer
@ -686,21 +770,34 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn GetShaderInfoLog(&self, shader: Option<&WebGLShader>) -> Option<DOMString> {
if let Some(shader) = shader {
shader.info_log().map(DOMString::from)
fn GetProgramParameter(&self, _: *mut JSContext, program: Option<&WebGLProgram>, param_id: u32) -> JSVal {
if let Some(program) = program {
match handle_potential_webgl_error!(self, program.parameter(param_id), WebGLParameter::Invalid) {
WebGLParameter::Int(val) => Int32Value(val),
WebGLParameter::Bool(val) => BooleanValue(val),
WebGLParameter::String(_) => panic!("Program parameter should not be string"),
WebGLParameter::Float(_) => panic!("Program parameter should not be float"),
WebGLParameter::Invalid => NullValue(),
}
} else {
None
NullValue()
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn GetShaderInfoLog(&self, shader: Option<&WebGLShader>) -> Option<DOMString> {
shader.and_then(|s| s.info_log()).map(DOMString::from)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn GetShaderParameter(&self, _: *mut JSContext, shader: Option<&WebGLShader>, param_id: u32) -> JSVal {
if let Some(shader) = shader {
match handle_potential_webgl_error!(self, shader.parameter(param_id), WebGLShaderParameter::Invalid) {
WebGLShaderParameter::Int(val) => Int32Value(val),
WebGLShaderParameter::Bool(val) => BooleanValue(val),
WebGLShaderParameter::Invalid => NullValue(),
match handle_potential_webgl_error!(self, shader.parameter(param_id), WebGLParameter::Invalid) {
WebGLParameter::Int(val) => Int32Value(val),
WebGLParameter::Bool(val) => BooleanValue(val),
WebGLParameter::String(_) => panic!("Shader parameter should not be string"),
WebGLParameter::Float(_) => panic!("Shader parameter should not be float"),
WebGLParameter::Invalid => NullValue(),
}
} else {
NullValue()
@ -848,13 +945,15 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
None => return,
};
let data_vec = unsafe {
let data_f32 = JS_GetFloat32ArrayData(data, ptr::null());
slice::from_raw_parts(data_f32, 4).to_vec()
};
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::Uniform4fv(uniform_id, data_vec)))
.unwrap()
if let Some(data_vec) = self.float32_array_to_slice(data) {
if data_vec.len() < 4 {
return self.webgl_error(InvalidOperation);
}
self.ipc_renderer
.send(CanvasMsg::WebGL(CanvasWebGLMsg::Uniform4fv(uniform_id, data_vec)))
.unwrap()
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
@ -864,6 +963,70 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib1f(&self, indx: u32, x: f32) {
self.vertex_attrib(indx, x, 0f32, 0f32, 1f32)
}
#[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib1fv(&self, _cx: *mut JSContext, indx: u32, data: *mut JSObject) {
if let Some(data_vec) = self.float32_array_to_slice(data) {
if data_vec.len() < 4 {
return self.webgl_error(InvalidOperation);
}
self.vertex_attrib(indx, data_vec[0], 0f32, 0f32, 1f32)
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib2f(&self, indx: u32, x: f32, y: f32) {
self.vertex_attrib(indx, x, y, 0f32, 1f32)
}
#[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib2fv(&self, _cx: *mut JSContext, indx: u32, data: *mut JSObject) {
if let Some(data_vec) = self.float32_array_to_slice(data) {
if data_vec.len() < 2 {
return self.webgl_error(InvalidOperation);
}
self.vertex_attrib(indx, data_vec[0], data_vec[1], 0f32, 1f32)
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib3f(&self, indx: u32, x: f32, y: f32, z: f32) {
self.vertex_attrib(indx, x, y, z, 1f32)
}
#[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib3fv(&self, _cx: *mut JSContext, indx: u32, data: *mut JSObject) {
if let Some(data_vec) = self.float32_array_to_slice(data) {
if data_vec.len() < 3 {
return self.webgl_error(InvalidOperation);
}
self.vertex_attrib(indx, data_vec[0], data_vec[1], data_vec[2], 1f32)
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib4f(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) {
self.vertex_attrib(indx, x, y, z, w)
}
#[allow(unsafe_code)]
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttrib4fv(&self, _cx: *mut JSContext, indx: u32, data: *mut JSObject) {
if let Some(data_vec) = self.float32_array_to_slice(data) {
if data_vec.len() < 4 {
return self.webgl_error(InvalidOperation);
}
self.vertex_attrib(indx, data_vec[0], data_vec[1], data_vec[2], data_vec[3])
}
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttribPointer(&self, attrib_id: u32, size: i32, data_type: u32,
normalized: bool, stride: i32, offset: i64) {
@ -962,36 +1125,12 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn TexParameterf(&self, target: u32, name: u32, value: f32) {
match target {
constants::TEXTURE_2D |
constants::TEXTURE_CUBE_MAP => {
if let Some(texture) = self.bound_texture_for(target) {
let result = texture.tex_parameter(target, name, TexParameterValue::Float(value));
handle_potential_webgl_error!(self, result);
} else {
return self.webgl_error(InvalidOperation);
}
},
_ => self.webgl_error(InvalidEnum),
}
self.tex_parameter(target, name, TexParameterValue::Float(value))
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn TexParameteri(&self, target: u32, name: u32, value: i32) {
match target {
constants::TEXTURE_2D |
constants::TEXTURE_CUBE_MAP => {
if let Some(texture) = self.bound_texture_for(target) {
let result = texture.tex_parameter(target, name, TexParameterValue::Int(value));
handle_potential_webgl_error!(self, result);
} else {
return self.webgl_error(InvalidOperation);
}
},
_ => self.webgl_error(InvalidEnum),
}
self.tex_parameter(target, name, TexParameterValue::Int(value))
}
}

View file

@ -4,9 +4,8 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use angle::hl::{BuiltInResources, Output, ShaderValidator};
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLError, WebGLResult, WebGLShaderParameter};
use canvas_traits::{CanvasMsg, CanvasWebGLMsg, WebGLResult, WebGLParameter};
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::codegen::Bindings::WebGLShaderBinding;
use dom::bindings::global::GlobalRef;
use dom::bindings::js::Root;
@ -132,16 +131,11 @@ impl WebGLShader {
self.info_log.borrow().clone()
}
/// glGetShaderParameter
pub fn parameter(&self, param_id: u32) -> WebGLResult<WebGLShaderParameter> {
match param_id {
constants::SHADER_TYPE | constants::DELETE_STATUS | constants::COMPILE_STATUS => {},
_ => return Err(WebGLError::InvalidEnum),
}
/// glGetParameter
pub fn parameter(&self, param_id: u32) -> WebGLResult<WebGLParameter> {
let (sender, receiver) = ipc::channel().unwrap();
self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::GetShaderParameter(self.id, param_id, sender))).unwrap();
Ok(receiver.recv().unwrap())
receiver.recv().unwrap()
}
/// Get the shader source

View file

@ -476,7 +476,7 @@ interface WebGLRenderingContextBase
void activeTexture(GLenum texture);
void attachShader(WebGLProgram? program, WebGLShader? shader);
//void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
void bindBuffer(GLenum target, WebGLBuffer? buffer);
void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
@ -552,7 +552,7 @@ interface WebGLRenderingContextBase
void disable(GLenum cap);
//void disableVertexAttribArray(GLuint index);
void drawArrays(GLenum mode, GLint first, GLsizei count);
//void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
void enable(GLenum cap);
void enableVertexAttribArray(GLuint index);
@ -573,14 +573,14 @@ interface WebGLRenderingContextBase
[WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name);
//any getBufferParameter(GLenum target, GLenum pname);
any getBufferParameter(GLenum target, GLenum pname);
any getParameter(GLenum pname);
[WebGLHandlesContextLoss] GLenum getError();
//any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
// GLenum pname);
//any getProgramParameter(WebGLProgram? program, GLenum pname);
any getProgramParameter(WebGLProgram? program, GLenum pname);
//DOMString? getProgramInfoLog(WebGLProgram? program);
//any getRenderbufferParameter(GLenum target, GLenum pname);
any getShaderParameter(WebGLShader? shader, GLenum pname);
@ -689,17 +689,23 @@ interface WebGLRenderingContextBase
void useProgram(WebGLProgram? program);
//void validateProgram(WebGLProgram? program);
//void vertexAttrib1f(GLuint indx, GLfloat x);
// FIXME(dmarcos)
// The code generator doesn't handle Float32Array so we're using 'object'
void vertexAttrib1f(GLuint indx, GLfloat x);
//void vertexAttrib1fv(GLuint indx, Float32Array values);
void vertexAttrib1fv(GLuint indx, object values);
//void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values);
//void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
//void vertexAttrib2fv(GLuint indx, Float32Array values);
void vertexAttrib2fv(GLuint indx, object values);
//void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values);
//void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
//void vertexAttrib3fv(GLuint indx, Float32Array values);
void vertexAttrib3fv(GLuint indx, object values);
//void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values);
//void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
//void vertexAttrib4fv(GLuint indx, Float32Array values);
void vertexAttrib4fv(GLuint indx, object values);
//void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
GLboolean normalized, GLsizei stride, GLintptr offset);

View file

@ -14,7 +14,7 @@ dependencies = [
"gaol 0.0.1 (git+https://github.com/pcwalton/gaol)",
"gfx 0.0.1",
"gfx_tests 0.0.1",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
@ -106,7 +106,7 @@ dependencies = [
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-skia 0.20130412.2 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-skia 0.20130412.3 (registry+https://github.com/rust-lang/crates.io-index)",
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -150,7 +150,7 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -193,10 +193,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cgl"
version = "0.1.2"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -254,7 +254,7 @@ dependencies = [
"gaol 0.0.1 (git+https://github.com/pcwalton/gaol)",
"gfx 0.0.1",
"gfx_traits 0.0.1",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
@ -632,7 +632,7 @@ dependencies = [
"serde 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-skia 0.20130412.2 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-skia 0.20130412.3 (registry+https://github.com/rust-lang/crates.io-index)",
"simd 0.1.0 (git+https://github.com/huonw/simd)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -688,7 +688,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.1.20"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -705,10 +705,10 @@ name = "glutin_app"
version = "0.0.1"
dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"compositing 0.0.1",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -852,13 +852,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "io-surface"
version = "0.1.1"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cgl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -912,20 +912,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "layers"
version = "0.2.0"
source = "git+https://github.com/servo/rust-layers#c4efb24deb170908a534ae916d23890f85725b17"
source = "git+https://github.com/servo/rust-layers#f75cff14252571fc02857ad28ca502774a012743"
dependencies = [
"azure 0.2.1 (git+https://github.com/servo/rust-azure)",
"cgl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-skia 0.20130412.2 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-skia 0.20130412.3 (registry+https://github.com/rust-lang/crates.io-index)",
"x11 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1117,7 +1117,7 @@ dependencies = [
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"plugins 0.0.1",
@ -1259,13 +1259,13 @@ dependencies = [
[[package]]
name = "offscreen_gl_context"
version = "0.1.0"
source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#483abed6709570cb0930e6427455cd453363ffcd"
source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#348364d8869d5e673b49c60f40803dfa903c70f2"
dependencies = [
"cgl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.0 (git+https://github.com/servo/rust-layers)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1658,7 +1658,7 @@ version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cocoa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1685,15 +1685,15 @@ dependencies = [
[[package]]
name = "servo-skia"
version = "0.20130412.2"
version = "0.20130412.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cgl 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cgl 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"expat-sys 2.1.1-really.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-egl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -135,7 +135,7 @@ git = "https://github.com/servo/rust-layers"
features = ["plugins"]
[dependencies.gleam]
version = "0.1"
version = "0.2"
[dependencies.offscreen_gl_context]
git = "https://github.com/ecoal95/rust-offscreen-rendering-context"