johang88 / TR.Stride

Various stride utilities / projects (stride3d.net)
MIT License
51 stars 8 forks source link

Buoyancy Crash as a result of IndexOutOfRange in SampleRepeat #12

Open sandsalamand opened 10 months ago

sandsalamand commented 10 months ago
static Vector4 SampleRepeat(Vector4[] source, int w, int h, int x, int y)
{
    x = x % w;
    y = y & h;

    return source[y * w + x];
}

source has a size of 65536 as a result of the 256 x 256 set in Size, and y * w = 65536