Closed Bug 1229210 Opened 9 years ago Closed 9 years ago

Handle the new formats required by WebGL2 in ReadPixels

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: jrmuizel, Assigned: jrmuizel)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(1 file, 2 obsolete files)

This is required for deqp/functional/gles3/builtinprecision00.html to pass on Linux
Blocks: webgl2
Attached patch WIP to get things working (obsolete) — Splinter Review
Attached patch Add LOCAL_GL_INT as well (obsolete) — Splinter Review
jgilbert, is this approach sane?
Attachment #8695450 - Attachment is obsolete: true
Attachment #8698557 - Flags: feedback?(jgilbert)
Comment on attachment 8698557 [details] [diff] [review]
Add LOCAL_GL_INT as well

Review of attachment 8698557 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/canvas/WebGLContextGL.cpp
@@ +1458,5 @@
> +    if (IsWebGL2()) {
> +      if (!IsFormatAndTypeUnpackable2(format, type))
> +        return ErrorInvalidEnum("readPixels: Bad format or type.");
> +    } else {
> +      if (!IsFormatAndTypeUnpackable(format, type))

In other places, we have functions like these as virtuals. We should *probably* go that route here as well.

@@ +1499,5 @@
>  
> +    case LOCAL_GL_UNSIGNED_INT:
> +    case LOCAL_GL_INT:
> +        bytesPerPixel = 4;
> +        requiredDataType = js::Scalar::Uint32;

Shouldn't GL_INT require Int32?
Attachment #8698557 - Flags: feedback?(jgilbert) → feedback+
Whiteboard: [gfx-noted]
Summary: Handle the new format required by WebGL2 in ReadPixels → Handle the new formats required by WebGL2 in ReadPixels
I decided against doing a virtual function for a couple of reasons:
1. The existing function is static
2. I wanted to avoid the code duplication
3. I wanted to make the fact that WebGL2 is a superset of format more obvious
4. I wanted to keep the format checking code closer together
5. I find having the WebGL2 conditional easier to read because you don't have to know that the function is virtual to see what's going on.
Attachment #8698557 - Attachment is obsolete: true
Attachment #8699214 - Flags: review?(jgilbert)
Attachment #8699214 - Flags: review?(jgilbert) → review+
https://hg.mozilla.org/mozilla-central/rev/05b0e3cb50a4
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Assignee: nobody → jmuizelaar
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: