From 2635328c4770c370564b919a4127de6c8bab7362 Mon Sep 17 00:00:00 2001 From: howetuft Date: Sat, 2 Mar 2024 11:42:59 +0100 Subject: [PATCH] Update osl to work with version 1.13.6 While keeping compatibility with older versions. --- src/kernel/osl/services.cpp | 18 ++++++++++++++++-- src/kernel/osl/services.h | 18 ++++++++++++++++-- src/kernel/osl/types.h | 4 ++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/kernel/osl/services.cpp b/src/kernel/osl/services.cpp index 02dc1cd1a..5d0320c38 100644 --- a/src/kernel/osl/services.cpp +++ b/src/kernel/osl/services.cpp @@ -1165,7 +1165,11 @@ bool OSLRenderServices::get_userdata( return false; /* disabled by lockgeom */ } -#if OSL_LIBRARY_VERSION_CODE >= 11100 +#if OSL_LIBRARY_VERSION_CODE >= 11306 +TextureSystem::TextureHandle *OSLRenderServices::get_texture_handle(OSLUStringHash filename, + OSL::ShadingContext *context, + const OSL::TextureOpt* options) +#elif OSL_LIBRARY_VERSION_CODE >= 11100 TextureSystem::TextureHandle *OSLRenderServices::get_texture_handle(OSLUStringHash filename, OSL::ShadingContext *) #else @@ -1616,7 +1620,17 @@ bool OSLRenderServices::environment(OSLUStringHash filename, return status; } -#if OSL_LIBRARY_VERSION_CODE >= 11100 +#if OSL_LIBRARY_VERSION_CODE >= 11306 +bool OSLRenderServices::get_texture_info(OSLUStringHash filename, + TextureHandle *texture_handle, + TexturePerthread *texture_thread_info, + OSL::ShaderGlobals* sg, + int subimage, + OSLUStringHash dataname, + TypeDesc datatype, + void *data, + OSLUStringHash *errormessage) +#elif OSL_LIBRARY_VERSION_CODE >= 11100 bool OSLRenderServices::get_texture_info(OSLUStringHash filename, TextureHandle *texture_handle, TexturePerthread *texture_thread_info, diff --git a/src/kernel/osl/services.h b/src/kernel/osl/services.h index b674fa7c7..63248c50f 100644 --- a/src/kernel/osl/services.h +++ b/src/kernel/osl/services.h @@ -189,7 +189,11 @@ class OSLRenderServices : public OSL::RendererServices { void *val, bool derivatives) override; -#if OSL_LIBRARY_VERSION_CODE >= 11100 +#if OSL_LIBRARY_VERSION_CODE >= 11306 + TextureSystem::TextureHandle *get_texture_handle(OSLUStringHash filename, + OSL::ShadingContext *context, + const OSL::TextureOpt* options) override; +#elif OSL_LIBRARY_VERSION_CODE >= 11100 TextureSystem::TextureHandle *get_texture_handle(OSLUStringHash filename, OSL::ShadingContext *context) override; #else @@ -245,7 +249,17 @@ class OSLRenderServices : public OSL::RendererServices { float *dresultdt, OSLUStringHash *errormessage) override; -#if OSL_LIBRARY_VERSION_CODE >= 11100 +#if OSL_LIBRARY_VERSION_CODE >= 11306 + bool get_texture_info(OSLUStringHash filename, + TextureHandle *texture_handle, + TexturePerthread *texture_thread_info, + OSL::ShaderGlobals* sg, + int subimage, + OSLUStringHash dataname, + TypeDesc datatype, + void *data, + OSLUStringHash *errormessage) override; +#elif OSL_LIBRARY_VERSION_CODE >= 11100 bool get_texture_info(OSLUStringHash filename, TextureHandle *texture_handle, TexturePerthread *texture_thread_info, diff --git a/src/kernel/osl/types.h b/src/kernel/osl/types.h index 71c808ff9..4721e14b4 100644 --- a/src/kernel/osl/types.h +++ b/src/kernel/osl/types.h @@ -88,6 +88,10 @@ struct ShaderGlobals { void *context; #if OSL_LIBRARY_VERSION_CODE >= 11302 void *shadingStateUniform; +#endif +#if OSL_LIBRARY_VERSION_CODE >= 11306 + int thread_index; + int shade_index; #endif void *renderer; ccl_private void *object2common; -- 2.30.2