Closed Bug 1186129 Opened 8 years ago Closed 8 years ago

WebGL texture conversions: Fix assignment of alpha in pack premultiply of RA16F

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: kyle_fung, Assigned: kyle_fung)

Details

Attachments

(1 file)

Current implementation of pack premultiply for RA16F from WebGLTexelConversions.h :

> template<> MOZ_ALWAYS_INLINE void
> pack<WebGLTexelFormat::RA16F, WebGLTexelPremultiplicationOp::Premultiply, uint16_t, uint16_t>(const uint16_t* __restrict src, uint16_t* __restrict dst)
> {
>     float scaleFactor = unpackFromFloat16(src[3]);
>     dst[0] = packToFloat16(unpackFromFloat16(src[0]) * scaleFactor);
>     dst[1] = scaleFactor;
> }

The assignment of dst[1] should be to src[3] not scaleFactor since scaleFactor is a float unpacked from src[3].
Attachment #8636723 - Flags: review?(jgilbert)
Attachment #8636723 - Flags: review?(jgilbert) → review+
Comment on attachment 8636723 [details] [diff] [review]
fix-alpha-assignment.patch

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

::: dom/canvas/WebGLTexelConversions.h
@@ +859,5 @@
>  pack<WebGLTexelFormat::RA32F, WebGLTexelPremultiplicationOp::Premultiply, float, float>(const float* __restrict src, float* __restrict dst)
>  {
>      float scaleFactor = src[3];
>      dst[0] = src[0] * scaleFactor;
> +    dst[1] = src[3];

This is clearer, but it's the same result.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/730b6090f696
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.