forked from bartvdbraak/blender
Fix T48139: Checker texture strange behavior in cycles
Seems particular CUDA implementations has some precision issues, which made integer coordinate (which was expected to always be positive) to go negative.
This commit is contained in:
parent
177d051126
commit
3165e8740b
@ -25,9 +25,9 @@ ccl_device_noinline float svm_checker(float3 p)
|
|||||||
p.y = (p.y + 0.000001f)*0.999999f;
|
p.y = (p.y + 0.000001f)*0.999999f;
|
||||||
p.z = (p.z + 0.000001f)*0.999999f;
|
p.z = (p.z + 0.000001f)*0.999999f;
|
||||||
|
|
||||||
int xi = float_to_int(fabsf(floorf(p.x)));
|
int xi = abs(float_to_int(floorf(p.x)));
|
||||||
int yi = float_to_int(fabsf(floorf(p.y)));
|
int yi = abs(float_to_int(floorf(p.y)));
|
||||||
int zi = float_to_int(fabsf(floorf(p.z)));
|
int zi = abs(float_to_int(floorf(p.z)));
|
||||||
|
|
||||||
return ((xi % 2 == yi % 2) == (zi % 2))? 1.0f: 0.0f;
|
return ((xi % 2 == yi % 2) == (zi % 2))? 1.0f: 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -97,6 +97,11 @@ ccl_device_inline float fminf(float a, float b)
|
|||||||
|
|
||||||
#ifndef __KERNEL_GPU__
|
#ifndef __KERNEL_GPU__
|
||||||
|
|
||||||
|
ccl_device_inline int abs(int x)
|
||||||
|
{
|
||||||
|
return (x > 0)? x: -x;
|
||||||
|
}
|
||||||
|
|
||||||
ccl_device_inline int max(int a, int b)
|
ccl_device_inline int max(int a, int b)
|
||||||
{
|
{
|
||||||
return (a > b)? a: b;
|
return (a > b)? a: b;
|
||||||
|
Loading…
Reference in New Issue
Block a user