[Bf-blender-cvs] [a4bcd9b] master: Cycles: Fix missing packed images with newer versions of OSL

Sergey Sharybin noreply at git.blender.org
Thu Sep 3 15:16:37 CEST 2015


Commit: a4bcd9bc9676edf9706dd6169c4c7f8eabf312b4
Author: Sergey Sharybin
Date:   Thu Sep 3 17:46:18 2015 +0500
Branches: master
https://developer.blender.org/rBa4bcd9bc9676edf9706dd6169c4c7f8eabf312b4

Cycles: Fix missing packed images with newer versions of OSL

This isn't really complete fix, complete fix would require calculating
derivatives via OIIO API, but supporting this will either end up with
some code duplication or will require some non really safe changes at
this release cycle.

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

M	intern/cycles/kernel/osl/osl_services.h

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

diff --git a/intern/cycles/kernel/osl/osl_services.h b/intern/cycles/kernel/osl/osl_services.h
index 190234a..cb6f231 100644
--- a/intern/cycles/kernel/osl/osl_services.h
+++ b/intern/cycles/kernel/osl/osl_services.h
@@ -104,6 +104,53 @@ public:
 	               const OSL::Vec3 &dPdx, const OSL::Vec3 &dPdy,
 	               const OSL::Vec3 &dPdz, int nchannels, float *result);
 
+#if OSL_LIBRARY_VERSION_CODE >= 10700
+	bool texture(ustring filename,
+	             TextureHandle * /*texture_handle*/,
+	             TexturePerthread * /*texture_thread_info*/,
+	             TextureOpt &options,
+	             OSL::ShaderGlobals *sg,
+	             float s, float t,
+	             float dsdx, float dtdx, float dsdy, float dtdy,
+	             int nchannels,
+	             float *result,
+	             float * /*dresultds*/,
+	             float * /*dresultdt*/)
+	{
+		return texture(filename,
+		               options,
+		               sg,
+		               s, t,
+		               dsdx, dtdx, dsdy, dtdy,
+		               nchannels,
+		               result);
+	}
+
+	bool texture3d(ustring filename,
+	               TextureHandle * /*texture_handle*/,
+	               TexturePerthread * /*texture_thread_info*/,
+	               TextureOpt &options,
+	               OSL::ShaderGlobals *sg,
+	               const OSL::Vec3 &P,
+	               const OSL::Vec3 &dPdx,
+	               const OSL::Vec3 &dPdy,
+	               const OSL::Vec3 &dPdz,
+	               int nchannels,
+	               float *result,
+	               float * /*dresultds*/,
+	               float * /*dresultdt*/,
+	               float * /*dresultdr*/)
+	{
+		return texture3d(filename,
+		                 options,
+		                 sg,
+		                 P,
+		                 dPdx, dPdy, dPdz,
+		                 nchannels,
+		                 result);
+	}
+#endif
+
 	bool environment(ustring filename, TextureOpt &options,
 	                 OSL::ShaderGlobals *sg, const OSL::Vec3 &R,
 	                 const OSL::Vec3 &dRdx, const OSL::Vec3 &dRdy,




More information about the Bf-blender-cvs mailing list