[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] ARB_robustness and array bounds checking



To be more constructive, (and I think this has been suggested before), if we could come up with an short list of acceptable behaviors then we could test for them. Hopefully it would only take a short list to be acceptable to all GPU vendors.

Of the top of my head

*) Clamp to the ends of the array

As in:
    someArray[clamp(someIndex, 0, lengthOfSomeArray - 1)];

*) Return 0

As in:
    ((someIndex >= 0 || someIndex < lengthOfSomeArray) ? someArray[someIndex] : typeOfSomeArray(0.0));

*) Mod the index

As in:
    someArray[mod(abs(someIndex), lengthOfSomeArray];

Are there any other solutions that would need to be considered?

That doesn't solve the consistent behavior problem but it would at least solve the testing problem.