Cleanup: strip trailing space for cycles

This commit is contained in:
Campbell Barton
2018-07-06 10:17:58 +02:00
parent 62fbb7d4a1
commit 1daa20ad9f
257 changed files with 373 additions and 616 deletions

View File

@@ -164,7 +164,7 @@ bool link_ptxas(CompilationSettings &settings)
ptx += " --verbose";
printf("%s\n", ptx.c_str());
}
int pxresult = system(ptx.c_str());
if(pxresult) {
fprintf(stderr, "Error: ptxas failed (%x)\n\n", pxresult);

View File

@@ -112,4 +112,3 @@ int main(int argc, const char **argv)
return 0;
}

View File

@@ -524,4 +524,3 @@ int main(int argc, const char **argv)
return 0;
}

View File

@@ -184,7 +184,7 @@ static bool xml_equal_string(xml_node node, const char *name, const char *value)
if(attr)
return string_iequals(attr.value(), value);
return false;
}
@@ -697,4 +697,3 @@ void xml_read_file(Scene *scene, const char *filepath)
}
CCL_NAMESPACE_END

View File

@@ -39,7 +39,7 @@ def write(node, fname):
f = open(fname, "w")
f.write(s)
class CyclesXMLSettings(bpy.types.PropertyGroup):
@classmethod
def register(cls):
@@ -53,11 +53,11 @@ class CyclesXMLSettings(bpy.types.PropertyGroup):
maxlen=256,
default='',
subtype='FILE_PATH')
@classmethod
def unregister(cls):
del bpy.types.Scene.cycles_xml
# User Interface Drawing Code
class RenderButtonsPanel():
bl_space_type = 'PROPERTIES'
@@ -75,13 +75,13 @@ class PHYSICS_PT_fluid_export(RenderButtonsPanel, bpy.types.Panel):
def draw(self, context):
layout = self.layout
cycles = context.scene.cycles_xml
#layout.prop(cycles, "filepath")
layout.operator("export_mesh.cycles_xml")
# Export Operator
class ExportCyclesXML(bpy.types.Operator, ExportHelper):
bl_idname = "export_mesh.cycles_xml"
@@ -118,23 +118,23 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
P += "%f %f %f " % (v.co[0], v.co[1], v.co[2])
verts_and_uvs = zip(mesh.tessfaces, mesh.tessface_uv_textures.active.data)
for f, uvf in verts_and_uvs:
vcount = len(f.vertices)
nverts += str(vcount) + " "
for v in f.vertices:
verts += str(v) + " "
uvs += str(uvf.uv1[0]) + " " + str(uvf.uv1[1]) + " "
uvs += str(uvf.uv2[0]) + " " + str(uvf.uv2[1]) + " "
uvs += str(uvf.uv3[0]) + " " + str(uvf.uv3[1]) + " "
if vcount==4:
uvs += " " + str(uvf.uv4[0]) + " " + str(uvf.uv4[1]) + " "
node = etree.Element('mesh', attrib={'nverts': nverts.strip(), 'verts': verts.strip(), 'P': P, 'UV' : uvs.strip()})
# write to file
write(node, filepath)
@@ -148,5 +148,3 @@ def unregister():
if __name__ == "__main__":
register()

View File

@@ -124,7 +124,7 @@ static float blender_camera_focal_distance(BL::RenderEngine& b_engine,
if(!b_dof_object)
return b_camera.dof_distance();
/* for dof object, return distance along camera Z direction */
BL::Array<float, 16> b_ob_matrix;
b_engine.camera_model_matrix(b_ob, bcam->use_spherical_stereo, b_ob_matrix);
@@ -726,7 +726,7 @@ static void blender_camera_view_subset(BL::RenderEngine& b_engine,
blender_camera_viewplane(&cam_bcam, cam_bcam.full_width, cam_bcam.full_height,
&cam, &cam_aspect, &sensor_size);
/* return */
*view_box = view * (1.0f/view_aspect);
*cam_box = cam * (1.0f/cam_aspect);
@@ -895,4 +895,3 @@ BufferParams BlenderSync::get_buffer_params(BL::RenderSettings& b_render,
}
CCL_NAMESPACE_END

View File

@@ -125,7 +125,7 @@ void BlenderSync::sync_light(BL::Object& b_parent,
*use_portal = true;
return;
}
BL::Lamp b_lamp(b_ob.data());
/* type */
@@ -185,7 +185,7 @@ void BlenderSync::sync_light(BL::Object& b_parent,
PointerRNA clamp = RNA_pointer_get(&b_lamp.ptr, "cycles");
light->cast_shadow = get_boolean(clamp, "cast_shadow");
light->use_mis = get_boolean(clamp, "use_multiple_importance_sampling");
int samples = get_int(clamp, "samples");
if(get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
@@ -287,7 +287,7 @@ Object *BlenderSync::sync_object(BL::Object& b_parent,
{
BL::Object b_ob = (b_dupli_ob ? b_dupli_ob.object() : b_parent);
bool motion = motion_time != 0.0f;
/* light is handled separately */
if(object_is_light(b_ob)) {
/* don't use lamps for excluded layers used as mask layer */
@@ -360,7 +360,7 @@ Object *BlenderSync::sync_object(BL::Object& b_parent,
if(object_map.sync(&object, b_ob, b_parent, key))
object_updated = true;
/* mesh sync */
object->mesh = sync_mesh(b_ob, object_updated, hide_tris);
@@ -502,7 +502,7 @@ static bool object_render_hide(BL::Object& b_ob,
}
parent = parent.parent();
}
hide_triangles = hide_emitter;
if(show_emitter) {
@@ -530,7 +530,7 @@ void BlenderSync::sync_objects(float motion_time)
/* layer data */
uint scene_layer = render_layer.scene_layer;
bool motion = motion_time != 0.0f;
if(!motion) {
/* prepare for sync */
light_map.pre_sync();
@@ -755,4 +755,3 @@ void BlenderSync::sync_motion(BL::RenderSettings& b_render,
}
CCL_NAMESPACE_END

View File

@@ -146,4 +146,3 @@ bool BlenderObjectCulling::test_distance(Scene *scene, float3 bb[8])
}
CCL_NAMESPACE_END

View File

@@ -68,7 +68,7 @@ bool BlenderSync::sync_dupli_particle(BL::Object& b_ob,
/* add particle */
BL::Particle b_pa = b_psys.particles[persistent_id[0]];
Particle pa;
pa.index = persistent_id[0];
pa.age = b_scene.frame_current() - b_pa.birth_time();
pa.lifetime = b_pa.lifetime();

View File

@@ -331,7 +331,7 @@ static PyObject *draw_func(PyObject * /*self*/, PyObject *args)
if(!PyArg_ParseTuple(args, "OOO", &pysession, &pyv3d, &pyrv3d))
return NULL;
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
if(PyLong_AsVoidPtr(pyrv3d)) {
@@ -590,7 +590,7 @@ static PyObject *osl_compile_func(PyObject * /*self*/, PyObject *args)
if(!PyArg_ParseTuple(args, "ss", &inputfile, &outputfile))
return NULL;
/* return */
if(!OSLShaderManager::osl_compile(inputfile, outputfile))
Py_RETURN_FALSE;

View File

@@ -154,7 +154,7 @@ static SocketType::Type convert_socket_type(BL::NodeSocket& b_socket)
return SocketType::STRING;
case BL::NodeSocket::type_SHADER:
return SocketType::CLOSURE;
default:
return SocketType::UNDEFINED;
}
@@ -443,7 +443,7 @@ static ShaderNode *add_node(Scene *scene,
else if(b_node.is_a(&RNA_ShaderNodeBsdfGlossy)) {
BL::ShaderNodeBsdfGlossy b_glossy_node(b_node);
GlossyBsdfNode *glossy = new GlossyBsdfNode();
switch(b_glossy_node.distribution()) {
case BL::ShaderNodeBsdfGlossy::distribution_SHARP:
glossy->distribution = CLOSURE_BSDF_REFLECTION_ID;
@@ -943,7 +943,7 @@ static ShaderInput *node_find_input_by_name(ShaderNode *node,
BL::NodeSocket& b_socket)
{
string name = b_socket.name();
if(node_use_modified_socket_name(node)) {
BL::Node::inputs_iterator b_input;
bool found = false;
@@ -1062,7 +1062,7 @@ static void add_nodes(Scene *scene,
}
}
else if(b_node->is_a(&RNA_ShaderNodeGroup) || b_node->is_a(&RNA_NodeCustomGroup)) {
BL::ShaderNodeTree b_group_ntree(PointerRNA_NULL);
if(b_node->is_a(&RNA_ShaderNodeGroup))
b_group_ntree = BL::ShaderNodeTree(((BL::NodeGroup)(*b_node)).node_tree());
@@ -1104,7 +1104,7 @@ static void add_nodes(Scene *scene,
output_map[b_output->ptr.data] = proxy->outputs[0];
}
if(b_group_ntree) {
add_nodes(scene,
b_engine,
@@ -1481,4 +1481,3 @@ void BlenderSync::sync_shaders()
}
CCL_NAMESPACE_END

View File

@@ -142,7 +142,7 @@ bool BlenderSync::sync_recalc()
if(b_ob->is_updated_data() || b_ob->data().is_updated())
light_map.set_recalc(*b_ob);
}
if(b_ob->is_updated_data()) {
BL::Object::particle_systems_iterator b_psys;
for(b_ob->particle_systems.begin(b_psys); b_psys != b_ob->particle_systems.end(); ++b_psys)
@@ -301,7 +301,7 @@ void BlenderSync::sync_integrator()
integrator->mesh_light_samples = mesh_light_samples * mesh_light_samples;
integrator->subsurface_samples = subsurface_samples * subsurface_samples;
integrator->volume_samples = volume_samples * volume_samples;
}
}
else {
integrator->diffuse_samples = diffuse_samples;
integrator->glossy_samples = glossy_samples;
@@ -336,7 +336,7 @@ void BlenderSync::sync_film()
Film *film = scene->film;
Film prevfilm = *film;
film->exposure = get_float(cscene, "film_exposure");
film->filter_type = (FilterType)get_enum(cscene,
"pixel_filter_type",
@@ -633,7 +633,7 @@ SceneParams BlenderSync::get_scene_params(BL::Scene& b_scene,
params.shadingsystem = SHADINGSYSTEM_SVM;
else if(shadingsystem == 1)
params.shadingsystem = SHADINGSYSTEM_OSL;
if(background || DebugFlags().viewport_static_bvh)
params.bvh_type = SceneParams::BVH_STATIC;
else
@@ -698,7 +698,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
/* device type */
vector<DeviceInfo>& devices = Device::available_devices();
/* device default CPU */
foreach(DeviceInfo& device, devices) {
if(device.type == DEVICE_CPU) {
@@ -773,7 +773,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
int aa_samples = get_int(cscene, "aa_samples");
int preview_samples = get_int(cscene, "preview_samples");
int preview_aa_samples = get_int(cscene, "preview_aa_samples");
if(get_boolean(cscene, "use_square_samples")) {
aa_samples = aa_samples * aa_samples;
preview_aa_samples = preview_aa_samples * preview_aa_samples;
@@ -869,7 +869,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
params.shadingsystem = SHADINGSYSTEM_SVM;
else if(shadingsystem == 1)
params.shadingsystem = SHADINGSYSTEM_OSL;
/* color managagement */
#ifdef GLEW_MX
/* When using GLEW MX we need to check whether we've got an OpenGL
@@ -894,4 +894,3 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine& b_engine,
}
CCL_NAMESPACE_END

View File

@@ -214,4 +214,3 @@ private:
CCL_NAMESPACE_END
#endif /* __BLENDER_SYNC_H__ */

View File

@@ -251,4 +251,3 @@ void BVHObjectBinning::split(BVHReference* prims,
}
CCL_NAMESPACE_END

View File

@@ -206,7 +206,7 @@ void InnerNode::print(int depth) const
{
for(int i = 0; i < depth; i++)
printf(" ");
printf("inner node %p\n", (void*)this);
if(children[0])
@@ -219,9 +219,8 @@ void LeafNode::print(int depth) const
{
for(int i = 0; i < depth; i++)
printf(" ");
printf("leaf node %d to %d\n", lo, hi);
}
CCL_NAMESPACE_END

View File

@@ -201,4 +201,3 @@ void bvh_reference_sort(int start,
}
CCL_NAMESPACE_END

View File

@@ -123,7 +123,7 @@ public:
/* Use OpenSubdiv patch evaluation */
bool use_patch_evaluation;
/* Use Transparent shadows */
bool use_transparent;
@@ -294,7 +294,7 @@ public:
/* open shading language, only for CPU device */
virtual void *osl_memory() { return NULL; }
/* load/compile kernels, must be called before adding tasks */
/* load/compile kernels, must be called before adding tasks */
virtual bool load_kernels(
const DeviceRequestedFeatures& /*requested_features*/)
{ return true; }
@@ -304,7 +304,7 @@ public:
virtual void task_add(DeviceTask& task) = 0;
virtual void task_wait() = 0;
virtual void task_cancel() = 0;
/* opengl drawing */
virtual void draw_pixels(device_memory& mem, int y, int w, int h,
int dx, int dy, int width, int height, bool transparent,
@@ -362,4 +362,3 @@ private:
CCL_NAMESPACE_END
#endif /* __DEVICE_H__ */

View File

@@ -41,4 +41,3 @@ string device_cuda_capabilities(void);
CCL_NAMESPACE_END
#endif /* __DEVICE_INTERN_H__ */

View File

@@ -138,4 +138,3 @@ device_sub_ptr::~device_sub_ptr()
}
CCL_NAMESPACE_END

View File

@@ -51,7 +51,7 @@ enum DataType {
TYPE_UINT64,
};
static inline size_t datatype_size(DataType datatype)
static inline size_t datatype_size(DataType datatype)
{
switch(datatype) {
case TYPE_UNKNOWN: return 1;
@@ -497,4 +497,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __DEVICE_MEMORY_H__ */

View File

@@ -376,4 +376,3 @@ Device *device_multi_create(DeviceInfo& info, Stats &stats, bool background)
}
CCL_NAMESPACE_END

View File

@@ -797,5 +797,3 @@ void Device::server_run()
CCL_NAMESPACE_END
#endif

View File

@@ -179,7 +179,7 @@ public:
boost::asio::write(socket,
boost::asio::buffer(archive_str),
boost::asio::transfer_all(), error);
if(error.value())
error_func->network_error(error.message());
@@ -193,7 +193,7 @@ public:
boost::asio::write(socket,
boost::asio::buffer(buffer, size),
boost::asio::transfer_all(), error);
if(error.value())
error_func->network_error(error.message());
}
@@ -467,7 +467,7 @@ private:
/* buffer and endpoint for receiving messages */
char receive_buffer[256];
boost::asio::ip::udp::endpoint receive_endpoint;
// os, version, devices, status, host name, group name, ip as far as fields go
struct ServerInfo {
string cycles_version;
@@ -489,4 +489,3 @@ CCL_NAMESPACE_END
#endif
#endif /* __DEVICE_NETWORK_H__ */

View File

@@ -261,7 +261,7 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
ENQUEUE_SPLIT_KERNEL(buffer_update, global_size, local_size);
if(task->get_cancel() && cancel_time == DBL_MAX) {
/* Wait up to twice as many seconds for current samples to finish
/* Wait up to twice as many seconds for current samples to finish
* to avoid artifacts in render result from ending too soon.
*/
cancel_time = time_dt() + 2.0 * time_multiplier;
@@ -322,5 +322,3 @@ bool DeviceSplitKernel::path_trace(DeviceTask *task,
}
CCL_NAMESPACE_END

View File

@@ -131,6 +131,3 @@ public:
CCL_NAMESPACE_END
#endif /* __DEVICE_SPLIT_KERNEL_H__ */

View File

@@ -126,4 +126,3 @@ void DeviceTask::update_progress(RenderTile *rtile, int pixel_samples)
}
CCL_NAMESPACE_END

View File

@@ -86,4 +86,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __DEVICE_TASK_H__ */

View File

@@ -254,4 +254,3 @@ void MemoryManager::set_kernel_arg_buffers(cl_kernel kernel, cl_uint *narg)
CCL_NAMESPACE_END
#endif /* WITH_OPENCL */

View File

@@ -104,4 +104,3 @@ public:
};
CCL_NAMESPACE_END

View File

@@ -200,4 +200,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -13,7 +13,7 @@ met:
distribution.
* Neither the name of Industrial Light & Magic nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
@@ -26,4 +26,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -33,4 +33,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -25,4 +25,3 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -26,4 +26,3 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -13,4 +13,3 @@ MIT license
Boost License
* Boost and OpenCL dynamic loading

View File

@@ -496,4 +496,3 @@ void Node::hash(MD5Hash& md5)
}
CCL_NAMESPACE_END

View File

@@ -97,4 +97,3 @@ struct Node
};
CCL_NAMESPACE_END

View File

@@ -45,4 +45,3 @@ private:
};
CCL_NAMESPACE_END

View File

@@ -217,4 +217,3 @@ const NodeType *NodeType::find(ustring name)
}
CCL_NAMESPACE_END

View File

@@ -263,4 +263,3 @@ const NodeType *structname::register_type()
{ type->register_output(ustring(#name), ustring(ui_name), SocketType::ENUM); }
CCL_NAMESPACE_END

View File

@@ -458,4 +458,3 @@ xml_node xml_write_node(Node *node, xml_node xml_root)
}
CCL_NAMESPACE_END

View File

@@ -32,4 +32,3 @@ void xml_read_node(XMLReader& reader, Node *node, xml_node xml_node);
xml_node xml_write_node(Node *node, xml_node xml_root);
CCL_NAMESPACE_END

View File

@@ -486,4 +486,3 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure *b)
}
CCL_NAMESPACE_END

View File

@@ -117,7 +117,7 @@ ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(
lobe = 1.0f;
}
float norm = sqrtf((n_x + 1.0f)*(n_y + 1.0f)) / (8.0f * M_PI_F);
out = NdotO * norm * lobe * pump;
*pdf = norm * lobe / HdotI;
}

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -46,7 +46,7 @@ ccl_device int bsdf_ashikhmin_velvet_setup(VelvetBsdf *bsdf)
{
float sigma = fmaxf(bsdf->sigma, 0.01f);
bsdf->invsigma2 = 1.0f/(sigma * sigma);
bsdf->type = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID;
return SD_BSDF|SD_BSDF_HAS_EVAL;
@@ -159,4 +159,3 @@ ccl_device int bsdf_ashikhmin_velvet_sample(const ShaderClosure *sc, float3 Ng,
CCL_NAMESPACE_END
#endif /* __BSDF_ASHIKHMIN_VELVET_H__ */

View File

@@ -88,7 +88,7 @@ ccl_device int bsdf_diffuse_sample(const ShaderClosure *sc, float3 Ng, float3 I,
}
else
*pdf = 0.0f;
return LABEL_REFLECT|LABEL_DIFFUSE;
}
@@ -140,4 +140,3 @@ ccl_device int bsdf_translucent_sample(const ShaderClosure *sc, float3 Ng, float
CCL_NAMESPACE_END
#endif /* __BSDF_DIFFUSE_H__ */

View File

@@ -46,7 +46,7 @@ typedef ccl_addr_space struct DiffuseRampBsdf {
ccl_device float3 bsdf_diffuse_ramp_get_color(const float3 colors[8], float pos)
{
int MAXCOLORS = 8;
float npos = pos * (float)(MAXCOLORS - 1);
int ipos = float_to_int(npos);
if(ipos < 0)
@@ -99,7 +99,7 @@ ccl_device int bsdf_diffuse_ramp_sample(const ShaderClosure *sc, float3 Ng, floa
}
else
*pdf = 0.0f;
return LABEL_REFLECT|LABEL_DIFFUSE;
}

View File

@@ -278,4 +278,3 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc, float3 Ng,
CCL_NAMESPACE_END
#endif /* __BSDF_HAIR_H__ */

View File

@@ -231,7 +231,7 @@ ccl_device_forceinline float3 microfacet_sample_stretched(
/* 5. compute normal */
return normalize(make_float3(-slope_x, -slope_y, 1.0f));
}
}
/* Calculate the reflection color
*
@@ -434,7 +434,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, cons
/* eq. 34: now calculate G1(i,m) and G1(o,m) */
G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
}
else {
/* anisotropic */
@@ -535,7 +535,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
/* eq. 34: now calculate G1(i,m) and G1(o,m) */
G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
float G = G1o * G1i;
@@ -706,7 +706,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
dIdx, dIdy, &dRdx, &dRdy, &dTdx, &dTdy,
#endif
&inside);
if(!inside && fresnel != 1.0f) {
*omega_in = T;
@@ -733,7 +733,7 @@ ccl_device int bsdf_microfacet_ggx_sample(KernelGlobals *kg, const ShaderClosure
float cosNI = dot(N, *omega_in);
/* eq. 34: now calculate G1(i,m) */
float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI)));
/* eq. 21 */
float cosHI = dot(m, *omega_in);
@@ -1125,4 +1125,3 @@ ccl_device int bsdf_microfacet_beckmann_sample(KernelGlobals *kg, const ShaderCl
CCL_NAMESPACE_END
#endif /* __BSDF_MICROFACET_H__ */

View File

@@ -47,7 +47,7 @@ typedef ccl_addr_space struct PhongRampBsdf {
ccl_device float3 bsdf_phong_ramp_get_color(const float3 colors[8], float pos)
{
int MAXCOLORS = 8;
float npos = pos * (float)(MAXCOLORS - 1);
int ipos = float_to_int(npos);
if(ipos < 0)
@@ -71,7 +71,7 @@ ccl_device float3 bsdf_phong_ramp_eval_reflect(const ShaderClosure *sc, const fl
float m_exponent = bsdf->exponent;
float cosNI = dot(bsdf->N, omega_in);
float cosNO = dot(bsdf->N, I);
if(cosNI > 0 && cosNO > 0) {
// reflect the view vector
float3 R = (2 * cosNO) * bsdf->N - I;
@@ -84,7 +84,7 @@ ccl_device float3 bsdf_phong_ramp_eval_reflect(const ShaderClosure *sc, const fl
return bsdf_phong_ramp_get_color(bsdf->colors, cosp) * out;
}
}
return make_float3(0.0f, 0.0f, 0.0f);
}
@@ -98,7 +98,7 @@ ccl_device int bsdf_phong_ramp_sample(const ShaderClosure *sc, float3 Ng, float3
const PhongRampBsdf *bsdf = (const PhongRampBsdf*)sc;
float cosNO = dot(bsdf->N, I);
float m_exponent = bsdf->exponent;
if(cosNO > 0) {
// reflect the view vector
float3 R = (2 * cosNO) * bsdf->N - I;
@@ -107,7 +107,7 @@ ccl_device int bsdf_phong_ramp_sample(const ShaderClosure *sc, float3 Ng, float3
*domega_in_dx = (2 * dot(bsdf->N, dIdx)) * bsdf->N - dIdx;
*domega_in_dy = (2 * dot(bsdf->N, dIdy)) * bsdf->N - dIdy;
#endif
float3 T, B;
make_orthonormals (R, &T, &B);
float phi = M_2PI_F * randu;

View File

@@ -123,5 +123,3 @@ ccl_device int bsdf_principled_diffuse_sample(const ShaderClosure *sc,
CCL_NAMESPACE_END
#endif /* __BSDF_PRINCIPLED_DIFFUSE_H__ */

View File

@@ -109,5 +109,3 @@ ccl_device int bsdf_principled_sheen_sample(const ShaderClosure *sc,
CCL_NAMESPACE_END
#endif /* __BSDF_PRINCIPLED_SHEEN_H__ */

View File

@@ -78,4 +78,3 @@ ccl_device int bsdf_reflection_sample(const ShaderClosure *sc, float3 Ng, float3
CCL_NAMESPACE_END
#endif /* __BSDF_REFLECTION_H__ */

View File

@@ -87,4 +87,3 @@ ccl_device int bsdf_refraction_sample(const ShaderClosure *sc, float3 Ng, float3
CCL_NAMESPACE_END
#endif /* __BSDF_REFRACTION_H__ */

View File

@@ -73,7 +73,7 @@ ccl_device float3 bsdf_toon_get_intensity(float max_angle, float smooth, float a
is = (1.0f - (angle - max_angle)/smooth);
else
is = 0.0f;
return make_float3(is, is, is);
}
@@ -90,7 +90,7 @@ ccl_device float3 bsdf_diffuse_toon_eval_reflect(const ShaderClosure *sc, const
float angle = safe_acosf(fmaxf(dot(bsdf->N, omega_in), 0.0f));
float3 eval = bsdf_toon_get_intensity(max_angle, smooth, angle);
if(eval.x > 0.0f) {
float sample_angle = bsdf_toon_get_sample_angle(max_angle, smooth);
@@ -152,7 +152,7 @@ ccl_device float3 bsdf_glossy_toon_eval_reflect(const ShaderClosure *sc, const f
float smooth = bsdf->smooth*M_PI_2_F;
float cosNI = dot(bsdf->N, omega_in);
float cosNO = dot(bsdf->N, I);
if(cosNI > 0 && cosNO > 0) {
/* reflect the view vector */
float3 R = (2 * cosNO) * bsdf->N - I;
@@ -166,7 +166,7 @@ ccl_device float3 bsdf_glossy_toon_eval_reflect(const ShaderClosure *sc, const f
*pdf = 0.5f * M_1_PI_F / (1.0f - cosf(sample_angle));
return *pdf * eval;
}
return make_float3(0.0f, 0.0f, 0.0f);
}
@@ -181,7 +181,7 @@ ccl_device int bsdf_glossy_toon_sample(const ShaderClosure *sc, float3 Ng, float
float max_angle = bsdf->size*M_PI_2_F;
float smooth = bsdf->smooth*M_PI_2_F;
float cosNO = dot(bsdf->N, I);
if(cosNO > 0) {
/* reflect the view vector */
float3 R = (2 * cosNO) * bsdf->N - I;
@@ -216,4 +216,3 @@ ccl_device int bsdf_glossy_toon_sample(const ShaderClosure *sc, float3 Ng, float
CCL_NAMESPACE_END
#endif /* __BSDF_TOON_H__ */

View File

@@ -107,4 +107,3 @@ ccl_device int bsdf_transparent_sample(const ShaderClosure *sc, float3 Ng, float
CCL_NAMESPACE_END
#endif /* __BSDF_TRANSPARENT_H__ */

View File

@@ -62,14 +62,14 @@ ccl_device float fresnel_dielectric(
Nn = -N;
*is_inside = true;
}
// compute reflection
*R = (2 * cos)* Nn - I;
#ifdef __RAY_DIFFERENTIALS__
*dRdx = (2 * dot(Nn, dIdx)) * Nn - dIdx;
*dRdy = (2 * dot(Nn, dIdy)) * Nn - dIdy;
#endif
float arg = 1 -(neta * neta *(1 -(cos * cos)));
if(arg < 0) {
*T = make_float3(0.0f, 0.0f, 0.0f);
@@ -159,4 +159,3 @@ ccl_device_forceinline float3 interpolate_fresnel_color(float3 L, float3 H, floa
CCL_NAMESPACE_END
#endif /* __BSDF_UTIL_H__ */

View File

@@ -500,4 +500,3 @@ ccl_device_forceinline float bssrdf_pdf(const ShaderClosure *sc, float r)
CCL_NAMESPACE_END
#endif /* __KERNEL_BSSRDF_H__ */

View File

@@ -76,9 +76,8 @@ ccl_device void emissive_sample(const float3 Ng, float randu, float randv,
ccl_device float3 emissive_simple_eval(const float3 Ng, const float3 I)
{
float res = emissive_pdf(Ng, I);
return make_float3(res, res, res);
}
CCL_NAMESPACE_END

View File

@@ -51,7 +51,7 @@ ccl_device float single_peaked_henyey_greenstein(float cos_theta, float g)
ccl_device int volume_henyey_greenstein_setup(HenyeyGreensteinVolume *volume)
{
volume->type = CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID;
/* clamp anisotropy to avoid delta function */
volume->g = signf(volume->g) * min(fabsf(volume->g), 1.0f - 1e-3f);

View File

@@ -30,4 +30,3 @@
#include "kernel/geom/geom_curve_intersect.h"
#include "kernel/geom/geom_volume.h"
#include "kernel/geom/geom_primitive.h"

View File

@@ -66,7 +66,7 @@ ccl_device_inline AttributeDescriptor find_attribute(KernelGlobals *kg, const Sh
uint attr_offset = object_attribute_map_offset(kg, sd->object);
attr_offset += attribute_primitive_type(kg, sd);
uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
while(attr_map.x != id) {
if(UNLIKELY(attr_map.x == ATTR_STD_NONE)) {
return attribute_not_found();
@@ -77,7 +77,7 @@ ccl_device_inline AttributeDescriptor find_attribute(KernelGlobals *kg, const Sh
AttributeDescriptor desc;
desc.element = (AttributeElement)attr_map.y;
if(sd->prim == PRIM_NONE &&
desc.element != ATTR_ELEMENT_MESH &&
desc.element != ATTR_ELEMENT_VOXEL &&
@@ -108,4 +108,3 @@ ccl_device Transform primitive_attribute_matrix(KernelGlobals *kg, const ShaderD
}
CCL_NAMESPACE_END

View File

@@ -214,4 +214,3 @@ ccl_device_inline void motion_cardinal_curve_keys_avx(KernelGlobals *kg,
#endif
CCL_NAMESPACE_END

View File

@@ -34,14 +34,14 @@ ccl_device_inline int find_attribute_motion(KernelGlobals *kg, int object, uint
/* todo: find a better (faster) solution for this, maybe store offset per object */
uint attr_offset = object_attribute_map_offset(kg, object);
uint4 attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
while(attr_map.x != id) {
attr_offset += ATTR_PRIM_TYPES;
attr_map = kernel_tex_fetch(__attributes_map, attr_offset);
}
*elem = (AttributeElement)attr_map.y;
/* return result */
return (attr_map.y == ATTR_ELEMENT_NONE) ? (int)ATTR_STD_NOT_FOUND : (int)attr_map.z;
}

View File

@@ -120,4 +120,3 @@ ccl_device_noinline void motion_triangle_shader_setup(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -613,4 +613,3 @@ ccl_device_inline void object_normal_transform_addrspace(KernelGlobals *kg,
#endif
CCL_NAMESPACE_END

View File

@@ -340,4 +340,3 @@ ccl_device float3 patch_eval_uchar4(KernelGlobals *kg, const ShaderData *sd, int
}
CCL_NAMESPACE_END

View File

@@ -192,7 +192,7 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *
/* object motion. note that depending on the mesh having motion vectors, this
* transformation was set match the world/object space of motion_pre/post */
Transform tfm;
tfm = object_fetch_motion_pass_transform(kg, sd->object, OBJECT_PASS_MOTION_PRE);
motion_pre = transform_point(&tfm, motion_pre);
@@ -240,4 +240,3 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData *
}
CCL_NAMESPACE_END

View File

@@ -352,4 +352,3 @@ ccl_device_noinline float3 subd_triangle_attribute_float3(KernelGlobals *kg, con
}
CCL_NAMESPACE_END

View File

@@ -80,4 +80,3 @@ ccl_device float3 volume_attribute_float3(KernelGlobals *kg, const ShaderData *s
#endif
CCL_NAMESPACE_END

View File

@@ -64,4 +64,3 @@ void kernel_tex_copy(KernelGlobals *kg,
CCL_NAMESPACE_END
#endif /* __KERNEL_H__ */

View File

@@ -270,7 +270,7 @@ ccl_device_inline void path_radiance_bsdf_bounce(
L_state->transmission +
L_state->subsurface +
L_state->scatter;
L_state->direct = *throughput;
}
else {

View File

@@ -563,4 +563,3 @@ ccl_device void kernel_background_evaluate(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -153,4 +153,3 @@ ccl_device_inline void print_sse3i(const char *label, sse3i& a)
CCL_NAMESPACE_END
#endif /* __KERNEL_COMPAT_CPU_H__ */

View File

@@ -154,4 +154,3 @@
#include "util/util_types.h"
#endif /* __KERNEL_COMPAT_OPENCL_H__ */

View File

@@ -103,4 +103,3 @@ ccl_device differential3 differential3_zero()
}
CCL_NAMESPACE_END

View File

@@ -76,7 +76,7 @@ ccl_device_noinline float3 direct_emissive_eval(KernelGlobals *kg,
/* Evaluate emissive closure. */
eval = shader_emissive_eval(kg, emission_sd);
}
eval *= ls->eval_fac;
return eval;
@@ -338,4 +338,3 @@ ccl_device_noinline float3 indirect_background(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -87,4 +87,3 @@ ccl_device void kernel_film_convert_to_half_float(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -226,4 +226,3 @@ ccl_device void cmj_sample_2D(int s, int N, int p, float *fx, float *fy)
#endif
CCL_NAMESPACE_END

View File

@@ -506,7 +506,7 @@ ccl_device float lamp_light_pdf(KernelGlobals *kg, const float3 Ng, const float3
if(cos_pi <= 0.0f)
return 0.0f;
return t*t/cos_pi;
}

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:

View File

@@ -203,7 +203,7 @@ ccl_device_inline void kernel_write_data_passes(KernelGlobals *kg, ccl_global fl
if(!((flag | light_flag) & PASS_ANY))
return;
if(!(path_flag & PATH_RAY_SINGLE_PASS_DONE)) {
if(!(sd->flag & SD_TRANSPARENT) ||
kernel_data.film.pass_alpha_threshold == 0.0f ||
@@ -285,7 +285,7 @@ ccl_device_inline void kernel_write_light_passes(KernelGlobals *kg, ccl_global f
if(!kernel_data.film.use_light_pass)
return;
if(light_flag & PASSMASK(DIFFUSE_INDIRECT))
kernel_write_pass_float3(buffer + kernel_data.film.pass_diffuse_indirect, L->indirect_diffuse);
if(light_flag & PASSMASK(GLOSSY_INDIRECT))
@@ -392,4 +392,3 @@ ccl_device_inline void kernel_write_result(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -762,4 +762,3 @@ ccl_device void kernel_path_trace(KernelGlobals *kg,
#endif /* __SPLIT_KERNEL__ */
CCL_NAMESPACE_END

View File

@@ -269,4 +269,3 @@ ccl_device_inline void path_state_branch(ccl_addr_space PathState *state,
}
CCL_NAMESPACE_END

View File

@@ -152,4 +152,3 @@ ccl_device void kernel_path_subsurface_setup_indirect(
#endif /* __SUBSURFACE__ */
CCL_NAMESPACE_END

View File

@@ -356,4 +356,3 @@ ccl_device bool kernel_path_surface_bounce(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -85,7 +85,7 @@ bool kernel_path_volume_bounce(
if(phase_pdf == 0.0f || bsdf_eval_is_zero(&phase_eval))
return false;
/* modify throughput */
path_radiance_bsdf_bounce(kg, L_state, throughput, &phase_eval, phase_pdf, state->bounce, label);
@@ -223,7 +223,7 @@ ccl_device void kernel_branched_path_volume_connect_light(
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
/* todo: split up light_sample so we don't have to call it again with new position */
if(result == VOLUME_PATH_SCATTERED &&
light_sample(kg, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) {
@@ -260,7 +260,7 @@ ccl_device void kernel_branched_path_volume_connect_light(
VolumeIntegrateResult result = kernel_volume_decoupled_scatter(kg,
state, ray, sd, &tp, rphase, rscatter, segment, (ls.t != FLT_MAX)? &ls.P: NULL, false);
/* todo: split up light_sample so we don't have to call it again with new position */
if(result == VOLUME_PATH_SCATTERED &&
light_sample(kg, light_u, light_v, sd->time, sd->P, state->bounce, &ls)) {
@@ -284,4 +284,3 @@ ccl_device void kernel_branched_path_volume_connect_light(
#endif /* __VOLUME_SCATTER__ */
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:

View File

@@ -296,4 +296,3 @@ ccl_device float lcg_step_float_addrspace(ccl_addr_space uint *rng)
}
CCL_NAMESPACE_END

View File

@@ -50,7 +50,7 @@ ccl_device_inline float3 subsurface_scatter_eval(ShaderData *sd,
for(int i = 0; i < sd->num_closure; i++) {
sc = &sd->closure[i];
if(CLOSURE_IS_DISK_BSSRDF(sc->type)) {
/* in case of branched path integrate we sample all bssrdf's once,
* for path trace we pick one, so adjust pdf for that */
@@ -533,4 +533,3 @@ ccl_device_inline int subsurface_scatter_multi_intersect(
}
CCL_NAMESPACE_END

View File

@@ -85,4 +85,3 @@ KERNEL_TEX(TextureInfo, __texture_info)
KERNEL_TEX(float, __ies)
#undef KERNEL_TEX

View File

@@ -1238,19 +1238,19 @@ typedef struct KernelFilm {
int pass_glossy_color;
int pass_transmission_color;
int pass_subsurface_color;
int pass_diffuse_indirect;
int pass_glossy_indirect;
int pass_transmission_indirect;
int pass_subsurface_indirect;
int pass_volume_indirect;
int pass_diffuse_direct;
int pass_glossy_direct;
int pass_transmission_direct;
int pass_subsurface_direct;
int pass_volume_direct;
int pass_emission;
int pass_background;
int pass_ao;
@@ -1671,4 +1671,3 @@ typedef struct WorkTile {
CCL_NAMESPACE_END
#endif /* __KERNEL_TYPES_H__ */

View File

@@ -68,7 +68,7 @@ ccl_device_inline bool volume_shader_sample(KernelGlobals *kg,
if(!(sd->flag & (SD_EXTINCTION|SD_SCATTER|SD_EMISSION)))
return false;
coeff->sigma_s = make_float3(0.0f, 0.0f, 0.0f);
coeff->sigma_t = (sd->flag & SD_EXTINCTION)? sd->closure_transparent_extinction:
make_float3(0.0f, 0.0f, 0.0f);
@@ -368,7 +368,7 @@ ccl_device float3 kernel_volume_emission_integrate(VolumeShaderCoefficients *coe
}
else
emission *= t;
return emission;
}
@@ -475,7 +475,7 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_homogeneous(
new_tp = *throughput * transmittance / pdf;
}
}
else
else
#endif
if(closure_flag & SD_EXTINCTION) {
/* absorption only, no sampling needed */
@@ -596,7 +596,7 @@ ccl_device VolumeIntegrateResult kernel_volume_integrate_heterogeneous_distance(
xi = 1.0f - (1.0f - xi)/sample_transmittance;
}
}
else
else
#endif
if(closure_flag & SD_EXTINCTION) {
/* absorption only, no sampling needed */
@@ -751,7 +751,7 @@ ccl_device void kernel_volume_decoupled_record(KernelGlobals *kg, PathState *sta
step_offset = 0.0f;
segment->steps = &segment->stack_step;
}
/* init accumulation variables */
float3 accum_emission = make_float3(0.0f, 0.0f, 0.0f);
float3 accum_transmittance = make_float3(1.0f, 1.0f, 1.0f);
@@ -1263,7 +1263,7 @@ ccl_device void kernel_volume_stack_enter_exit(KernelGlobals *kg, ShaderData *sd
if(!(sd->flag & SD_HAS_VOLUME))
return;
if(sd->flag & SD_BACKFACING) {
/* exit volume object: remove from stack */
for(int i = 0; stack[i].shader != SHADER_NONE; i++) {

View File

@@ -60,4 +60,3 @@
#include "kernel/kernel.h"
#define KERNEL_ARCH cpu
#include "kernel/kernels/cpu/kernel_cpu_impl.h"

View File

@@ -106,4 +106,3 @@
#if CUDA_KERNEL_BRANCHED_MAX_REGISTERS > CUDA_THREAD_MAX_REGISTERS
# error "Maximum number of registers per thread exceeded"
#endif

View File

@@ -188,4 +188,3 @@ ccl_device float4 kernel_tex_image_interp_3d(KernelGlobals *kg, int id, float x,
return make_float4(f, f, f, 1.0f);
}
}

View File

@@ -62,4 +62,3 @@ __kernel void KERNEL_NAME_EVAL(kernel_ocl_path_trace, KERNEL_NAME)(
#undef KERNEL_NAME_JOIN
#undef KERNEL_NAME_EVAL

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -96,4 +96,3 @@ ClosureParam *closure_holdout_params()
CCLOSURE_PREPARE(closure_holdout_prepare, HoldoutClosure)
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -82,4 +82,3 @@ ClosureParam *closure_bsdf_diffuse_ramp_params()
CCLOSURE_PREPARE(closure_bsdf_diffuse_ramp_prepare, DiffuseRampClosure)
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -82,4 +82,3 @@ ClosureParam *closure_bsdf_phong_ramp_params()
CCLOSURE_PREPARE(closure_bsdf_phong_ramp_prepare, PhongRampClosure)
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -72,4 +72,3 @@ ClosureParam *closure_emission_params()
CCLOSURE_PREPARE(closure_emission_prepare, GenericEmissiveClosure)
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -132,4 +132,3 @@ ClosureParam *closure_bssrdf_params()
CCLOSURE_PREPARE(closure_bssrdf_prepare, CBSSRDFClosure)
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -770,4 +770,3 @@ CCLOSURE_PREPARE(closure_henyey_greenstein_prepare, VolumeHenyeyGreensteinClosur
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -146,4 +146,3 @@ CCLOSURE_PREPARE_STATIC(bsdf_##lower##_prepare, Upper##Closure)
CCL_NAMESPACE_END
#endif /* __OSL_CLOSURES_H__ */

View File

@@ -95,4 +95,3 @@ CCL_NAMESPACE_END
#endif
#endif /* __OSL_GLOBALS_H__ */

View File

@@ -364,7 +364,7 @@ bool OSLRenderServices::get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result
bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring to)
{
KernelGlobals *kg = kernel_globals;
if(to == u_ndc) {
copy_matrix(result, kernel_data.cam.worldtondc);
return true;
@@ -381,11 +381,11 @@ bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44
copy_matrix(result, kernel_data.cam.worldtocamera);
return true;
}
return false;
}
bool OSLRenderServices::get_array_attribute(OSL::ShaderGlobals *sg, bool derivatives,
bool OSLRenderServices::get_array_attribute(OSL::ShaderGlobals *sg, bool derivatives,
ustring object, TypeDesc type, ustring name,
int index, void *val)
{
@@ -684,7 +684,7 @@ bool OSLRenderServices::get_object_standard_attribute(KernelGlobals *kg, ShaderD
float3 f = particle_angular_velocity(kg, particle_id);
return set_attribute_float3(f, type, derivatives, val);
}
/* Geometry Attributes */
else if(name == u_geom_numpolyvertices) {
return set_attribute_int(3, type, derivatives, val);
@@ -873,7 +873,7 @@ bool OSLRenderServices::get_attribute(ShaderData *sd, bool derivatives, ustring
return false;
}
bool OSLRenderServices::get_userdata(bool derivatives, ustring name, TypeDesc type,
bool OSLRenderServices::get_userdata(bool derivatives, ustring name, TypeDesc type,
OSL::ShaderGlobals *sg, void *val)
{
return false; /* disabled by lockgeom */

View File

@@ -45,18 +45,18 @@ class OSLRenderServices : public OSL::RendererServices
public:
OSLRenderServices();
~OSLRenderServices();
void thread_init(KernelGlobals *kernel_globals, OSL::TextureSystem *ts);
bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time);
bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time);
bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from, float time);
bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring to, float time);
bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform);
bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform);
bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from);
bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from);
@@ -195,4 +195,3 @@ private:
CCL_NAMESPACE_END
#endif /* __OSL_SERVICES_H__ */

View File

@@ -115,7 +115,7 @@ static void shaderdata_to_shaderglobals(KernelGlobals *kg, ShaderData *sd, PathS
globals->backfacing = (sd->flag & SD_BACKFACING);
/* shader data to be used in services callbacks */
globals->renderstate = sd;
globals->renderstate = sd;
/* hacky, we leave it to services to fetch actual object matrix */
globals->shader2common = sd;
@@ -340,7 +340,7 @@ void OSLShader::eval_volume(KernelGlobals *kg, ShaderData *sd, PathState *state,
if(kg->osl->volume_state[shader]) {
ss->execute(octx, *(kg->osl->volume_state[shader]), *globals);
}
/* flatten closure tree */
if(globals->Ci)
flatten_volume_closure_tree(sd, globals->Ci);
@@ -405,4 +405,3 @@ int OSLShader::find_attribute(KernelGlobals *kg, const ShaderData *sd, uint id,
}
CCL_NAMESPACE_END

View File

@@ -67,4 +67,3 @@ CCL_NAMESPACE_END
#endif
#endif /* __OSL_SHADER_H__ */

View File

@@ -131,7 +131,7 @@ color hsv_to_rgb(color hsv)
else {
if (h == 1.0)
h = 0.0;
h *= 6.0;
i = floor(h);
f = h - i;
@@ -150,4 +150,3 @@ color hsv_to_rgb(color hsv)
return rgb;
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
float fresnel_dielectric_cos(float cosi, float eta)
{
/* compute fresnel reflectance without explicitly computing
@@ -46,4 +46,3 @@ color fresnel_conductor(float cosi, color eta, color k)
(tmp_f + (2.0 * eta * cosi) + cosi2);
return (Rparl2 + Rperp2) * 0.5;
}

View File

@@ -84,6 +84,6 @@ float rgb_ramp_lookup(float ramp[], float at, int interpolate, int extrapolate)
if (interpolate && t > 0.0)
result = (1.0 - t) * result + t * ramp[i + 1];
return result;
}

View File

@@ -90,11 +90,11 @@ void voronoi(point p, float e, float da[4], point pa[4])
float safe_noise(point p, string type)
{
float f = 0.0;
/* Perlin noise in range -1..1 */
if (type == "signed")
f = noise("perlin", p);
/* Perlin noise in range 0..1 */
else
f = noise(p);
@@ -102,7 +102,7 @@ float safe_noise(point p, string type)
/* can happen for big coordinates, things even out to 0.5 then anyway */
if (!isfinite(f))
return 0.5;
return f;
}
@@ -114,7 +114,7 @@ float noise_turbulence(point p, float details, int hard)
float amp = 1.0;
float sum = 0.0;
int i, n;
float octaves = clamp(details, 0.0, 16.0);
n = (int)octaves;
@@ -128,7 +128,7 @@ float noise_turbulence(point p, float details, int hard)
amp *= 0.5;
fscale *= 2.0;
}
float rmd = octaves - floor(octaves);
if (rmd != 0.0) {
@@ -160,7 +160,6 @@ float nonzero(float f, float eps)
r = sign(f) * eps;
else
r = f;
return r;
}

View File

@@ -213,7 +213,7 @@ void fresnel (vector I, normal N, float eta,
F *= sqr (beta / (g+c));
Kr = F;
Kt = (1.0 - Kr) * eta*eta;
// OPT: the following recomputes some of the above values, but it
// OPT: the following recomputes some of the above values, but it
// gives us the same result as if the shader-writer called refract()
T = refract(I, N, eta);
} else {
@@ -415,7 +415,7 @@ color transformc (string from, string to, color x)
return transformc (to, r);
}
// Matrix functions

View File

@@ -231,4 +231,3 @@ ccl_device_noinline bool kernel_split_branched_path_surface_indirect_light_iter(
#endif /* __BRANCHED_PATH__ */
CCL_NAMESPACE_END

View File

@@ -65,4 +65,3 @@ ccl_device void kernel_lamp_emission(KernelGlobals *kg)
}
CCL_NAMESPACE_END

View File

@@ -52,4 +52,3 @@ ccl_device void kernel_shadow_blocked_ao(KernelGlobals *kg)
}
CCL_NAMESPACE_END

View File

@@ -498,4 +498,3 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ccl_a
CCL_NAMESPACE_END
#endif /* __SVM_H__ */

View File

@@ -154,4 +154,3 @@ void svm_node_attr_bump_dy(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -223,4 +223,3 @@ ccl_device void svm_node_bevel(
}
CCL_NAMESPACE_END

View File

@@ -36,7 +36,7 @@ ccl_device_noinline float2 svm_brick(float3 p, float mortar_size, float mortar_s
float x, y;
rownum = floor_to_int(p.y / row_height);
if(offset_frequency && squash_frequency) {
brick_width *= (rownum % squash_frequency) ? 1.0f : squash_amount; /* squash */
offset = (rownum % offset_frequency) ? 0.0f : (brick_width*offset_amount); /* offset */
@@ -66,31 +66,31 @@ ccl_device_noinline float2 svm_brick(float3 p, float mortar_size, float mortar_s
}
ccl_device void svm_node_tex_brick(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int *offset)
{
{
uint4 node2 = read_node(kg, offset);
uint4 node3 = read_node(kg, offset);
uint4 node4 = read_node(kg, offset);
/* Input and Output Sockets */
uint co_offset, color1_offset, color2_offset, mortar_offset, scale_offset;
uint mortar_size_offset, bias_offset, brick_width_offset, row_height_offset;
uint color_offset, fac_offset, mortar_smooth_offset;
/* RNA properties */
uint offset_frequency, squash_frequency;
decode_node_uchar4(node.y, &co_offset, &color1_offset, &color2_offset, &mortar_offset);
decode_node_uchar4(node.z, &scale_offset, &mortar_size_offset, &bias_offset, &brick_width_offset);
decode_node_uchar4(node.w, &row_height_offset, &color_offset, &fac_offset, &mortar_smooth_offset);
decode_node_uchar4(node2.x, &offset_frequency, &squash_frequency, NULL, NULL);
float3 co = stack_load_float3(stack, co_offset);
float3 color1 = stack_load_float3(stack, color1_offset);
float3 color2 = stack_load_float3(stack, color2_offset);
float3 mortar = stack_load_float3(stack, mortar_offset);
float scale = stack_load_float_default(stack, scale_offset, node2.y);
float mortar_size = stack_load_float_default(stack, mortar_size_offset, node2.z);
float mortar_smooth = stack_load_float_default(stack, mortar_smooth_offset, node4.x);
@@ -99,13 +99,13 @@ ccl_device void svm_node_tex_brick(KernelGlobals *kg, ShaderData *sd, float *sta
float row_height = stack_load_float_default(stack, row_height_offset, node3.y);
float offset_amount = __int_as_float(node3.z);
float squash_amount = __int_as_float(node3.w);
float2 f2 = svm_brick(co*scale, mortar_size, mortar_smooth, bias, brick_width, row_height,
offset_amount, offset_frequency, squash_amount, squash_frequency);
float tint = f2.x;
float f = f2.y;
if(f != 1.0f) {
float facm = 1.0f - tint;
color1 = facm * color1 + tint * color2;
@@ -118,4 +118,3 @@ ccl_device void svm_node_tex_brick(KernelGlobals *kg, ShaderData *sd, float *sta
}
CCL_NAMESPACE_END

View File

@@ -51,4 +51,3 @@ ccl_device void svm_node_leave_bump_eval(KernelGlobals *kg, ShaderData *sd, floa
}
CCL_NAMESPACE_END

View File

@@ -38,4 +38,3 @@ ccl_device void svm_node_camera(KernelGlobals *kg, ShaderData *sd, float *stack,
}
CCL_NAMESPACE_END

View File

@@ -33,7 +33,7 @@ ccl_device_noinline float svm_checker(float3 p)
}
ccl_device void svm_node_tex_checker(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
{
{
uint co_offset, color1_offset, color2_offset, scale_offset;
uint color_offset, fac_offset;
@@ -44,7 +44,7 @@ ccl_device void svm_node_tex_checker(KernelGlobals *kg, ShaderData *sd, float *s
float3 color1 = stack_load_float3(stack, color1_offset);
float3 color2 = stack_load_float3(stack, color2_offset);
float scale = stack_load_float_default(stack, scale_offset, node.w);
float f = svm_checker(co*scale);
if(stack_valid(color_offset))
@@ -54,4 +54,3 @@ ccl_device void svm_node_tex_checker(KernelGlobals *kg, ShaderData *sd, float *s
}
CCL_NAMESPACE_END

View File

@@ -130,7 +130,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
// calculate weights of the diffuse and specular part
float diffuse_weight = (1.0f - saturate(metallic)) * (1.0f - saturate(transmission));
float final_transmission = saturate(transmission) * (1.0f - saturate(metallic));
float specular_weight = (1.0f - final_transmission);
@@ -713,7 +713,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
bsdf->N = N;
bsdf->size = param1;
bsdf->smooth = param2;
if(type == CLOSURE_BSDF_DIFFUSE_TOON_ID)
sd->flag |= bsdf_diffuse_toon_setup(bsdf);
else
@@ -725,7 +725,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *
case CLOSURE_BSDF_HAIR_REFLECTION_ID:
case CLOSURE_BSDF_HAIR_TRANSMISSION_ID: {
float3 weight = sd->svm_closure_weight * mix_weight;
if(sd->flag & SD_BACKFACING && sd->type & PRIMITIVE_ALL_CURVE) {
/* todo: giving a fixed weight here will cause issues when
* mixing multiple BSDFS. energy will not be conserved and
@@ -1055,4 +1055,3 @@ ccl_device void svm_node_set_normal(KernelGlobals *kg, ShaderData *sd, float *st
}
CCL_NAMESPACE_END

View File

@@ -60,7 +60,7 @@ ccl_device float3 svm_mix_overlay(float t, float3 col1, float3 col2)
outcol.z *= tm + 2.0f*t*col2.z;
else
outcol.z = 1.0f - (tm + 2.0f*t*(1.0f - col2.z))*(1.0f - outcol.z);
return outcol;
}
@@ -167,7 +167,7 @@ ccl_device float3 svm_mix_burn(float t, float3 col1, float3 col2)
outcol.z = 1.0f;
else
outcol.z = tmp;
return outcol;
}
@@ -180,7 +180,7 @@ ccl_device float3 svm_mix_hue(float t, float3 col1, float3 col2)
if(hsv2.y != 0.0f) {
float3 hsv = rgb_to_hsv(outcol);
hsv.x = hsv2.x;
float3 tmp = hsv_to_rgb(hsv);
float3 tmp = hsv_to_rgb(hsv);
outcol = interp(outcol, tmp, t);
}
@@ -227,7 +227,7 @@ ccl_device float3 svm_mix_color(float t, float3 col1, float3 col2)
float3 hsv = rgb_to_hsv(outcol);
hsv.x = hsv2.x;
hsv.y = hsv2.y;
float3 tmp = hsv_to_rgb(hsv);
float3 tmp = hsv_to_rgb(hsv);
outcol = interp(outcol, tmp, t);
}
@@ -303,4 +303,3 @@ ccl_device_inline float3 svm_brightness_contrast(float3 color, float brightness,
}
CCL_NAMESPACE_END

View File

@@ -69,4 +69,3 @@ ccl_device void svm_node_convert(KernelGlobals *kg, ShaderData *sd, float *stack
}
CCL_NAMESPACE_END

View File

@@ -160,4 +160,3 @@ ccl_device void svm_node_vector_displacement(KernelGlobals *kg, ShaderData *sd,
}
CCL_NAMESPACE_END

View File

@@ -24,7 +24,7 @@ ccl_device void svm_node_fresnel(ShaderData *sd, float *stack, uint ior_offset,
decode_node_uchar4(node, &normal_offset, &out_offset, NULL, NULL);
float eta = (stack_valid(ior_offset))? stack_load_float(stack, ior_offset): __uint_as_float(ior_value);
float3 normal_in = stack_valid(normal_offset)? stack_load_float3(stack, normal_offset): sd->N;
eta = fmaxf(eta, 1e-5f);
eta = (sd->flag & SD_BACKFACING)? 1.0f/eta: eta;
@@ -71,4 +71,3 @@ ccl_device void svm_node_layer_weight(ShaderData *sd, float *stack, uint4 node)
}
CCL_NAMESPACE_END

View File

@@ -208,4 +208,3 @@ ccl_device void svm_node_hair_info(KernelGlobals *kg,
#endif
CCL_NAMESPACE_END

View File

@@ -36,7 +36,7 @@ ccl_device float svm_gradient(float3 p, NodeGradientType type)
else if(type == NODE_BLEND_EASING) {
float r = fminf(fmaxf(x, 0.0f), 1.0f);
float t = r*r;
return (3.0f*t - 2.0f*t*r);
}
else if(type == NODE_BLEND_DIAGONAL) {
@@ -78,4 +78,3 @@ ccl_device void svm_node_tex_gradient(ShaderData *sd, float *stack, uint4 node)
}
CCL_NAMESPACE_END

View File

@@ -60,4 +60,3 @@ ccl_device void svm_node_hsv(KernelGlobals *kg, ShaderData *sd, float *stack, ui
CCL_NAMESPACE_END
#endif /* __SVM_HSV_H__ */

View File

@@ -203,4 +203,3 @@ ccl_device void svm_node_tex_environment(KernelGlobals *kg, ShaderData *sd, floa
}
CCL_NAMESPACE_END

View File

@@ -35,4 +35,3 @@ ccl_device void svm_node_invert(ShaderData *sd, float *stack, uint in_fac, uint
}
CCL_NAMESPACE_END

View File

@@ -74,4 +74,3 @@ ccl_device void svm_node_light_falloff(ShaderData *sd, float *stack, uint4 node)
}
CCL_NAMESPACE_END

View File

@@ -109,4 +109,3 @@ ccl_device void svm_node_tex_magic(KernelGlobals *kg, ShaderData *sd, float *sta
}
CCL_NAMESPACE_END

View File

@@ -43,4 +43,3 @@ ccl_device void svm_node_min_max(KernelGlobals *kg, ShaderData *sd, float *stack
}
CCL_NAMESPACE_END

View File

@@ -47,4 +47,3 @@ ccl_device void svm_node_vector_math(KernelGlobals *kg, ShaderData *sd, float *s
}
CCL_NAMESPACE_END

View File

@@ -98,7 +98,7 @@ ccl_device float svm_math(NodeMath type, float Fac1, float Fac2)
Fac = saturate(Fac1);
else
Fac = 0.0f;
return Fac;
}
@@ -180,4 +180,3 @@ ccl_device_inline float3 svm_math_gamma_color(float3 color, float gamma)
}
CCL_NAMESPACE_END

View File

@@ -32,4 +32,3 @@ ccl_device void svm_node_mix(KernelGlobals *kg, ShaderData *sd, float *stack, ui
}
CCL_NAMESPACE_END

View File

@@ -193,7 +193,7 @@ ccl_device float svm_musgrave(NodeMusgraveType type, float dimension, float lacu
return intensity*noise_musgrave_ridged_multi_fractal(p, dimension, lacunarity, octaves, offset, gain);
else if(type == NODE_MUSGRAVE_HETERO_TERRAIN)
return intensity*noise_musgrave_hetero_terrain(p, dimension, lacunarity, octaves, offset);
return 0.0f;
}
@@ -232,4 +232,3 @@ ccl_device void svm_node_tex_musgrave(KernelGlobals *kg, ShaderData *sd, float *
}
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2011, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -120,7 +120,7 @@ ccl_device int imod(int a, int b)
return a < 0 ? a + b : a;
}
ccl_device uint phash(int kx, int ky, int kz, int3 p)
ccl_device uint phash(int kx, int ky, int kz, int3 p)
{
return hash(imod(kx, p.x), imod(ky, p.y), imod(kz, p.z));
}
@@ -334,4 +334,3 @@ ccl_device ssef cellnoise_color(const ssef& p)
#endif
CCL_NAMESPACE_END

View File

@@ -57,4 +57,3 @@ ccl_device void svm_node_tex_noise(KernelGlobals *kg, ShaderData *sd, float *sta
}
CCL_NAMESPACE_END

View File

@@ -36,4 +36,3 @@ ccl_device void svm_node_normal(KernelGlobals *kg, ShaderData *sd, float *stack,
}
CCL_NAMESPACE_END

View File

@@ -109,4 +109,3 @@ ccl_device void svm_node_curves(KernelGlobals *kg, ShaderData *sd, float *stack,
CCL_NAMESPACE_END
#endif /* __SVM_RAMP_H__ */

View File

@@ -96,4 +96,3 @@ ccl_device float float_ramp_lookup(const float *ramp,
CCL_NAMESPACE_END
#endif /* __SVM_RAMP_UTIL_H__ */

View File

@@ -20,11 +20,11 @@ ccl_device void svm_node_combine_hsv(KernelGlobals *kg, ShaderData *sd, float *s
{
uint4 node1 = read_node(kg, offset);
uint color_out = node1.y;
float hue = stack_load_float(stack, hue_in);
float saturation = stack_load_float(stack, saturation_in);
float value = stack_load_float(stack, value_in);
/* Combine, and convert back to RGB */
float3 color = hsv_to_rgb(make_float3(hue, saturation, value));
@@ -36,9 +36,9 @@ ccl_device void svm_node_separate_hsv(KernelGlobals *kg, ShaderData *sd, float *
{
uint4 node1 = read_node(kg, offset);
uint value_out = node1.y;
float3 color = stack_load_float3(stack, color_in);
/* Convert to HSV */
color = rgb_to_hsv(color);
@@ -51,4 +51,3 @@ ccl_device void svm_node_separate_hsv(KernelGlobals *kg, ShaderData *sd, float *
}
CCL_NAMESPACE_END

View File

@@ -41,4 +41,3 @@ ccl_device void svm_node_separate_vector(ShaderData *sd, float *stack, uint ivec
}
CCL_NAMESPACE_END

View File

@@ -110,7 +110,7 @@ ccl_device void svm_node_tex_sky(KernelGlobals *kg, ShaderData *sd, float *stack
/* Define variables */
float sunphi, suntheta, radiance_x, radiance_y, radiance_z;
float config_x[9], config_y[9], config_z[9];
/* Load data */
uint dir_offset = node.y;
uint out_offset = node.z;
@@ -121,49 +121,49 @@ ccl_device void svm_node_tex_sky(KernelGlobals *kg, ShaderData *sd, float *stack
suntheta = data.y;
radiance_x = data.z;
radiance_y = data.w;
data = read_node_float(kg, offset);
radiance_z = data.x;
config_x[0] = data.y;
config_x[1] = data.z;
config_x[2] = data.w;
data = read_node_float(kg, offset);
config_x[3] = data.x;
config_x[4] = data.y;
config_x[5] = data.z;
config_x[6] = data.w;
data = read_node_float(kg, offset);
config_x[7] = data.x;
config_x[8] = data.y;
config_y[0] = data.z;
config_y[1] = data.w;
data = read_node_float(kg, offset);
config_y[2] = data.x;
config_y[3] = data.y;
config_y[4] = data.z;
config_y[5] = data.w;
data = read_node_float(kg, offset);
config_y[6] = data.x;
config_y[7] = data.y;
config_y[8] = data.z;
config_z[0] = data.w;
data = read_node_float(kg, offset);
config_z[1] = data.x;
config_z[2] = data.y;
config_z[3] = data.z;
config_z[4] = data.w;
data = read_node_float(kg, offset);
config_z[5] = data.x;
config_z[6] = data.y;
config_z[7] = data.z;
config_z[8] = data.w;
float3 dir = stack_load_float3(stack, dir_offset);
float3 f;
@@ -183,4 +183,3 @@ ccl_device void svm_node_tex_sky(KernelGlobals *kg, ShaderData *sd, float *stack
}
CCL_NAMESPACE_END

View File

@@ -323,7 +323,7 @@ ccl_device void svm_node_normal_map(KernelGlobals *kg, ShaderData *sd, float *st
color.y = -color.y;
color.z = -color.z;
}
/* object, world space */
N = color;
@@ -392,4 +392,3 @@ ccl_device void svm_node_tangent(KernelGlobals *kg, ShaderData *sd, float *stack
}
CCL_NAMESPACE_END

View File

@@ -61,4 +61,3 @@ ccl_device_noinline float noise_turbulence(float3 p, float octaves, int hard)
}
CCL_NAMESPACE_END

View File

@@ -24,7 +24,7 @@ CCL_NAMESPACE_BEGIN
/* SVM stack has a fixed size */
#define SVM_STACK_SIZE 255
/* SVM stack offsets with this value indicate that it's not on the stack */
#define SVM_STACK_INVALID 255
#define SVM_STACK_INVALID 255
#define SVM_BUMP_EVAL_STATE_SIZE 9
@@ -505,4 +505,3 @@ typedef enum ClosureType {
CCL_NAMESPACE_END
#endif /* __SVM_TYPES_H__ */

View File

@@ -33,4 +33,3 @@ ccl_device void svm_node_value_v(KernelGlobals *kg, ShaderData *sd, float *stack
}
CCL_NAMESPACE_END

View File

@@ -22,20 +22,20 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, flo
{
uint itype, ifrom, ito;
uint vector_in, vector_out;
decode_node_uchar4(node.y, &itype, &ifrom, &ito, NULL);
decode_node_uchar4(node.z, &vector_in, &vector_out, NULL, NULL);
float3 in = stack_load_float3(stack, vector_in);
NodeVectorTransformType type = (NodeVectorTransformType)itype;
NodeVectorTransformConvertSpace from = (NodeVectorTransformConvertSpace)ifrom;
NodeVectorTransformConvertSpace to = (NodeVectorTransformConvertSpace)ito;
Transform tfm;
bool is_object = (sd->object != OBJECT_NONE);
bool is_direction = (type == NODE_VECTOR_TRANSFORM_TYPE_VECTOR || type == NODE_VECTOR_TRANSFORM_TYPE_NORMAL);
/* From world */
if(from == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD) {
if(to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA) {
@@ -52,7 +52,7 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, flo
object_inverse_position_transform(kg, sd, &in);
}
}
/* From camera */
else if(from == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA) {
if(to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD || to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT) {
@@ -69,7 +69,7 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, flo
object_inverse_position_transform(kg, sd, &in);
}
}
/* From object */
else if(from == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT) {
if((to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD || to == NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA) && is_object) {
@@ -86,11 +86,11 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, flo
in = transform_point(&tfm, in);
}
}
/* Normalize Normal */
if(type == NODE_VECTOR_TRANSFORM_TYPE_NORMAL)
in = normalize(in);
/* Output */
if(stack_valid(vector_out)) {
stack_store_float3(stack, vector_out, in);
@@ -98,4 +98,3 @@ ccl_device void svm_node_vector_transform(KernelGlobals *kg, ShaderData *sd, flo
}
CCL_NAMESPACE_END

View File

@@ -137,4 +137,3 @@ ccl_device void svm_node_tex_voronoi(KernelGlobals *kg, ShaderData *sd, float *s
}
CCL_NAMESPACE_END

View File

@@ -63,4 +63,3 @@ ccl_device void svm_node_tex_wave(KernelGlobals *kg, ShaderData *sd, float *stac
}
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2013, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -71,12 +71,12 @@ ccl_static_constant float cie_colour_match[81][3] = {
};
ccl_device void svm_node_wavelength(KernelGlobals *kg, ShaderData *sd, float *stack, uint wavelength, uint color_out)
{
{
float lambda_nm = stack_load_float(stack, wavelength);
float ii = (lambda_nm-380.0f) * (1.0f/5.0f); // scaled 0..80
int i = float_to_int(ii);
float3 color;
if(i < 0 || i >= 80) {
color = make_float3(0.0f, 0.0f, 0.0f);
}
@@ -85,10 +85,10 @@ ccl_device void svm_node_wavelength(KernelGlobals *kg, ShaderData *sd, float *st
ccl_constant float *c = cie_colour_match[i];
color = interp(make_float3(c[0], c[1], c[2]), make_float3(c[3], c[4], c[5]), ii);
}
color = xyz_to_rgb(kg, color);
color *= 1.0f/2.52f; // Empirical scale from lg to make all comps <= 1
/* Clamp to zero if values are smaller */
color = max(color, make_float3(0.0f, 0.0f, 0.0f));
@@ -96,4 +96,3 @@ ccl_device void svm_node_wavelength(KernelGlobals *kg, ShaderData *sd, float *st
}
CCL_NAMESPACE_END

View File

@@ -5,7 +5,7 @@
* All Rights Reserved.
*
* Modifications Copyright 2013, Blender Foundation.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -134,4 +134,3 @@ ccl_device void svm_node_wireframe(KernelGlobals *kg,
}
CCL_NAMESPACE_END

View File

@@ -202,7 +202,7 @@ bool Attribute::same_storage(TypeDesc a, TypeDesc b)
{
if(a == b)
return true;
if(a == TypeDesc::TypeColor || a == TypeDesc::TypePoint ||
a == TypeDesc::TypeVector || a == TypeDesc::TypeNormal)
{
@@ -292,7 +292,7 @@ const char *Attribute::standard_name(AttributeStandard std)
case ATTR_STD_NUM:
return "";
}
return "";
}
@@ -476,7 +476,7 @@ Attribute *AttributeSet::add(AttributeStandard std, ustring name)
}
attr->std = std;
return attr;
}
@@ -682,7 +682,7 @@ bool AttributeRequestSet::find(ustring name)
foreach(AttributeRequest& req, requests)
if(req.name == name)
return true;
return false;
}
@@ -706,4 +706,3 @@ void AttributeRequestSet::clear()
}
CCL_NAMESPACE_END

View File

@@ -173,4 +173,3 @@ public:
CCL_NAMESPACE_END
#endif /* __ATTRIBUTE_H__ */

View File

@@ -62,7 +62,7 @@ void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene
{
if(!need_update)
return;
device_free(device, dscene);
Shader *bg_shader = shader;
@@ -135,4 +135,3 @@ void Background::tag_update(Scene *scene)
}
CCL_NAMESPACE_END

View File

@@ -60,4 +60,3 @@ public:
CCL_NAMESPACE_END
#endif /* __BACKGROUND_H__ */

View File

@@ -84,4 +84,3 @@ private:
CCL_NAMESPACE_END
#endif /* __BAKE_H__ */

View File

@@ -448,4 +448,3 @@ bool DisplayBuffer::draw_ready()
}
CCL_NAMESPACE_END

View File

@@ -147,4 +147,3 @@ public:
CCL_NAMESPACE_END
#endif /* __BUFFERS_H__ */

View File

@@ -246,7 +246,7 @@ void Camera::update(Scene *scene)
cameratoscreen = projection_orthographic(nearclip, farclip);
else
cameratoscreen = projection_identity();
ProjectionTransform screentocamera = projection_inverse(cameratoscreen);
rastertocamera = screentocamera * rastertoscreen;

View File

@@ -181,7 +181,7 @@ public:
/* functions */
Camera();
~Camera();
void compute_auto_viewplane();
void update(Scene *scene);
@@ -213,4 +213,3 @@ private:
CCL_NAMESPACE_END
#endif /* __CAMERA_H__ */

View File

@@ -71,4 +71,3 @@ public:
CCL_NAMESPACE_END
#endif /* __CONSTANT_FOLD_H__ */

View File

@@ -188,4 +188,3 @@ void CurveSystemManager::tag_update_mesh()
need_mesh_update = true;
}
CCL_NAMESPACE_END

View File

@@ -120,4 +120,3 @@ public:
CCL_NAMESPACE_END
#endif /* __CURVES_H__ */

View File

@@ -175,11 +175,11 @@ bool Pass::equals(const array<Pass>& A, const array<Pass>& B)
{
if(A.size() != B.size())
return false;
for(int i = 0; i < A.size(); i++)
if(A[i].type != B[i].type)
return false;
return true;
}
@@ -188,7 +188,7 @@ bool Pass::contains(const array<Pass>& passes, PassType type)
for(size_t i = 0; i < passes.size(); i++)
if(passes[i].type == type)
return true;
return false;
}
@@ -302,7 +302,7 @@ void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
{
if(!need_update)
return;
device_free(device, dscene, scene);
KernelFilm *kfilm = &dscene->data.film;
@@ -510,4 +510,3 @@ void Film::tag_update(Scene * /*scene*/)
}
CCL_NAMESPACE_END

View File

@@ -93,4 +93,3 @@ public:
CCL_NAMESPACE_END
#endif /* __FILM_H__ */

View File

@@ -745,7 +745,7 @@ void ShaderGraph::clean(Scene *scene)
vector<bool> visited(num_node_ids, false);
vector<bool> on_stack(num_node_ids, false);
/* break cycles */
break_cycles(output(), visited, on_stack);
@@ -860,7 +860,7 @@ void ShaderGraph::refine_bump_nodes()
copy_nodes(nodes_bump, nodes_dx);
copy_nodes(nodes_bump, nodes_dy);
/* mark nodes to indicate they are use for bump computation, so
that any texture coordinates are shifted by dx/dy when sampling */
foreach(ShaderNode *node, nodes_bump)
@@ -876,13 +876,13 @@ void ShaderGraph::refine_bump_nodes()
connect(out_dx, node->input("SampleX"));
connect(out_dy, node->input("SampleY"));
/* add generated nodes */
foreach(NodePair& pair, nodes_dx)
add(pair.second);
foreach(NodePair& pair, nodes_dy)
add(pair.second);
/* connect what is connected is bump to samplecenter input*/
connect(out , node->input("SampleCenter"));
@@ -941,7 +941,7 @@ void ShaderGraph::bump_from_displacement(bool use_object_space)
* this for bump from displacement, this will be the only bump allowed to
* overwrite the shader normal */
ShaderNode *set_normal = add(new SetNormalNode());
/* add bump node and connect copied graphs to it */
BumpNode *bump = (BumpNode*)add(new BumpNode());
bump->use_object_space = use_object_space;
@@ -973,7 +973,7 @@ void ShaderGraph::bump_from_displacement(bool use_object_space)
connect(dot_center->output("Value"), bump->input("SampleCenter"));
connect(dot_dx->output("Value"), bump->input("SampleX"));
connect(dot_dy->output("Value"), bump->input("SampleY"));
/* connect the bump out to the set normal in: */
connect(bump->output("Normal"), set_normal->input("Direction"));
@@ -996,7 +996,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
* the graph into nodes that feed weights into closure nodes. this is too
* avoid building a closure tree and then flattening it, and instead write it
* directly to an array */
if(node->special_type == SHADER_SPECIAL_TYPE_COMBINE_CLOSURE) {
ShaderInput *fin = node->input("Fac");
ShaderInput *cl1in = node->input("Closure1");
@@ -1007,8 +1007,8 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight
/* mix closure: add node to mix closure weights */
MixClosureWeightNode *mix_node = new MixClosureWeightNode();
add(mix_node);
ShaderInput *fac_in = mix_node->input("Fac");
ShaderInput *weight_in = mix_node->input("Weight");
ShaderInput *fac_in = mix_node->input("Fac");
ShaderInput *weight_in = mix_node->input("Weight");
if(fin->link)
connect(fin->link, fac_in);
@@ -1171,4 +1171,3 @@ void ShaderGraph::dump_graph(const char *filename)
}
CCL_NAMESPACE_END

View File

@@ -165,7 +165,7 @@ public:
int id; /* index in graph node array */
ShaderBump bump; /* for bump mapping utility */
ShaderNodeSpecialType special_type; /* special node type */
/* ** Selective nodes compilation ** */
@@ -294,4 +294,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __GRAPH_H__ */

View File

@@ -1034,4 +1034,3 @@ void ImageManager::device_free(Device *device)
}
CCL_NAMESPACE_END

View File

@@ -167,4 +167,3 @@ private:
CCL_NAMESPACE_END
#endif /* __IMAGE_H__ */

View File

@@ -118,7 +118,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
}
/* Transparent Shadows
* We only need to enable transparent shadows, if we actually have
* We only need to enable transparent shadows, if we actually have
* transparent shaders in the scene. Otherwise we can disable it
* to improve performance a bit. */
kintegrator->transparent_shadows = false;
@@ -141,7 +141,7 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene
kintegrator->use_ambient_occlusion =
((Pass::contains(scene->film->passes, PASS_AO)) || dscene->data.background.ao_factor != 0.0f);
kintegrator->sample_clamp_direct = (sample_clamp_direct == 0.0f)? FLT_MAX: sample_clamp_direct*3.0f;
kintegrator->sample_clamp_indirect = (sample_clamp_indirect == 0.0f)? FLT_MAX: sample_clamp_indirect*3.0f;
@@ -236,4 +236,3 @@ void Integrator::tag_update(Scene *scene)
}
CCL_NAMESPACE_END

View File

@@ -75,7 +75,7 @@ public:
NUM_METHODS,
};
Method method;
SamplingPattern sampling_pattern;
@@ -95,4 +95,3 @@ public:
CCL_NAMESPACE_END
#endif /* __INTEGRATOR_H__ */

View File

@@ -759,7 +759,7 @@ void LightManager::device_update_points(Device *,
float area = len(axisu)*len(axisv);
float invarea = (area > 0.0f)? 1.0f/area: 1.0f;
float3 dir = light->dir;
dir = safe_normalize(dir);
if(light->use_mis && area > 0.0f)
@@ -788,7 +788,7 @@ void LightManager::device_update_points(Device *,
float spot_angle = cosf(light->spot_angle*0.5f);
float spot_smooth = (1.0f - spot_angle)*light->spot_smooth;
float3 dir = light->dir;
dir = safe_normalize(dir);
if(light->use_mis && radius > 0.0f)
@@ -1027,4 +1027,3 @@ void LightManager::device_update_ies(DeviceScene *dscene)
}
CCL_NAMESPACE_END

View File

@@ -140,4 +140,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __LIGHT_H__ */

View File

@@ -388,4 +388,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __MESH_H__ */

View File

@@ -89,7 +89,7 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me
int object = object_index;
int prim = mesh->tri_offset + i;
float u, v;
switch(j) {
case 0:
u = 1.0f;
@@ -113,7 +113,7 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me
if(d_input_size == 0)
return false;
/* run device task */
device_vector<float4> d_output(device, "displace_output", MEM_READ_WRITE);
d_output.alloc(d_input_size);
@@ -319,4 +319,3 @@ bool MeshManager::displace(Device *device, DeviceScene *dscene, Scene *scene, Me
}
CCL_NAMESPACE_END

View File

@@ -613,4 +613,3 @@ void Mesh::tessellate(DiagSplit *split)
}
CCL_NAMESPACE_END

View File

@@ -82,7 +82,7 @@ Transform TextureMapping::compute_transform()
mmat[1][y_mapping-1] = 1.0f;
if(z_mapping != NONE)
mmat[2][z_mapping-1] = 1.0f;
float3 scale_clamped = scale;
if(type == TEXTURE || type == NORMAL) {
@@ -94,7 +94,7 @@ Transform TextureMapping::compute_transform()
if(fabsf(scale.z) < 1e-5f)
scale_clamped.z = signf(scale.z)*1e-5f;
}
Transform smat = transform_scale(scale_clamped);
Transform rmat = transform_euler(rotation);
Transform tmat = transform_translate(translation);
@@ -137,12 +137,12 @@ bool TextureMapping::skip()
return false;
if(scale != make_float3(1.0f, 1.0f, 1.0f))
return false;
if(x_mapping != X || y_mapping != Y || z_mapping != Z)
return false;
if(use_minmax)
return false;
return true;
}
@@ -520,7 +520,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler)
compiler.stack_assign_if_linked(alpha_out),
srgb),
projection);
tex_mapping.compile_end(compiler, vector_in, vector_offset);
}
else {
@@ -612,7 +612,7 @@ static void sky_texture_precompute_old(SunSky *sunsky, float3 dir, float turbidi
* zenith_Y/x/y is now radiance_x/y/z
* perez_Y/x/y is now config_x/y/z
*/
float2 spherical = sky_spherical_coordinates(dir);
float theta = spherical.x;
float phi = spherical.y;
@@ -676,12 +676,12 @@ static void sky_texture_precompute_new(SunSky *sunsky, float3 dir, float turbidi
float2 spherical = sky_spherical_coordinates(dir);
float theta = spherical.x;
float phi = spherical.y;
/* Clamp Turbidity */
turbidity = clamp(turbidity, 0.0f, 10.0f);
turbidity = clamp(turbidity, 0.0f, 10.0f);
/* Clamp to Horizon */
theta = clamp(theta, 0.0f, M_PI_2_F);
theta = clamp(theta, 0.0f, M_PI_2_F);
sunsky->theta = theta;
sunsky->phi = phi;
@@ -773,7 +773,7 @@ void SkyTextureNode::compile(OSLCompiler& compiler)
sky_texture_precompute_new(&sunsky, sun_direction, turbidity, ground_albedo);
else
assert(false);
compiler.parameter(this, "type");
compiler.parameter("theta", sunsky.theta);
compiler.parameter("phi", sunsky.phi);
@@ -1296,7 +1296,7 @@ void CheckerTextureNode::compile(SVMCompiler& compiler)
ShaderInput *color1_in = input("Color1");
ShaderInput *color2_in = input("Color2");
ShaderInput *scale_in = input("Scale");
ShaderOutput *color_out = output("Color");
ShaderOutput *fac_out = output("Fac");
@@ -1371,7 +1371,7 @@ void BrickTextureNode::compile(SVMCompiler& compiler)
ShaderInput *bias_in = input("Bias");
ShaderInput *brick_width_in = input("Brick Width");
ShaderInput *row_height_in = input("Row Height");
ShaderOutput *color_out = output("Color");
ShaderOutput *fac_out = output("Fac");
@@ -1393,7 +1393,7 @@ void BrickTextureNode::compile(SVMCompiler& compiler)
compiler.stack_assign_if_linked(color_out),
compiler.stack_assign_if_linked(fac_out),
compiler.stack_assign_if_linked(mortar_smooth_in)));
compiler.add_node(compiler.encode_uchar4(offset_frequency, squash_frequency),
__float_as_int(scale),
__float_as_int(mortar_size),
@@ -2310,7 +2310,7 @@ ToonBsdfNode::ToonBsdfNode()
void ToonBsdfNode::compile(SVMCompiler& compiler)
{
closure = component;
BsdfNode::compile(compiler, input("Size"), input("Smooth"));
}
@@ -2864,7 +2864,7 @@ void VolumeNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput
compiler.add_node(NODE_CLOSURE_WEIGHT, compiler.stack_assign(color_in));
else
compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color);
compiler.add_node(NODE_CLOSURE_VOLUME,
compiler.encode_uchar4(closure,
(param1)? compiler.stack_assign(param1): SVM_STACK_INVALID,
@@ -3158,7 +3158,7 @@ void GeometryNode::compile(SVMCompiler& compiler)
geom_node = NODE_GEOMETRY_BUMP_DY;
attr_node = NODE_ATTR_BUMP_DY;
}
out = output("Position");
if(!out->links.empty()) {
compiler.add_node(geom_node, NODE_GEOM_P, compiler.stack_assign(out));
@@ -3287,7 +3287,7 @@ void TextureCoordinateNode::compile(SVMCompiler& compiler)
attr_node = NODE_ATTR_BUMP_DY;
geom_node = NODE_GEOMETRY_BUMP_DY;
}
out = output("Generated");
if(!out->links.empty()) {
if(compiler.background) {
@@ -3363,7 +3363,7 @@ void TextureCoordinateNode::compile(OSLCompiler& compiler)
compiler.parameter("bump_offset", "dy");
else
compiler.parameter("bump_offset", "center");
if(compiler.background)
compiler.parameter("is_background", true);
if(compiler.output_type() == SHADER_TYPE_VOLUME)
@@ -3525,7 +3525,7 @@ void LightPathNode::compile(SVMCompiler& compiler)
if(!out->links.empty()) {
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_transmission, compiler.stack_assign(out));
}
out = output("Is Volume Scatter Ray");
if(!out->links.empty()) {
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_volume_scatter, compiler.stack_assign(out));
@@ -3535,7 +3535,7 @@ void LightPathNode::compile(SVMCompiler& compiler)
if(!out->links.empty()) {
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_length, compiler.stack_assign(out));
}
out = output("Ray Depth");
if(!out->links.empty()) {
compiler.add_node(NODE_LIGHT_PATH, NODE_LP_ray_depth, compiler.stack_assign(out));
@@ -3728,7 +3728,7 @@ void ParticleInfoNode::attributes(Shader *shader, AttributeRequestSet *attribute
void ParticleInfoNode::compile(SVMCompiler& compiler)
{
ShaderOutput *out;
out = output("Index");
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_INDEX, compiler.stack_assign(out));
@@ -3738,22 +3738,22 @@ void ParticleInfoNode::compile(SVMCompiler& compiler)
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_RANDOM, compiler.stack_assign(out));
}
out = output("Age");
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_AGE, compiler.stack_assign(out));
}
out = output("Lifetime");
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_LIFETIME, compiler.stack_assign(out));
}
out = output("Location");
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_LOCATION, compiler.stack_assign(out));
}
/* quaternion data is not yet supported by Cycles */
#if 0
out = output("Rotation");
@@ -3761,17 +3761,17 @@ void ParticleInfoNode::compile(SVMCompiler& compiler)
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_ROTATION, compiler.stack_assign(out));
}
#endif
out = output("Size");
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_SIZE, compiler.stack_assign(out));
}
out = output("Velocity");
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_VELOCITY, compiler.stack_assign(out));
}
out = output("Angular Velocity");
if(!out->links.empty()) {
compiler.add_node(NODE_PARTICLE_INFO, NODE_INFO_PAR_ANGULAR_VELOCITY, compiler.stack_assign(out));
@@ -3824,7 +3824,7 @@ void HairInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes)
void HairInfoNode::compile(SVMCompiler& compiler)
{
ShaderOutput *out;
out = output("Is Strand");
if(!out->links.empty()) {
compiler.add_node(NODE_HAIR_INFO, NODE_INFO_CURVE_IS_STRAND, compiler.stack_assign(out));
@@ -4747,7 +4747,7 @@ void AttributeNode::compile(OSLCompiler& compiler)
compiler.parameter("bump_offset", "dy");
else
compiler.parameter("bump_offset", "center");
if(Attribute::name_standard(attribute.c_str()) != ATTR_STD_NONE)
compiler.parameter("name", (string("geom:") + attribute.c_str()).c_str());
else
@@ -5553,7 +5553,7 @@ void RGBRampNode::compile(OSLCompiler& compiler)
compiler.parameter_color_array("ramp_color", ramp);
compiler.parameter_array("ramp_alpha", ramp_alpha.data(), ramp_alpha.size());
compiler.parameter(this, "interpolate");
compiler.add(this, "node_rgb_ramp");
}
@@ -5586,7 +5586,7 @@ void SetNormalNode::compile(SVMCompiler& compiler)
void SetNormalNode::compile(OSLCompiler& compiler)
{
compiler.add(this, "node_set_normal");
compiler.add(this, "node_set_normal");
}
/* OSLNode */
@@ -5707,7 +5707,7 @@ void NormalMapNode::attributes(Shader *shader, AttributeRequestSet *attributes)
attributes->add(ATTR_STD_VERTEX_NORMAL);
}
ShaderNode::attributes(shader, attributes);
}
@@ -5752,7 +5752,7 @@ void NormalMapNode::compile(OSLCompiler& compiler)
}
compiler.parameter(this, "space");
compiler.add(this, "node_normal_map");
compiler.add(this, "node_normal_map");
}
/* Tangent */
@@ -5797,7 +5797,7 @@ void TangentNode::attributes(Shader *shader, AttributeRequestSet *attributes)
else
attributes->add(ATTR_STD_GENERATED);
}
ShaderNode::attributes(shader, attributes);
}
@@ -5833,7 +5833,7 @@ void TangentNode::compile(OSLCompiler& compiler)
compiler.parameter(this, "direction_type");
compiler.parameter(this, "axis");
compiler.add(this, "node_tangent");
compiler.add(this, "node_tangent");
}
/* Bevel */

View File

@@ -1121,4 +1121,3 @@ public:
CCL_NAMESPACE_END
#endif /* __NODES_H__ */

View File

@@ -183,7 +183,7 @@ void Object::apply_transform(bool apply_to_motion)
{
if(!mesh || tfm == transform_identity())
return;
/* triangles */
if(mesh->verts.size()) {
/* store matrix to transform later. when accessing these as attributes we
@@ -194,7 +194,7 @@ void Object::apply_transform(bool apply_to_motion)
/* apply to mesh vertices */
for(size_t i = 0; i < mesh->verts.size(); i++)
mesh->verts[i] = transform_point(&tfm, mesh->verts[i]);
if(apply_to_motion) {
Attribute *attr = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
@@ -840,4 +840,3 @@ void ObjectManager::tag_update(Scene *scene)
}
CCL_NAMESPACE_END

View File

@@ -129,4 +129,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __OBJECT_H__ */

View File

@@ -122,7 +122,7 @@ void OSLShaderManager::device_update(Device *device, DeviceScene *dscene, Scene
shader->need_update = false;
need_update = false;
/* set texture system */
scene->image_manager->set_osl_texture_system((void*)ts);
@@ -578,7 +578,7 @@ string OSLCompiler::compatible_name(ShaderNode *node, ShaderInput *input)
/* strip whitespace */
while((i = sname.find(" ")) != string::npos)
sname.replace(i, 1, "");
/* if output exists with the same name, add "In" suffix */
foreach(ShaderOutput *output, node->outputs) {
if(input->name() == output->name()) {
@@ -586,7 +586,7 @@ string OSLCompiler::compatible_name(ShaderNode *node, ShaderInput *input)
break;
}
}
return sname;
}
@@ -598,7 +598,7 @@ string OSLCompiler::compatible_name(ShaderNode *node, ShaderOutput *output)
/* strip whitespace */
while((i = sname.find(" ")) != string::npos)
sname.replace(i, 1, "");
/* if input exists with the same name, add "Out" suffix */
foreach(ShaderInput *input, node->inputs) {
if(input->name() == output->name()) {
@@ -606,7 +606,7 @@ string OSLCompiler::compatible_name(ShaderNode *node, ShaderOutput *output)
break;
}
}
return sname;
}
@@ -614,7 +614,7 @@ bool OSLCompiler::node_skip_input(ShaderNode *node, ShaderInput *input)
{
/* exception for output node, only one input is actually used
* depending on the current shader type */
if(input->flags() & SocketType::SVM_INTERNAL)
return true;
@@ -704,7 +704,7 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
ss->Shader("displacement", name, id(node).c_str());
else
assert(0);
/* link inputs to other nodes */
foreach(ShaderInput *input, node->inputs) {
if(input->link) {
@@ -1250,4 +1250,3 @@ void OSLCompiler::parameter_color_array(const char * /*name*/, const array<float
#endif /* WITH_OSL */
CCL_NAMESPACE_END

View File

@@ -171,4 +171,3 @@ private:
CCL_NAMESPACE_END
#endif /* __OSL_H__ */

View File

@@ -61,12 +61,12 @@ void ParticleSystemManager::device_update_particles(Device *, DeviceScene *dscen
int num_particles = 1;
for(size_t j = 0; j < scene->particle_systems.size(); j++)
num_particles += scene->particle_systems[j]->particles.size();
KernelParticle *kparticles = dscene->particles.alloc(num_particles);
/* dummy particle */
memset(kparticles, 0, sizeof(KernelParticle));
int i = 1;
for(size_t j = 0; j < scene->particle_systems.size(); j++) {
ParticleSystem *psys = scene->particle_systems[j];
@@ -74,7 +74,7 @@ void ParticleSystemManager::device_update_particles(Device *, DeviceScene *dscen
for(size_t k = 0; k < psys->particles.size(); k++) {
/* pack in texture */
Particle& pa = psys->particles[k];
kparticles[i].index = pa.index;
kparticles[i].age = pa.age;
kparticles[i].lifetime = pa.lifetime;
@@ -83,13 +83,13 @@ void ParticleSystemManager::device_update_particles(Device *, DeviceScene *dscen
kparticles[i].location = float3_to_float4(pa.location);
kparticles[i].velocity = float3_to_float4(pa.velocity);
kparticles[i].angular_velocity = float3_to_float4(pa.angular_velocity);
i++;
if(progress.get_cancel()) return;
}
}
dscene->particles.copy_to_device();
}
@@ -105,9 +105,9 @@ void ParticleSystemManager::device_update(Device *device, DeviceScene *dscene, S
progress.set_status("Updating Particle Systems", "Copying Particles to device");
device_update_particles(device, dscene, scene, progress);
if(progress.get_cancel()) return;
need_update = false;
}
@@ -122,4 +122,3 @@ void ParticleSystemManager::tag_update(Scene * /*scene*/)
}
CCL_NAMESPACE_END

View File

@@ -69,4 +69,3 @@ public:
CCL_NAMESPACE_END
#endif /* __PARTICLES_H__ */

View File

@@ -319,7 +319,7 @@ bool Scene::need_global_attribute(AttributeStandard std)
return need_motion() != MOTION_NONE;
else if(std == ATTR_STD_MOTION_VERTEX_NORMAL)
return need_motion() == MOTION_BLUR;
return false;
}
@@ -380,4 +380,3 @@ void Scene::device_free()
}
CCL_NAMESPACE_END

View File

@@ -267,4 +267,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __SCENE_H__ */

View File

@@ -364,7 +364,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
if(!tile_manager.next_tile(tile, device_num))
return false;
/* fill render tile */
rtile.x = tile_manager.state.buffer.full_x + tile->x;
rtile.y = tile_manager.state.buffer.full_y + tile->y;
@@ -916,7 +916,7 @@ void Session::update_status_time(bool show_pause, bool show_done)
substatus = string_printf("Path Tracing Sample %d/%d",
progressive_sample+1,
num_samples);
if(show_pause) {
status = "Paused";
}
@@ -941,7 +941,7 @@ void Session::render()
/* Add path trace task. */
DeviceTask task(DeviceTask::RENDER);
task.acquire_tile = function_bind(&Session::acquire_tile, this, _1, _2);
task.release_tile = function_bind(&Session::release_tile, this, _1);
task.map_neighbor_tiles = function_bind(&Session::map_neighbor_tiles, this, _1, _2);

View File

@@ -237,4 +237,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __SESSION_H__ */

View File

@@ -313,7 +313,7 @@ void Shader::tag_update(Scene *scene)
if(has_displacement && displacement_method == DISPLACE_BOTH) {
attributes.add(ATTR_STD_POSITION_UNDISPLACED);
}
/* compare if the attributes changed, mesh manager will check
* need_update_mesh, update the relevant meshes and clear it. */
if(attributes.modified(prev_attributes)) {
@@ -398,7 +398,7 @@ ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem)
{
manager = new SVMShaderManager();
}
add_default(scene);
return manager;
@@ -413,7 +413,7 @@ uint ShaderManager::get_attribute_id(ustring name)
if(it != unique_attribute_id.end())
return it->second;
uint id = (uint)ATTR_STD_NUM + unique_attribute_id.size();
unique_attribute_id[name] = id;
return id;
@@ -432,10 +432,10 @@ int ShaderManager::get_shader_id(Shader *shader, bool smooth)
/* smooth flag */
if(smooth)
id |= SHADER_SMOOTH_NORMAL;
/* default flags */
id |= SHADER_CAST_SHADOW|SHADER_AREA_LIGHT;
return id;
}
@@ -696,4 +696,3 @@ float ShaderManager::linear_rgb_to_gray(float3 c)
}
CCL_NAMESPACE_END

View File

@@ -155,7 +155,7 @@ public:
};
/* Shader Manager virtual base class
*
*
* From this the SVM and OSL shader managers are derived, that do the actual
* shader compiling and device updating. */
@@ -223,4 +223,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __SHADER_H__ */

View File

@@ -7,7 +7,7 @@
* http://web.maths.unsw.edu.au/~fkuo/sobol/
*
* From these papers:
*
*
* S. Joe and F. Y. Kuo, Remark on Algorithm 659: Implementing Sobol's quasirandom
* sequence generator, ACM Trans. Math. Softw. 29, 49-57 (2003)
*
@@ -18,22 +18,22 @@
/* Copyright (c) 2008, Frances Y. Kuo and Stephen Joe
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
*
* * Neither the names of the copyright holders nor the names of the
* University of New South Wales and the University of Waikato
* and its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -21284,21 +21284,20 @@ void sobol_generate_direction_vectors(uint vectors[][SOBOL_BITS], int dimensions
if(L <= s) {
for(uint i = 0; i < L; i++)
v[i] = m[i] << (31-i);
v[i] = m[i] << (31-i);
}
else {
for(uint i = 0; i < s; i++)
v[i] = m[i] << (31-i);
v[i] = m[i] << (31-i);
for(uint i = s; i < L; i++) {
v[i] = v[i-s] ^ (v[i-s] >> s);
v[i] = v[i-s] ^ (v[i-s] >> s);
for(uint k = 1; k < s; k++)
v[i] ^= (((a >> (s-1-k)) & 1) * v[i-k]);
for(uint k = 1; k < s; k++)
v[i] ^= (((a >> (s-1-k)) & 1) * v[i-k]);
}
}
}
}
CCL_NAMESPACE_END

View File

@@ -29,4 +29,3 @@ void sobol_generate_direction_vectors(uint vectors[][SOBOL_BITS], int dimensions
CCL_NAMESPACE_END
#endif /* __SOBOL_H__ */

View File

@@ -71,12 +71,12 @@ void SVMShaderManager::device_update_shader(Scene *scene,
scene->light_manager->need_update = true;
}
/* The copy needs to be done inside the lock, if another thread resizes the array
* while memcpy is running, it'll be copying into possibly invalid/freed ram.
/* The copy needs to be done inside the lock, if another thread resizes the array
* while memcpy is running, it'll be copying into possibly invalid/freed ram.
*/
size_t global_nodes_size = global_svm_nodes->size();
global_svm_nodes->resize(global_nodes_size + svm_nodes.size());
/* Offset local SVM nodes to a global address space. */
int4& jump_node = (*global_svm_nodes)[shader->id];
jump_node.y = svm_nodes[0].y + global_nodes_size - 1;
@@ -173,7 +173,7 @@ SVMCompiler::SVMCompiler(ShaderManager *shader_manager_,
int SVMCompiler::stack_size(SocketType::Type type)
{
int size = 0;
switch(type) {
case SocketType::FLOAT:
case SocketType::INT:
@@ -192,14 +192,14 @@ int SVMCompiler::stack_size(SocketType::Type type)
assert(0);
break;
}
return size;
}
int SVMCompiler::stack_find_offset(int size)
{
int offset = -1;
/* find free space in stack & mark as used */
for(int i = 0, num_unused = 0; i < SVM_STACK_SIZE; i++) {
if(active_stack.users[i]) num_unused = 0;
@@ -413,7 +413,7 @@ bool SVMCompiler::node_skip_input(ShaderNode * /*node*/, ShaderInput *input)
/* nasty exception .. */
if(current_type == SHADER_TYPE_DISPLACEMENT && input->link && input->link->parent->special_type == SHADER_SPECIAL_TYPE_BUMP)
return true;
return false;
}
@@ -715,7 +715,7 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
/* get input in output node */
ShaderNode *node = graph->output();
ShaderInput *clin = NULL;
switch(type) {
case SHADER_TYPE_SURFACE:
clin = node->input("Surface");
@@ -756,9 +756,9 @@ void SVMCompiler::compile_type(Shader *shader, ShaderGraph *graph, ShaderType ty
if(shader->used) {
if(clin->link) {
bool generate = false;
switch(type) {
case SHADER_TYPE_SURFACE: /* generate surface shader */
case SHADER_TYPE_SURFACE: /* generate surface shader */
generate = true;
shader->has_surface = true;
break;
@@ -936,4 +936,3 @@ SVMCompiler::CompilerState::CompilerState(ShaderGraph *graph)
}
CCL_NAMESPACE_END

View File

@@ -224,4 +224,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __SVM_H__ */

View File

@@ -115,4 +115,3 @@ void LookupTables::remove_table(size_t *offset)
}
CCL_NAMESPACE_END

View File

@@ -51,4 +51,3 @@ public:
CCL_NAMESPACE_END
#endif /* __TABLES_H__ */

View File

@@ -535,4 +535,3 @@ int TileManager::get_num_effective_samples()
}
CCL_NAMESPACE_END

View File

@@ -155,4 +155,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __TILE_H__ */

View File

@@ -348,4 +348,3 @@ void QuadDice::dice(SubPatch& sub, EdgeFactors& ef)
}
CCL_NAMESPACE_END

View File

@@ -81,7 +81,7 @@ public:
* Edge tessellation factors and subpatch coordinates are as follows:
*
* tu1
* P01 --------- P11
* P01 --------- P11
* | |
* tv0 | | tv1
* | |
@@ -135,4 +135,3 @@ public:
CCL_NAMESPACE_END
#endif /* __SUBD_DICE_H__ */

View File

@@ -80,7 +80,7 @@ BoundBox LinearQuadPatch::bound()
for(int i = 0; i < 4; i++)
bbox.grow(hull[i]);
return bbox;
}
@@ -110,9 +110,8 @@ BoundBox BicubicPatch::bound()
for(int i = 0; i < 16; i++)
bbox.grow(hull[i]);
return bbox;
}
CCL_NAMESPACE_END

View File

@@ -57,4 +57,3 @@ public:
CCL_NAMESPACE_END
#endif /* __SUBD_PATCH_H__ */

View File

@@ -294,4 +294,3 @@ void PackedPatchTable::copy_adjusting_offsets(uint* dest, int doffset)
}
CCL_NAMESPACE_END

View File

@@ -60,4 +60,3 @@ struct PackedPatchTable {
CCL_NAMESPACE_END
#endif /* __SUBD_PATCH_TABLE_H__ */

View File

@@ -86,7 +86,7 @@ int DiagSplit::T(Patch *patch, float2 Pstart, float2 Pend)
if(tmax - tmin > params.split_threshold)
return DSPLIT_NON_UNIFORM;
return tmax;
}
@@ -258,4 +258,3 @@ void DiagSplit::split_quad(Patch *patch, QuadDice::SubPatch *subpatch)
}
CCL_NAMESPACE_END

View File

@@ -57,4 +57,3 @@ public:
CCL_NAMESPACE_END
#endif /* __SUBD_SPLIT_H__ */

View File

@@ -30,4 +30,3 @@ using std::remove;
CCL_NAMESPACE_END
#endif /* __UTIL_ALGORITHM_H__ */

View File

@@ -29,4 +29,3 @@ OIIO_NAMESPACE_USING
CCL_NAMESPACE_END
#endif /* __UTIL_ARGS_H__ */

View File

@@ -55,7 +55,7 @@ public:
{
}
__forceinline void grow(const float3& pt)
__forceinline void grow(const float3& pt)
{
/* the order of arguments to min is such that if pt is nan, it will not
* influence the resulting bounding box */
@@ -63,7 +63,7 @@ public:
max = ccl::max(pt, max);
}
__forceinline void grow(const float3& pt, float border)
__forceinline void grow(const float3& pt, float border)
{
float3 shift = make_float3(border, border, border);
min = ccl::min(pt - shift, min);
@@ -76,7 +76,7 @@ public:
grow(bbox.max);
}
__forceinline void grow_safe(const float3& pt)
__forceinline void grow_safe(const float3& pt)
{
/* the order of arguments to min is such that if pt is nan, it will not
* influence the resulting bounding box */
@@ -86,7 +86,7 @@ public:
}
}
__forceinline void grow_safe(const float3& pt, float border)
__forceinline void grow_safe(const float3& pt, float border)
{
if(isfinite(pt.x) && isfinite(pt.y) && isfinite(pt.z) && isfinite(border)) {
float3 shift = make_float3(border, border, border);
@@ -101,7 +101,7 @@ public:
grow_safe(bbox.max);
}
__forceinline void intersect(const BoundBox& bbox)
__forceinline void intersect(const BoundBox& bbox)
{
min = ccl::max(min, bbox.min);
max = ccl::min(max, bbox.max);
@@ -283,4 +283,3 @@ public:
CCL_NAMESPACE_END
#endif /* __UTIL_BOUNDBOX_H__ */

View File

@@ -241,4 +241,3 @@ ccl_device float4 color_srgb_to_linear_v4(float4 c)
CCL_NAMESPACE_END
#endif /* __UTIL_COLOR_H__ */

View File

@@ -133,4 +133,3 @@ template<typename T> static inline T decltype_helper(T x) { return x; }
#endif
#endif /* __UTIL_DEFINES_H__ */

View File

@@ -27,4 +27,3 @@
#endif
#endif /* __UTIL_FOREACH_H__ */

View File

@@ -47,4 +47,3 @@ using boost::function;
CCL_NAMESPACE_END
#endif /* __UTIL_FUNCTION_H__ */

View File

@@ -149,4 +149,3 @@ ccl_device_inline half float_to_half(float f)
CCL_NAMESPACE_END
#endif /* __UTIL_HALF_H__ */

View File

@@ -69,4 +69,3 @@ ccl_device_inline float hash_int_01(uint k)
CCL_NAMESPACE_END
#endif /* __UTIL_HASH_H__ */

View File

@@ -26,4 +26,3 @@ using std::list;
CCL_NAMESPACE_END
#endif /* __UTIL_LIST_H__ */

View File

@@ -54,4 +54,3 @@ using std::unordered_map;
CCL_NAMESPACE_END
#endif /* __UTIL_MAP_H__ */

View File

@@ -338,7 +338,7 @@ bool MD5Hash::append_file(const string& filepath)
bool success = (ferror(f) == 0);
fclose(f);
return success;
}
@@ -376,7 +376,7 @@ string MD5Hash::get_hex()
for(int i = 0; i < 16; i++)
sprintf(buf + i*2, "%02X", (unsigned int)digest[i]);
buf[sizeof(buf)-1] = '\0';
return string(buf);
}
@@ -388,4 +388,3 @@ string util_md5_string(const string& str)
}
CCL_NAMESPACE_END

View File

@@ -59,4 +59,3 @@ string util_md5_string(const string& str);
CCL_NAMESPACE_END
#endif /* __UTIL_MD5_H__ */

View File

@@ -69,4 +69,3 @@
#endif
#endif /* __UTIL_OPTIMIZATION_H__ */

View File

@@ -31,4 +31,3 @@ OIIO_NAMESPACE_USING
CCL_NAMESPACE_END
#endif /* __UTIL_PARAM_H__ */

View File

@@ -987,4 +987,3 @@ void path_cache_clear_except(const string& name, const set<string>& except)
}
CCL_NAMESPACE_END

View File

@@ -76,4 +76,3 @@ void path_cache_clear_except(const string& name, const set<string>& except);
CCL_NAMESPACE_END
#endif

View File

@@ -366,4 +366,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __UTIL_PROGRESS_H__ */

View File

@@ -174,4 +174,3 @@ ccl_device_inline ProjectionTransform projection_orthographic(float znear, float
CCL_NAMESPACE_END
#endif /* __UTIL_PROJECTION_H__ */

View File

@@ -26,4 +26,3 @@ using std::queue;
CCL_NAMESPACE_END
#endif /* __UTIL_LIST_H__ */

View File

@@ -70,4 +70,3 @@ ccl_device_inline int rect_size(int4 rect)
CCL_NAMESPACE_END
#endif /* __UTIL_RECT_H__ */

View File

@@ -60,4 +60,3 @@ using std::unordered_set;
CCL_NAMESPACE_END
#endif /* __UTIL_SET_H__ */

View File

@@ -111,7 +111,7 @@ __forceinline size_t __popcnt(size_t in) {
#endif
__forceinline int __bsf(int v) {
#if defined(__KERNEL_AVX2__)
#if defined(__KERNEL_AVX2__)
return _tzcnt_u32(v);
#else
unsigned long r = 0; _BitScanForward(&r,v); return r;
@@ -119,7 +119,7 @@ __forceinline int __bsf(int v) {
}
__forceinline unsigned int __bsf(unsigned int v) {
#if defined(__KERNEL_AVX2__)
#if defined(__KERNEL_AVX2__)
return _tzcnt_u32(v);
#else
unsigned long r = 0; _BitScanForward(&r,v); return r;
@@ -143,7 +143,7 @@ __forceinline int __btr(int v, int i) {
}
__forceinline int bitscan(int v) {
#if defined(__KERNEL_AVX2__)
#if defined(__KERNEL_AVX2__)
return _tzcnt_u32(v);
#else
return __bsf(v);
@@ -156,18 +156,18 @@ __forceinline int clz(const int x)
return _lzcnt_u32(x);
#else
if(UNLIKELY(x == 0)) return 32;
return 31 - __bsr(x);
return 31 - __bsr(x);
#endif
}
__forceinline int __bscf(int& v)
__forceinline int __bscf(int& v)
{
int i = __bsf(v);
v &= v-1;
return i;
}
__forceinline unsigned int __bscf(unsigned int& v)
__forceinline unsigned int __bscf(unsigned int& v)
{
unsigned int i = __bsf(v);
v &= v-1;
@@ -177,7 +177,7 @@ __forceinline unsigned int __bscf(unsigned int& v)
#if defined(__KERNEL_64_BIT__)
__forceinline size_t __bsf(size_t v) {
#if defined(__KERNEL_AVX2__)
#if defined(__KERNEL_AVX2__)
return _tzcnt_u64(v);
#else
unsigned long r = 0; _BitScanForward64(&r,v); return r;
@@ -212,7 +212,7 @@ __forceinline size_t bitscan(size_t v) {
#endif
}
__forceinline size_t __bscf(size_t& v)
__forceinline size_t __bscf(size_t& v)
{
size_t i = __bsf(v);
v &= v-1;
@@ -274,7 +274,7 @@ __forceinline size_t __btr(size_t v, size_t i) {
}
__forceinline int bitscan(int v) {
#if defined(__KERNEL_AVX2__)
#if defined(__KERNEL_AVX2__)
return _tzcnt_u32(v);
#else
return __bsf(v);
@@ -282,7 +282,7 @@ __forceinline int bitscan(int v) {
}
__forceinline unsigned int bitscan(unsigned int v) {
#if defined(__KERNEL_AVX2__)
#if defined(__KERNEL_AVX2__)
return _tzcnt_u32(v);
#else
return __bsf(v);
@@ -309,11 +309,11 @@ __forceinline int clz(const int x)
return _lzcnt_u32(x);
#else
if(UNLIKELY(x == 0)) return 32;
return 31 - __bsr(x);
return 31 - __bsr(x);
#endif
}
__forceinline int __bscf(int& v)
__forceinline int __bscf(int& v)
{
int i = bitscan(v);
#if defined(__KERNEL_AVX2__)
@@ -324,7 +324,7 @@ __forceinline int __bscf(int& v)
return i;
}
__forceinline unsigned int __bscf(unsigned int& v)
__forceinline unsigned int __bscf(unsigned int& v)
{
unsigned int i = bitscan(v);
v &= v-1;
@@ -332,7 +332,7 @@ __forceinline unsigned int __bscf(unsigned int& v)
}
#if (defined(__KERNEL_64_BIT__) || defined(__APPLE__)) && !(defined(__ILP32__) && defined(__x86_64__))
__forceinline size_t __bscf(size_t& v)
__forceinline size_t __bscf(size_t& v)
{
size_t i = bitscan(v);
#if defined(__KERNEL_AVX2__)
@@ -375,28 +375,28 @@ __forceinline __m128 _mm_blendv_ps_emu( __m128 value, __m128 input, __m128 mask)
#define _mm_blend_ps _mm_blend_ps_emu
__forceinline __m128 _mm_blend_ps_emu( __m128 value, __m128 input, const int mask)
{
assert(mask < 0x10); return _mm_blendv_ps(value, input, _mm_lookupmask_ps[mask]);
assert(mask < 0x10); return _mm_blendv_ps(value, input, _mm_lookupmask_ps[mask]);
}
#undef _mm_blendv_epi8
#define _mm_blendv_epi8 _mm_blendv_epi8_emu
__forceinline __m128i _mm_blendv_epi8_emu( __m128i value, __m128i input, __m128i mask)
{
return _mm_or_si128(_mm_and_si128(mask, input), _mm_andnot_si128(mask, value));
return _mm_or_si128(_mm_and_si128(mask, input), _mm_andnot_si128(mask, value));
}
#undef _mm_min_epi32
#define _mm_min_epi32 _mm_min_epi32_emu
__forceinline __m128i _mm_min_epi32_emu( __m128i value, __m128i input)
{
return _mm_blendv_epi8(input, value, _mm_cmplt_epi32(value, input));
return _mm_blendv_epi8(input, value, _mm_cmplt_epi32(value, input));
}
#undef _mm_max_epi32
#define _mm_max_epi32 _mm_max_epi32_emu
__forceinline __m128i _mm_max_epi32_emu( __m128i value, __m128i input)
{
return _mm_blendv_epi8(value, input, _mm_cmplt_epi32(value, input));
return _mm_blendv_epi8(value, input, _mm_cmplt_epi32(value, input));
}
#undef _mm_extract_epi32
@@ -416,7 +416,7 @@ __forceinline int _mm_extract_epi32_emu( __m128i input, const int index)
#define _mm_insert_epi32 _mm_insert_epi32_emu
__forceinline __m128i _mm_insert_epi32_emu( __m128i value, int input, const int index)
{
assert(index >= 0 && index < 4); ((int*)&value)[index] = input; return value;
assert(index >= 0 && index < 4); ((int*)&value)[index] = input; return value;
}
#undef _mm_insert_ps
@@ -487,4 +487,3 @@ CCL_NAMESPACE_END
#endif /* __KERNEL_GPU__ */
#endif /* __UTIL_SIMD_TYPES_H__ */

View File

@@ -367,4 +367,3 @@ ArHosekSkyModelState * arhosek_xyz_skymodelstate_alloc_init(
}
CCL_NAMESPACE_END

View File

@@ -38,7 +38,7 @@ struct sseb
////////////////////////////////////////////////////////////////////////////////
/// Constructors, Assignment & Cast Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline sseb ( ) {}
__forceinline sseb ( const sseb& other ) { m128 = other.m128; }
__forceinline sseb& operator=( const sseb& other ) { m128 = other.m128; return *this; }
@@ -47,10 +47,10 @@ struct sseb
__forceinline operator const __m128&( void ) const { return m128; }
__forceinline operator const __m128i( void ) const { return _mm_castps_si128(m128); }
__forceinline operator const __m128d( void ) const { return _mm_castps_pd(m128); }
__forceinline sseb ( bool a )
: m128(_mm_lookupmask_ps[(size_t(a) << 3) | (size_t(a) << 2) | (size_t(a) << 1) | size_t(a)]) {}
__forceinline sseb ( bool a, bool b)
__forceinline sseb ( bool a, bool b)
: m128(_mm_lookupmask_ps[(size_t(b) << 3) | (size_t(a) << 2) | (size_t(b) << 1) | size_t(a)]) {}
__forceinline sseb ( bool a, bool b, bool c, bool d)
: m128(_mm_lookupmask_ps[(size_t(d) << 3) | (size_t(c) << 2) | (size_t(b) << 1) | size_t(a)]) {}
@@ -103,11 +103,11 @@ __forceinline const sseb operator ^=( sseb& a, const sseb& b ) { return a = a ^
__forceinline const sseb operator !=( const sseb& a, const sseb& b ) { return _mm_xor_ps(a, b); }
__forceinline const sseb operator ==( const sseb& a, const sseb& b ) { return _mm_castsi128_ps(_mm_cmpeq_epi32(a, b)); }
__forceinline const sseb select( const sseb& m, const sseb& t, const sseb& f ) {
__forceinline const sseb select( const sseb& m, const sseb& t, const sseb& f ) {
#if defined(__KERNEL_SSE41__)
return _mm_blendv_ps(f, t, m);
return _mm_blendv_ps(f, t, m);
#else
return _mm_or_ps(_mm_and_ps(m, t), _mm_andnot_ps(m, f));
return _mm_or_ps(_mm_and_ps(m, t), _mm_andnot_ps(m, f));
#endif
}
@@ -186,4 +186,3 @@ ccl_device_inline void print_sseb(const char *label, const sseb &a)
CCL_NAMESPACE_END
#endif

View File

@@ -31,14 +31,14 @@ struct ssef
typedef sseb Mask; // mask type
typedef ssei Int; // int type
typedef ssef Float; // float type
enum { size = 4 }; // number of SIMD elements
union { __m128 m128; float f[4]; int i[4]; }; // data
////////////////////////////////////////////////////////////////////////////////
/// Constructors, Assignment & Cast Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline ssef () {}
__forceinline ssef (const ssef& other) { m128 = other.m128; }
__forceinline ssef& operator=(const ssef& other) { m128 = other.m128; return *this; }
@@ -143,7 +143,7 @@ __forceinline ssef mini(const ssef& a, const ssef& b) {
return _mm_castsi128_ps(ci);
}
#endif
#if defined(__KERNEL_SSE41__)
__forceinline ssef maxi(const ssef& a, const ssef& b) {
const ssei ai = _mm_castps_si128(a);
@@ -229,7 +229,7 @@ __forceinline const ssef select(const ssef& m, const ssef& t, const ssef& f) {
#endif
}
__forceinline const ssef select(const int mask, const ssef& t, const ssef& f) {
__forceinline const ssef select(const int mask, const ssef& t, const ssef& f) {
#if defined(__KERNEL_SSE41__) && ((!defined(__clang__) && !defined(_MSC_VER)) || defined(__INTEL_COMPILER))
return _mm_blend_ps(f, t, mask);
#else
@@ -298,8 +298,8 @@ template<> __forceinline const ssef shuffle<2, 3, 2, 3>(const ssef& a, const sse
}
#if defined(__KERNEL_SSSE3__)
__forceinline const ssef shuffle8(const ssef& a, const ssei& shuf) {
return _mm_castsi128_ps(_mm_shuffle_epi8(_mm_castps_si128(a), shuf));
__forceinline const ssef shuffle8(const ssef& a, const ssei& shuf) {
return _mm_castsi128_ps(_mm_shuffle_epi8(_mm_castps_si128(a), shuf));
}
#endif
@@ -333,7 +333,7 @@ template<size_t dst> __forceinline const ssef insert(const ssef& a,
/// Transpose
////////////////////////////////////////////////////////////////////////////////
__forceinline void transpose(const ssef& r0, const ssef& r1, const ssef& r2, const ssef& r3, ssef& c0, ssef& c1, ssef& c2, ssef& c3)
__forceinline void transpose(const ssef& r0, const ssef& r1, const ssef& r2, const ssef& r3, ssef& c0, ssef& c1, ssef& c2, ssef& c3)
{
ssef l02 = unpacklo(r0,r2);
ssef h02 = unpackhi(r0,r2);
@@ -345,7 +345,7 @@ __forceinline void transpose(const ssef& r0, const ssef& r1, const ssef& r2, con
c3 = unpackhi(h02,h13);
}
__forceinline void transpose(const ssef& r0, const ssef& r1, const ssef& r2, const ssef& r3, ssef& c0, ssef& c1, ssef& c2)
__forceinline void transpose(const ssef& r0, const ssef& r1, const ssef& r2, const ssef& r3, ssef& c0, ssef& c1, ssef& c2)
{
ssef l02 = unpacklo(r0,r2);
ssef h02 = unpackhi(r0,r2);
@@ -382,22 +382,22 @@ __forceinline size_t movemask( const ssef& a ) { return _mm_movemask_ps(a); }
__forceinline ssef load4f(const float4& a) {
#ifdef __KERNEL_WITH_SSE_ALIGN__
return _mm_load_ps(&a.x);
return _mm_load_ps(&a.x);
#else
return _mm_loadu_ps(&a.x);
return _mm_loadu_ps(&a.x);
#endif
}
__forceinline ssef load4f(const float3& a) {
#ifdef __KERNEL_WITH_SSE_ALIGN__
return _mm_load_ps(&a.x);
return _mm_load_ps(&a.x);
#else
return _mm_loadu_ps(&a.x);
return _mm_loadu_ps(&a.x);
#endif
}
__forceinline ssef load4f(const void* const a) {
return _mm_load_ps((float*)a);
return _mm_load_ps((float*)a);
}
__forceinline ssef load1f_first(const float a) {
@@ -409,14 +409,14 @@ __forceinline void store4f(void* ptr, const ssef& v) {
}
__forceinline ssef loadu4f(const void* const a) {
return _mm_loadu_ps((float*)a);
return _mm_loadu_ps((float*)a);
}
__forceinline void storeu4f(void* ptr, const ssef& v) {
_mm_storeu_ps((float*)ptr,v);
}
__forceinline void store4f(const sseb& mask, void* ptr, const ssef& f) {
__forceinline void store4f(const sseb& mask, void* ptr, const ssef& f) {
#if defined(__KERNEL_AVX__)
_mm_maskstore_ps((float*)ptr,(__m128i)mask,f);
#else
@@ -428,7 +428,7 @@ __forceinline ssef load4f_nt(void* ptr) {
#if defined(__KERNEL_SSE41__)
return _mm_castsi128_ps(_mm_stream_load_si128((__m128i*)ptr));
#else
return _mm_load_ps((float*)ptr);
return _mm_load_ps((float*)ptr);
#endif
}
@@ -449,7 +449,7 @@ __forceinline float dot(const ssef& a, const ssef& b) {
}
/* calculate shuffled cross product, useful when order of components does not matter */
__forceinline ssef cross_zxy(const ssef& a, const ssef& b)
__forceinline ssef cross_zxy(const ssef& a, const ssef& b)
{
const ssef a0 = a;
const ssef b0 = shuffle<1,2,0,3>(b);
@@ -458,7 +458,7 @@ __forceinline ssef cross_zxy(const ssef& a, const ssef& b)
return msub(a0,b0,a1*b1);
}
__forceinline ssef cross(const ssef& a, const ssef& b)
__forceinline ssef cross(const ssef& a, const ssef& b)
{
return shuffle<1,2,0,3>(cross_zxy(a, b));
}
@@ -628,4 +628,3 @@ ccl_device_inline void print_ssef(const char *label, const ssef &a)
CCL_NAMESPACE_END
#endif

View File

@@ -38,7 +38,7 @@ struct ssei
////////////////////////////////////////////////////////////////////////////////
/// Constructors, Assignment & Cast Operators
////////////////////////////////////////////////////////////////////////////////
__forceinline ssei ( ) {}
__forceinline ssei ( const ssei& a ) { m128 = a.m128; }
__forceinline ssei& operator=( const ssei& a ) { m128 = a.m128; return *this; }
@@ -173,15 +173,15 @@ __forceinline const sseb operator <=( const ssei& a, const ssei& b ) { return !(
__forceinline const sseb operator <=( const ssei& a, const int32_t& b ) { return a <= ssei(b); }
__forceinline const sseb operator <=( const int32_t& a, const ssei& b ) { return ssei(a) <= b; }
__forceinline const ssei select( const sseb& m, const ssei& t, const ssei& f ) {
__forceinline const ssei select( const sseb& m, const ssei& t, const ssei& f ) {
#ifdef __KERNEL_SSE41__
return _mm_castps_si128(_mm_blendv_ps(_mm_castsi128_ps(f), _mm_castsi128_ps(t), m));
return _mm_castps_si128(_mm_blendv_ps(_mm_castsi128_ps(f), _mm_castsi128_ps(t), m));
#else
return _mm_or_si128(_mm_and_si128(m, t), _mm_andnot_si128(m, f));
return _mm_or_si128(_mm_and_si128(m, t), _mm_andnot_si128(m, f));
#endif
}
__forceinline const ssei select( const int mask, const ssei& t, const ssei& f ) {
__forceinline const ssei select( const int mask, const ssei& t, const ssei& f ) {
#if defined(__KERNEL_SSE41__) && ((!defined(__clang__) && !defined(_MSC_VER)) || defined(__INTEL_COMPILER))
return _mm_castps_si128(_mm_blend_ps(_mm_castsi128_ps(f), _mm_castsi128_ps(t), mask));
#else
@@ -249,8 +249,8 @@ __forceinline int reduce_add(const ssei& v) { return v[0]+v[1]+v[2]+v[3]; }
/// Memory load and store operations
////////////////////////////////////////////////////////////////////////////////
__forceinline ssei load4i( const void* const a ) {
return _mm_load_si128((__m128i*)a);
__forceinline ssei load4i( const void* const a ) {
return _mm_load_si128((__m128i*)a);
}
__forceinline void store4i(void* ptr, const ssei& v) {
@@ -261,7 +261,7 @@ __forceinline void storeu4i(void* ptr, const ssei& v) {
_mm_storeu_si128((__m128i*)ptr,v);
}
__forceinline void store4i( const sseb& mask, void* ptr, const ssei& i ) {
__forceinline void store4i( const sseb& mask, void* ptr, const ssei& i ) {
#if defined (__KERNEL_AVX__)
_mm_maskstore_ps((float*)ptr,(__m128i)mask,_mm_castsi128_ps(i));
#else
@@ -269,17 +269,17 @@ __forceinline void store4i( const sseb& mask, void* ptr, const ssei& i ) {
#endif
}
__forceinline ssei load4i_nt (void* ptr) {
__forceinline ssei load4i_nt (void* ptr) {
#if defined(__KERNEL_SSE41__)
return _mm_stream_load_si128((__m128i*)ptr);
return _mm_stream_load_si128((__m128i*)ptr);
#else
return _mm_load_si128((__m128i*)ptr);
return _mm_load_si128((__m128i*)ptr);
#endif
}
__forceinline void store4i_nt(void* ptr, const ssei& v) {
__forceinline void store4i_nt(void* ptr, const ssei& v) {
#if defined(__KERNEL_SSE41__)
_mm_stream_ps((float*)ptr,_mm_castsi128_ps(v));
_mm_stream_ps((float*)ptr,_mm_castsi128_ps(v));
#else
_mm_store_si128((__m128i*)ptr,v);
#endif
@@ -300,4 +300,3 @@ ccl_device_inline void print_ssei(const char *label, const ssei &a)
CCL_NAMESPACE_END
#endif

View File

@@ -293,4 +293,3 @@ string string_human_readable_number(size_t num)
}
CCL_NAMESPACE_END

View File

@@ -73,4 +73,3 @@ string string_human_readable_number(size_t num);
CCL_NAMESPACE_END
#endif /* __UTIL_STRING_H__ */

View File

@@ -312,4 +312,3 @@ size_t system_physical_ram()
}
CCL_NAMESPACE_END

View File

@@ -47,4 +47,3 @@ size_t system_physical_ram();
CCL_NAMESPACE_END
#endif /* __UTIL_SYSTEM_H__ */

View File

@@ -122,7 +122,7 @@ void TaskPool::cancel()
do_cancel = true;
TaskScheduler::clear(this);
{
thread_scoped_lock num_lock(num_mutex);
@@ -210,7 +210,7 @@ void TaskScheduler::init(int num_threads)
int current_group_threads = 0;
if(num_groups > 1) {
process_groups.resize(num_groups);
num_process_groups = system_cpu_process_groups(num_groups,
num_process_groups = system_cpu_process_groups(num_groups,
&process_groups[0]);
if(num_process_groups == 1) {
current_group_threads = system_cpu_group_thread_count(process_groups[0]);
@@ -251,7 +251,7 @@ void TaskScheduler::init(int num_threads)
}
}
}
users++;
}
@@ -295,7 +295,7 @@ bool TaskScheduler::thread_wait_pop(Entry& entry)
assert(do_exit);
return false;
}
entry = queue.front();
queue.pop_front();
@@ -518,4 +518,3 @@ string TaskPool::Summary::full_report() const
}
CCL_NAMESPACE_END

View File

@@ -118,7 +118,7 @@ protected:
};
/* Task Scheduler
*
*
* Central scheduler that holds running threads ready to execute tasks. A singe
* queue holds the task from all pools. */
@@ -207,4 +207,3 @@ protected:
CCL_NAMESPACE_END
#endif

View File

@@ -155,4 +155,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __UTIL_THREAD_H__ */

View File

@@ -77,4 +77,3 @@ void time_sleep(double t)
CCL_NAMESPACE_END
#endif

View File

@@ -59,4 +59,3 @@ protected:
CCL_NAMESPACE_END
#endif

View File

@@ -16,10 +16,10 @@
/*
* Adapted from code with license:
*
*
* Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
* Digital Ltd. LLC. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
@@ -31,8 +31,8 @@
* distribution.
* * Neither the name of Industrial Light & Magic nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -236,7 +236,7 @@ static void transform_decompose(DecomposedTransform *decomp, const Transform *tf
for(int i = 0; i < 3; i++)
for(int j = 0; j < 4; j++)
Rnext[i][j] = 0.5f * (R[i][j] + Rit[i][j]);
norm = 0.0f;
for(int i = 0; i < 3; i++) {
norm = max(norm,

View File

@@ -258,7 +258,7 @@ ccl_device_inline bool transform_uniform_scale(const Transform& tfm, float& scal
/* the epsilon here is quite arbitrary, but this function is only used for
* surface area and bump, where we expect it to not be so sensitive */
float eps = 1e-6f;
float sx = len_squared(float4_to_float3(tfm.x));
float sy = len_squared(float4_to_float3(tfm.y));
float sz = len_squared(float4_to_float3(tfm.z));
@@ -471,4 +471,3 @@ OPENCL_TRANSFORM_ADDRSPACE_DECLARE(transform_direction_transposed)
CCL_NAMESPACE_END
#endif /* __UTIL_TRANSFORM_H__ */

View File

@@ -152,4 +152,3 @@ CCL_NAMESPACE_END
#endif
#endif /* __UTIL_TYPES_H__ */

View File

@@ -102,7 +102,7 @@ ccl_device_inline float4 make_float4(const int4& i)
ccl_device_inline void print_float4(const char *label, const float4& a)
{
printf("%s: %.8f %.8f %.8f %.8f\n",
label,
label,
(double)a.x, (double)a.y, (double)a.z, (double)a.w);
}
#endif /* __KERNEL_GPU__ */

View File

@@ -341,4 +341,3 @@ protected:
CCL_NAMESPACE_END
#endif /* __UTIL_VECTOR_H__ */

View File

@@ -272,4 +272,3 @@ void view_redraw()
}
CCL_NAMESPACE_END

View File

@@ -41,4 +41,3 @@ void view_redraw();
CCL_NAMESPACE_END
#endif /*__UTIL_VIEW_H__*/

View File

@@ -57,4 +57,3 @@ CCL_NAMESPACE_END
#endif /* WIN32 */
#endif /* __UTIL_WINDOWS_H__ */