Khronos.org Message Boards

Public discussions about the Khronos Dynamic Media APIs
It is currently Thu Sep 09, 2010 4:24 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Non-power of 2 vector types
PostPosted: Thu Oct 15, 2009 7:07 am 
Offline

Joined: Wed Sep 09, 2009 1:29 am
Posts: 38
Currently vectors can only be declared to be a power of 2 in length, eg. float2, float4, char8, int16.

With that said, it is seems to be possible (i.e. I can't find anything in the spec to disallow it, and it seems to work) to work on vectors that aren't a power of 2 in length.
Code:
float4 color;
colour.xyz = colour.w * colour.xyz;

Here, colour.xyz is a vector of length 3. This is useful, but because there is no type to define this, it's impossible to construct values, and I'm finding myself writing code like this:
Code:
colour.xyz *= ((float4)(0.5, 1.0, 2.0, 0.0)).xyz;

i.e. constructing a four element vector, just to select three elements out of it.

As these types appear to exist in the language, they should be named, and be able to be constructed. At the moment I'm only finding myself wanting 3-element vectors (for pixels and geometry), but it should probably be generalised. I notice that the spec defines the names as already reserved, so I expect this has already been raised, but I wanted to add my vote for it.


Top
 Profile E-mail  
 
 Post subject: Re: Non-power of 2 vector types
PostPosted: Fri Oct 16, 2009 12:02 am 
Offline

Joined: Tue Jul 21, 2009 11:23 am
Posts: 311
Location: Northern Europe
You're not the only one who would like to be able to store and use 3-length vectors. :)


Top
 Profile E-mail  
 
 Post subject: Re: Non-power of 2 vector types
PostPosted: Mon Feb 01, 2010 12:15 pm 
Offline

Joined: Tue May 19, 2009 9:53 am
Posts: 91
Add my vote too!


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group