[Bf-blender-cvs] [d5220d2] master: Cycles: Fixes for recent refactor

Sergey Sharybin noreply at git.blender.org
Tue May 31 15:33:41 CEST 2016


Commit: d5220d23f976d14350d5d76f7cb97d4fef8e977d
Author: Sergey Sharybin
Date:   Tue May 31 15:32:31 2016 +0200
Branches: master
https://developer.blender.org/rBd5220d23f976d14350d5d76f7cb97d4fef8e977d

Cycles: Fixes for recent refactor

- add_vertex() can be called from split_vertex() which does not guarantee
  to have properly pre-allocate arrays.

- Need to check whether Cycles is compiled with OSL in XML reader.

===================================================================

M	intern/cycles/app/cycles_xml.cpp
M	intern/cycles/render/mesh.cpp
M	intern/cycles/render/mesh.h

===================================================================

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 6f9cbe3..9f967a4 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -306,6 +306,7 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml
 
 			snode = env;
 		}
+#ifdef WITH_OSL
 		else if(string_iequals(node.name(), "osl_shader")) {
 			if(manager->use_osl()) {
 				std::string filepath;
@@ -329,6 +330,7 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml
 				fprintf(stderr, "OSL node without using --shadingsys osl.\n");
 			}
 		}
+#endif
 		else if(string_iequals(node.name(), "sky_texture")) {
 			SkyTextureNode *sky = new SkyTextureNode();
 			
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index d92226d..755b16a 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -206,7 +206,7 @@ void Mesh::clear()
 int Mesh::split_vertex(int vertex)
 {
 	/* copy vertex location and vertex attributes */
-	add_vertex(verts[vertex]);
+	add_vertex_slow(verts[vertex]);
 
 	foreach(Attribute& attr, attributes.attributes) {
 		if(attr.element == ATTR_ELEMENT_VERTEX) {
@@ -224,6 +224,11 @@ void Mesh::add_vertex(float3 P)
 	verts.push_back_reserved(P);
 }
 
+void Mesh::add_vertex_slow(float3 P)
+{
+	verts.push_back_slow(P);
+}
+
 void Mesh::add_triangle(int v0, int v1, int v2, int shader_, bool smooth_, bool forms_quad_)
 {
 	triangles.push_back_reserved(v0);
diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h
index 5c788fc..edad6d3 100644
--- a/intern/cycles/render/mesh.h
+++ b/intern/cycles/render/mesh.h
@@ -156,6 +156,7 @@ public:
 	void reserve_curves(int numcurves, int numkeys);
 	void clear();
 	void add_vertex(float3 P);
+	void add_vertex_slow(float3 P);
 	void add_triangle(int v0, int v1, int v2, int shader, bool smooth, bool forms_quad = false);
 	void add_curve_key(float3 loc, float radius);
 	void add_curve(int first_key, int shader);




More information about the Bf-blender-cvs mailing list