-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement WEBGL_color_buffer_float and EXT_color_buffer_half_float (f…
…ixes #22113)
- Loading branch information
Showing
12 changed files
with
240 additions
and
32 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
components/script/dom/webgl_extensions/ext/extcolorbufferhalffloat.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
use canvas_traits::webgl::WebGLVersion; | ||
use dom::bindings::codegen::Bindings::EXTColorBufferHalfFloatBinding; | ||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; | ||
use dom::bindings::root::DomRoot; | ||
use dom::webgl_extensions::ext::oestexturehalffloat::OESTextureHalfFloat; | ||
use dom::webglrenderingcontext::WebGLRenderingContext; | ||
use dom_struct::dom_struct; | ||
use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; | ||
|
||
#[dom_struct] | ||
pub struct EXTColorBufferHalfFloat { | ||
reflector_: Reflector, | ||
} | ||
|
||
impl EXTColorBufferHalfFloat { | ||
fn new_inherited() -> EXTColorBufferHalfFloat { | ||
Self { | ||
reflector_: Reflector::new(), | ||
} | ||
} | ||
} | ||
|
||
impl WebGLExtension for EXTColorBufferHalfFloat { | ||
type Extension = EXTColorBufferHalfFloat; | ||
fn new(ctx: &WebGLRenderingContext) -> DomRoot<EXTColorBufferHalfFloat> { | ||
reflect_dom_object(Box::new(EXTColorBufferHalfFloat::new_inherited()), | ||
&*ctx.global(), | ||
EXTColorBufferHalfFloatBinding::Wrap) | ||
} | ||
|
||
fn spec() -> WebGLExtensionSpec { | ||
WebGLExtensionSpec::Specific(WebGLVersion::WebGL1) | ||
} | ||
|
||
fn is_supported(ext: &WebGLExtensions) -> bool { | ||
OESTextureHalfFloat::is_supported(ext) | ||
} | ||
|
||
fn enable(_ext: &WebGLExtensions) { | ||
} | ||
|
||
fn name() -> &'static str { | ||
"EXT_color_buffer_half_float" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
components/script/dom/webgl_extensions/ext/webglcolorbufferfloat.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
use canvas_traits::webgl::WebGLVersion; | ||
use dom::bindings::codegen::Bindings::WEBGLColorBufferFloatBinding; | ||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object}; | ||
use dom::bindings::root::DomRoot; | ||
use dom::webgl_extensions::ext::oestexturefloat::OESTextureFloat; | ||
use dom::webglrenderingcontext::WebGLRenderingContext; | ||
use dom_struct::dom_struct; | ||
use super::{WebGLExtension, WebGLExtensions, WebGLExtensionSpec}; | ||
|
||
#[dom_struct] | ||
pub struct WEBGLColorBufferFloat { | ||
reflector_: Reflector, | ||
} | ||
|
||
impl WEBGLColorBufferFloat { | ||
fn new_inherited() -> WEBGLColorBufferFloat { | ||
Self { | ||
reflector_: Reflector::new(), | ||
} | ||
} | ||
} | ||
|
||
impl WebGLExtension for WEBGLColorBufferFloat { | ||
type Extension = WEBGLColorBufferFloat; | ||
fn new(ctx: &WebGLRenderingContext) -> DomRoot<WEBGLColorBufferFloat> { | ||
reflect_dom_object(Box::new(WEBGLColorBufferFloat::new_inherited()), | ||
&*ctx.global(), | ||
WEBGLColorBufferFloatBinding::Wrap) | ||
} | ||
|
||
fn spec() -> WebGLExtensionSpec { | ||
WebGLExtensionSpec::Specific(WebGLVersion::WebGL1) | ||
} | ||
|
||
fn is_supported(ext: &WebGLExtensions) -> bool { | ||
OESTextureFloat::is_supported(ext) | ||
} | ||
|
||
fn enable(_ext: &WebGLExtensions) { | ||
} | ||
|
||
fn name() -> &'static str { | ||
"WEBGL_color_buffer_float" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
components/script/dom/webidls/EXTColorBufferHalfFloat.webidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
/* | ||
* WebGL IDL definitions from the Khronos specification: | ||
* https://www.khronos.org/registry/webgl/extensions/EXT_color_buffer_half_float/ | ||
*/ | ||
|
||
[NoInterfaceObject] | ||
interface EXTColorBufferHalfFloat { | ||
const GLenum RGBA16F_EXT = 0x881A; | ||
const GLenum RGB16F_EXT = 0x881B; | ||
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; | ||
const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; | ||
}; // interface EXT_color_buffer_half_float |
14 changes: 14 additions & 0 deletions
14
components/script/dom/webidls/WEBGLColorBufferFloat.webidl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
/* | ||
* WebGL IDL definitions from the Khronos specification: | ||
* https://www.khronos.org/registry/webgl/extensions/WEBGL_color_buffer_float/ | ||
*/ | ||
|
||
[NoInterfaceObject] | ||
interface WEBGLColorBufferFloat { | ||
const GLenum RGBA32F_EXT = 0x8814; | ||
const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211; | ||
const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17; | ||
}; // interface WEBGL_color_buffer_float |
4 changes: 0 additions & 4 deletions
4
tests/wpt/webgl/meta/conformance/extensions/oes-texture-float.html.ini
This file was deleted.
Oops, something went wrong.
56 changes: 55 additions & 1 deletion
56
tests/wpt/webgl/meta/conformance/extensions/oes-texture-half-float.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,58 @@ | ||
[oes-texture-half-float.html] | ||
[WebGL test #72: RGBA/HALF_FLOAT_OES is color renderable but EXT_color_buffer_half_float not exposed] | ||
[WebGL test #84: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_TYPE should fail for incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #97: getError expected: INVALID_FRAMEBUFFER_OPERATION. Was INVALID_OPERATION : readPixels should fail on incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #89: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) should be null (of type object). Was 5121 (of type number).] | ||
expected: FAIL | ||
|
||
[WebGL test #100: Green channel should be 0.25 for FLOAT readPixels. Received: 0] | ||
expected: FAIL | ||
|
||
[WebGL test #91: getError expected: INVALID_FRAMEBUFFER_OPERATION. Was INVALID_OPERATION : readPixels should fail on incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #88: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_FORMAT should fail for incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #90: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_TYPE should fail for incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #95: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) should be null (of type object). Was 5121 (of type number).] | ||
expected: FAIL | ||
|
||
[WebGL test #85: getError expected: INVALID_FRAMEBUFFER_OPERATION. Was INVALID_OPERATION : readPixels should fail on incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #94: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_FORMAT should fail for incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #101: Blue channel should be 0.5 for FLOAT readPixels. Received: 0] | ||
expected: FAIL | ||
|
||
[WebGL test #87: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT) should be null (of type object). Was 6408 (of type number).] | ||
expected: FAIL | ||
|
||
[WebGL test #83: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE) should be null (of type object). Was 5121 (of type number).] | ||
expected: FAIL | ||
|
||
[WebGL test #81: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT) should be null (of type object). Was 6408 (of type number).] | ||
expected: FAIL | ||
|
||
[WebGL test #98: getError expected: NO_ERROR. Was INVALID_OPERATION : readPixels should return NO_ERROR when reading FLOAT data.] | ||
expected: FAIL | ||
|
||
[WebGL test #102: Alpha channel should be 0.75 for FLOAT readPixels. Received: 0] | ||
expected: FAIL | ||
|
||
[WebGL test #93: gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT) should be null (of type object). Was 6408 (of type number).] | ||
expected: FAIL | ||
|
||
[WebGL test #96: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_TYPE should fail for incomplete framebuffers.] | ||
expected: FAIL | ||
|
||
[WebGL test #82: getError expected: INVALID_OPERATION. Was NO_ERROR : IMPLEMENTATION_COLOR_READ_FORMAT should fail for incomplete framebuffers.] | ||
expected: FAIL | ||
|