In texSubImage2D, check that the update format matches the existing texture

RESOLVED FIXED

Status

()

Core
Canvas: WebGL
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: bjacob, Assigned: bjacob)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Created attachment 541956 [details] [diff] [review]
check same format in texSubImage2D

This 2-liner makes us pass 3 more WebGL test pages!
Attachment #541956 - Flags: review?(jmuizelaar)
Do you know where this behaviour is specified. I couldn't really find it in the spec.
Comment on attachment 541956 [details] [diff] [review]
check same format in texSubImage2D

Please add a comment like:
OpenGL ES requires the format and type of glTexSubImage2D to match glTexImage.
Attachment #541956 - Flags: review?(jmuizelaar) → review+
I don't find where is this specified in OpenGL ES and WebGL specs.

It might be a mistake in the WebGL conformance tests.

IMHO it would make sense if texSubImage2D took an "internalFormat" argument, but here "format" and "type" defines how to unpack passed "data" argument to the texture's internal format, which itself does not change.
(Assignee)

Comment 4

6 years ago
Actually, in WebGL the format and type parameters prescribe how the texture image should be stored on the GPU. So if you have an existing texture stored in a given format, and update it with a different format, you're really requiring that part of the texture to be stored in a different format, which doesn't make sense. So at least in WebGL's case this requirement is easy to justify.
WebGL and ES have indeed the restriction internalformat==format, so it might make sense to restrict format but - at least - type is still purely unpack-related imho.

Considering a texture defined by :

texImage2D(...RGB, RGB, UNSIGNED_BYTE...).

then

texSubImage2D(...RGB, UNSIGNED_BYTE...data)

and

texSubImage2D(...RGB, GL_UNSIGNED_SHORT_5_6_5...data)

are imho semantically equivalent and the format stays the same, it just changes how the pixel data array is unpacked into the RGB texture... which anyways already need to be performed on our side because of UNPACK_*_WEBGL parameters afaik.


I agree this behavior probably isn't very useful, however if WebGL does not support this, I believe it should be clear in the spec and noted as another difference compared to ES 2.0.
(Assignee)

Comment 6

6 years ago
Landed before I saw your reply:
http://hg.mozilla.org/mozilla-central/rev/533f49000a9e

I'm happy that this makes us pass conformance tests for now. We can continue this conversation on the WebGL lists.
"GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage2D or glCopyTexImage2D operation whose internalformat matches the format of glTexSubImage2D."

`format' behavior is specified, opening a new thread to discuss unspecified `type' limitation on 3dweb.
This was never marked fixed.
Assignee: nobody → bjacob
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.