diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-10-21 18:30:35 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-10-21 18:30:35 +0300 |
commit | 0775680e4d05eda3c495a56dc0b6eafbe96dc586 (patch) | |
tree | 4f3286eef96dec6ababe43467ed2a4f50388b988 /intern/cycles/kernel/kernel_compat_cpu.h | |
parent | 4ade467fc6adfc13ce9e21d7e50b366fce70ea5f (diff) | |
parent | 6bc007610263c879f6bb30b844ba9d9a0fb9433c (diff) |
Merge branch 'master' into UI-graphical-redesignUI-graphical-redesign
Conflicts:
source/blender/blenkernel/BKE_blender.h
source/blender/blenloader/intern/versioning_270.c
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/resources.c
Diffstat (limited to 'intern/cycles/kernel/kernel_compat_cpu.h')
-rw-r--r-- | intern/cycles/kernel/kernel_compat_cpu.h | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/intern/cycles/kernel/kernel_compat_cpu.h b/intern/cycles/kernel/kernel_compat_cpu.h index d02670f630a..04c4cf35587 100644 --- a/intern/cycles/kernel/kernel_compat_cpu.h +++ b/intern/cycles/kernel/kernel_compat_cpu.h @@ -144,7 +144,7 @@ template<typename T> struct texture_image { iy = wrap_periodic(iy, height); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x >= width || y >= height) { + if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ @@ -168,16 +168,16 @@ template<typename T> struct texture_image { niy = wrap_periodic(iy+1, height); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x >= width || y >= height) { + if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ case EXTENSION_EXTEND: - ix = wrap_clamp(ix, width); - iy = wrap_clamp(iy, height); - nix = wrap_clamp(ix+1, width); niy = wrap_clamp(iy+1, height); + + ix = wrap_clamp(ix, width); + iy = wrap_clamp(iy, height); break; } @@ -190,8 +190,8 @@ template<typename T> struct texture_image { } else { /* Bicubic b-spline interpolation. */ - const float tx = frac(x*(float)width - 0.5f, &ix); - const float ty = frac(y*(float)height - 0.5f, &iy); + float tx = frac(x*(float)width - 0.5f, &ix); + float ty = frac(y*(float)height - 0.5f, &iy); int pix, piy, nnix, nniy; switch(extension) { case EXTENSION_REPEAT: @@ -208,14 +208,11 @@ template<typename T> struct texture_image { nniy = wrap_periodic(iy+2, height); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x >= width || y >= height) { + if(x < 0.0f || y < 0.0f || x > 1.0f || y > 1.0f) { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ case EXTENSION_EXTEND: - ix = wrap_clamp(ix, width); - iy = wrap_clamp(iy, height); - pix = wrap_clamp(ix-1, width); piy = wrap_clamp(iy-1, height); @@ -224,6 +221,9 @@ template<typename T> struct texture_image { nnix = wrap_clamp(ix+2, width); nniy = wrap_clamp(iy+2, height); + + ix = wrap_clamp(ix, width); + iy = wrap_clamp(iy, height); break; } @@ -279,7 +279,9 @@ template<typename T> struct texture_image { iz = wrap_periodic(iz, depth); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x >= width || y >= height) { + if(x < 0.0f || y < 0.0f || z < 0.0f || + x > 1.0f || y > 1.0f || z > 1.0f) + { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ @@ -308,18 +310,20 @@ template<typename T> struct texture_image { niz = wrap_periodic(iz+1, depth); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x >= width || y >= height) { + if(x < 0.0f || y < 0.0f || z < 0.0f || + x > 1.0f || y > 1.0f || z > 1.0f) + { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ case EXTENSION_EXTEND: - ix = wrap_clamp(ix, width); - iy = wrap_clamp(iy, height); - iz = wrap_clamp(iz, depth); - nix = wrap_clamp(ix+1, width); niy = wrap_clamp(iy+1, height); niz = wrap_clamp(iz+1, depth); + + ix = wrap_clamp(ix, width); + iy = wrap_clamp(iy, height); + iz = wrap_clamp(iz, depth); break; } @@ -363,15 +367,13 @@ template<typename T> struct texture_image { nniz = wrap_periodic(iz+2, depth); break; case EXTENSION_CLIP: - if (x < 0.0f || y < 0.0f || x >= width || y >= height) { + if(x < 0.0f || y < 0.0f || z < 0.0f || + x > 1.0f || y > 1.0f || z > 1.0f) + { return make_float4(0.0f, 0.0f, 0.0f, 0.0f); } /* Fall through. */ case EXTENSION_EXTEND: - ix = wrap_clamp(ix, width); - iy = wrap_clamp(iy, height); - iz = wrap_clamp(iz, depth); - pix = wrap_clamp(ix-1, width); piy = wrap_clamp(iy-1, height); piz = wrap_clamp(iz-1, depth); @@ -383,6 +385,10 @@ template<typename T> struct texture_image { nnix = wrap_clamp(ix+2, width); nniy = wrap_clamp(iy+2, height); nniz = wrap_clamp(iz+2, depth); + + ix = wrap_clamp(ix, width); + iy = wrap_clamp(iy, height); + iz = wrap_clamp(iz, depth); break; } |