forked from bartvdbraak/blender
Style cleanup: indentation, braces
This commit is contained in:
parent
e86dbf6877
commit
dc13969e48
@ -214,7 +214,7 @@ static void motion(int x, int y, int button)
|
|||||||
|
|
||||||
/* Rotate */
|
/* Rotate */
|
||||||
else if(button == 2) {
|
else if(button == 2) {
|
||||||
float4 r1= make_float4((float)x * 0.1f, 0.0f, 1.0f, 0.0f);
|
float4 r1 = make_float4((float)x * 0.1f, 0.0f, 1.0f, 0.0f);
|
||||||
matrix = matrix * transform_rotate(DEG2RADF(r1.x), make_float3(r1.y, r1.z, r1.w));
|
matrix = matrix * transform_rotate(DEG2RADF(r1.x), make_float3(r1.y, r1.z, r1.w));
|
||||||
|
|
||||||
float4 r2 = make_float4(y * 0.1f, 1.0f, 0.0f, 0.0f);
|
float4 r2 = make_float4(y * 0.1f, 1.0f, 0.0f, 0.0f);
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
* limitations under the License
|
* limitations under the License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CYCLES_XML__
|
#ifndef __CYCLES_XML_H__
|
||||||
#define __CYCLES_XML__
|
#define __CYCLES_XML_H__
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -29,5 +29,4 @@ void xml_read_file(Scene *scene, const char *filepath);
|
|||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
|
||||||
#endif /* __CYCLES_XML__ */
|
#endif /* __CYCLES_XML_H__ */
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
* limitations under the License
|
* limitations under the License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CCL_API_H
|
#ifndef __CCL_API_H__
|
||||||
#define CCL_API_H
|
#define __CCL_API_H__
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -40,5 +40,4 @@ void *CCL_python_module_init(void);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* CCL_API_H */
|
#endif /* __CCL_API_H__ */
|
||||||
|
|
||||||
|
@ -322,7 +322,8 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
|
|||||||
/* create triangles */
|
/* create triangles */
|
||||||
if(n == 4) {
|
if(n == 4) {
|
||||||
if(is_zero(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) ||
|
if(is_zero(cross(mesh->verts[vi[1]] - mesh->verts[vi[0]], mesh->verts[vi[2]] - mesh->verts[vi[0]])) ||
|
||||||
is_zero(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]]))) {
|
is_zero(cross(mesh->verts[vi[2]] - mesh->verts[vi[0]], mesh->verts[vi[3]] - mesh->verts[vi[0]])))
|
||||||
|
{
|
||||||
mesh->set_triangle(ti++, vi[0], vi[1], vi[3], shader, smooth);
|
mesh->set_triangle(ti++, vi[0], vi[1], vi[3], shader, smooth);
|
||||||
mesh->set_triangle(ti++, vi[2], vi[3], vi[1], shader, smooth);
|
mesh->set_triangle(ti++, vi[2], vi[3], vi[1], shader, smooth);
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,8 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
else if(param->type.vecsemantics == TypeDesc::POINT ||
|
else if(param->type.vecsemantics == TypeDesc::POINT ||
|
||||||
param->type.vecsemantics == TypeDesc::VECTOR ||
|
param->type.vecsemantics == TypeDesc::VECTOR ||
|
||||||
param->type.vecsemantics == TypeDesc::NORMAL) {
|
param->type.vecsemantics == TypeDesc::NORMAL)
|
||||||
|
{
|
||||||
socket_type = "NodeSocketVector";
|
socket_type = "NodeSocketVector";
|
||||||
data_type = BL::NodeSocket::type_VECTOR;
|
data_type = BL::NodeSocket::type_VECTOR;
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ public:
|
|||||||
if(interpolation == INTERPOLATION_CLOSEST) {
|
if(interpolation == INTERPOLATION_CLOSEST) {
|
||||||
cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_POINT));
|
cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_POINT));
|
||||||
}
|
}
|
||||||
else if (interpolation == INTERPOLATION_LINEAR){
|
else if (interpolation == INTERPOLATION_LINEAR) {
|
||||||
cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_LINEAR));
|
cuda_assert(cuTexRefSetFilterMode(texref, CU_TR_FILTER_MODE_LINEAR));
|
||||||
}
|
}
|
||||||
else {/* CUBIC and SMART are unsupported for CUDA */
|
else {/* CUBIC and SMART are unsupported for CUDA */
|
||||||
|
@ -326,7 +326,7 @@ class DeviceServer {
|
|||||||
public:
|
public:
|
||||||
thread_mutex rpc_lock;
|
thread_mutex rpc_lock;
|
||||||
|
|
||||||
void network_error(const string &message){
|
void network_error(const string &message) {
|
||||||
error_func.network_error(message);
|
error_func.network_error(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ protected:
|
|||||||
{
|
{
|
||||||
/* create a new DataVector and insert it into mem_data */
|
/* create a new DataVector and insert it into mem_data */
|
||||||
pair<DataMap::iterator,bool> data_ins = mem_data.insert(
|
pair<DataMap::iterator,bool> data_ins = mem_data.insert(
|
||||||
DataMap::value_type(client_pointer, DataVector()));
|
DataMap::value_type(client_pointer, DataVector()));
|
||||||
|
|
||||||
/* make sure it was a unique insertion */
|
/* make sure it was a unique insertion */
|
||||||
assert(data_ins.second);
|
assert(data_ins.second);
|
||||||
|
@ -209,7 +209,7 @@ public:
|
|||||||
boost::system::error_code error;
|
boost::system::error_code error;
|
||||||
size_t len = boost::asio::read(socket, boost::asio::buffer(header), error);
|
size_t len = boost::asio::read(socket, boost::asio::buffer(header), error);
|
||||||
|
|
||||||
if(error.value()){
|
if(error.value()) {
|
||||||
error_func->network_error(error.message());
|
error_func->network_error(error.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ public:
|
|||||||
boost::system::error_code error;
|
boost::system::error_code error;
|
||||||
size_t len = boost::asio::read(socket, boost::asio::buffer(buffer, size), error);
|
size_t len = boost::asio::read(socket, boost::asio::buffer(buffer, size), error);
|
||||||
|
|
||||||
if(error.value()){
|
if(error.value()) {
|
||||||
error_func->network_error(error.message());
|
error_func->network_error(error.message());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ private:
|
|||||||
|
|
||||||
/* add address if it's not already in the list */
|
/* add address if it's not already in the list */
|
||||||
bool found = std::find(servers.begin(), servers.end(),
|
bool found = std::find(servers.begin(), servers.end(),
|
||||||
address) != servers.end();
|
address) != servers.end();
|
||||||
|
|
||||||
if(!found)
|
if(!found)
|
||||||
servers.push_back(address);
|
servers.push_back(address);
|
||||||
|
@ -461,7 +461,7 @@ public:
|
|||||||
vector<cl_platform_id> platforms(num_platforms, NULL);
|
vector<cl_platform_id> platforms(num_platforms, NULL);
|
||||||
|
|
||||||
ciErr = clGetPlatformIDs(num_platforms, &platforms[0], NULL);
|
ciErr = clGetPlatformIDs(num_platforms, &platforms[0], NULL);
|
||||||
if(opencl_error(ciErr)){
|
if(opencl_error(ciErr)) {
|
||||||
fprintf(stderr, "clGetPlatformIDs failed \n");
|
fprintf(stderr, "clGetPlatformIDs failed \n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -489,7 +489,7 @@ public:
|
|||||||
/* get devices */
|
/* get devices */
|
||||||
vector<cl_device_id> device_ids(num_devices, NULL);
|
vector<cl_device_id> device_ids(num_devices, NULL);
|
||||||
|
|
||||||
if(opencl_error(clGetDeviceIDs(cpPlatform, opencl_device_type(), num_devices, &device_ids[0], NULL))){
|
if(opencl_error(clGetDeviceIDs(cpPlatform, opencl_device_type(), num_devices, &device_ids[0], NULL))) {
|
||||||
fprintf(stderr, "clGetDeviceIDs failed \n");
|
fprintf(stderr, "clGetDeviceIDs failed \n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -528,7 +528,7 @@ public:
|
|||||||
cxContext = clCreateContext(context_props, 1, &cdDevice,
|
cxContext = clCreateContext(context_props, 1, &cdDevice,
|
||||||
context_notify_callback, cdDevice, &ciErr);
|
context_notify_callback, cdDevice, &ciErr);
|
||||||
|
|
||||||
if(opencl_error(ciErr)){
|
if(opencl_error(ciErr)) {
|
||||||
opencl_error("OpenCL: clCreateContext failed");
|
opencl_error("OpenCL: clCreateContext failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ ccl_device float3 bsdf_hair_reflection_eval_reflect(const ShaderClosure *sc, con
|
|||||||
float theta_i = M_PI_2_F - safe_acosf(omega_in_z);
|
float theta_i = M_PI_2_F - safe_acosf(omega_in_z);
|
||||||
float cosphi_i = dot(omega_in_y, locy);
|
float cosphi_i = dot(omega_in_y, locy);
|
||||||
|
|
||||||
if(M_PI_2_F - fabsf(theta_i) < 0.001f || cosphi_i < 0.0f){
|
if(M_PI_2_F - fabsf(theta_i) < 0.001f || cosphi_i < 0.0f) {
|
||||||
*pdf = 0.0f;
|
*pdf = 0.0f;
|
||||||
return make_float3(*pdf, *pdf, *pdf);
|
return make_float3(*pdf, *pdf, *pdf);
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ ccl_device float3 bsdf_hair_transmission_eval_transmit(const ShaderClosure *sc,
|
|||||||
float theta_i = M_PI_2_F - safe_acosf(omega_in_z);
|
float theta_i = M_PI_2_F - safe_acosf(omega_in_z);
|
||||||
float phi_i = safe_acosf(dot(omega_in_y, locy));
|
float phi_i = safe_acosf(dot(omega_in_y, locy));
|
||||||
|
|
||||||
if(M_PI_2_F - fabsf(theta_i) < 0.001f){
|
if(M_PI_2_F - fabsf(theta_i) < 0.001f) {
|
||||||
*pdf = 0.0f;
|
*pdf = 0.0f;
|
||||||
return make_float3(*pdf, *pdf, *pdf);
|
return make_float3(*pdf, *pdf, *pdf);
|
||||||
}
|
}
|
||||||
@ -251,8 +251,8 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc, float3 Ng,
|
|||||||
float phi_pdf = roughness2 / (c_TT * (p * p + roughness2 * roughness2));
|
float phi_pdf = roughness2 / (c_TT * (p * p + roughness2 * roughness2));
|
||||||
|
|
||||||
*omega_in =(cosf(phi) * costheta_i) * locy -
|
*omega_in =(cosf(phi) * costheta_i) * locy -
|
||||||
(sinf(phi) * costheta_i) * locx +
|
(sinf(phi) * costheta_i) * locx +
|
||||||
( sintheta_i) * Tg;
|
( sintheta_i) * Tg;
|
||||||
|
|
||||||
//differentials - TODO: find a better approximation for the transmission bounce
|
//differentials - TODO: find a better approximation for the transmission bounce
|
||||||
#ifdef __RAY_DIFFERENTIALS__
|
#ifdef __RAY_DIFFERENTIALS__
|
||||||
@ -261,7 +261,7 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc, float3 Ng,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
*pdf = fabsf(phi_pdf * theta_pdf);
|
*pdf = fabsf(phi_pdf * theta_pdf);
|
||||||
if(M_PI_2_F - fabsf(theta_i) < 0.001f){
|
if(M_PI_2_F - fabsf(theta_i) < 0.001f) {
|
||||||
*pdf = 0.0f;
|
*pdf = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ ccl_device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, fl
|
|||||||
float sinThetaM = cosThetaM * safe_sqrtf(tanThetaM2);
|
float sinThetaM = cosThetaM * safe_sqrtf(tanThetaM2);
|
||||||
float phiM = M_2PI_F * randv;
|
float phiM = M_2PI_F * randv;
|
||||||
float3 m = (cosf(phiM) * sinThetaM) * X +
|
float3 m = (cosf(phiM) * sinThetaM) * X +
|
||||||
(sinf(phiM) * sinThetaM) * Y +
|
(sinf(phiM) * sinThetaM) * Y +
|
||||||
cosThetaM * Z;
|
( cosThetaM) * Z;
|
||||||
if(!m_refractive) {
|
if(!m_refractive) {
|
||||||
float cosMO = dot(m, I);
|
float cosMO = dot(m, I);
|
||||||
if(cosMO > 0) {
|
if(cosMO > 0) {
|
||||||
@ -383,8 +383,8 @@ ccl_device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 N
|
|||||||
float sinThetaM = cosThetaM * tanThetaM;
|
float sinThetaM = cosThetaM * tanThetaM;
|
||||||
float phiM = M_2PI_F * randv;
|
float phiM = M_2PI_F * randv;
|
||||||
float3 m = (cosf(phiM) * sinThetaM) * X +
|
float3 m = (cosf(phiM) * sinThetaM) * X +
|
||||||
(sinf(phiM) * sinThetaM) * Y +
|
(sinf(phiM) * sinThetaM) * Y +
|
||||||
cosThetaM * Z;
|
( cosThetaM) * Z;
|
||||||
|
|
||||||
if(!m_refractive) {
|
if(!m_refractive) {
|
||||||
float cosMO = dot(m, I);
|
float cosMO = dot(m, I);
|
||||||
|
@ -109,8 +109,8 @@ ccl_device int bsdf_phong_ramp_sample(const ShaderClosure *sc, const float3 colo
|
|||||||
float sinTheta2 = 1 - cosTheta * cosTheta;
|
float sinTheta2 = 1 - cosTheta * cosTheta;
|
||||||
float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
|
float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
|
||||||
*omega_in = (cosf(phi) * sinTheta) * T +
|
*omega_in = (cosf(phi) * sinTheta) * T +
|
||||||
(sinf(phi) * sinTheta) * B +
|
(sinf(phi) * sinTheta) * B +
|
||||||
( cosTheta) * R;
|
( cosTheta) * R;
|
||||||
if (dot(Ng, *omega_in) > 0.0f)
|
if (dot(Ng, *omega_in) > 0.0f)
|
||||||
{
|
{
|
||||||
// common terms for pdf and eval
|
// common terms for pdf and eval
|
||||||
|
@ -35,14 +35,15 @@
|
|||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
ccl_device float fresnel_dielectric(float eta, const float3 N,
|
ccl_device float fresnel_dielectric(
|
||||||
const float3 I, float3 *R, float3 *T,
|
float eta, const float3 N,
|
||||||
|
const float3 I, float3 *R, float3 *T,
|
||||||
#ifdef __RAY_DIFFERENTIALS__
|
#ifdef __RAY_DIFFERENTIALS__
|
||||||
const float3 dIdx, const float3 dIdy,
|
const float3 dIdx, const float3 dIdy,
|
||||||
float3 *dRdx, float3 *dRdy,
|
float3 *dRdx, float3 *dRdy,
|
||||||
float3 *dTdx, float3 *dTdy,
|
float3 *dTdx, float3 *dTdy,
|
||||||
#endif
|
#endif
|
||||||
bool *is_inside)
|
bool *is_inside)
|
||||||
{
|
{
|
||||||
float cos = dot(N, I), neta;
|
float cos = dot(N, I), neta;
|
||||||
float3 Nn;
|
float3 Nn;
|
||||||
|
@ -96,10 +96,9 @@ ccl_device int bsdf_westin_backscatter_sample(const ShaderClosure *sc, float3 Ng
|
|||||||
float sinTheta2 = 1 - cosTheta * cosTheta;
|
float sinTheta2 = 1 - cosTheta * cosTheta;
|
||||||
float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
|
float sinTheta = sinTheta2 > 0 ? sqrtf(sinTheta2) : 0;
|
||||||
*omega_in = (cosf(phi) * sinTheta) * T +
|
*omega_in = (cosf(phi) * sinTheta) * T +
|
||||||
(sinf(phi) * sinTheta) * B +
|
(sinf(phi) * sinTheta) * B +
|
||||||
(cosTheta) * I;
|
(cosTheta) * I;
|
||||||
if(dot(Ng, *omega_in) > 0)
|
if(dot(Ng, *omega_in) > 0) {
|
||||||
{
|
|
||||||
// common terms for pdf and eval
|
// common terms for pdf and eval
|
||||||
float cosNI = dot(N, *omega_in);
|
float cosNI = dot(N, *omega_in);
|
||||||
// make sure the direction we chose is still in the right hemisphere
|
// make sure the direction we chose is still in the right hemisphere
|
||||||
|
@ -253,12 +253,13 @@ ccl_device bool BVH_FUNCTION_NAME
|
|||||||
int shader = 0;
|
int shader = 0;
|
||||||
|
|
||||||
#ifdef __HAIR__
|
#ifdef __HAIR__
|
||||||
if(kernel_tex_fetch(__prim_type, isect_array->prim) & PRIMITIVE_ALL_TRIANGLE) {
|
if(kernel_tex_fetch(__prim_type, isect_array->prim) & PRIMITIVE_ALL_TRIANGLE)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
float4 Ns = kernel_tex_fetch(__tri_normal, prim);
|
float4 Ns = kernel_tex_fetch(__tri_normal, prim);
|
||||||
shader = __float_as_int(Ns.w);
|
shader = __float_as_int(Ns.w);
|
||||||
#ifdef __HAIR__
|
|
||||||
}
|
}
|
||||||
|
#ifdef __HAIR__
|
||||||
else {
|
else {
|
||||||
float4 str = kernel_tex_fetch(__curves, prim);
|
float4 str = kernel_tex_fetch(__curves, prim);
|
||||||
shader = __float_as_int(str.z);
|
shader = __float_as_int(str.z);
|
||||||
|
@ -366,8 +366,8 @@ ccl_device_inline float3 bvh_clamp_direction(float3 dir)
|
|||||||
/* clamp absolute values by exp2f(-80.0f) to avoid division by zero when calculating inverse direction */
|
/* clamp absolute values by exp2f(-80.0f) to avoid division by zero when calculating inverse direction */
|
||||||
float ooeps = 8.271806E-25f;
|
float ooeps = 8.271806E-25f;
|
||||||
return make_float3((fabsf(dir.x) > ooeps)? dir.x: copysignf(ooeps, dir.x),
|
return make_float3((fabsf(dir.x) > ooeps)? dir.x: copysignf(ooeps, dir.x),
|
||||||
(fabsf(dir.y) > ooeps)? dir.y: copysignf(ooeps, dir.y),
|
(fabsf(dir.y) > ooeps)? dir.y: copysignf(ooeps, dir.y),
|
||||||
(fabsf(dir.z) > ooeps)? dir.z: copysignf(ooeps, dir.z));
|
(fabsf(dir.z) > ooeps)? dir.z: copysignf(ooeps, dir.z));
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline float3 bvh_inverse_direction(float3 dir)
|
ccl_device_inline float3 bvh_inverse_direction(float3 dir)
|
||||||
|
@ -77,6 +77,6 @@ CCL_NAMESPACE_END
|
|||||||
|
|
||||||
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
||||||
void __dummy_function_cycles_avx(void);
|
void __dummy_function_cycles_avx(void);
|
||||||
void __dummy_function_cycles_avx(void){}
|
void __dummy_function_cycles_avx(void) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -119,7 +119,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
|
|||||||
/* TODO, disable the closures we won't need */
|
/* TODO, disable the closures we won't need */
|
||||||
shader_setup_from_sample(kg, &sd, P, Ng, I, shader, object, prim, u, v, t, time, bounce, transparent_bounce);
|
shader_setup_from_sample(kg, &sd, P, Ng, I, shader, object, prim, u, v, t, time, bounce, transparent_bounce);
|
||||||
|
|
||||||
if(is_light_pass(type)){
|
if(is_light_pass(type)) {
|
||||||
RNG rng = cmj_hash(i, 0);
|
RNG rng = cmj_hash(i, 0);
|
||||||
compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_AO));
|
compute_light_pass(kg, &sd, &L, rng, (type == SHADER_EVAL_AO));
|
||||||
}
|
}
|
||||||
|
@ -166,10 +166,11 @@ ccl_device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, Shader
|
|||||||
float3 L = shader_emissive_eval(kg, sd);
|
float3 L = shader_emissive_eval(kg, sd);
|
||||||
|
|
||||||
#ifdef __HAIR__
|
#ifdef __HAIR__
|
||||||
if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS) && (sd->type & PRIMITIVE_ALL_TRIANGLE)) {
|
if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS) && (sd->type & PRIMITIVE_ALL_TRIANGLE))
|
||||||
#else
|
#else
|
||||||
if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS)) {
|
if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
/* multiple importance sampling, get triangle light pdf,
|
/* multiple importance sampling, get triangle light pdf,
|
||||||
* and compute weight with respect to BSDF pdf */
|
* and compute weight with respect to BSDF pdf */
|
||||||
float pdf = triangle_light_pdf(kg, sd->Ng, sd->I, t);
|
float pdf = triangle_light_pdf(kg, sd->Ng, sd->I, t);
|
||||||
|
@ -51,7 +51,8 @@ ccl_device_inline void kernel_write_data_passes(KernelGlobals *kg, ccl_global fl
|
|||||||
if(!(path_flag & PATH_RAY_SINGLE_PASS_DONE)) {
|
if(!(path_flag & PATH_RAY_SINGLE_PASS_DONE)) {
|
||||||
if(!(sd->flag & SD_TRANSPARENT) ||
|
if(!(sd->flag & SD_TRANSPARENT) ||
|
||||||
kernel_data.film.pass_alpha_threshold == 0.0f ||
|
kernel_data.film.pass_alpha_threshold == 0.0f ||
|
||||||
average(shader_bsdf_alpha(kg, sd)) >= kernel_data.film.pass_alpha_threshold) {
|
average(shader_bsdf_alpha(kg, sd)) >= kernel_data.film.pass_alpha_threshold)
|
||||||
|
{
|
||||||
|
|
||||||
if(sample == 0) {
|
if(sample == 0) {
|
||||||
if(flag & PASS_DEPTH) {
|
if(flag & PASS_DEPTH) {
|
||||||
|
@ -1304,21 +1304,21 @@ ccl_device float4 kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
|
|||||||
/* do subsurface scatter step with copy of shader data, this will
|
/* do subsurface scatter step with copy of shader data, this will
|
||||||
* replace the BSSRDF with a diffuse BSDF closure */
|
* replace the BSSRDF with a diffuse BSDF closure */
|
||||||
for(int j = 0; j < num_samples; j++) {
|
for(int j = 0; j < num_samples; j++) {
|
||||||
ShaderData bssrdf_sd[BSSRDF_MAX_HITS];
|
ShaderData bssrdf_sd[BSSRDF_MAX_HITS];
|
||||||
float bssrdf_u, bssrdf_v;
|
float bssrdf_u, bssrdf_v;
|
||||||
path_branched_rng_2D(kg, &bssrdf_rng, &state, j, num_samples, PRNG_BSDF_U, &bssrdf_u, &bssrdf_v);
|
path_branched_rng_2D(kg, &bssrdf_rng, &state, j, num_samples, PRNG_BSDF_U, &bssrdf_u, &bssrdf_v);
|
||||||
int num_hits = subsurface_scatter_multi_step(kg, &sd, bssrdf_sd, state.flag, sc, &lcg_state, bssrdf_u, bssrdf_v, true);
|
int num_hits = subsurface_scatter_multi_step(kg, &sd, bssrdf_sd, state.flag, sc, &lcg_state, bssrdf_u, bssrdf_v, true);
|
||||||
|
|
||||||
/* compute lighting with the BSDF closure */
|
/* compute lighting with the BSDF closure */
|
||||||
for(int hit = 0; hit < num_hits; hit++) {
|
for(int hit = 0; hit < num_hits; hit++) {
|
||||||
PathState hit_state = state;
|
PathState hit_state = state;
|
||||||
|
|
||||||
path_state_branch(&hit_state, j, num_samples);
|
path_state_branch(&hit_state, j, num_samples);
|
||||||
|
|
||||||
kernel_branched_path_integrate_lighting(kg, rng,
|
kernel_branched_path_integrate_lighting(kg, rng,
|
||||||
&bssrdf_sd[hit], throughput, num_samples_inv,
|
&bssrdf_sd[hit], throughput, num_samples_inv,
|
||||||
&hit_state, &L, buffer);
|
&hit_state, &L, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state.flag &= ~PATH_RAY_BSSRDF_ANCESTOR;
|
state.flag &= ~PATH_RAY_BSSRDF_ANCESTOR;
|
||||||
|
@ -39,7 +39,7 @@ ccl_device void shader_setup_object_transforms(KernelGlobals *kg, ShaderData *sd
|
|||||||
{
|
{
|
||||||
if(sd->flag & SD_OBJECT_MOTION) {
|
if(sd->flag & SD_OBJECT_MOTION) {
|
||||||
sd->ob_tfm = object_fetch_transform_motion(kg, sd->object, time);
|
sd->ob_tfm = object_fetch_transform_motion(kg, sd->object, time);
|
||||||
sd->ob_itfm= transform_quick_inverse(sd->ob_tfm);
|
sd->ob_itfm = transform_quick_inverse(sd->ob_tfm);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sd->ob_tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
|
sd->ob_tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
|
||||||
|
@ -190,7 +190,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *
|
|||||||
|
|
||||||
ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ray, float3 *shadow)
|
ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ray, float3 *shadow)
|
||||||
{
|
{
|
||||||
*shadow = make_float3(1.0f, 1.0f, 1.0f);
|
*shadow = make_float3(1.0f, 1.0f, 1.0f);
|
||||||
|
|
||||||
if(ray->t == 0.0f)
|
if(ray->t == 0.0f)
|
||||||
return false;
|
return false;
|
||||||
@ -217,10 +217,11 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
#ifdef __HAIR__
|
#ifdef __HAIR__
|
||||||
if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect, NULL, 0.0f, 0.0f)) {
|
if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect, NULL, 0.0f, 0.0f))
|
||||||
#else
|
#else
|
||||||
if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect)) {
|
if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
|
||||||
#ifdef __VOLUME__
|
#ifdef __VOLUME__
|
||||||
/* attenuation for last line segment towards light */
|
/* attenuation for last line segment towards light */
|
||||||
|
@ -75,6 +75,6 @@ CCL_NAMESPACE_END
|
|||||||
|
|
||||||
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
||||||
void __dummy_function_cycles_sse2(void);
|
void __dummy_function_cycles_sse2(void);
|
||||||
void __dummy_function_cycles_sse2(void){}
|
void __dummy_function_cycles_sse2(void) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -76,6 +76,6 @@ CCL_NAMESPACE_END
|
|||||||
|
|
||||||
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
||||||
void __dummy_function_cycles_sse3(void);
|
void __dummy_function_cycles_sse3(void);
|
||||||
void __dummy_function_cycles_sse3(void){}
|
void __dummy_function_cycles_sse3(void) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,6 +77,6 @@ CCL_NAMESPACE_END
|
|||||||
|
|
||||||
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
/* needed for some linkers in combination with scons making empty compilation unit in a library */
|
||||||
void __dummy_function_cycles_sse41(void);
|
void __dummy_function_cycles_sse41(void);
|
||||||
void __dummy_function_cycles_sse41(void){}
|
void __dummy_function_cycles_sse41(void) {}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -524,7 +524,8 @@ static bool get_mesh_element_attribute(KernelGlobals *kg, const ShaderData *sd,
|
|||||||
const TypeDesc& type, bool derivatives, void *val)
|
const TypeDesc& type, bool derivatives, void *val)
|
||||||
{
|
{
|
||||||
if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector ||
|
if (attr.type == TypeDesc::TypePoint || attr.type == TypeDesc::TypeVector ||
|
||||||
attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor) {
|
attr.type == TypeDesc::TypeNormal || attr.type == TypeDesc::TypeColor)
|
||||||
|
{
|
||||||
float3 fval[3];
|
float3 fval[3];
|
||||||
fval[0] = primitive_attribute_float3(kg, sd, attr.elem, attr.offset,
|
fval[0] = primitive_attribute_float3(kg, sd, attr.elem, attr.offset,
|
||||||
(derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
|
(derivatives) ? &fval[1] : NULL, (derivatives) ? &fval[2] : NULL);
|
||||||
@ -606,7 +607,7 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD
|
|||||||
}
|
}
|
||||||
else if (name == u_particle_lifetime) {
|
else if (name == u_particle_lifetime) {
|
||||||
int particle_id = object_particle_id(kg, sd->object);
|
int particle_id = object_particle_id(kg, sd->object);
|
||||||
float f= particle_lifetime(kg, particle_id);
|
float f = particle_lifetime(kg, particle_id);
|
||||||
return set_attribute_float(f, type, derivatives, val);
|
return set_attribute_float(f, type, derivatives, val);
|
||||||
}
|
}
|
||||||
else if (name == u_particle_location) {
|
else if (name == u_particle_location) {
|
||||||
@ -643,10 +644,11 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD
|
|||||||
}
|
}
|
||||||
else if ((name == u_geom_trianglevertices || name == u_geom_polyvertices)
|
else if ((name == u_geom_trianglevertices || name == u_geom_polyvertices)
|
||||||
#ifdef __HAIR__
|
#ifdef __HAIR__
|
||||||
&& sd->type & PRIMITIVE_ALL_TRIANGLE) {
|
&& sd->type & PRIMITIVE_ALL_TRIANGLE)
|
||||||
#else
|
#else
|
||||||
) {
|
)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
float3 P[3];
|
float3 P[3];
|
||||||
|
|
||||||
if(sd->type & PRIMITIVE_TRIANGLE)
|
if(sd->type & PRIMITIVE_TRIANGLE)
|
||||||
|
@ -110,9 +110,9 @@ public:
|
|||||||
ustring dataname, TypeDesc datatype, void *data);
|
ustring dataname, TypeDesc datatype, void *data);
|
||||||
|
|
||||||
static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
|
static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
|
||||||
TypeDesc type, bool derivatives, void *val);
|
TypeDesc type, bool derivatives, void *val);
|
||||||
static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
|
static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
|
||||||
TypeDesc type, bool derivatives, void *val);
|
TypeDesc type, bool derivatives, void *val);
|
||||||
|
|
||||||
static ustring u_distance;
|
static ustring u_distance;
|
||||||
static ustring u_index;
|
static ustring u_index;
|
||||||
|
@ -409,8 +409,9 @@ static void flatten_volume_closure_tree(ShaderData *sd,
|
|||||||
sc.data1 = volume->sc.data1;
|
sc.data1 = volume->sc.data1;
|
||||||
|
|
||||||
/* add */
|
/* add */
|
||||||
if(sc.sample_weight > CLOSURE_WEIGHT_CUTOFF &&
|
if((sc.sample_weight > CLOSURE_WEIGHT_CUTOFF) &&
|
||||||
sd->num_closure < MAX_CLOSURE) {
|
(sd->num_closure < MAX_CLOSURE))
|
||||||
|
{
|
||||||
sd->closure[sd->num_closure++] = sc;
|
sd->closure[sd->num_closure++] = sc;
|
||||||
sd->flag |= volume->shaderdata_flag();
|
sd->flag |= volume->shaderdata_flag();
|
||||||
}
|
}
|
||||||
|
@ -117,13 +117,13 @@ ccl_device void svm_node_particle_info(KernelGlobals *kg, ShaderData *sd, float
|
|||||||
stack_store_float3(stack, out_offset, particle_location(kg, particle_id));
|
stack_store_float3(stack, out_offset, particle_location(kg, particle_id));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#if 0 /* XXX float4 currently not supported in SVM stack */
|
#if 0 /* XXX float4 currently not supported in SVM stack */
|
||||||
case NODE_INFO_PAR_ROTATION: {
|
case NODE_INFO_PAR_ROTATION: {
|
||||||
int particle_id = object_particle_id(kg, sd->object);
|
int particle_id = object_particle_id(kg, sd->object);
|
||||||
stack_store_float4(stack, out_offset, particle_rotation(kg, particle_id));
|
stack_store_float4(stack, out_offset, particle_rotation(kg, particle_id));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case NODE_INFO_PAR_SIZE: {
|
case NODE_INFO_PAR_SIZE: {
|
||||||
int particle_id = object_particle_id(kg, sd->object);
|
int particle_id = object_particle_id(kg, sd->object);
|
||||||
stack_store_float(stack, out_offset, particle_size(kg, particle_id));
|
stack_store_float(stack, out_offset, particle_size(kg, particle_id));
|
||||||
|
@ -65,7 +65,7 @@ ccl_device float4 svm_image_texture(KernelGlobals *kg, int id, float x, float y,
|
|||||||
|
|
||||||
float4 r;
|
float4 r;
|
||||||
int ix, iy, nix, niy;
|
int ix, iy, nix, niy;
|
||||||
if (interpolation == INTERPOLATION_CLOSEST){
|
if (interpolation == INTERPOLATION_CLOSEST) {
|
||||||
svm_image_texture_frac(x*width, &ix);
|
svm_image_texture_frac(x*width, &ix);
|
||||||
svm_image_texture_frac(y*height, &iy);
|
svm_image_texture_frac(y*height, &iy);
|
||||||
|
|
||||||
|
@ -43,11 +43,11 @@ ccl_device void svm_node_separate_hsv(KernelGlobals *kg, ShaderData *sd, float *
|
|||||||
color = rgb_to_hsv(color);
|
color = rgb_to_hsv(color);
|
||||||
|
|
||||||
if (stack_valid(hue_out))
|
if (stack_valid(hue_out))
|
||||||
stack_store_float(stack, hue_out, color.x);
|
stack_store_float(stack, hue_out, color.x);
|
||||||
if (stack_valid(saturation_out))
|
if (stack_valid(saturation_out))
|
||||||
stack_store_float(stack, saturation_out, color.y);
|
stack_store_float(stack, saturation_out, color.y);
|
||||||
if (stack_valid(value_out))
|
if (stack_valid(value_out))
|
||||||
stack_store_float(stack, value_out, color.z);
|
stack_store_float(stack, value_out, color.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@ -93,7 +93,7 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, flo
|
|||||||
|
|
||||||
/* Output */
|
/* Output */
|
||||||
if(stack_valid(vector_out)) {
|
if(stack_valid(vector_out)) {
|
||||||
stack_store_float3(stack, vector_out, in);
|
stack_store_float3(stack, vector_out, in);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +45,11 @@ ccl_device void svm_node_wireframe(KernelGlobals *kg, ShaderData *sd, float *sta
|
|||||||
|
|
||||||
/* Calculate wireframe */
|
/* Calculate wireframe */
|
||||||
#ifdef __HAIR__
|
#ifdef __HAIR__
|
||||||
if (sd->prim != PRIM_NONE && sd->type & PRIMITIVE_ALL_TRIANGLE) {
|
if (sd->prim != PRIM_NONE && sd->type & PRIMITIVE_ALL_TRIANGLE)
|
||||||
#else
|
#else
|
||||||
if (sd->prim != PRIM_NONE) {
|
if (sd->prim != PRIM_NONE)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
float3 Co[3];
|
float3 Co[3];
|
||||||
float pixelwidth = 1.0f;
|
float pixelwidth = 1.0f;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void CurveSystemManager::device_update(Device *device, DeviceScene *dscene, Scen
|
|||||||
|
|
||||||
progress.set_status("Updating Hair settings", "Copying Hair settings to device");
|
progress.set_status("Updating Hair settings", "Copying Hair settings to device");
|
||||||
|
|
||||||
KernelCurves *kcurve= &dscene->data.curve;
|
KernelCurves *kcurve = &dscene->data.curve;
|
||||||
|
|
||||||
kcurve->curveflags = 0;
|
kcurve->curveflags = 0;
|
||||||
|
|
||||||
|
@ -554,7 +554,7 @@ bool Mesh::has_motion_blur() const
|
|||||||
{
|
{
|
||||||
return (use_motion_blur &&
|
return (use_motion_blur &&
|
||||||
(attributes.find(ATTR_STD_MOTION_VERTEX_POSITION) ||
|
(attributes.find(ATTR_STD_MOTION_VERTEX_POSITION) ||
|
||||||
curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION)));
|
curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mesh Manager */
|
/* Mesh Manager */
|
||||||
|
@ -317,7 +317,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler)
|
|||||||
compiler.parameter("is_float", is_float);
|
compiler.parameter("is_float", is_float);
|
||||||
compiler.parameter("use_alpha", !alpha_out->links.empty());
|
compiler.parameter("use_alpha", !alpha_out->links.empty());
|
||||||
|
|
||||||
switch (interpolation){
|
switch (interpolation) {
|
||||||
case INTERPOLATION_CLOSEST:
|
case INTERPOLATION_CLOSEST:
|
||||||
compiler.parameter("interpolation", "closest");
|
compiler.parameter("interpolation", "closest");
|
||||||
break;
|
break;
|
||||||
|
@ -226,7 +226,8 @@ void SVMCompiler::stack_assign(ShaderInput *input)
|
|||||||
else if(input->type == SHADER_SOCKET_VECTOR ||
|
else if(input->type == SHADER_SOCKET_VECTOR ||
|
||||||
input->type == SHADER_SOCKET_NORMAL ||
|
input->type == SHADER_SOCKET_NORMAL ||
|
||||||
input->type == SHADER_SOCKET_POINT ||
|
input->type == SHADER_SOCKET_POINT ||
|
||||||
input->type == SHADER_SOCKET_COLOR) {
|
input->type == SHADER_SOCKET_COLOR)
|
||||||
|
{
|
||||||
|
|
||||||
add_node(NODE_VALUE_V, input->stack_offset);
|
add_node(NODE_VALUE_V, input->stack_offset);
|
||||||
add_node(NODE_VALUE_V, input->value);
|
add_node(NODE_VALUE_V, input->value);
|
||||||
@ -506,8 +507,8 @@ void SVMCompiler::generate_multi_closure(ShaderNode *node, set<ShaderNode*>& don
|
|||||||
find_dependencies(cl2deps, done, cl2in);
|
find_dependencies(cl2deps, done, cl2in);
|
||||||
|
|
||||||
set_intersection(cl1deps.begin(), cl1deps.end(),
|
set_intersection(cl1deps.begin(), cl1deps.end(),
|
||||||
cl2deps.begin(), cl2deps.end(),
|
cl2deps.begin(), cl2deps.end(),
|
||||||
std::inserter(shareddeps, shareddeps.begin()));
|
std::inserter(shareddeps, shareddeps.begin()));
|
||||||
|
|
||||||
if(!shareddeps.empty()) {
|
if(!shareddeps.empty()) {
|
||||||
if(cl1in->link)
|
if(cl1in->link)
|
||||||
|
@ -132,8 +132,8 @@ ccl_device float3 xyY_to_xyz(float x, float y, float Y)
|
|||||||
ccl_device float3 xyz_to_rgb(float x, float y, float z)
|
ccl_device float3 xyz_to_rgb(float x, float y, float z)
|
||||||
{
|
{
|
||||||
return make_float3(3.240479f * x + -1.537150f * y + -0.498535f * z,
|
return make_float3(3.240479f * x + -1.537150f * y + -0.498535f * z,
|
||||||
-0.969256f * x + 1.875991f * y + 0.041556f * z,
|
-0.969256f * x + 1.875991f * y + 0.041556f * z,
|
||||||
0.055648f * x + -0.204043f * y + 1.057311f * z);
|
0.055648f * x + -0.204043f * y + 1.057311f * z);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __KERNEL_OPENCL__
|
#ifndef __KERNEL_OPENCL__
|
||||||
|
@ -23,7 +23,7 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
static inline uint hash_int_2d(uint kx, uint ky)
|
static inline uint hash_int_2d(uint kx, uint ky)
|
||||||
{
|
{
|
||||||
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
|
#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
|
||||||
|
|
||||||
uint a, b, c;
|
uint a, b, c;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ static inline uint hash_int_2d(uint kx, uint ky)
|
|||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
#undef rot
|
#undef rot
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint hash_int(uint k)
|
static inline uint hash_int(uint k)
|
||||||
|
@ -304,7 +304,9 @@ typedef struct _cl_kernel * cl_kernel;
|
|||||||
typedef struct _cl_event * cl_event;
|
typedef struct _cl_event * cl_event;
|
||||||
typedef struct _cl_sampler * cl_sampler;
|
typedef struct _cl_sampler * cl_sampler;
|
||||||
|
|
||||||
typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
|
/* WARNING! Unlike cl_ types in cl_platform.h,
|
||||||
|
* cl_bool is not guaranteed to be the same size as the bool in kernels. */
|
||||||
|
typedef cl_uint cl_bool;
|
||||||
typedef cl_ulong cl_bitfield;
|
typedef cl_ulong cl_bitfield;
|
||||||
typedef cl_bitfield cl_device_type;
|
typedef cl_bitfield cl_device_type;
|
||||||
typedef cl_uint cl_platform_info;
|
typedef cl_uint cl_platform_info;
|
||||||
|
@ -71,7 +71,7 @@ ccl_device_inline const __m128 shuffle_swap(const __m128& a, shuffle_swap_t shuf
|
|||||||
|
|
||||||
#ifdef __KERNEL_SSE41__
|
#ifdef __KERNEL_SSE41__
|
||||||
ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t &shuf_identity, const shuffle_swap_t &shuf_swap,
|
ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t &shuf_identity, const shuffle_swap_t &shuf_swap,
|
||||||
const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3])
|
const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3])
|
||||||
{
|
{
|
||||||
const __m128 idirsplat_raw[] = { _mm_set_ps1(idir.x), _mm_set_ps1(idir.y), _mm_set_ps1(idir.z) };
|
const __m128 idirsplat_raw[] = { _mm_set_ps1(idir.x), _mm_set_ps1(idir.y), _mm_set_ps1(idir.z) };
|
||||||
idirsplat[0] = _mm_xor_ps(idirsplat_raw[0], pn);
|
idirsplat[0] = _mm_xor_ps(idirsplat_raw[0], pn);
|
||||||
@ -87,7 +87,7 @@ ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t &shuf_identity, const shuffle_swap_t &shuf_swap,
|
ccl_device_inline void gen_idirsplat_swap(const __m128 &pn, const shuffle_swap_t &shuf_identity, const shuffle_swap_t &shuf_swap,
|
||||||
const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3])
|
const float3& idir, __m128 idirsplat[3], shuffle_swap_t shufflexyz[3])
|
||||||
{
|
{
|
||||||
idirsplat[0] = _mm_xor_ps(_mm_set_ps1(idir.x), pn);
|
idirsplat[0] = _mm_xor_ps(_mm_set_ps1(idir.x), pn);
|
||||||
idirsplat[1] = _mm_xor_ps(_mm_set_ps1(idir.y), pn);
|
idirsplat[1] = _mm_xor_ps(_mm_set_ps1(idir.y), pn);
|
||||||
|
@ -169,14 +169,15 @@ static CPUCapabilities& system_cpu_capabilities()
|
|||||||
if( os_uses_xsave_xrestore && cpu_avx_support) {
|
if( os_uses_xsave_xrestore && cpu_avx_support) {
|
||||||
// Check if the OS will save the YMM registers
|
// Check if the OS will save the YMM registers
|
||||||
uint32_t xcr_feature_mask;
|
uint32_t xcr_feature_mask;
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
int edx; // not used
|
int edx; /* not used */
|
||||||
__asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (xcr_feature_mask) , "=d" (edx) : "c" (0) ); /* actual opcode for xgetbv */
|
/* actual opcode for xgetbv */
|
||||||
#elif defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
|
__asm__ (".byte 0x0f, 0x01, 0xd0" : "=a" (xcr_feature_mask) , "=d" (edx) : "c" (0) );
|
||||||
xcr_feature_mask = (uint32_t)_xgetbv(_XCR_XFEATURE_ENABLED_MASK); /* min VS2010 SP1 compiler is required */
|
#elif defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
|
||||||
#else
|
xcr_feature_mask = (uint32_t)_xgetbv(_XCR_XFEATURE_ENABLED_MASK); /* min VS2010 SP1 compiler is required */
|
||||||
xcr_feature_mask = 0;
|
#else
|
||||||
#endif
|
xcr_feature_mask = 0;
|
||||||
|
#endif
|
||||||
caps.avx = (xcr_feature_mask & 0x6) == 0x6;
|
caps.avx = (xcr_feature_mask & 0x6) == 0x6;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,9 +108,9 @@ ccl_device_inline Transform transform_transpose(const Transform a)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline Transform make_transform(float a, float b, float c, float d,
|
ccl_device_inline Transform make_transform(float a, float b, float c, float d,
|
||||||
float e, float f, float g, float h,
|
float e, float f, float g, float h,
|
||||||
float i, float j, float k, float l,
|
float i, float j, float k, float l,
|
||||||
float m, float n, float o, float p)
|
float m, float n, float o, float p)
|
||||||
{
|
{
|
||||||
Transform t;
|
Transform t;
|
||||||
|
|
||||||
|
@ -159,8 +159,8 @@ struct int2 {
|
|||||||
__forceinline int& operator[](int i) { return *(&x + i); }
|
__forceinline int& operator[](int i) { return *(&x + i); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __KERNEL_SSE__
|
|
||||||
struct ccl_try_align(16) int3 {
|
struct ccl_try_align(16) int3 {
|
||||||
|
#ifdef __KERNEL_SSE__
|
||||||
union {
|
union {
|
||||||
__m128i m128;
|
__m128i m128;
|
||||||
struct { int x, y, z, w; };
|
struct { int x, y, z, w; };
|
||||||
@ -171,7 +171,6 @@ struct ccl_try_align(16) int3 {
|
|||||||
__forceinline operator const __m128i&(void) const { return m128; }
|
__forceinline operator const __m128i&(void) const { return m128; }
|
||||||
__forceinline operator __m128i&(void) { return m128; }
|
__forceinline operator __m128i&(void) { return m128; }
|
||||||
#else
|
#else
|
||||||
struct ccl_try_align(16) int3 {
|
|
||||||
int x, y, z, w;
|
int x, y, z, w;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -179,8 +178,8 @@ struct ccl_try_align(16) int3 {
|
|||||||
__forceinline int& operator[](int i) { return *(&x + i); }
|
__forceinline int& operator[](int i) { return *(&x + i); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __KERNEL_SSE__
|
|
||||||
struct ccl_try_align(16) int4 {
|
struct ccl_try_align(16) int4 {
|
||||||
|
#ifdef __KERNEL_SSE__
|
||||||
union {
|
union {
|
||||||
__m128i m128;
|
__m128i m128;
|
||||||
struct { int x, y, z, w; };
|
struct { int x, y, z, w; };
|
||||||
@ -191,7 +190,6 @@ struct ccl_try_align(16) int4 {
|
|||||||
__forceinline operator const __m128i&(void) const { return m128; }
|
__forceinline operator const __m128i&(void) const { return m128; }
|
||||||
__forceinline operator __m128i&(void) { return m128; }
|
__forceinline operator __m128i&(void) { return m128; }
|
||||||
#else
|
#else
|
||||||
struct ccl_try_align(16) int4 {
|
|
||||||
int x, y, z, w;
|
int x, y, z, w;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -227,8 +225,8 @@ struct float2 {
|
|||||||
__forceinline float& operator[](int i) { return *(&x + i); }
|
__forceinline float& operator[](int i) { return *(&x + i); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __KERNEL_SSE__
|
|
||||||
struct ccl_try_align(16) float3 {
|
struct ccl_try_align(16) float3 {
|
||||||
|
#ifdef __KERNEL_SSE__
|
||||||
union {
|
union {
|
||||||
__m128 m128;
|
__m128 m128;
|
||||||
struct { float x, y, z, w; };
|
struct { float x, y, z, w; };
|
||||||
@ -239,7 +237,6 @@ struct ccl_try_align(16) float3 {
|
|||||||
__forceinline operator const __m128&(void) const { return m128; }
|
__forceinline operator const __m128&(void) const { return m128; }
|
||||||
__forceinline operator __m128&(void) { return m128; }
|
__forceinline operator __m128&(void) { return m128; }
|
||||||
#else
|
#else
|
||||||
struct ccl_try_align(16) float3 {
|
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -247,8 +244,8 @@ struct ccl_try_align(16) float3 {
|
|||||||
__forceinline float& operator[](int i) { return *(&x + i); }
|
__forceinline float& operator[](int i) { return *(&x + i); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __KERNEL_SSE__
|
|
||||||
struct ccl_try_align(16) float4 {
|
struct ccl_try_align(16) float4 {
|
||||||
|
#ifdef __KERNEL_SSE__
|
||||||
union {
|
union {
|
||||||
__m128 m128;
|
__m128 m128;
|
||||||
struct { float x, y, z, w; };
|
struct { float x, y, z, w; };
|
||||||
@ -259,7 +256,6 @@ struct ccl_try_align(16) float4 {
|
|||||||
__forceinline operator const __m128&(void) const { return m128; }
|
__forceinline operator const __m128&(void) const { return m128; }
|
||||||
__forceinline operator __m128&(void) { return m128; }
|
__forceinline operator __m128&(void) { return m128; }
|
||||||
#else
|
#else
|
||||||
struct ccl_try_align(16) float4 {
|
|
||||||
float x, y, z, w;
|
float x, y, z, w;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user