forked from bartvdbraak/blender
Cycles: Updates for new OSL 1.5 API.
Differential Revision: https://developer.blender.org/D662 Patch by Sergey and myself.
This commit is contained in:
parent
35f07cfc1b
commit
6582215f87
@ -126,7 +126,7 @@ void OSLRenderServices::thread_init(KernelGlobals *kernel_globals_, OSL::Texture
|
||||
osl_ts = osl_ts_;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time)
|
||||
bool OSLRenderServices::get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time)
|
||||
{
|
||||
/* this is only used for shader and object space, we don't really have
|
||||
* a concept of shader space, so we just use object space for both. */
|
||||
@ -156,7 +156,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time)
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform, float time)
|
||||
{
|
||||
/* this is only used for shader and object space, we don't really have
|
||||
* a concept of shader space, so we just use object space for both. */
|
||||
@ -186,7 +186,7 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::Transform
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from, float time)
|
||||
bool OSLRenderServices::get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from, float time)
|
||||
{
|
||||
KernelGlobals *kg = kernel_globals;
|
||||
|
||||
@ -218,7 +218,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from, float ti
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to, float time)
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring to, float time)
|
||||
{
|
||||
KernelGlobals *kg = kernel_globals;
|
||||
|
||||
@ -250,7 +250,7 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to, fl
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform)
|
||||
bool OSLRenderServices::get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform)
|
||||
{
|
||||
/* this is only used for shader and object space, we don't really have
|
||||
* a concept of shader space, so we just use object space for both. */
|
||||
@ -275,7 +275,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform)
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, OSL::TransformationPtr xform)
|
||||
{
|
||||
/* this is only used for shader and object space, we don't really have
|
||||
* a concept of shader space, so we just use object space for both. */
|
||||
@ -300,7 +300,7 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, OSL::Transform
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from)
|
||||
bool OSLRenderServices::get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from)
|
||||
{
|
||||
KernelGlobals *kg = kernel_globals;
|
||||
|
||||
@ -328,7 +328,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to)
|
||||
bool OSLRenderServices::get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring to)
|
||||
{
|
||||
KernelGlobals *kg = kernel_globals;
|
||||
|
||||
@ -356,7 +356,7 @@ bool OSLRenderServices::get_inverse_matrix(OSL::Matrix44 &result, ustring to)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_array_attribute(void *renderstate, bool derivatives,
|
||||
bool OSLRenderServices::get_array_attribute(OSL::ShaderGlobals *sg, bool derivatives,
|
||||
ustring object, TypeDesc type, ustring name,
|
||||
int index, void *val)
|
||||
{
|
||||
@ -751,13 +751,13 @@ bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData *
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustring object_name,
|
||||
bool OSLRenderServices::get_attribute(OSL::ShaderGlobals *sg, bool derivatives, ustring object_name,
|
||||
TypeDesc type, ustring name, void *val)
|
||||
{
|
||||
if (renderstate == NULL)
|
||||
if (sg->renderstate == NULL)
|
||||
return false;
|
||||
|
||||
ShaderData *sd = (ShaderData *)renderstate;
|
||||
ShaderData *sd = (ShaderData *)(sg->renderstate);
|
||||
KernelGlobals *kg = sd->osl_globals;
|
||||
bool is_curve;
|
||||
int object;
|
||||
@ -815,12 +815,12 @@ bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustri
|
||||
}
|
||||
|
||||
bool OSLRenderServices::get_userdata(bool derivatives, ustring name, TypeDesc type,
|
||||
void *renderstate, void *val)
|
||||
OSL::ShaderGlobals *sg, void *val)
|
||||
{
|
||||
return false; /* disabled by lockgeom */
|
||||
}
|
||||
|
||||
bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, void *renderstate)
|
||||
bool OSLRenderServices::has_userdata(ustring name, TypeDesc type, OSL::ShaderGlobals *sg)
|
||||
{
|
||||
return false; /* never called by OSL */
|
||||
}
|
||||
@ -1100,7 +1100,7 @@ bool OSLRenderServices::getmessage(OSL::ShaderGlobals *sg, ustring source, ustri
|
||||
return set_attribute_float(f, type, derivatives, val);
|
||||
}
|
||||
|
||||
return get_attribute(sd, derivatives, u_empty, type, name, val);
|
||||
return get_attribute(sg, derivatives, u_empty, type, name, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,27 +49,27 @@ public:
|
||||
|
||||
void thread_init(KernelGlobals *kernel_globals, OSL::TextureSystem *ts);
|
||||
|
||||
bool get_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time);
|
||||
bool get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform, float time);
|
||||
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::Matrix44 &result, ustring from, float time);
|
||||
bool get_inverse_matrix(OSL::Matrix44 &result, ustring to, 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::Matrix44 &result, OSL::TransformationPtr xform);
|
||||
bool get_inverse_matrix(OSL::Matrix44 &result, OSL::TransformationPtr xform);
|
||||
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::Matrix44 &result, ustring from);
|
||||
bool get_inverse_matrix(OSL::Matrix44 &result, ustring from);
|
||||
bool get_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from);
|
||||
bool get_inverse_matrix(OSL::ShaderGlobals *sg, OSL::Matrix44 &result, ustring from);
|
||||
|
||||
bool get_array_attribute(void *renderstate, bool derivatives,
|
||||
bool get_array_attribute(OSL::ShaderGlobals *sg, bool derivatives,
|
||||
ustring object, TypeDesc type, ustring name,
|
||||
int index, void *val);
|
||||
bool get_attribute(void *renderstate, bool derivatives, ustring object,
|
||||
bool get_attribute(OSL::ShaderGlobals *sg, bool derivatives, ustring object,
|
||||
TypeDesc type, ustring name, void *val);
|
||||
|
||||
bool get_userdata(bool derivatives, ustring name, TypeDesc type,
|
||||
void *renderstate, void *val);
|
||||
bool has_userdata(ustring name, TypeDesc type, void *renderstate);
|
||||
OSL::ShaderGlobals *sg, void *val);
|
||||
bool has_userdata(ustring name, TypeDesc type, OSL::ShaderGlobals *sg);
|
||||
|
||||
int pointcloud_search(OSL::ShaderGlobals *sg, ustring filename, const OSL::Vec3 ¢er,
|
||||
float radius, int max_points, bool sort, size_t *out_indices,
|
||||
@ -157,6 +157,65 @@ public:
|
||||
static ustring u_v;
|
||||
static ustring u_empty;
|
||||
|
||||
#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);
|
||||
}
|
||||
#endif
|
||||
private:
|
||||
KernelGlobals *kernel_globals;
|
||||
OSL::TextureSystem *osl_ts;
|
||||
|
@ -248,7 +248,11 @@ void OSLShaderManager::shading_system_free()
|
||||
|
||||
bool OSLShaderManager::osl_compile(const string& inputfile, const string& outputfile)
|
||||
{
|
||||
#if OSL_LIBRARY_VERSION_CODE >= 10500
|
||||
vector<string_view> options;
|
||||
#else
|
||||
vector<string> options;
|
||||
#endif
|
||||
string stdosl_path;
|
||||
|
||||
/* specify output file name */
|
||||
|
Loading…
Reference in New Issue
Block a user