Implement IsShader fn and IsTexture fn for WebGLRenderingContext

This commit is contained in:
Daniel 2016-05-07 12:06:17 -04:00
parent a09b2374f9
commit 8a5b0b8972
5 changed files with 51 additions and 2 deletions

View file

@ -1157,6 +1157,16 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
.unwrap()
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn IsShader(&self, shader: Option<&WebGLShader>) -> bool {
shader.map_or(false, |s| !s.is_deleted() || s.is_attached())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn IsTexture(&self, texture: Option<&WebGLTexture>) -> bool {
texture.map_or(false, |tex| tex.target().is_some() && !tex.is_deleted())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn LineWidth(&self, width: f32) {
if width.is_nan() || width <= 0f32 {