Results 1 to 5 of 5

Thread: float4 and possible out of range?

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

    float4 and possible out of range?

    Suppose I were to create a memory buffer for only 17 * sizeof(float) bytes and access this buffer in the kernel through a __global float4 pointer. Can I read from and write to the fifth and last float4, or do these actions result in some out of range faults? What are the initial values for the .yzw swizzles, if it's a valid read operation?

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

    Re: float4 and possible out of range?

    Suppose I were to create a memory buffer for only 17 * sizeof(float) bytes and access this buffer in the kernel through a __global float4 pointer.
    That's problematic since the beginning. The __global float4 pointer can only read from memory addresses that are aligned to a float4. See section 6.1.5.

    Can I read from and write to the fifth and last float4
    Behavior is undefined for out-of-bounds memory accesses. It could page fault, it could start playing a tune through your speakers, or it could do anything else.
    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

    Re: float4 and possible out of range?

    add 3 more elements as 0.0 .... prob solved....

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

    Re: float4 and possible out of range?

    Quote Originally Posted by sameerrevankar
    add 3 more elements as 0.0 .... prob solved....
    Not quite true for all cases, for example when one of the increments is negative and the other is positive. In that example you‘d have to pad the beginning on the negative increment vector. Also, the proper padding value depends on the problem/algorithm.

    Anyways, padding works if you control the entire program but if you want to make a kernel library it would be best to avoid additional constraints on vector lengths.

  5. #5

    Re: float4 and possible out of range?

    watever .....

Similar Threads

  1. Range of valid indices for glGenTextures, glGenBuffers
    By WhiteGolem in forum OpenGL ES 1.X - fixed function hardware
    Replies: 1
    Last Post: 01-21-2013, 06:33 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
  •