Closed Bug 594352 Opened 14 years ago Closed 14 years ago

Optimize texture conversion when no conversion needed

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bjacob, Assigned: bjacob)

Details

Attachments

(1 file, 2 obsolete files)

When srcFormat == dstFormat and srcPremultiplied == dstPremultiplied, we can directly use memcpy(). To allow flipping, this patch does one memcpy() per row.
Attachment #473026 - Flags: review?(vladimir)
Oops, forgot the 'return'. Not this is _actually_ an optimization.
Assignee: nobody → bjacob
Attachment #473026 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #473032 - Flags: review?(vladimir)
Attachment #473026 - Flags: review?(vladimir)
Comment on attachment 473032 [details] [diff] [review]
Optimize texture conversion when no conversion needed

this we definitely want, regardless of template optimization.  However, why do we need memcpy at all here?  Can't we just.. not convert?  No extra allocation, memcpy, etc.
Attachment #473032 - Flags: review?(vladimir) → review+
This is a separate optimization. What you describe is something we should do when no conversion AND no flipping is needed. When flipping, we still need 1 memcpy per row.
Improved patch:

 * we now avoid doing anything at all (use src buffer in place, no ConvertImage call, no memcpy) when possible, i.e. when the source texture has the right format, premultiplication, stride and no flipY is requested.

 * otherwise, when the format and premultiplication are good but there may still be a need to flip / change stride, we do 1 memcpy per row in ConvertImage()
Attachment #473032 - Attachment is obsolete: true
Attachment #483318 - Flags: review?(vladimir)
on second thought --- we never have to change the stride. so the only reason why we may have to do 1 memcpy per row, is when flipping the image.
Attachment #483318 - Flags: approval2.0+
http://hg.mozilla.org/mozilla-central/rev/4dac41e6edd2
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: