Last Comment Bug 667222 - In texSubImage2D, check that the update format matches the existing texture
: In texSubImage2D, check that the update format matches the existing texture
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Canvas: WebGL (show other bugs)
: unspecified
: All All
: -- normal (vote)
: ---
Assigned To: Benoit Jacob [:bjacob] (mostly away)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-06-25 12:26 PDT by Benoit Jacob [:bjacob] (mostly away)
Modified: 2012-04-05 17:33 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
check same format in texSubImage2D (4.05 KB, patch)
2011-06-25 12:26 PDT, Benoit Jacob [:bjacob] (mostly away)
jmuizelaar: review+
Details | Diff | Review

Description Benoit Jacob [:bjacob] (mostly away) 2011-06-25 12:26:22 PDT
Created attachment 541956 [details] [diff] [review]
check same format in texSubImage2D

This 2-liner makes us pass 3 more WebGL test pages!
Comment 1 Jeff Muizelaar [:jrmuizel] 2011-07-05 16:12:42 PDT
Do you know where this behaviour is specified. I couldn't really find it in the spec.
Comment 2 Jeff Muizelaar [:jrmuizel] 2011-07-27 10:42:18 PDT
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.
Comment 3 Cedric Vivier [:cedricv] 2011-07-27 11:05:36 PDT
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.
Comment 4 Benoit Jacob [:bjacob] (mostly away) 2011-07-27 11:18:53 PDT
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.
Comment 5 Cedric Vivier [:cedricv] 2011-07-27 11:47:12 PDT
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.
Comment 6 Benoit Jacob [:bjacob] (mostly away) 2011-07-27 11:57:59 PDT
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.
Comment 7 Cedric Vivier [:cedricv] 2011-08-02 22:49:51 PDT
"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.
Comment 8 Jeff Gilbert [:jgilbert] 2012-04-05 17:33:26 PDT
This was never marked fixed.

Note You need to log in before you can comment on or make changes to this bug.