Skip to content

Commit 8fc2a0d

Browse files
authored
Revise WEBGL_shader_pixel_local_storage extension. (#3765)
Add noncoherent usage flag, and renumber enums, to track the current ANGLE extension. Specify and test PLS framebuffer query of PIXEL_LOCAL_USAGE_WEGBL, and add usage parameter to framebufferTexturePixelLocalStorageWEBGL calls in the test. Tested against the revised extension implementation in Chromium. Thanks to Alexey Knyazev for thorough code review. Associated with https://issues.angleproject.org/issues/40096838 .
1 parent 6cb5b67 commit 8fc2a0d

2 files changed

Lines changed: 24 additions & 12 deletions

File tree

extensions/WEBGL_shader_pixel_local_storage/extension.xml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,17 @@ interface WEBGL_shader_pixel_local_storage {
7878
const GLenum PIXEL_LOCAL_TEXTURE_NAME_WEBGL = 0x96E8;
7979
const GLenum PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL = 0x96E9;
8080
const GLenum PIXEL_LOCAL_TEXTURE_LAYER_WEBGL = 0x96EA;
81-
const GLenum PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL = 0x96EB;
82-
const GLenum PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL = 0x96EC;
83-
const GLenum PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL = 0x96ED;
81+
const GLenum PIXEL_LOCAL_USAGE_WEBGL = 0x96EB;
82+
const GLenum PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL = 0x96EC;
83+
const GLenum PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL = 0x96ED;
84+
const GLenum PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL = 0x96EE;
85+
const GLenum PIXEL_LOCAL_USAGE_ALWAYS_NONCOHERENT_BIT_WEBGL = 0x1;
8486
GLboolean isCoherent();
8587
undefined framebufferTexturePixelLocalStorageWEBGL(GLint plane,
8688
WebGLTexture? texture,
8789
GLint level,
88-
GLint layer);
90+
GLint layer,
91+
GLbitfield usage);
8992
undefined framebufferPixelLocalClearValuefvWEBGL(GLint plane,
9093
Float32List value,
9194
optional unsigned long long srcOffset = 0);
@@ -121,6 +124,7 @@ interface WEBGL_shader_pixel_local_storage {
121124
<param name="texture" type="WebGLTexture?"/>
122125
<param name="level" type="GLint"/>
123126
<param name="layer" type="GLint"/>
127+
<param name="usage" type="GLbitfield"/>
124128
<p>
125129
Establishes the backing texture for the given plane.
126130
</p>
@@ -266,6 +270,7 @@ interface WEBGL_shader_pixel_local_storage {
266270
<tr><td>PIXEL_LOCAL_TEXTURE_NAME_WEBGL</td><td>WebGLTexture?</td></tr>
267271
<tr><td>PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL</td><td>GLint</td></tr>
268272
<tr><td>PIXEL_LOCAL_TEXTURE_LAYER_WEBGL</td><td>GLint</td></tr>
273+
<tr><td>PIXEL_LOCAL_USAGE_WEBGL</td><td>GLbitfield</td></tr>
269274
<tr><td>PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL</td><td>Float32Array</td></tr>
270275
<tr><td>PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL</td><td>Int32Array</td></tr>
271276
<tr><td>PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL</td><td>Uint32Array</td></tr>
@@ -283,5 +288,8 @@ interface WEBGL_shader_pixel_local_storage {
283288
<revision date="2025/03/24">
284289
<change>Removed MAX_COLOR_ATTACHMENTS_WITH_ACTIVE_PIXEL_LOCAL_STORAGE_WEBGL enum, which was removed from the underlying ANGLE extension.</change>
285290
</revision>
291+
<revision date="2026/02/20">
292+
<change>Added non-coherent "usage" flag and revised enum values, tracking ANGLE extension.</change>
293+
</revision>
286294
</history>
287295
</draft>

sdk/tests/conformance2/extensions/webgl-shader-pixel-local-storage.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@
130130
shouldBe("pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL", "0x96E8");
131131
shouldBe("pls.PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL", "0x96E9");
132132
shouldBe("pls.PIXEL_LOCAL_TEXTURE_LAYER_WEBGL", "0x96EA");
133-
shouldBe("pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL", "0x96EB");
134-
shouldBe("pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL", "0x96EC");
135-
shouldBe("pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL", "0x96ED");
133+
shouldBe("pls.PIXEL_LOCAL_USAGE_WEBGL", "0x96EB");
134+
shouldBe("pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL", "0x96EC");
135+
shouldBe("pls.PIXEL_LOCAL_CLEAR_VALUE_INT_WEBGL", "0x96ED");
136+
shouldBe("pls.PIXEL_LOCAL_CLEAR_VALUE_UNSIGNED_INT_WEBGL", "0x96EE");
137+
shouldBe("pls.PIXEL_LOCAL_USAGE_ALWAYS_NONCOHERENT_BIT_WEBGL", "0x1");
136138
}
137139

138140
function checkImplementationDependentLimits() {
@@ -182,6 +184,8 @@
182184
i, pls.PIXEL_LOCAL_TEXTURE_LEVEL_WEBGL) == 0);
183185
expectTrue(pls.getFramebufferPixelLocalStorageParameterWEBGL(
184186
i, pls.PIXEL_LOCAL_TEXTURE_LAYER_WEBGL) == 0);
187+
expectTrue(pls.getFramebufferPixelLocalStorageParameterWEBGL(
188+
i, pls.PIXEL_LOCAL_USAGE_WEBGL) == 0);
185189
expectTrue(arraysEqual(
186190
pls.getFramebufferPixelLocalStorageParameterWEBGL(
187191
i, pls.PIXEL_LOCAL_CLEAR_VALUE_FLOAT_WEBGL),
@@ -211,7 +215,7 @@
211215
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 1, 1);
212216
wtu.glErrorShouldBe(gl, gl.NONE);
213217
gl.deleteTexture(tex);
214-
pls.framebufferTexturePixelLocalStorageWEBGL(0, tex, 0, 0);
218+
pls.framebufferTexturePixelLocalStorageWEBGL(0, tex, 0, 0, 0);
215219
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION);
216220

217221
debug("\nIf 'texture' was generated by a different WebGL2RenderingContext than this one, " +
@@ -220,7 +224,7 @@
220224
const tex2 = gl2.createTexture();
221225
gl2.bindTexture(gl2.TEXTURE_2D, tex2);
222226
gl2.texStorage2D(gl2.TEXTURE_2D, 1, gl2.RGBA8, 1, 1);
223-
pls.framebufferTexturePixelLocalStorageWEBGL(0, tex2, 0, 0);
227+
pls.framebufferTexturePixelLocalStorageWEBGL(0, tex2, 0, 0, 0);
224228
wtu.glErrorShouldBe(gl2, gl2.NONE);
225229
wtu.glErrorShouldBe(gl, gl.INVALID_OPERATION);
226230

@@ -294,10 +298,10 @@
294298
gl.bindTexture(gl.TEXTURE_2D, validTex);
295299
gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, 1, 1);
296300
wtu.glErrorShouldBe(gl, gl.NONE);
297-
pls.framebufferTexturePixelLocalStorageWEBGL(0, validTex, 0, 0);
301+
pls.framebufferTexturePixelLocalStorageWEBGL(0, validTex, 0, 0, 0);
298302
shouldBeTrue(`pls.getFramebufferPixelLocalStorageParameterWEBGL(
299303
0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL) === validTex`);
300-
pls.framebufferTexturePixelLocalStorageWEBGL(0, null, 0, 0);
304+
pls.framebufferTexturePixelLocalStorageWEBGL(0, null, 0, 0, 0);
301305
shouldBeTrue(`pls.getFramebufferPixelLocalStorageParameterWEBGL(
302306
0, pls.PIXEL_LOCAL_TEXTURE_NAME_WEBGL) === null`);
303307

@@ -323,7 +327,7 @@
323327

324328
const plsFBO = localGL.createFramebuffer();
325329
localGL.bindFramebuffer(localGL.FRAMEBUFFER, plsFBO);
326-
localPLS.framebufferTexturePixelLocalStorageWEBGL(0, tex, 0, 0);
330+
localPLS.framebufferTexturePixelLocalStorageWEBGL(0, tex, 0, 0, 0);
327331
wtu.glErrorShouldBe(localGL, localGL.NONE);
328332

329333
localGL.viewport(0, 0, localCanvas.width, localCanvas.height);

0 commit comments

Comments
 (0)