Results 1 to 3 of 3

Thread: Add gentype1 in addition to gentype to complete gentypen

  1. #1
    Senior Member
    Join Date
    Mar 2011
    Location
    Seoul
    Posts
    118

    Add gentype1 in addition to gentype to complete gentypen

    It would be useful if gentypen were extended to include gentype1 as an alternative to the scalar gentype. I found myself in need of the swizzle properties for scalar datatypes when trying to generalize kernels for all vector lengths--including scalars. For example,
    Code :
    __kernel void kernel(__global gentypen *x)
    {
       // vector length is sizeof(*x) / sizeof((*x).s0)
        ...
    }

    The problem with the above code is that gentype doesn't have .s0 in cl_platform.h. I propose adding something like the following:
    Code :
    typedef union
    {
        cl_float  CL_ALIGNED(4) s[1];
    #if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
       __extension__ struct{ cl_float  x; };
       __extension__ struct{ cl_float  s0; };
       __extension__ struct{ cl_float  lo; };
       __extension__ struct{ cl_float  hi; };
    #endif
    #if defined( __CL_FLOAT1__) 
        __cl_float1     v1;
    #endif
    }cl_float1;

    Maybe including the last "#if defined" isn't correct; I'm not sure.

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

    Re: Add gentype1 in addition to gentype to complete gentypen

    I fully agree with you, and this was actually discussed in the past: allowing scalars to be treated as 1-component vectors in general. I don't remember why it was turned down... I will try asking again; there must be a reason.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Senior Member
    Join Date
    Mar 2011
    Location
    Seoul
    Posts
    118

    Re: Add gentype1 in addition to gentype to complete gentypen

    Hi David,

    If you found out more info on this topic could you share it and maybe the opposing argument?

Similar Threads

  1. Can OpenMAX AL be used as a complete replacement 4 GStreamer
    By johnjlawless77 in forum OpenMAX AL
    Replies: 3
    Last Post: 01-25-2013, 07:16 AM
  2. GLSL ES max/min() for genType ambiguity
    By tomyun in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 1
    Last Post: 06-05-2009, 07:19 AM

Posting Permissions

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