mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
webgl: Refactor implementation to move logic inside the DOM interfaces
This improves the encapsulation and consistency in our WebGL implementation. Also allows to implement new methods such as `getShaderSource()`. It will also allow us to use `delete()` in the destructors of them (note that we will want to keep track of them from the context).
This commit is contained in:
parent
c022262826
commit
b1765c6882
11 changed files with 452 additions and 130 deletions
|
@ -107,9 +107,9 @@ pub enum CanvasWebGLMsg {
|
|||
BindTexture(u32, u32),
|
||||
DrawArrays(u32, i32, i32),
|
||||
EnableVertexAttribArray(u32),
|
||||
GetAttribLocation(u32, String, Sender<i32>),
|
||||
GetShaderInfoLog(u32, Sender<String>),
|
||||
GetShaderParameter(u32, u32, Sender<i32>),
|
||||
GetShaderInfoLog(u32, Sender<Option<String>>),
|
||||
GetShaderParameter(u32, u32, Sender<WebGLShaderParameter>),
|
||||
GetAttribLocation(u32, String, Sender<Option<i32>>),
|
||||
GetUniformLocation(u32, String, Sender<Option<i32>>),
|
||||
LinkProgram(u32),
|
||||
ShaderSource(u32, String),
|
||||
|
@ -121,6 +121,24 @@ pub enum CanvasWebGLMsg {
|
|||
DrawingBufferHeight(Sender<i32>),
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum WebGLError {
|
||||
InvalidEnum,
|
||||
InvalidOperation,
|
||||
InvalidValue,
|
||||
OutOfMemory,
|
||||
ContextLost,
|
||||
}
|
||||
|
||||
pub type WebGLResult<T> = Result<T, WebGLError>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum WebGLShaderParameter {
|
||||
Int(i32),
|
||||
Bool(bool),
|
||||
Invalid,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum CanvasCommonMsg {
|
||||
Close,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue