mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Manually clamp the argument of WebGLRenderingContext.clearDepth
Better be safe than to feed stuff to some GPU driver that wouldn't clamp it.
This commit is contained in:
parent
fc6335c01d
commit
7b4d66b621
3 changed files with 5 additions and 4 deletions
|
@ -678,8 +678,9 @@ impl WebGLImpl {
|
||||||
ctx.gl().clear(mask),
|
ctx.gl().clear(mask),
|
||||||
WebGLCommand::ClearColor(r, g, b, a) =>
|
WebGLCommand::ClearColor(r, g, b, a) =>
|
||||||
ctx.gl().clear_color(r, g, b, a),
|
ctx.gl().clear_color(r, g, b, a),
|
||||||
WebGLCommand::ClearDepth(depth) =>
|
WebGLCommand::ClearDepth(depth) => {
|
||||||
ctx.gl().clear_depth(depth),
|
ctx.gl().clear_depth(depth.max(0.).min(1.) as f64)
|
||||||
|
}
|
||||||
WebGLCommand::ClearStencil(stencil) =>
|
WebGLCommand::ClearStencil(stencil) =>
|
||||||
ctx.gl().clear_stencil(stencil),
|
ctx.gl().clear_stencil(stencil),
|
||||||
WebGLCommand::ColorMask(r, g, b, a) =>
|
WebGLCommand::ColorMask(r, g, b, a) =>
|
||||||
|
|
|
@ -170,7 +170,7 @@ pub enum WebGLCommand {
|
||||||
BufferSubData(u32, isize, ByteBuf),
|
BufferSubData(u32, isize, ByteBuf),
|
||||||
Clear(u32),
|
Clear(u32),
|
||||||
ClearColor(f32, f32, f32, f32),
|
ClearColor(f32, f32, f32, f32),
|
||||||
ClearDepth(f64),
|
ClearDepth(f32),
|
||||||
ClearStencil(i32),
|
ClearStencil(i32),
|
||||||
ColorMask(bool, bool, bool, bool),
|
ColorMask(bool, bool, bool, bool),
|
||||||
CullFace(u32),
|
CullFace(u32),
|
||||||
|
|
|
@ -1876,7 +1876,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||||
fn ClearDepth(&self, depth: f32) {
|
fn ClearDepth(&self, depth: f32) {
|
||||||
self.send_command(WebGLCommand::ClearDepth(depth as f64))
|
self.send_command(WebGLCommand::ClearDepth(depth))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue