Expose EXT_texture_norm16 webgl extension
Categories
(Core :: Graphics: CanvasWebGL, enhancement)
Tracking
()
People
(Reporter: kbrussel, Assigned: fabio.kaminski, NeedInfo)
References
(Blocks 2 open bugs, Regressed 1 open bug)
Details
(Keywords: dev-doc-needed, parity-chrome, parity-safari, Whiteboard: [platform-feature])
Attachments
(1 external file)
A colleague at Esri indicates that the EXT_texture_norm16 extension is important for GIS applications to achieve optimal performance with much of their texture data.
It looks like EXT_texture_norm16 was implemented as a draft extension in Bug 1658433. Now that this extension is community approved, could it please be exposed in Gecko?
Note that on macOS specifically, if Firefox aims to use ANGLE and its Metal backend, there's an implicit dependency on https://bugs.chromium.org/p/angleproject/issues/detail?id=6547 .
Thanks in advance.
Comment 1•5 years ago
|
||
Note that Firefox's use of EXT_texture_norm16 seems to be disabled, even if webgl.use-draft-extensions is set to true, if the user is using ANGLE, naming an unnamed bug: https://github.com/mozilla/gecko-dev/blob/37373cdeed20695af1ff1fd090f0736d9bf15e65/dom/canvas/WebGLExtensions.cpp#L103-L104
I wasn't able to find a historical reference for this bug, but I suspect this has been fixed by now.
Comment 2•4 years ago
|
||
Unity's WebGL build target would also make use of the texture formats supported by the EXT_texture_norm16 extension if it was to be made available.
Comment 3•3 years ago
|
||
We would also like to use this extension for 3D rendering of medical (volume) data. The data has 16-bit value range, and the alternative integer texture doesn't support linear filtering in hardware, which is sloooow when done in the shader....
What is the state of the draft extension?
Anything we could do that could be helpful to move this forward or to increase the priority a bit? ๐
Comment 4•2 years ago
|
||
I also would like to have EXT_texture_norm16. I am using 16-bit textures, and all my shaders work with textures as values between 0 and 1. I want to be able to use the same shader for 8-bit and 16-bit textures.
Updated•2 years ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Comment 5•3 months ago
|
||
This should be trivial.
I think the only work to do here is going to the function WebGLExtensionTextureNorm16::IsSupported and deleting these two lines:
if (!StaticPrefs::webgl_enable_draft_extensions()) return false;
...
if (gl->IsANGLE()) return false;
It has been 6 years since the code landed so I expect ANGLE bugs were fixed already. There is already a webgl-conf CTS test for this extension in https://searchfox.org/firefox-main/source/dom/canvas/test/webgl-conf/checkout/conformance2/extensions/ext-texture-norm16.html so we would know if it works as soon as it is unblocked by removing those lines.
Updated•1 month ago
|
Updated•20 days ago
|
Updated•20 days ago
|
Updated•20 days ago
|
Comment 9•20 days ago
|
||
Backed out for causing ochitest core-nofis failures at EXT_texture_norm16
Backout Link
Push with failures
Failure Log
Failure line TEST-UNEXPECTED-FAIL | dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html | Should not have webgl2 extension EXT_texture_norm16.
| Assignee | ||
Comment 10•20 days ago
|
||
Updated the patch: the ensure-exts tests still treated EXT_texture_norm16 as a draft extension. Moved it to the shipped list in test_common.html and updated test_EXT_texture_norm16.html
Comment 11•19 days ago
|
||
Updated•19 days ago
|
Comment 12•19 days ago
|
||
| bugherder | ||
Comment 13•19 days ago
|
||
Bug was resolved, but the web-feature ext-texture-norm16 (definition file) is not yet marked as supported in Firefox.
Feature bugs are usually automatically closed once the corresponding web-features are marked as supported; this typically happens after the feature reaches release.
Comment 14•19 days ago
|
||
Re-resolving and using 2079151 as the tracking bug that matches the feature lifecycle, so that this doesn't interfere with RelMan processes.
Comment 15•18 days ago
|
||
Did you want to nominate this for the Fx159 relnotes? If so, set the relnote-firefox flag to "?"
https://wiki.mozilla.org/Release_Management/Release_Notes_Nomination
Possible wording:
The WebGL extension
EXT_texture_norm16is now available on compatible devices.
| Assignee | ||
Comment 16•18 days ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Firefox now exposes the EXT_texture_norm16 WebGL 2 extension by default while previously it was only available behind the draft-extensions pref. Chrome and Safari already ship it, so this closes a compatibility gap.
[Affects Firefox for Android]: Yes, on devices whose graphics driver supports the 16-bit normalized formats.
[Suggested wording]: WebGL 2 now supports the EXT_texture_norm16 extension on compatible devices, adding 16-bit normalized texture and renderbuffer formats.
[Links (documentation, blog post, etc)]:
| Assignee | ||
Comment 17•18 days ago
|
||
Note: You can remove "... adding 16-bit normalized texture and renderbuffer formats." from [Suggested wording] if you wish.
Updated•16 days ago
|
Comment 19•2 hours ago
|
||
FF159 Docs work for this can be tracked in https://github.com/mdn/content/issues/46144
- Can I get a review on: https://github.com/mdn/content/pull/46263 ???
I'm not very familar with Web GPU. I've interpreted the spec with Claude's help and asked it to confirm claims against various spots. While it seems to hold together, I could miss something obvious. - After some checking on oddities of behaviour, claude thinks ther might be a bug: EXT_texture_norm16 formats are not texture-filterable
Textures that use the EXT_texture_norm16 formats are treated as non-filterable. Sampling them with LINEAR filtering makes the texture incomplete, so sampling returns (0, 0, 0, 1).
The OpenGL ES EXT_texture_norm16 spec, which the WebGL extension mirrors, marks all eight formats as texture-filterable (Table 8.13, "TF" column). The WebGL extension spec doesn't override this. Chrome 156 filters these formats as expected.
Linear filtering is also the main use case for this extension. Bug 1735401 comment 3 notes that the integer-texture alternative "doesn't support linear filtering in hardware".
Steps to reproduce (paste into the console; tested in Nightly 161 on Windows, ANGLE D3D11):
const canvas = document.createElement("canvas");
canvas.width = canvas.height = 1;
const gl = canvas.getContext("webgl2");
const ext = gl.getExtension("EXT_texture_norm16");
const compile = (type, src) => {
const s = gl.createShader(type);
gl.shaderSource(s, src);
gl.compileShader(s);
return s;
};
const prog = gl.createProgram();
gl.attachShader(prog, compile(gl.VERTEX_SHADER, `#version 300 es
void main() { gl_Position = vec4(0.0, 0.0, 0.0, 1.0); gl_PointSize = 1.0; }`));
gl.attachShader(prog, compile(gl.FRAGMENT_SHADER, `#version 300 es
precision highp float;
uniform sampler2D t;
out vec4 color;
void main() { color = texture(t, vec2(0.5, 0.5)); }`));
gl.linkProgram(prog);
gl.useProgram(prog);
function sampleMiddle(internalFormat, type, data) {
gl.bindTexture(gl.TEXTURE_2D, gl.createTexture());
gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, 2, 1, 0, gl.RED, type, data);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.drawArrays(gl.POINTS, 0, 1);
const px = new Uint8Array(4);
gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, px);
return px[0];
}
console.log("R16_EXT:", sampleMiddle(ext.R16_EXT, gl.UNSIGNED_SHORT, new Uint16Array([0, 65535])));
console.log("R16_SNORM_EXT:", sampleMiddle(ext.R16_SNORM_EXT, gl.SHORT, new Int16Array([0, 32767])));
Expected: about 128 for both lines, the linearly filtered midpoint. Chrome 156 logs 127 and 127.
Actual: 0 for both lines, with the warning:
โ WebGL warning: drawArraysInstanced: TEXTURE_2D at unit 0 is incomplete: Minification or magnification filtering is not NEAREST or NEAREST_MIPMAP_NEAREST, and the texture's format is not "texture-filterable".
Likely cause: in dom/canvas/WebGLExtensions.cpp, the WebGLExtensionTextureNorm16 constructor registers the formats with AddTexUnpack() and AllowSizedTexFormat(), and sets SetRenderable() for R16, RG16 and RGBA16. It never sets
usage->isFilterable = true, unlike the other format extensions in the same file.
Updated•2 hours ago
|
Description
•