Fix T48691: Cycles - OpenCL - HDR Image mapping does not match CUDA rendering
authorLukas Stockner <lukas.stockner@freenet.de>
Mon, 20 Jun 2016 22:49:25 +0000 (00:49 +0200)
committerLukas Stockner <lukas.stockner@freenet.de>
Mon, 20 Jun 2016 22:49:25 +0000 (00:49 +0200)
The OpenCL texture code didn't offset the coordinates by half a pixel like the CPU code does.

intern/cycles/kernel/svm/svm_image.h

index 3d9ab405849738bd0347274963d1fa2c484b4de5..aa9c07c867ec74b8b80cf94d35d697b07d195850 100644 (file)
@@ -93,8 +93,8 @@ ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y,
                r = svm_image_texture_read(kg, id, offset + ix + iy*width);
        }
        else { /* We default to linear interpolation if it is not closest */
-               float tx = svm_image_texture_frac(x*width, &ix);
-               float ty = svm_image_texture_frac(y*height, &iy);
+               float tx = svm_image_texture_frac(x*width - 0.5f, &ix);
+               float ty = svm_image_texture_frac(y*height - 0.5f, &iy);
 
                if(periodic) {
                        ix = svm_image_texture_wrap_periodic(ix, width);