143 closure_pool =
reinterpret_cast<uint8_t *
>(
144 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureMul) - 1) &
145 (-
alignof(OSLClosureMul)));
146 sd->osl_closure_pool = closure_pool +
sizeof(OSLClosureMul);
151 closure->weight = *weight;
152 closure->closure = a;
161 if (weight == 0.0f || !a) {
164 else if (weight == 1.0f) {
170 uint8_t *closure_pool = sd->osl_closure_pool;
172 closure_pool =
reinterpret_cast<uint8_t *
>(
173 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureMul) - 1) &
174 (-
alignof(OSLClosureMul)));
175 sd->osl_closure_pool = closure_pool +
sizeof(OSLClosureMul);
180 closure->weight =
make_float3(weight, weight, weight);
181 closure->closure = a;
201 closure_pool =
reinterpret_cast<uint8_t *
>(
202 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureAdd) - 1) &
203 (-
alignof(OSLClosureAdd)));
204 sd->osl_closure_pool = closure_pool +
sizeof(OSLClosureAdd);
209 closure->closureA = a;
210 closure->closureB =
b;
222 closure_pool =
reinterpret_cast<uint8_t *
>(
223 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureComponent) - 1) &
224 (-
alignof(OSLClosureComponent)));
225 sd->osl_closure_pool = closure_pool +
sizeof(OSLClosureComponent) + size;
228 reinterpret_cast<ccl_private OSLClosureComponent *
>(closure_pool);
242 closure_pool =
reinterpret_cast<uint8_t *
>(
243 (
reinterpret_cast<size_t>(closure_pool) +
alignof(OSLClosureComponent) - 1) &
244 (-
alignof(OSLClosureComponent)));
245 sd->osl_closure_pool = closure_pool +
sizeof(OSLClosureComponent) + size;
248 reinterpret_cast<ccl_private OSLClosureComponent *
>(closure_pool);
250 closure->weight = *weight;
279 const int result = indexvalue < 0 ? 0 : indexvalue >= length ? length - 1 : indexvalue;
281 if (result != indexvalue) {
282 printf(
"Index [%d] out of range\n", indexvalue);
327 color *= 1.0f / 2.52f;
344 for (
int i = 0; i < 3; ++i) {
378 else if (!c_in_derivs) {
385 for (
int i = 0; i < (c_in_derivs ? 3 : 1); ++i) {
413 c_out[i] = rgb_to_xyz(
nullptr, rgb);
416 c_out[i] = xyz_to_xyY(rgb_to_xyz(
nullptr, rgb));
495 m[0], m[4], m[8], m[12], m[1], m[5], m[9], m[13], m[2], m[6], m[10], m[14]);
509 for (
int i = 0; i < 16; ++i) {
525 for (
int i = 0; i < 16; ++i) {
534 for (
int i = 0; i < 16; ++i) {
541 float f = (
b == 0) ? 0.0f : (a /
b);
557 for (
int i = 0; i < 3; ++i) {
575 for (
int i = 0; i < 3; ++i) {
593 for (
int i = 0; i < 3; ++i) {
610 int object = sd->object;
654 int object = sd->object;
705 float m_from[16], m_to[16];
726 else if (!p_in_derivs) {
753 else if (vectype == 3 ) {
761 else if (vectype == 4 ) {
818 const unsigned char type_basetype = type & 0xF;
819 const unsigned char type_aggregate = (type >> 8) & 0xF;
820 const int type_arraylen = type >> 32;
822 if (type_basetype == 11 ) {
823 if ((type_aggregate == 2 ) || (type_aggregate == 1 && type_arraylen == 2))
825 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
826 static_cast<ccl_private float *
>(val)[i * 2 + 0] = fval[i];
827 static_cast<ccl_private float *
>(val)[i * 2 + 1] = fval[i];
831 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
833 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
834 static_cast<ccl_private float *
>(val)[i * 3 + 0] = fval[i];
835 static_cast<ccl_private float *
>(val)[i * 3 + 1] = fval[i];
836 static_cast<ccl_private float *
>(val)[i * 3 + 2] = fval[i];
840 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
842 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
843 static_cast<ccl_private float *
>(val)[i * 4 + 0] = fval[i];
844 static_cast<ccl_private float *
>(val)[i * 4 + 1] = fval[i];
845 static_cast<ccl_private float *
>(val)[i * 4 + 2] = fval[i];
846 static_cast<ccl_private float *
>(val)[i * 4 + 3] = 1.0f;
850 if ((type_aggregate == 1 )) {
851 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
852 static_cast<ccl_private float *
>(val)[i] = fval[i];
878 const unsigned char type_basetype = type & 0xF;
879 const unsigned char type_aggregate = (type >> 8) & 0xF;
880 const int type_arraylen = type >> 32;
882 if (type_basetype == 11 ) {
883 if ((type_aggregate == 2 ) || (type_aggregate == 1 && type_arraylen == 2))
885 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
886 static_cast<ccl_private float *
>(val)[i * 2 + 0] = fval[i].x;
887 static_cast<ccl_private float *
>(val)[i * 2 + 1] = fval[i].y;
891 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
893 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
894 static_cast<ccl_private float *
>(val)[i * 3 + 0] = fval[i].x;
895 static_cast<ccl_private float *
>(val)[i * 3 + 1] = fval[i].y;
896 static_cast<ccl_private float *
>(val)[i * 3 + 2] = 0.0f;
900 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
902 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
903 static_cast<ccl_private float *
>(val)[i * 4 + 0] = fval[i].x;
904 static_cast<ccl_private float *
>(val)[i * 4 + 1] = fval[i].y;
905 static_cast<ccl_private float *
>(val)[i * 4 + 2] = 0.0f;
906 static_cast<ccl_private float *
>(val)[i * 4 + 3] = 1.0f;
910 if ((type_aggregate == 1 )) {
911 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
912 static_cast<ccl_private float *
>(val)[i] = fval[i].x;
925 const unsigned char type_basetype = type & 0xF;
926 const unsigned char type_aggregate = (type >> 8) & 0xF;
927 const int type_arraylen = type >> 32;
929 if (type_basetype == 11 ) {
930 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
932 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
933 static_cast<ccl_private float *
>(val)[i * 3 + 0] = fval[i].x;
934 static_cast<ccl_private float *
>(val)[i * 3 + 1] = fval[i].y;
935 static_cast<ccl_private float *
>(val)[i * 3 + 2] = fval[i].
z;
939 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
941 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
942 static_cast<ccl_private float *
>(val)[i * 4 + 0] = fval[i].x;
943 static_cast<ccl_private float *
>(val)[i * 4 + 1] = fval[i].y;
944 static_cast<ccl_private float *
>(val)[i * 4 + 2] = fval[i].
z;
945 static_cast<ccl_private float *
>(val)[i * 4 + 3] = 1.0f;
949 if ((type_aggregate == 1 )) {
950 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
977 const unsigned char type_basetype = type & 0xF;
978 const unsigned char type_aggregate = (type >> 8) & 0xF;
979 const int type_arraylen = type >> 32;
981 if (type_basetype == 11 ) {
982 if ((type_aggregate == 3 ) || (type_aggregate == 1 && type_arraylen == 3))
984 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
985 static_cast<ccl_private float *
>(val)[i * 3 + 0] = fval[i].x;
986 static_cast<ccl_private float *
>(val)[i * 3 + 1] = fval[i].y;
987 static_cast<ccl_private float *
>(val)[i * 3 + 2] = fval[i].
z;
991 if ((type_aggregate == 4 ) || (type_aggregate == 1 && type_arraylen == 4))
993 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
994 static_cast<ccl_private float *
>(val)[i * 4 + 0] = fval[i].x;
995 static_cast<ccl_private float *
>(val)[i * 4 + 1] = fval[i].y;
996 static_cast<ccl_private float *
>(val)[i * 4 + 2] = fval[i].
z;
997 static_cast<ccl_private float *
>(val)[i * 4 + 3] = fval[i].
w;
1001 if ((type_aggregate == 1 )) {
1002 for (
int i = 0; i < (derivatives ? 3 : 1); ++i) {
1015 const unsigned char type_basetype = type & 0xF;
1016 const unsigned char type_aggregate = (type >> 8) & 0xF;
1018 if (type_basetype == 11 && type_aggregate == 16 ) {
1035 float f = sd->ray_length;
1052 if (primitive_is_volume_attribute(sd, desc))
1053 fval[0] = primitive_volume_attribute_float(kg, sd, desc);
1057 kg, sd, desc, derivatives ? &fval[1] :
nullptr, derivatives ? &fval[2] :
nullptr);
1063 if (primitive_is_volume_attribute(sd, desc))
1068 kg, sd, desc, derivatives ? &fval[1] :
nullptr, derivatives ? &fval[2] :
nullptr);
1074 if (primitive_is_volume_attribute(sd, desc))
1075 fval[0] = primitive_volume_attribute_float3(kg, sd, desc);
1079 kg, sd, desc, derivatives ? &fval[1] :
nullptr, derivatives ? &fval[2] :
nullptr);
1085 if (primitive_is_volume_attribute(sd, desc))
1086 fval[0] = primitive_volume_attribute_float4(kg, sd, desc);
1090 kg, sd, desc, derivatives ? &fval[1] :
nullptr, derivatives ? &fval[2] :
nullptr);
1221 float f = curve_thickness(kg, sd);
1225 float3 f = curve_tangent_normal(kg, sd);
1229 float f = curve_random(kg, sd);
1234#ifdef __POINTCLOUD__
1241 float f = point_radius(kg, sd);
1245 float3 f = point_position(kg, sd);
1249 float f = point_random(kg, sd);
1285 object = sd->object;
1301 int userdata_has_derivs,
1303 int symbol_has_derivs,
1305 int symbol_data_size,
1374#define OSL_NOISE_IMPL(name, op) \
1375 ccl_device_extern float name##_ff(float x) \
1377 return op##_1d(x); \
1379 ccl_device_extern float name##_fff(float x, float y) \
1381 return op##_2d(make_float2(x, y)); \
1383 ccl_device_extern float name##_fv(ccl_private const float3 *v) \
1385 return op##_3d(*v); \
1387 ccl_device_extern float name##_fvf(ccl_private const float3 *v, float w) \
1389 return op##_4d(make_float4(v->x, v->y, v->z, w)); \
1391 ccl_device_extern void name##_vf(ccl_private float3 *res, float x) \
1395 const float n = name##_ff(x); \
1400 ccl_device_extern void name##_vff(ccl_private float3 *res, float x, float y) \
1402 const float n = name##_fff(x, y); \
1407 ccl_device_extern void name##_vv(ccl_private float3 *res, ccl_private const float3 *v) \
1409 const float n = name##_fv(v); \
1414 ccl_device_extern void name##_vvf( \
1415 ccl_private float3 *res, ccl_private const float3 *v, float w) \
1417 const float n = name##_fvf(v, w); \
1422 ccl_device_extern void name##_dfdf(ccl_private float *res, ccl_private const float *x) \
1424 res[0] = name##_ff(x[0]); \
1425 res[1] = name##_ff(x[1]); \
1426 res[2] = name##_ff(x[2]); \
1428 ccl_device_extern void name##_dfdff( \
1429 ccl_private float *res, ccl_private const float *x, float y) \
1431 res[0] = name##_fff(x[0], y); \
1432 res[1] = name##_fff(x[1], y); \
1433 res[2] = name##_fff(x[2], y); \
1435 ccl_device_extern void name##_dffdf( \
1436 ccl_private float *res, float x, ccl_private const float *y) \
1438 res[0] = name##_fff(x, y[0]); \
1439 res[1] = name##_fff(x, y[1]); \
1440 res[2] = name##_fff(x, y[2]); \
1442 ccl_device_extern void name##_dfdfdf( \
1443 ccl_private float *res, ccl_private const float *x, ccl_private const float *y) \
1445 res[0] = name##_fff(x[0], y[0]); \
1446 res[1] = name##_fff(x[1], y[1]); \
1447 res[2] = name##_fff(x[2], y[2]); \
1449 ccl_device_extern void name##_dfdv(ccl_private float *res, ccl_private const float3 *v) \
1451 res[0] = name##_fv(&v[0]); \
1452 res[1] = name##_fv(&v[1]); \
1453 res[2] = name##_fv(&v[2]); \
1455 ccl_device_extern void name##_dfdvf( \
1456 ccl_private float *res, ccl_private const float3 *v, float w) \
1458 res[0] = name##_fvf(&v[0], w); \
1459 res[1] = name##_fvf(&v[1], w); \
1460 res[2] = name##_fvf(&v[2], w); \
1462 ccl_device_extern void name##_dfvdf( \
1463 ccl_private float *res, ccl_private const float3 *v, ccl_private const float *w) \
1465 res[0] = name##_fvf(v, w[0]); \
1466 res[1] = name##_fvf(v, w[1]); \
1467 res[2] = name##_fvf(v, w[2]); \
1469 ccl_device_extern void name##_dfdvdf( \
1470 ccl_private float *res, ccl_private const float3 *v, ccl_private const float *w) \
1472 res[0] = name##_fvf(&v[0], w[0]); \
1473 res[1] = name##_fvf(&v[1], w[1]); \
1474 res[2] = name##_fvf(&v[2], w[2]); \
1476 ccl_device_extern void name##_dvdf(ccl_private float3 *res, ccl_private const float *x) \
1478 name##_vf(&res[0], x[0]); \
1479 name##_vf(&res[1], x[1]); \
1480 name##_vf(&res[2], x[2]); \
1482 ccl_device_extern void name##_dvdff( \
1483 ccl_private float3 *res, ccl_private const float *x, float y) \
1485 name##_vff(&res[0], x[0], y); \
1486 name##_vff(&res[1], x[1], y); \
1487 name##_vff(&res[2], x[2], y); \
1489 ccl_device_extern void name##_dvfdf( \
1490 ccl_private float3 *res, float x, ccl_private const float *y) \
1492 name##_vff(&res[0], x, y[0]); \
1493 name##_vff(&res[1], x, y[1]); \
1494 name##_vff(&res[2], x, y[2]); \
1496 ccl_device_extern void name##_dvdfdf( \
1497 ccl_private float3 *res, ccl_private const float *x, ccl_private const float *y) \
1499 name##_vff(&res[0], x[0], y[0]); \
1500 name##_vff(&res[1], x[1], y[1]); \
1501 name##_vff(&res[2], x[2], y[2]); \
1503 ccl_device_extern void name##_dvdv(ccl_private float3 *res, ccl_private const float3 *v) \
1505 name##_vv(&res[0], &v[0]); \
1506 name##_vv(&res[1], &v[1]); \
1507 name##_vv(&res[2], &v[2]); \
1509 ccl_device_extern void name##_dvdvf( \
1510 ccl_private float3 *res, ccl_private const float3 *v, float w) \
1512 name##_vvf(&res[0], &v[0], w); \
1513 name##_vvf(&res[1], &v[1], w); \
1514 name##_vvf(&res[2], &v[2], w); \
1516 ccl_device_extern void name##_dvvdf( \
1517 ccl_private float3 *res, ccl_private const float3 *v, ccl_private const float *w) \
1519 name##_vvf(&res[0], v, w[0]); \
1520 name##_vvf(&res[1], v, w[1]); \
1521 name##_vvf(&res[2], v, w[2]); \
1523 ccl_device_extern void name##_dvdvdf( \
1524 ccl_private float3 *res, ccl_private const float3 *v, ccl_private const float *w) \
1526 name##_vvf(&res[0], &v[0], w[0]); \
1527 name##_vvf(&res[1], &v[1], w[1]); \
1528 name##_vvf(&res[2], &v[2], w[2]); \
1534 return hash_uint(x) /
static_cast<float>(~0u);
1540 return hash_uint2(x, y) /
static_cast<float>(~0u);
1547 return hash_uint3(x, y,
z) /
static_cast<float>(~0u);
1555 return hash_uint4(x, y,
z,
w) /
static_cast<float>(~0u);
1565#include "kernel/util/ies.h"
1648 if (nchannels > 0) {
1651 if (nchannels > 1) {
1654 if (nchannels > 2) {
1663 if (nchannels > 0) {
1697 if (nchannels > 0) {
1700 if (nchannels > 1) {
1703 if (nchannels > 2) {
1733 if (nchannels > 0) {
1736 if (nchannels > 1) {
1739 if (nchannels > 2) {
1775 sg, filename, texture_handle, dataname, basetype, arraylen, aggegrate, data, errormessage);
1780#define OSL_OP_IMPL_II(name, op) \
1781 ccl_device_extern int name##_ii(int a) \
1785#define OSL_OP_IMPL_IF(name, op) \
1786 ccl_device_extern int name##_if(float a) \
1790#define OSL_OP_IMPL_FF(name, op) \
1791 ccl_device_extern float name##_ff(float a) \
1795#define OSL_OP_IMPL_DFDF(name, op) \
1796 ccl_device_extern void name##_dfdf(ccl_private float *res, ccl_private const float *a) \
1798 for (int i = 0; i < 3; ++i) { \
1799 res[i] = op(a[i]); \
1802#define OSL_OP_IMPL_DFDV(name, op) \
1803 ccl_device_extern void name##_dfdv(ccl_private float *res, ccl_private const float3 *a) \
1805 for (int i = 0; i < 3; ++i) { \
1806 res[i] = op(a[i]); \
1809#define OSL_OP_IMPL_FV(name, op) \
1810 ccl_device_extern float name##_fv(ccl_private const float3 *a) \
1814#define OSL_OP_IMPL_VV(name, op) \
1815 ccl_device_extern void name##_vv(ccl_private float3 *res, ccl_private const float3 *a) \
1819#define OSL_OP_IMPL_VV_(name, op) \
1820 ccl_device_extern void name##_vv(ccl_private float3 *res, ccl_private const float3 *a) \
1822 res->x = op(a->x); \
1823 res->y = op(a->y); \
1824 res->z = op(a->z); \
1826#define OSL_OP_IMPL_DVDV(name, op) \
1827 ccl_device_extern void name##_dvdv(ccl_private float3 *res, ccl_private const float3 *a) \
1829 for (int i = 0; i < 3; ++i) { \
1830 res[i] = op(a[i]); \
1833#define OSL_OP_IMPL_DVDV_(name, op) \
1834 ccl_device_extern void name##_dvdv(ccl_private float3 *res, ccl_private const float3 *a) \
1836 for (int i = 0; i < 3; ++i) { \
1837 res[i].x = op(a[i].x); \
1838 res[i].y = op(a[i].y); \
1839 res[i].z = op(a[i].z); \
1843#define OSL_OP_IMPL_III(name, op) \
1844 ccl_device_extern int name##_iii(int a, int b) \
1848#define OSL_OP_IMPL_FFF(name, op) \
1849 ccl_device_extern float name##_fff(float a, float b) \
1853#define OSL_OP_IMPL_FVV(name, op) \
1854 ccl_device_extern float name##_fvv(ccl_private const float3 *a, ccl_private const float3 *b) \
1856 return op(*a, *b); \
1858#define OSL_OP_IMPL_DFFDF(name, op) \
1859 ccl_device_extern void name##_dffdf( \
1860 ccl_private float *res, float a, ccl_private const float *b) \
1862 for (int i = 0; i < 3; ++i) { \
1863 res[i] = op(a, b[i]); \
1866#define OSL_OP_IMPL_DFDFF(name, op) \
1867 ccl_device_extern void name##_dfdff( \
1868 ccl_private float *res, ccl_private const float *a, float b) \
1870 for (int i = 0; i < 3; ++i) { \
1871 res[i] = op(a[i], b); \
1874#define OSL_OP_IMPL_DFDFDF(name, op) \
1875 ccl_device_extern void name##_dfdfdf( \
1876 ccl_private float *res, ccl_private const float *a, ccl_private const float *b) \
1878 for (int i = 0; i < 3; ++i) { \
1879 res[i] = op(a[i], b[i]); \
1882#define OSL_OP_IMPL_DFVDV(name, op) \
1883 ccl_device_extern void name##_dfvdv( \
1884 ccl_private float *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1886 for (int i = 0; i < 3; ++i) { \
1887 res[i] = op(a[0], b[i]); \
1890#define OSL_OP_IMPL_DFDVV(name, op) \
1891 ccl_device_extern void name##_dfdvv( \
1892 ccl_private float *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1894 for (int i = 0; i < 3; ++i) { \
1895 res[i] = op(a[i], b[0]); \
1898#define OSL_OP_IMPL_DFDVDV(name, op) \
1899 ccl_device_extern void name##_dfdvdv( \
1900 ccl_private float *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1902 for (int i = 0; i < 3; ++i) { \
1903 res[i] = op(a[i], b[i]); \
1906#define OSL_OP_IMPL_VVF_(name, op) \
1907 ccl_device_extern void name##_vvf( \
1908 ccl_private float3 *res, ccl_private const float3 *a, float b) \
1910 res->x = op(a->x, b); \
1911 res->y = op(a->y, b); \
1912 res->z = op(a->z, b); \
1914#define OSL_OP_IMPL_VVV(name, op) \
1915 ccl_device_extern void name##_vvv( \
1916 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1918 *res = op(*a, *b); \
1920#define OSL_OP_IMPL_VVV_(name, op) \
1921 ccl_device_extern void name##_vvv( \
1922 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1924 res->x = op(a->x, b->x); \
1925 res->y = op(a->y, b->y); \
1926 res->z = op(a->z, b->z); \
1928#define OSL_OP_IMPL_DVVDF_(name, op) \
1929 ccl_device_extern void name##_dvvdf( \
1930 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float *b) \
1932 for (int i = 0; i < 3; ++i) { \
1933 res[i].x = op(a[0].x, b[i]); \
1934 res[i].y = op(a[0].y, b[i]); \
1935 res[i].z = op(a[0].z, b[i]); \
1938#define OSL_OP_IMPL_DVDVF_(name, op) \
1939 ccl_device_extern void name##_dvdvf( \
1940 ccl_private float3 *res, ccl_private const float3 *a, float b) \
1942 for (int i = 0; i < 3; ++i) { \
1943 res[i].x = op(a[i].x, b); \
1944 res[i].y = op(a[i].y, b); \
1945 res[i].z = op(a[i].z, b); \
1948#define OSL_OP_IMPL_DVVDV(name, op) \
1949 ccl_device_extern void name##_dvvdv( \
1950 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1952 for (int i = 0; i < 3; ++i) { \
1953 res[i] = op(a[0], b[i]); \
1956#define OSL_OP_IMPL_DVVDV_(name, op) \
1957 ccl_device_extern void name##_dvvdv( \
1958 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1960 for (int i = 0; i < 3; ++i) { \
1961 res[i].x = op(a[0].x, b[i].x); \
1962 res[i].y = op(a[0].y, b[i].y); \
1963 res[i].z = op(a[0].z, b[i].z); \
1966#define OSL_OP_IMPL_DVDVV(name, op) \
1967 ccl_device_extern void name##_dvdvv( \
1968 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1970 for (int i = 0; i < 3; ++i) { \
1971 res[i] = op(a[i], b[0]); \
1974#define OSL_OP_IMPL_DVDVV_(name, op) \
1975 ccl_device_extern void name##_dvdvv( \
1976 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1978 for (int i = 0; i < 3; ++i) { \
1979 res[i].x = op(a[i].x, b[0].x); \
1980 res[i].y = op(a[i].y, b[0].y); \
1981 res[i].z = op(a[i].z, b[0].z); \
1984#define OSL_OP_IMPL_DVDVDF_(name, op) \
1985 ccl_device_extern void name##_dvdvdf( \
1986 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float *b) \
1988 for (int i = 0; i < 3; ++i) { \
1989 res[i].x = op(a[i].x, b[i]); \
1990 res[i].y = op(a[i].y, b[i]); \
1991 res[i].z = op(a[i].z, b[i]); \
1994#define OSL_OP_IMPL_DVDVDV(name, op) \
1995 ccl_device_extern void name##_dvdvdv( \
1996 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
1998 for (int i = 0; i < 3; ++i) { \
1999 res[i] = op(a[i], b[i]); \
2002#define OSL_OP_IMPL_DVDVDV_(name, op) \
2003 ccl_device_extern void name##_dvdvdv( \
2004 ccl_private float3 *res, ccl_private const float3 *a, ccl_private const float3 *b) \
2006 for (int i = 0; i < 3; ++i) { \
2007 res[i].x = op(a[i].x, b[i].x); \
2008 res[i].y = op(a[i].y, b[i].y); \
2009 res[i].z = op(a[i].z, b[i].z); \
2013#define OSL_OP_IMPL_FFFF(name, op) \
2014 ccl_device_extern float name##_ffff(float a, float b, float c) \
2016 return op(a, b, c); \
2018#define OSL_OP_IMPL_DFFFDF(name, op) \
2019 ccl_device_extern void name##_dfffdf( \
2020 ccl_private float *res, float a, float b, ccl_private const float *c) \
2022 for (int i = 0; i < 3; ++i) { \
2023 res[i] = op(a, b, c[i]); \
2026#define OSL_OP_IMPL_DFFDFF(name, op) \
2027 ccl_device_extern void name##_dffdff( \
2028 ccl_private float *res, float a, ccl_private const float *b, float c) \
2030 for (int i = 0; i < 3; ++i) { \
2031 res[i] = op(a, b[i], c); \
2034#define OSL_OP_IMPL_DFFDFDF(name, op) \
2035 ccl_device_extern void name##_dffdfdf( \
2036 ccl_private float *res, float a, ccl_private const float *b, ccl_private const float *c) \
2038 for (int i = 0; i < 3; ++i) { \
2039 res[i] = op(a, b[i], c[i]); \
2043#define OSL_OP_IMPL_DFDFFF(name, op) \
2044 ccl_device_extern void name##_dfdfff( \
2045 ccl_private float *res, ccl_private const float *a, float b, float c) \
2047 for (int i = 0; i < 3; ++i) { \
2048 res[i] = op(a[i], b, c); \
2051#define OSL_OP_IMPL_DFDFFDF(name, op) \
2052 ccl_device_extern void name##_dfdffdf( \
2053 ccl_private float *res, ccl_private const float *a, float b, ccl_private const float *c) \
2055 for (int i = 0; i < 3; ++i) { \
2056 res[i] = op(a[i], b, c[i]); \
2059#define OSL_OP_IMPL_DFDFDFF(name, op) \
2060 ccl_device_extern void name##_dfdfdff( \
2061 ccl_private float *res, ccl_private const float *a, ccl_private const float *b, float c) \
2063 for (int i = 0; i < 3; ++i) { \
2064 res[i] = op(a[i], b[i], c); \
2067#define OSL_OP_IMPL_DFDFDFDF(name, op) \
2068 ccl_device_extern void name##_dfdfdfdf(ccl_private float *res, \
2069 ccl_private const float *a, \
2070 ccl_private const float *b, \
2071 ccl_private const float *c) \
2073 for (int i = 0; i < 3; ++i) { \
2074 res[i] = op(a[i], b[i], c[i]); \
2078#define OSL_OP_IMPL_XX(name, op) \
2079 OSL_OP_IMPL_FF(name, op) \
2080 OSL_OP_IMPL_DFDF(name, op) \
2081 OSL_OP_IMPL_VV_(name, op) \
2082 OSL_OP_IMPL_DVDV_(name, op)
2084#define OSL_OP_IMPL_XXX(name, op) \
2085 OSL_OP_IMPL_FFF(name, op) \
2086 OSL_OP_IMPL_DFFDF(name, op) \
2087 OSL_OP_IMPL_DFDFF(name, op) \
2088 OSL_OP_IMPL_DFDFDF(name, op) \
2089 OSL_OP_IMPL_VVV_(name, op) \
2090 OSL_OP_IMPL_DVVDV_(name, op) \
2091 OSL_OP_IMPL_DVDVV_(name, op) \
2092 OSL_OP_IMPL_DVDVDV_(name, op)
2107 return (
b != 0) ? a /
b : 0;
2111 return (
b != 0) ? a %
b : 0;
2126 for (
int i = 0; i < 3; ++i) {
2127 sincos(a[i],
b + i, c);
2134 for (
int i = 0; i < 3; ++i) {
2135 sincos(a[i],
b, c + i);
2142 for (
int i = 0; i < 3; ++i) {
2143 sincos(a[i],
b + i, c + i);
2150 sincos(a->x, &
b->x, &c->x);
2151 sincos(a->y, &
b->y, &c->y);
2152 sincos(a->z, &
b->z, &c->z);
2158 for (
int i = 0; i < 3; ++i) {
2159 sincos(a[i].x, &
b[i].x, &c->x);
2160 sincos(a[i].y, &
b[i].y, &c->y);
2161 sincos(a[i].
z, &
b[i].
z, &c->z);
2168 for (
int i = 0; i < 3; ++i) {
2169 sincos(a[i].x, &
b->x, &c[i].x);
2170 sincos(a[i].y, &
b->y, &c[i].y);
2171 sincos(a[i].
z, &
b->z, &c[i].z);
2178 for (
int i = 0; i < 3; ++i) {
2179 sincos(a[i].x, &
b[i].x, &c[i].x);
2180 sincos(a[i].y, &
b[i].y, &c[i].y);
2181 sincos(a[i].
z, &
b[i].
z, &c[i].
z);
2218 return x < edge ? 0.0f : 1.0f;
2270 if (sg->flipHandedness) {
2271 *res =
cross(p[2], p[1]);
2274 *res =
cross(p[1], p[2]);
2285 return sqrtf(x[1] * x[1] + x[2] * x[2]);
2290 for (
int i = 0; i < 3; ++i) {
2297 return (sg->raytype & bit) != 0;
MINLINE float safe_powf(float base, float exponent)
void rgb_to_hsl(float r, float g, float b, float *r_h, float *r_s, float *r_l)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
void hsl_to_rgb(float h, float s, float l, float *r_r, float *r_g, float *r_b)
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
local_group_size(16, 16) .push_constant(Type b
ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals kg, int id, float3 P, InterpolationType interp)
ccl_device float4 kernel_tex_image_interp(KernelGlobals kg, int id, float x, float y)
const KernelGlobalsCPU *ccl_restrict KernelGlobals
#define ccl_device_forceinline
#define ccl_device_inline
#define ccl_device_extern
#define ccl_device_constant
ccl_device_inline float3 triangle_smooth_normal_unnormalized(KernelGlobals kg, ccl_private const ShaderData *sd, float3 Ng, int prim, float u, float v)
ccl_device_inline uint hash_uint2(uint kx, uint ky)
ccl_device_inline uint hash_uint3(uint kx, uint ky, uint kz)
ccl_device_inline uint hash_uint4(uint kx, uint ky, uint kz, uint kw)
ccl_device_inline uint hash_uint(uint kx)
ccl_device_inline float hash_uint2_to_float(uint kx, uint ky)
ccl_device Transform primitive_attribute_matrix(KernelGlobals kg, const AttributeDescriptor desc)
ccl_device_inline float object_pass_id(KernelGlobals kg, int object)
ccl_device_inline float object_alpha(KernelGlobals kg, int object)
ccl_device float particle_age(KernelGlobals kg, int particle)
ccl_device float4 particle_rotation(KernelGlobals kg, int particle)
ccl_device_inline uint particle_index(KernelGlobals kg, int particle)
ccl_device_inline float3 object_location(KernelGlobals kg, ccl_private const ShaderData *sd)
ccl_device_inline float object_random_number(KernelGlobals kg, int object)
ccl_device float particle_lifetime(KernelGlobals kg, int particle)
ccl_device float3 particle_angular_velocity(KernelGlobals kg, int particle)
ccl_device_inline int object_particle_id(KernelGlobals kg, int object)
ccl_device_inline float3 object_color(KernelGlobals kg, int object)
ccl_device_inline Transform object_get_transform(KernelGlobals kg, ccl_private const ShaderData *sd)
ccl_device int shader_pass_id(KernelGlobals kg, ccl_private const ShaderData *sd)
ccl_device float3 particle_velocity(KernelGlobals kg, int particle)
ccl_device float3 particle_location(KernelGlobals kg, int particle)
ccl_device float particle_size(KernelGlobals kg, int particle)
ccl_device_inline Transform lamp_fetch_transform(KernelGlobals kg, int lamp, bool inverse)
ccl_device_inline float3 object_dupli_generated(KernelGlobals kg, int object)
ccl_device_inline float3 object_dupli_uv(KernelGlobals kg, int object)
ccl_device_inline Transform object_get_inverse_transform(KernelGlobals kg, ccl_private const ShaderData *sd)
#define OSL_TEXTURE_HANDLE_SLOT(handle)
CCL_NAMESPACE_BEGIN typedef const char * DeviceString
#define OSL_TEXTURE_HANDLE_TYPE(handle)
#define OSL_TEXTURE_HANDLE_TYPE_SVM
#define OSL_TEXTURE_HANDLE_TYPE_IES
ccl_device float3 rec709_to_rgb(KernelGlobals kg, float3 rec709)
ccl_device float linear_rgb_to_gray(KernelGlobals kg, float3 c)
ccl_device_inline float kernel_ies_interp(KernelGlobals kg, int slot, float h_angle, float v_angle)
MINLINE float smoothstep(float edge0, float edge1, float x)
MINLINE float compatible_signf(float f)
ccl_device_inline float average(const float2 a)
ccl_device_inline float2 safe_normalize(const float2 a)
ccl_device_inline float cross(const float2 a, const float2 b)
ccl_device_inline float3 one_float3()
CCL_NAMESPACE_BEGIN ccl_device_inline float3 zero_float3()
ccl_device float3 svm_math_wavelength_color_xyz(float lambda_nm)
ccl_device float3 svm_math_blackbody_color_rec709(float t)
ccl_device_constant DeviceString u_particle_rotation
ccl_device_constant DeviceString u_point_position
ccl_device_constant DeviceString u_path_transparent_depth
ccl_device_constant DeviceString u_object_color
ccl_device_constant DeviceString u_is_point
ccl_device_constant DeviceString u_particle_lifetime
ccl_device_constant DeviceString u_geom_numpolyvertices
ccl_device_constant DeviceString u_is_curve
ccl_device_constant DeviceString u_material_index
ccl_device_constant DeviceString u_point_radius
ccl_device_constant DeviceString u_particle_location
ccl_device_constant DeviceString u_object_is_light
ccl_device_constant DeviceString u_path_ray_length
ccl_device_constant DeviceString u_path_diffuse_depth
ccl_device_constant DeviceString u_path_transmission_depth
ccl_device_constant DeviceString u_geom_dupli_uv
ccl_device_constant DeviceString u_object_location
ccl_device_constant DeviceString u_hsv
ccl_device_constant DeviceString u_xyy
ccl_device_constant DeviceString u_particle_age
ccl_device_constant DeviceString u_screen
ccl_device_constant DeviceString _emptystring_
ccl_device_constant DeviceString u_is_smooth
ccl_device_constant DeviceString u_normal_map_normal
ccl_device_constant DeviceString u_path_ray_depth
ccl_device_constant DeviceString u_path_glossy_depth
ccl_device_constant DeviceString u_world
ccl_device_constant DeviceString u_object_alpha
ccl_device_constant DeviceString u_object
ccl_device_constant DeviceString u_particle_velocity
ccl_device_constant DeviceString u_raster
ccl_device_constant DeviceString u_common
ccl_device_constant DeviceString u_camera
ccl_device_constant DeviceString u_curve_length
ccl_device_constant DeviceString u_xyz
ccl_device_constant DeviceString u_particle_index
ccl_device_constant DeviceString u_particle_size
ccl_device_constant DeviceString u_point_random
ccl_device_constant DeviceString u_geom_dupli_generated
ccl_device_constant DeviceString u_particle_angular_velocity
ccl_device_constant DeviceString u_shader
ccl_device_constant DeviceString u_srgb
ccl_device_constant DeviceString u_object_random
ccl_device_constant DeviceString u_ndc
ccl_device_constant DeviceString u_hsl
ccl_device_constant DeviceString u_object_index
ccl_device_constant DeviceString u_curve_tangent_normal
ccl_device_constant DeviceString u_geom_polyvertices
ccl_device_constant DeviceString u_geom_name
ccl_device_constant DeviceString u_curve_thickness
ccl_device_constant DeviceString u_particle_random
ccl_device_constant DeviceString u_geom_undisplaced
ccl_device_constant DeviceString u_curve_random
ccl_device_constant DeviceString u_geom_trianglevertices
color xyY_to_xyz(float x, float y, float Y)
color xyz_to_rgb(float x, float y, float z)
ccl_device_forceinline float3 primitive_surface_attribute_float3(KernelGlobals kg, ccl_private const ShaderData *sd, const AttributeDescriptor desc, ccl_private float3 *dx, ccl_private float3 *dy)
ccl_device_forceinline float2 primitive_surface_attribute_float2(KernelGlobals kg, ccl_private const ShaderData *sd, const AttributeDescriptor desc, ccl_private float2 *dx, ccl_private float2 *dy)
ccl_device_forceinline float4 primitive_surface_attribute_float4(KernelGlobals kg, ccl_private const ShaderData *sd, const AttributeDescriptor desc, ccl_private float4 *dx, ccl_private float4 *dy)
CCL_NAMESPACE_BEGIN ccl_device_forceinline float primitive_surface_attribute_float(KernelGlobals kg, ccl_private const ShaderData *sd, const AttributeDescriptor desc, ccl_private float *dx, ccl_private float *dy)
ccl_device_extern OSLNoiseOptions * osl_get_noise_options(ccl_private ShaderGlobals *sg)
ccl_device_extern bool osl_transformc(ccl_private ShaderGlobals *sg, ccl_private float3 *c_in, int c_in_derivs, ccl_private float3 *c_out, int c_out_derivs, DeviceString from, DeviceString to)
ccl_device_extern void osl_sincos_dvdvv(ccl_private const float3 *a, ccl_private float3 *b, ccl_private float3 *c)
ccl_device_extern void osl_sincos_dfdfdf(ccl_private const float *a, ccl_private float *b, ccl_private float *c)
#define OSL_OP_IMPL_DVDVDV(name, op)
ccl_device_extern void osl_noiseparams_set_bandwidth(ccl_private OSLNoiseOptions *opt, float bandwidth)
ccl_device_forceinline void copy_matrix(ccl_private float *res, const Transform &tfm)
ccl_device_inline bool get_object_attribute(KernelGlobals kg, ccl_private ShaderData *sd, const AttributeDescriptor &desc, TypeDesc type, bool derivatives, ccl_private void *val)
#define OSL_OP_IMPL_FF(name, op)
#define OSL_OP_IMPL_DFDFFDF(name, op)
ccl_device_extern uint osl_range_check_err(int indexvalue, int length, DeviceString symname, ccl_private ShaderGlobals *sg, DeviceString sourcefile, int sourceline, DeviceString groupname, int layer, DeviceString layername, DeviceString shadername)
ccl_device_extern void osl_noiseparams_set_direction(ccl_private OSLNoiseOptions *opt, float3 *direction)
ccl_device_extern uint osl_hash_iv(ccl_private const float3 *v)
ccl_device_forceinline float hashnoise_3d(float3 p)
#define OSL_OP_IMPL_III(name, op)
#define OSL_OP_IMPL_DFFFDF(name, op)
ccl_device_extern bool osl_transform_triple_nonlinear(ccl_private ShaderGlobals *sg, ccl_private float3 *p_in, int p_in_derivs, ccl_private float3 *p_out, int p_out_derivs, DeviceString from, DeviceString to, int vectype)
ccl_device_extern uint osl_hash_ii(int x)
ccl_device_extern void osl_texture_set_stwidth(ccl_private OSLTextureOptions *opt, float width)
ccl_device_extern void osl_texture_set_twrap_code(ccl_private OSLTextureOptions *opt, int mode)
ccl_device_extern void osl_blackbody_vf(ccl_private ShaderGlobals *sg, ccl_private float3 *result, float temperature)
ccl_device_extern void osl_prepend_color_from(ccl_private ShaderGlobals *sg, ccl_private float3 *res, DeviceString from)
#define OSL_OP_IMPL_VV_(name, op)
ccl_device_extern void osl_texture_set_tblur(ccl_private OSLTextureOptions *opt, float blur)
#define OSL_OP_IMPL_VV(name, op)
ccl_device_extern void osl_texture_set_stwrap_code(ccl_private OSLTextureOptions *opt, int mode)
ccl_device_extern void osl_mul_mmf(ccl_private float *res, ccl_private const float *a, float b)
ccl_device_extern void osl_texture_set_stblur(ccl_private OSLTextureOptions *opt, float blur)
ccl_device_extern ccl_private OSLClosure * osl_add_closure_closure(ccl_private ShaderGlobals *sg, ccl_private OSLClosure *a, ccl_private OSLClosure *b)
ccl_device_extern void osl_sincos_dffdf(ccl_private const float *a, ccl_private float *b, ccl_private float *c)
#define OSL_OP_IMPL_DFDFDFDF(name, op)
#define OSL_OP_IMPL_XX(name, op)
ccl_device_extern uint osl_hash_iff(float x, float y)
ccl_device_extern ccl_private OSLClosure * osl_allocate_weighted_closure_component(ccl_private ShaderGlobals *sg, int id, int size, ccl_private const float3 *weight)
ccl_device_extern void osl_sincos_vvv(ccl_private const float3 *a, ccl_private float3 *b, ccl_private float3 *c)
ccl_device_extern bool osl_get_textureinfo_st(ccl_private ShaderGlobals *sg, DeviceString filename, ccl_private void *texture_handle, float s, float t, DeviceString dataname, int basetype, int arraylen, int aggegrate, ccl_private void *data, ccl_private void *errormessage)
ccl_device_extern void osl_transpose_mm(ccl_private float *res, ccl_private const float *m)
ccl_device_extern void osl_printf(ccl_private ShaderGlobals *sg, const char *format, void *args)
#define OSL_OP_IMPL_VVV(name, op)
#define OSL_OP_IMPL_FV(name, op)
ccl_device_extern void osl_texture_set_sblur(ccl_private OSLTextureOptions *opt, float blur)
ccl_device_extern void osl_texture_set_time(ccl_private OSLTextureOptions *opt, float time)
ccl_device_forceinline float step_impl(float edge, float x)
ccl_device_extern void osl_sincos_dvvdv(ccl_private const float3 *a, ccl_private float3 *b, ccl_private float3 *c)
#define OSL_OP_IMPL_DFDFFF(name, op)
ccl_device_extern float osl_filterwidth_fdf(ccl_private const float *x)
ccl_device_extern bool osl_texture3d(ccl_private ShaderGlobals *sg, DeviceString filename, ccl_private void *texture_handle, ccl_private OSLTextureOptions *opt, ccl_private const float3 *P, ccl_private const float3 *dPdx, ccl_private const float3 *dPdy, ccl_private const float3 *dPdz, int nchannels, ccl_private float *result, ccl_private float *dresultds, ccl_private float *dresultdt, ccl_private float *alpha, ccl_private float *dalphadx, ccl_private float *dalphady, ccl_private void *errormessage)
#define OSL_OP_IMPL_FFF(name, op)
ccl_device_extern bool osl_transform_triple(ccl_private ShaderGlobals *sg, ccl_private float3 *p_in, int p_in_derivs, ccl_private float3 *p_out, int p_out_derivs, DeviceString from, DeviceString to, int vectype)
ccl_device_inline bool set_attribute_matrix(ccl_private const Transform &tfm, TypeDesc type, ccl_private void *val)
ccl_device_extern bool osl_get_from_to_matrix(ccl_private ShaderGlobals *sg, ccl_private float *res, DeviceString from, DeviceString to)
ccl_device_forceinline Transform convert_transform(ccl_private const float *m)
ccl_device_extern void osl_noiseparams_set_anisotropic(ccl_private OSLNoiseOptions *opt, int anisotropic)
#define OSL_OP_IMPL_FFFF(name, op)
ccl_device_extern ccl_private OSLClosure * osl_allocate_closure_component(ccl_private ShaderGlobals *sg, int id, int size)
ccl_device_extern bool osl_texture(ccl_private ShaderGlobals *sg, DeviceString filename, ccl_private void *texture_handle, ccl_private OSLTextureOptions *opt, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy, int nchannels, ccl_private float *result, ccl_private float *dresultdx, ccl_private float *dresultdy, ccl_private float *alpha, ccl_private float *dalphadx, ccl_private float *dalphady, ccl_private void *errormessage)
#define OSL_OP_IMPL_VVF_(name, op)
ccl_device_extern bool osl_raytype_bit(ccl_private ShaderGlobals *sg, int bit)
#define OSL_NOISE_IMPL(name, op)
ccl_device_extern void osl_texture_set_rwidth(ccl_private OSLTextureOptions *opt, float width)
ccl_device_extern void osl_luminance_dfdv(ccl_private ShaderGlobals *sg, ccl_private float *result, ccl_private float3 *color)
ccl_device_extern bool osl_get_inverse_matrix(ccl_private ShaderGlobals *sg, ccl_private float *res, DeviceString to)
ccl_device_extern ccl_private OSLClosure * osl_mul_closure_float(ccl_private ShaderGlobals *sg, ccl_private OSLClosure *a, float weight)
ccl_device_extern void osl_texture_set_rblur(ccl_private OSLTextureOptions *opt, float blur)
ccl_device_inline bool set_attribute_float2(ccl_private float2 fval[3], TypeDesc type, bool derivatives, ccl_private void *val)
#define OSL_OP_IMPL_DFDVV(name, op)
ccl_device_extern uint osl_hash_if(float x)
#define OSL_OP_IMPL_XXX(name, op)
ccl_device_extern uint osl_range_check(int indexvalue, int length, DeviceString symname, ccl_private ShaderGlobals *sg, DeviceString sourcefile, int sourceline, DeviceString groupname, int layer, DeviceString layername, DeviceString shadername)
#define OSL_OP_IMPL_FVV(name, op)
#define OSL_OP_IMPL_DFDVDV(name, op)
ccl_device_extern bool osl_get_textureinfo(ccl_private ShaderGlobals *sg, DeviceString filename, ccl_private void *texture_handle, DeviceString dataname, int basetype, int arraylen, int aggegrate, ccl_private void *data, ccl_private void *errormessage)
ccl_device_extern void osl_div_mfm(ccl_private float *res, float a, ccl_private const float *b)
ccl_device_extern ccl_private OSLTextureOptions * osl_get_texture_options(ccl_private ShaderGlobals *sg)
ccl_device_inline bool get_background_attribute(KernelGlobals kg, ccl_private ShaderData *sd, DeviceString name, TypeDesc type, bool derivatives, ccl_private void *val)
#define OSL_OP_IMPL_DFFDFF(name, op)
ccl_device_forceinline int safe_modulo(int a, int b)
#define OSL_OP_IMPL_VVV_(name, op)
ccl_device_extern void osl_texture_set_missingcolor_arena(ccl_private OSLTextureOptions *opt, ccl_private float3 *color)
ccl_device_extern void osl_texture_set_firstchannel(ccl_private OSLTextureOptions *opt, int firstchannel)
ccl_device_inline bool set_attribute_float(ccl_private float fval[3], TypeDesc type, bool derivatives, ccl_private void *val)
#define OSL_OP_IMPL_DVDVV(name, op)
ccl_device_inline bool get_object_standard_attribute(KernelGlobals kg, ccl_private ShaderData *sd, DeviceString name, TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_extern bool osl_prepend_matrix_from(ccl_private ShaderGlobals *sg, ccl_private float *res, DeviceString from)
#define OSL_OP_IMPL_DFFDFDF(name, op)
ccl_device_extern void osl_calculatenormal(ccl_private float3 *res, ccl_private ShaderGlobals *sg, ccl_private const float3 *p)
ccl_device_extern void osl_sincos_dfdff(ccl_private const float *a, ccl_private float *b, ccl_private float *c)
ccl_device_extern void osl_texture_set_fill(ccl_private OSLTextureOptions *opt, float fill)
ccl_device_extern void osl_wavelength_color_vf(ccl_private ShaderGlobals *sg, ccl_private float3 *result, float lambda_nm)
#define OSL_OP_IMPL_DFVDV(name, op)
ccl_device_extern void osl_warning(ccl_private ShaderGlobals *sg, const char *format, void *args)
ccl_device_extern void osl_noiseparams_set_do_filter(ccl_private OSLNoiseOptions *opt, int do_filter)
ccl_device_extern void osl_texture_set_missingcolor_alpha(ccl_private OSLTextureOptions *opt, int nchannels, float alpha)
ccl_device_extern void osl_transform_vmv(ccl_private float3 *res, ccl_private const float *m, ccl_private const float3 *v)
ccl_device_extern void osl_texture_set_twidth(ccl_private OSLTextureOptions *opt, float width)
ccl_device_forceinline float hashnoise_1d(float p)
ccl_device_extern void osl_noiseparams_set_impulses(ccl_private OSLNoiseOptions *opt, float impulses)
#define OSL_OP_IMPL_IF(name, op)
ccl_device_extern void osl_texture_set_rwrap_code(ccl_private OSLTextureOptions *opt, int mode)
ccl_device_extern void osl_sincos_dvdvdv(ccl_private const float3 *a, ccl_private float3 *b, ccl_private float3 *c)
#define OSL_OP_IMPL_DVDVDF_(name, op)
#define OSL_OP_IMPL_DVVDF_(name, op)
ccl_device_extern void osl_div_mmm(ccl_private float *res, ccl_private const float *a, ccl_private const float *b)
#define OSL_OP_IMPL_DVDV(name, op)
ccl_device_extern void osl_transformv_vmv(ccl_private float3 *res, ccl_private const float *m, ccl_private const float3 *v)
ccl_device_extern void osl_filterwidth_vdv(ccl_private float *res, ccl_private const float *x)
ccl_device_extern float osl_area(ccl_private const float3 *p)
ccl_device_inline bool set_attribute_float3(ccl_private float3 fval[3], TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_extern void osl_texture_set_swidth(ccl_private OSLTextureOptions *opt, float width)
ccl_device_extern void osl_texture_set_interp_code(ccl_private OSLTextureOptions *opt, int mode)
#define OSL_OP_IMPL_DFDFDFF(name, op)
ccl_device_extern void osl_transformn_vmv(ccl_private float3 *res, ccl_private const float *m, ccl_private const float3 *v)
#define OSL_OP_IMPL_II(name, op)
ccl_device_extern void osl_div_m_ff(ccl_private float *res, float a, float b)
#define OSL_OP_IMPL_DVDVF_(name, op)
ccl_device_extern void osl_mul_mmm(ccl_private float *res, ccl_private const float *a, ccl_private const float *b)
ccl_device_extern void osl_luminance_fv(ccl_private ShaderGlobals *sg, ccl_private float *result, ccl_private float3 *color)
ccl_device_inline bool set_attribute_float4(ccl_private float4 fval[3], TypeDesc type, bool derivatives, ccl_private void *val)
ccl_device_extern void osl_transformn_dvmdv(ccl_private float3 *res, ccl_private const float *m, ccl_private const float3 *v)
ccl_device_extern void osl_texture_set_swrap_code(ccl_private OSLTextureOptions *opt, int mode)
ccl_device_forceinline float hashnoise_4d(float4 p)
ccl_device_extern ccl_private OSLClosure * osl_mul_closure_color(ccl_private ShaderGlobals *sg, ccl_private OSLClosure *a, ccl_private const float3 *weight)
ccl_device_extern void osl_div_mmf(ccl_private float *res, ccl_private const float *a, float b)
ccl_device_extern void osl_texture_set_subimage(ccl_private OSLTextureOptions *opt, int subimage)
#define OSL_OP_IMPL_DVVDV(name, op)
ccl_device_extern uint osl_hash_ivf(ccl_private const float3 *v, float w)
ccl_device_forceinline float hashnoise_2d(float2 p)
ccl_device_extern bool osl_get_attribute(ccl_private ShaderGlobals *sg, int derivatives, DeviceString object_name, DeviceString name, int array_lookup, int index, TypeDesc type, ccl_private void *res)
ccl_device_forceinline void copy_identity_matrix(ccl_private float *res, float value=1.0f)
ccl_device_extern void osl_sincos_fff(float a, ccl_private float *b, ccl_private float *c)
ccl_device_extern void osl_transform_dvmdv(ccl_private float3 *res, ccl_private const float *m, ccl_private const float3 *v)
ccl_device_extern bool osl_environment(ccl_private ShaderGlobals *sg, DeviceString filename, ccl_private void *texture_handle, ccl_private OSLTextureOptions *opt, ccl_private const float3 *R, ccl_private const float3 *dRdx, ccl_private const float3 *dRdy, int nchannels, ccl_private float *result, ccl_private float *dresultds, ccl_private float *dresultdt, ccl_private float *alpha, ccl_private float *dalphax, ccl_private float *dalphay, ccl_private void *errormessage)
#define OSL_OP_IMPL_DFDV(name, op)
ccl_device_extern bool osl_get_matrix(ccl_private ShaderGlobals *sg, ccl_private float *res, DeviceString from)
ccl_device_forceinline int safe_divide(int a, int b)
ccl_device_extern void osl_error(ccl_private ShaderGlobals *sg, const char *format, void *args)
ccl_device_extern void osl_transformv_dvmdv(ccl_private float3 *res, ccl_private const float *m, ccl_private const float3 *v)
static bool find_attribute(const std::string &attributes, const char *search_attribute)
ccl_device float3 color_srgb_to_linear_v3(float3 c)
ccl_device float3 color_linear_to_srgb_v3(float3 c)
ccl_device_inline int abs(int x)
ccl_device_inline float3 float4_to_float3(const float4 a)