September 21, 2010
> vec3h a = vec3h(cast(half)1.f, cast(half)2.f, cast(half)3.f);

In C++ I can make the half type and create vec3h with

vec3h a = vec3h(1, 2.f, 3);

because so much thing are implicit.

> I heard stories of half-float => float conversions being the bottleneck

I meant float -> half-float

September 21, 2010
#ponce wrote:
>> vec3h a = vec3h(cast(half)1.f, cast(half)2.f, cast(half)3.f);
> 
> In C++ I can make the half type and create vec3h with
> 
> vec3h a = vec3h(1, 2.f, 3);
> 
> because so much thing are implicit.
> 
>> I heard stories of half-float => float conversions being the bottleneck
> 
> I meant float -> half-float
> 

My friend Google found some SSE2 code which does float->half in 3.5 cycles. Not too bad.

http://www.devmaster.net/forums/showthread.php?t=10924
October 09, 2010
On Tue, 21 Sep 2010 11:59:51 +0300, Don <nospam@nospam.com> wrote:

> bearophile wrote:
>> ponce:
>>
>>> Vibrant has been open source'd (again):
>>> http://bitbucket.org/ponce/vibrant
>>  Very good. I have seen 2D vectors implemented something like ten times in D code, so I think it's time to stop this. They need to go in the standard library:
>> http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec2.d
>> http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec3.d
>> http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vec4.d
>> http://bitbucket.org/ponce/vibrant/src/tip/trunk/common2/math/vectorop.d
>
> Definitely we need vectors in Phobos.

You know vectors are one of the hardest things to implement if you want everything. In D2 it should possible to have it all!

My ideal vector design :

- one struct for all dimensions.
- swizzling
- after a limit (dimension) you have a choice to use either unwrapping or plain for.
- avoid temporaries as much as possible.
- policy to use sse. etc...

Can't think of anything more now.

First 3 is very easy to implement, 4 wasn't possible on C++ because of aliasing, didn't give much of a thought in D, 5 also shouldn't be that hard.

alias vector!(3, float) vec3;
alias vector!(4, float) vec4;
...

There we solved everything! in theory :)

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
1 2
Next ›   Last »