Cycles: Remove compatibility code for OSL-1.4

That code was mainly needed for the transition period, now we've
got all platforms updated to new OSL.

Plus there are some crucial fixes baking in the current upstream
sources which we'll need to have for the next Blender release.
This commit is contained in:
Sergey Sharybin
2014-11-04 15:52:41 +05:00
parent d5f978b3cc
commit ffbd9448c8
3 changed files with 0 additions and 90 deletions

View File

@@ -385,13 +385,7 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
/* find socket socket */ /* find socket socket */
BL::NodeSocket b_sock(PointerRNA_NULL); BL::NodeSocket b_sock(PointerRNA_NULL);
if (param->isoutput) { if (param->isoutput) {
#if OSL_LIBRARY_VERSION_CODE < 10500
b_sock = b_node.outputs[param->name];
#else
b_sock = b_node.outputs[param->name.string()]; b_sock = b_node.outputs[param->name.string()];
#endif
/* remove if type no longer matches */ /* remove if type no longer matches */
if(b_sock && b_sock.bl_idname() != socket_type) { if(b_sock && b_sock.bl_idname() != socket_type) {
b_node.outputs.remove(b_sock); b_node.outputs.remove(b_sock);
@@ -399,12 +393,7 @@ static PyObject *osl_update_node_func(PyObject *self, PyObject *args)
} }
} }
else { else {
#if OSL_LIBRARY_VERSION_CODE < 10500
b_sock = b_node.inputs[param->name];
#else
b_sock = b_node.inputs[param->name.string()]; b_sock = b_node.inputs[param->name.string()];
#endif
/* remove if type no longer matches */ /* remove if type no longer matches */
if(b_sock && b_sock.bl_idname() != socket_type) { if(b_sock && b_sock.bl_idname() != socket_type) {
b_node.inputs.remove(b_sock); b_node.inputs.remove(b_sock);

View File

@@ -162,71 +162,6 @@ public:
/* Code to make OSL versions transition smooth. */ /* Code to make OSL versions transition smooth. */
#if OSL_LIBRARY_VERSION_CODE < 10500
bool get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) {
return get_matrix(NULL, result, xform, time);
}
bool get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time) {
return get_inverse_matrix(NULL, result, xform, time);
}
bool get_matrix(OSL::Matrix44 &result, ustring from, float time) {
return get_matrix(NULL, result, from, time);
}
bool get_inverse_matrix(OSL::Matrix44 &result, ustring to, float time) {
return get_inverse_matrix(NULL, result, to, time);
}
bool get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform) {
return get_matrix(NULL, result, xform);
}
bool get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform) {
return get_inverse_matrix(NULL, result, xform);
}
bool get_matrix(OSL::Matrix44 &result, ustring from) {
return get_matrix(NULL, result, from);
}
bool get_inverse_matrix(OSL::Matrix44 &result, ustring to) {
return get_inverse_matrix(NULL, result, to);
}
bool get_array_attribute(void *renderstate, bool derivatives,
ustring object, TypeDesc type, ustring name,
int index, void *val) {
OSL::ShaderGlobals sg;
sg.renderstate = renderstate;
return get_array_attribute(&sg, derivatives,
object, type, name,
index, val);
}
bool get_attribute(void *renderstate, bool derivatives, ustring object_name,
TypeDesc type, ustring name, void *val) {
OSL::ShaderGlobals sg;
sg.renderstate = renderstate;
return get_attribute(&sg, derivatives, object_name, type, name, val);
}
bool has_userdata(ustring name, TypeDesc type, void *renderstate) {
return has_userdata(name, type, (OSL::ShaderGlobals *) renderstate);
}
bool get_userdata(bool derivatives, ustring name, TypeDesc type,
void *renderstate, void *val) {
return get_userdata(derivatives, name, type, (OSL::ShaderGlobals *) renderstate, val);
}
bool get_texture_info(ustring filename, int subimage,
ustring dataname, TypeDesc datatype, void *data) {
return get_texture_info(NULL, filename, subimage, dataname, datatype, data);
}
#endif
#if OSL_LIBRARY_VERSION_CODE < 10600 #if OSL_LIBRARY_VERSION_CODE < 10600
inline bool texture(ustring filename, TextureOpt &options, inline bool texture(ustring filename, TextureOpt &options,
OSL::ShaderGlobals *sg, OSL::ShaderGlobals *sg,

View File

@@ -248,10 +248,6 @@ void OSLShaderManager::shading_system_free()
bool OSLShaderManager::osl_compile(const string& inputfile, const string& outputfile) bool OSLShaderManager::osl_compile(const string& inputfile, const string& outputfile)
{ {
#if OSL_LIBRARY_VERSION_CODE < 10500
typedef string string_view;
#endif
vector<string_view> options; vector<string_view> options;
string stdosl_path; string stdosl_path;
string shader_path = path_get("shader"); string shader_path = path_get("shader");
@@ -748,11 +744,7 @@ OSL::ShadingAttribStateRef OSLCompiler::compile_type(Shader *shader, ShaderGraph
current_type = type; current_type = type;
#if OSL_LIBRARY_VERSION_CODE >= 10501
OSL::ShadingAttribStateRef group = ss->ShaderGroupBegin(shader->name.c_str()); OSL::ShadingAttribStateRef group = ss->ShaderGroupBegin(shader->name.c_str());
#else
ss->ShaderGroupBegin(shader->name.c_str());
#endif
ShaderNode *output = graph->output(); ShaderNode *output = graph->output();
set<ShaderNode*> dependencies; set<ShaderNode*> dependencies;
@@ -780,13 +772,7 @@ OSL::ShadingAttribStateRef OSLCompiler::compile_type(Shader *shader, ShaderGraph
ss->ShaderGroupEnd(); ss->ShaderGroupEnd();
#if OSL_LIBRARY_VERSION_CODE >= 10501
return group; return group;
#else
OSL::ShadingAttribStateRef group = ss->state();
ss->clear_state();
return group;
#endif
} }
void OSLCompiler::compile(OSLGlobals *og, Shader *shader) void OSLCompiler::compile(OSLGlobals *og, Shader *shader)