Pretty small change but maybe requires some explanation:
WebKit gives us RGBA data. When we get a putImageData in JS it goes through
GrContext::writeRenderTargetPixels(). We upload the data to a scratch texture
and then draw from that texture to the RT. During this draw we convert from
unpremultiplied-alpha to premultiplied-alpha.
Currently the scratch texture is RGBA, matching WebKit's order. When we upload
WK's data to the texture in ANGLE it does a sw swizzle and behind our backs the
texture is really BGRA.
With this change we'll pretend to GL that the original data is BGRA during the
texture upload but then do the R/B swap during the draw (which is free).
There is no measurable end-to-end performance increase because the ANGLE swizzle
is SSE2 accelerated. But CPU utilization is reduced so it is still win.
(The early out added in internalWriteRenderTargetPixels is unrelated to the
above).
LGTM. Thanks for the explanation. http://codereview.appspot.com/5417046/diff/2001/src/gpu/GrGpuGL.cpp File src/gpu/GrGpuGL.cpp (right): http://codereview.appspot.com/5417046/diff/2001/src/gpu/GrGpuGL.cpp#newcode448 src/gpu/GrGpuGL.cpp:448: These two functions are ...
Issue 5417046: Write direct to RT/Tex when possible, use BGRA rather than RGBA intermediate texture on ANGLE
(Closed)
Created 13 years ago by bsalomon
Modified 13 years ago
Reviewers: TomH
Base URL: http://skia.googlecode.com/svn/trunk/
Comments: 1