URI: 
       fix(raytracer): prevent out-of-bounds access when pixel count is not divisible by block size - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
  HTML git clone git://src.adamsgaard.dk/sphere
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
   DIR commit a59d99c34192952f05e3485f16adce80bcc2aa63
   DIR parent e9a992a493dfb106030c3d6e4c65b985cd562f20
  HTML Author: Anders Damsgaard <anders@adamsgaard.dk>
       Date:   Sat,  4 Jul 2026 23:43:11 +0200
       
       fix(raytracer): prevent out-of-bounds access when pixel count is not divisible by block size
       
       Diffstat:
         M src/raytracer.cuh                   |       8 ++++----
       
       1 file changed, 4 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/src/raytracer.cuh b/src/raytracer.cuh
       @@ -17,7 +17,7 @@ __global__ void imageInit(
        {
            // Compute pixel position from threadIdx/blockIdx
            unsigned int mempos = threadIdx.x + blockIdx.x * blockDim.x;
       -    if (mempos > pixels)
       +    if (mempos >= pixels)
                return;
        
            dev_img[mempos*4]     = 255;        // Red channel
       @@ -35,7 +35,7 @@ __global__ void rayInitPerspective(
        {
            // Compute pixel position from threadIdx/blockIdx
            unsigned int mempos = threadIdx.x + blockIdx.x * blockDim.x;
       -    if (mempos > width*height) 
       +    if (mempos >= width*height)
                return;
        
            // Calculate 2D position from linear index
       @@ -64,7 +64,7 @@ __global__ void rayIntersectSpheres(
        {
            // Compute pixel position from threadIdx/blockIdx
            unsigned int mempos = threadIdx.x + blockIdx.x * blockDim.x;
       -    if (mempos > devC_pixels)
       +    if (mempos >= devC_pixels)
                return;
        
            // Read ray data from global memory
       @@ -155,7 +155,7 @@ __global__ void rayIntersectSpheresColormap(
        {
            // Compute pixel position from threadIdx/blockIdx
            unsigned int mempos = threadIdx.x + blockIdx.x * blockDim.x;
       -    if (mempos > devC_pixels)
       +    if (mempos >= devC_pixels)
                return;
        
            // Read ray data from global memory