[webkit-dev] Transformations precision: double -> float

Wasim Abbas Wasim.Abbas at arm.com
Tue May 22 06:26:08 PDT 2012


Would something like this work for testing in short term?

template <class T>
class TransformationMatrix_T
{
        T data[16];
};


typedef TransformationMatrix TransformationMatrix_T<float>;

typedef TransformationMatrixD TransformationMatrix_T<double>;

..
Wasim

-----Original Message-----
From: webkit-dev-bounces at lists.webkit.org [mailto:webkit-dev-bounces at lists.webkit.org] On Behalf Of kui zheng
Sent: 22 May 2012 14:04
To: Stephen Chenney
Cc: webkit-dev at lists.webkit.org
Subject: Re: [webkit-dev] Transformations precision: double -> float

Hi, I have the same questions. Using float,  It's easier to map to
OGLES2, Decrease memory usage and accelerated using ARM SIMD.
if you do profiling for CSS transformation/Animation, you'll find
TransformationMatrix hotspots that should be well optimized  using
NEON.

-Kuii

On Mon, May 21, 2012 at 6:55 PM, Stephen Chenney <schenney at chromium.org> wrote:
> Ideally WebKit would avoid casts by consistently using either double or
> floats everywhere a floating point representation is needed. I don't think
> it's as simple as adding a typedef, but maybe it is. In any event it would
> have to be spelled out in the style guide.
>
> My gut feeling is that floats are enough for web layout, and map better onto
> GPU back ends where bandwidth (memory) really matters. Is there anything in
> the specs that force one or the other, or both? Is there a compelling web
> content scenario that demands double precision?
>
> Stephen.
>
>
> On Mon, May 21, 2012 at 1:37 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
>>
>> Maybe you can add a typedef in Platform.h to make it configurable? e.g.
>> maybe you want to be able to use long double instead of regular double in
>> the future.
>>
>> - Ryosuke
>>
>> On Mon, May 21, 2012 at 10:34 AM, Simon Fraser <simon.fraser at apple.com>
>> wrote:
>>>
>>> TransformationMatrix started out as floats, then got changed to doubles
>>> in <http://trac.webkit.org/changeset/40761>
>>>
>>> This was done because on most hardware there is no penalty for using
>>> doubles over floats, and provided a better match with our system APIs that
>>> used doubles.
>>>
>>> I'd prefer to take a forward-looking stance here, and assume that in time
>>> hardware will catch up.
>>>
>>> Simon
>>>
>>> On May 21, 2012, at 4:04 AM, Zoltan Herczeg wrote:
>>>
>>> > Hi,
>>> >
>>> > is there any reason why the transformations in WebKit use doubles? We
>>> > could optimize some functions further with ARM SIMD if they would be
>>> > floats. Is there any objection to make them float if the change would
>>> > have
>>> > no other side effects except some rounding because of the lower
>>> > precision?
>>> >
>>> > Regards,
>>> > Zoltan
>>> >
>>> >
>>> > _______________________________________________
>>> > webkit-dev mailing list
>>> > webkit-dev at lists.webkit.org
>>> > http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>>
>>> _______________________________________________
>>> webkit-dev mailing list
>>> webkit-dev at lists.webkit.org
>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
_______________________________________________
webkit-dev mailing list
webkit-dev at lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev



-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.



More information about the webkit-dev mailing list