forked from bartvdbraak/blender
Cycles:
* Use float_to_int() functions in a few more places.
This commit is contained in:
parent
b2c81664ae
commit
49115b4dd3
@ -40,7 +40,7 @@ __device float3 bsdf_diffuse_ramp_get_color(const ShaderClosure *sc, const float
|
|||||||
int MAXCOLORS = 8;
|
int MAXCOLORS = 8;
|
||||||
|
|
||||||
float npos = pos * (float)(MAXCOLORS - 1);
|
float npos = pos * (float)(MAXCOLORS - 1);
|
||||||
int ipos = (int)npos;
|
int ipos = float_to_int(npos);
|
||||||
if (ipos >= (MAXCOLORS - 1))
|
if (ipos >= (MAXCOLORS - 1))
|
||||||
return colors[MAXCOLORS - 1];
|
return colors[MAXCOLORS - 1];
|
||||||
float offset = npos - (float)ipos;
|
float offset = npos - (float)ipos;
|
||||||
|
@ -40,7 +40,7 @@ __device float3 bsdf_phong_ramp_get_color(const ShaderClosure *sc, const float3
|
|||||||
int MAXCOLORS = 8;
|
int MAXCOLORS = 8;
|
||||||
|
|
||||||
float npos = pos * (float)(MAXCOLORS - 1);
|
float npos = pos * (float)(MAXCOLORS - 1);
|
||||||
int ipos = (int)npos;
|
int ipos = float_to_int(npos);
|
||||||
if (ipos >= (MAXCOLORS - 1))
|
if (ipos >= (MAXCOLORS - 1))
|
||||||
return colors[MAXCOLORS - 1];
|
return colors[MAXCOLORS - 1];
|
||||||
float offset = npos - (float)ipos;
|
float offset = npos - (float)ipos;
|
||||||
|
@ -25,7 +25,7 @@ __device void svm_node_convert(ShaderData *sd, float *stack, uint type, uint fro
|
|||||||
switch(type) {
|
switch(type) {
|
||||||
case NODE_CONVERT_FI: {
|
case NODE_CONVERT_FI: {
|
||||||
float f = stack_load_float(stack, from);
|
float f = stack_load_float(stack, from);
|
||||||
stack_store_int(stack, to, (int)f);
|
stack_store_int(stack, to, float_to_int(f));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NODE_CONVERT_FV: {
|
case NODE_CONVERT_FV: {
|
||||||
|
@ -45,7 +45,7 @@ __device_inline int svm_image_texture_wrap_clamp(int x, int width)
|
|||||||
|
|
||||||
__device_inline float svm_image_texture_frac(float x, int *ix)
|
__device_inline float svm_image_texture_frac(float x, int *ix)
|
||||||
{
|
{
|
||||||
int i = (int)x - ((x < 0.0f)? 1: 0);
|
int i = float_to_int(x) - ((x < 0.0f)? 1: 0);
|
||||||
*ix = i;
|
*ix = i;
|
||||||
return x - (float)i;
|
return x - (float)i;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user