Results 1 to 2 of 2

Thread: Casting int2, float2

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    18

    Casting int2, float2

    Stupid question, probably, but, why does
    Code :
    float2 charSizef = (float2)(charSize.x, charSize.y);
    work, whereas
    Code :
    float2 charSizef = (float2)charSize;
    Doesn't, where charSize is an int2 input to my kernel function.

    Also, what's the performance-hit from casting between int/int2 and float/float2?

    a|x

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: Casting int2, float2

    Try using a conversion:

    Code :
    float2 charSizef = convert_float2(charSize);
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

Similar Threads

  1. casting char* to struct
    By oconnellseanm in forum OpenCL
    Replies: 5
    Last Post: 07-28-2011, 10:38 AM
  2. Type casting question
    By dlw in forum OpenCL
    Replies: 1
    Last Post: 07-06-2011, 03:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •