22 #define OIIO_TEXTURESYSTEM_SUPPORTS_CLOSE 1
23 #define OIIO_TEXTURESYSTEM_SUPPORTS_COLORSPACE 1
26 #define OIIO_TEXTURESYSTEM_SUPPORTS_GETATTRIBUTETYPE 1
28 #define OIIO_TEXTURESYSTEM_SUPPORTS_STOCHASTIC 1
29 #define OIIO_TEXTURESYSTEM_SUPPORTS_DECODE_BY_USTRINGHASH 1
31 #ifndef INCLUDED_IMATHVEC_H
35 template <
class T>
class Vec3;
50 class TextureSystemImpl;
130 #ifndef OIIO_TEXTURE_SIMD_BATCH_WIDTH
131 # define OIIO_TEXTURE_SIMD_BATCH_WIDTH 16
156 #if OIIO_TEXTURE_SIMD_BATCH_WIDTH == 4
158 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 8
160 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 16
162 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 32
164 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 64
167 # error "Not a valid OIIO_TEXTURE_SIMD_BATCH_WIDTH choice"
230 : firstchannel(0), subimage(0),
231 swrap(WrapDefault), twrap(WrapDefault),
232 mipmode(MipModeDefault), interpmode(InterpSmartBicubic),
233 anisotropic(32), conservative_filter(true),
234 sblur(0.0
f), tblur(0.0
f), swidth(1.0
f), twidth(1.0
f),
235 fill(0.0
f), missingcolor(nullptr),
237 rwrap(WrapDefault), rblur(0.0
f), rwidth(1.0
f),
303 friend class pvt::TextureSystemImpl;
329 int firstchannel = 0;
337 int anisotropic = 32;
338 int conservative_filter = 1;
340 const float *missingcolor =
nullptr;
341 int colortransformid = 0;
348 friend class pvt::TextureSystemImpl;
413 bool conservative_filter;
458 friend class pvt::TextureSystemImpl;
528 bool teardown_imagecache =
false);
729 TypeDesc type,
void *val)
const = 0;
798 virtual Perthread* get_perthread_info(Perthread* thread_info =
nullptr) = 0;
802 virtual Perthread* create_thread_info() = 0;
805 virtual void destroy_thread_info(Perthread* threadinfo) = 0;
819 Perthread* thread_info =
nullptr,
823 Perthread* thread_info =
nullptr,
826 thread_info, options);
832 virtual bool good(TextureHandle* texture_handle) = 0;
837 virtual ustring filename_from_handle(TextureHandle* handle) = 0;
843 virtual int get_colortransform_id(
ustring fromspace,
845 virtual int get_colortransform_id(
ustringhash fromspace,
931 float s,
float t,
float dsdx,
float dtdx,
932 float dsdy,
float dtdy,
933 int nchannels,
float *
result,
934 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
938 virtual bool texture (TextureHandle *texture_handle,
940 float s,
float t,
float dsdx,
float dtdx,
941 float dsdy,
float dtdy,
942 int nchannels,
float *
result,
943 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1028 int nchannels,
float *
result,
1029 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1030 float *dresultdr=
nullptr) = 0;
1034 virtual bool texture3d (TextureHandle *texture_handle,
1038 int nchannels,
float *
result,
1039 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1040 float *dresultdr=
nullptr) = 0;
1050 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1054 virtual bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
1058 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1119 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1123 virtual bool environment (TextureHandle *texture_handle,
1127 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1183 const float *dsdx,
const float *dtdx,
1184 const float *dsdy,
const float *dtdy,
1185 int nchannels,
float *
result,
1186 float *dresultds=
nullptr,
1187 float *dresultdt=
nullptr) = 0;
1190 virtual bool texture (TextureHandle *texture_handle,
1193 const float *dsdx,
const float *dtdx,
1194 const float *dsdy,
const float *dtdy,
1195 int nchannels,
float *
result,
1196 float *dresultds=
nullptr,
1197 float *dresultdt=
nullptr) = 0;
1199 #ifndef OIIO_DOXYGEN
1204 Runflag *runflags,
int beginactive,
int endactive,
1208 int nchannels,
float *
result,
1209 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1211 virtual
bool texture (TextureHandle *texture_handle,
1213 Runflag *runflags,
int beginactive,
int endactive,
1217 int nchannels,
float *result,
1218 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1269 virtual bool texture3d (
ustring filename,
1271 const float *
P,
const float *dPdx,
1272 const float *dPdy,
const float *dPdz,
1273 int nchannels,
float *result,
1274 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1275 float *dresultdr=
nullptr) = 0;
1278 virtual bool texture3d (TextureHandle *texture_handle,
1279 Perthread *thread_info,
1281 const float *
P,
const float *dPdx,
1282 const float *dPdy,
const float *dPdz,
1283 int nchannels,
float *result,
1284 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1285 float *dresultdr=
nullptr) = 0;
1287 #ifndef OIIO_DOXYGEN
1292 Runflag *runflags,
int beginactive,
int endactive,
1297 int nchannels,
float *result,
1298 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1299 float *dresultdr=
nullptr) = 0;
1301 virtual
bool texture3d (TextureHandle *texture_handle,
1303 Runflag *runflags,
int beginactive,
int endactive,
1308 int nchannels,
float *result,
1309 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1310 float *dresultdr=
nullptr) = 0;
1361 virtual bool environment (
ustring filename,
1363 const float *
R,
const float *dRdx,
const float *dRdy,
1364 int nchannels,
float *result,
1365 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1368 virtual bool environment (TextureHandle *texture_handle, Perthread *thread_info,
1370 const float *
R,
const float *dRdx,
const float *dRdy,
1371 int nchannels,
float *result,
1372 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1374 #ifndef OIIO_DOXYGEN
1380 Runflag *runflags,
int beginactive,
int endactive,
1384 int nchannels,
float *result,
1385 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1387 virtual
bool environment (TextureHandle *texture_handle,
1389 Runflag *runflags,
int beginactive,
int endactive,
1393 int nchannels,
float *result,
1394 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1398 virtual bool shadow (
ustring filename,
1400 const float *P,
const float *dPdx,
const float *dPdy,
1401 float *result,
float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1402 virtual bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
1404 const float *P,
const float *dPdx,
const float *dPdy,
1405 float *result,
float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1407 #ifndef OIIO_DOXYGEN
1412 Runflag *runflags,
int beginactive,
int endactive,
1417 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1419 virtual
bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
1421 Runflag *runflags,
int beginactive,
int endactive,
1426 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1438 virtual std::string resolve_filename (
const std::string &filename)
const=0;
1623 virtual bool get_texture_info (
ustring filename,
int subimage,
1629 virtual bool get_texture_info (TextureHandle *texture_handle,
1630 Perthread *thread_info,
int subimage,
1649 virtual bool get_imagespec (
ustring filename,
int subimage,
1654 virtual bool get_imagespec (TextureHandle *texture_handle,
1655 Perthread *thread_info,
int subimage,
1683 virtual const ImageSpec *imagespec (TextureHandle *texture_handle,
1684 Perthread *thread_info =
nullptr,
1685 int subimage=0) = 0;
1729 int miplevel,
int xbegin,
int xend,
1730 int ybegin,
int yend,
int zbegin,
int zend,
1731 int chbegin,
int chend,
1736 virtual bool get_texels (TextureHandle *texture_handle,
1738 int miplevel,
int xbegin,
int xend,
1739 int ybegin,
int yend,
int zbegin,
int zend,
1740 int chbegin,
int chend,
1752 virtual bool is_udim(
ustring filename) = 0;
1757 virtual bool is_udim(TextureHandle* udimfile) = 0;
1765 virtual TextureHandle* resolve_udim(
ustring udimpattern,
1766 float s,
float t) = 0;
1773 virtual TextureHandle* resolve_udim(TextureHandle* udimfile,
1774 Perthread* thread_info,
1775 float s,
float t) = 0;
1788 virtual void inventory_udim(
ustring udimpattern,
1789 std::vector<ustring>& filenames,
1790 int& nutiles,
int& nvtiles) = 0;
1797 virtual void inventory_udim(TextureHandle* udimfile,
1798 Perthread* thread_info,
1799 std::vector<ustring>& filenames,
1800 int& nutiles,
int& nvtiles) = 0;
1811 virtual void invalidate (
ustring filename,
bool force =
true) = 0;
1815 virtual void invalidate_all (
bool force=
false) = 0;
1826 virtual void close_all () = 0;
1840 virtual std::string
geterror(
bool clear =
true)
const = 0;
1850 virtual std::string getstats (
int level=1,
bool icstats=
true)
const = 0;
1857 virtual void reset_stats () = 0;
1868 static void unit_test_hash();
1877 void operator delete(
void* ) {}
Use just one mipmap level.
Periodic, but only for powers of 2!!!
OIIO_API std::string geterror(bool clear=true)
OIIO_API bool has_error()
Is there a pending global error message waiting to be retrieved?
OIIO_INLINE_CONSTEXPR RunMask RunMaskOn
GT_API const UT_StringHolder filename
float rnd
Stratified sample value.
float twidth
Multiplier for derivatives.
OIIO_API Wrap decode_wrapmode(ustringhash name)
GT_API const UT_StringHolder time
int samples
Number of samples for shadows.
int subimage
Subimage or face ID.
static void parse_wrapmodes(const char *wrapmodes, TextureOpt::Wrap &swrapcode, TextureOpt::Wrap &twrapcode)
OIIO_INLINE_CONSTEXPR int BatchWidth
DEPRECATED Stochastic trilinear.
Force bilinear lookup within a mip level.
Use two MIPmap levels w/ anisotropic.
DEPRECATED Stochastic anisotropic.
**But if you need a or simply need to know when the task has note that the like this
int anisotropic
Maximum anisotropic ratio.
Use two MIPmap levels (trilinear)
**But if you need a result
OIIO_INLINE_CONSTEXPR int BatchAlign
static Wrap decode_wrapmode(const char *name)
Wrap swrap
Wrap mode in the s direction.
Force cubic lookup within a mip level.
simd::VecType< int, OIIO_TEXTURE_SIMD_BATCH_WIDTH >::type IntWide
A type alias for a SIMD vector of ints with the batch width.
Default high-quality lookup.
GLint GLint GLsizei GLint GLenum GLenum type
Wrap twrap
Wrap mode in the t direction.
OIIO_API void parse_wrapmodes(const char *wrapmodes, Wrap &swrapcode, Wrap &twrapcode)
Periodic with shared border (env)
#define OIIO_TEXTURE_SIMD_BATCH_WIDTH
int firstchannel
First channel of the lookup.
Just use highest-res image, no MIP mapping.
Use two MIPmap levels (trilinear)
float fill
Fill value for missing channels.
GLint GLint GLsizei GLint GLenum format
static void parse_wrapmodes(const char *wrapmodes, TextureOptions::Wrap &swrapcode, TextureOptions::Wrap &twrapcode)
Default high-quality lookup.
simd::VecType< float, OIIO_TEXTURE_SIMD_BATCH_WIDTH >::type FloatWide
A type alias for a SIMD vector of floats with the batch width.
Mark the end – don't use this!
GLuint const GLchar * name
Force bilinear lookup within a mip level.
ustring subimagename
Subimage name.
InterpMode interpmode
Interpolation mode.
int colortransformid
Color space id of the texture.
float rblur
Blur amount in the r direction.
float rwidth
Multiplier for derivatives in r direction.
Default high-quality lookup.
Force cubic lookup within a mip level.
Wrap rwrap
Wrap mode in the r direction.
Use two MIPmap levels (trilinear)
Force bilinear lookup within a mip level.
OIIO_API bool getattribute(string_view name, TypeDesc type, void *val)
Bicubic when magnifying, else bilinear.
IMATH_NAMESPACE::V2f IMATH_NAMESPACE::Box2i std::string this attribute is obsolete as of OpenEXR v3 float
Just use highest-res image, no MIP mapping.
const float * missingcolor
Color for missing texture.
Texture options for a batch of Tex::BatchWidth points and run mask.
static Wrap decode_wrapmode(ustringhash name)
SIM_API const UT_StringHolder force
Use two MIPmap levels w/ anisotropic.
float bias
Bias for shadows (DEPRECATED)
DEPRECATED Stochastic trilinear.
TextureHandle * get_texture_handle(const std::wstring &filename, Perthread *thread_info=nullptr, const TextureOpt *options=nullptr)
Get a TextureHandle using a UTF-16 encoded wstring filename.
static Wrap decode_wrapmode(ustring name)
bool conservative_filter
True == over-blur rather than alias.
Force cubic lookup within a mip level.
OIIO_API bool attribute(string_view name, TypeDesc type, const void *val)
Use the default found in the file.
static Wrap decode_wrapmode(ustringhash name)
Periodic, but only for powers of 2!!!
#define OIIO_NAMESPACE_END
float time
Time (for time-dependent texture lookups)
Use just one mipmap level.
Classes for SIMD processing.
std::string OIIO_UTIL_API utf16_to_utf8(const std::wstring &utf16str) noexcept
static Wrap decode_wrapmode(ustring name)
DEPRECATED Stochastic anisotropic.
ustring subimagename
Subimage name.
Periodic with shared border (env)
OIIO_API Wrap decode_wrapmode(const char *name)
Use the default found in the file.
Use the default found in the file.
Use just one mipmap level.
Just use highest-res image, no MIP mapping.
#define OIIO_NAMESPACE_BEGIN