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

@ -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);

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

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

@ -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

@ -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()

@ -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

@ -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

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

@ -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();

@ -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;

@ -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

@ -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

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

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

@ -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

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

@ -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__ */

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

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

@ -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__ */

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

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

@ -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__ */

@ -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

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

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

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

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

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

@ -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.

@ -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.

@ -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.

@ -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.

@ -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.

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

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

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

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

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

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

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

@ -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

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

@ -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;
}

@ -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__ */

@ -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__ */

@ -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;
}

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

@ -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__ */

@ -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;

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

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

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

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

@ -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__ */

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

@ -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__ */

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

@ -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

@ -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);

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

@ -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

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

@ -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;
}

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

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

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

@ -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

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

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

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

@ -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 {

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

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

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

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

@ -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

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

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

@ -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;
}

@ -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:

@ -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

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

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

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

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

@ -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

@ -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:

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

@ -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

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

@ -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__ */

@ -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++) {

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

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

@ -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);
}
}

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

@ -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

@ -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

@ -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

Some files were not shown because too many files have changed in this diff Show More