21 #define OIIO_TEXTURESYSTEM_SUPPORTS_CLOSE 1
23 #define OIIO_TEXTURESYSTEM_SUPPORTS_STOCHASTIC 1
35 class TextureSystemImpl;
114 #ifndef OIIO_TEXTURE_SIMD_BATCH_WIDTH
115 # define OIIO_TEXTURE_SIMD_BATCH_WIDTH 16
122 static constexpr
int BatchAlign = BatchWidth *
sizeof(
float);
140 #if OIIO_TEXTURE_SIMD_BATCH_WIDTH == 4
141 static constexpr
RunMask RunMaskOn = 0xf;
142 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 8
143 static constexpr
RunMask RunMaskOn = 0xff;
144 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 16
145 static constexpr
RunMask RunMaskOn = 0xffff;
146 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 32
147 static constexpr
RunMask RunMaskOn = 0xffffffff;
148 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 64
149 static constexpr
RunMask RunMaskOn = 0xffffffffffffffffULL;
151 # error "Not a valid OIIO_TEXTURE_SIMD_BATCH_WIDTH choice"
214 : firstchannel(0), subimage(0),
215 swrap(WrapDefault), twrap(WrapDefault),
216 mipmode(MipModeDefault), interpmode(InterpSmartBicubic),
217 anisotropic(32), conservative_filter(true),
218 sblur(0.0
f), tblur(0.0
f), swidth(1.0
f), twidth(1.0
f),
219 fill(0.0
f), missingcolor(nullptr),
221 rwrap(WrapDefault), rblur(0.0
f), rwidth(1.0
f),
280 friend class pvt::TextureSystemImpl;
293 alignas(Tex::BatchAlign)
float sblur[Tex::BatchWidth];
294 alignas(Tex::BatchAlign)
float tblur[Tex::BatchWidth];
295 alignas(Tex::BatchAlign)
float rblur[Tex::BatchWidth];
296 alignas(Tex::BatchAlign)
float swidth[Tex::BatchWidth];
297 alignas(Tex::BatchAlign)
float twidth[Tex::BatchWidth];
298 alignas(Tex::BatchAlign)
float rwidth[Tex::BatchWidth];
300 #if OIIO_VERSION_GREATER_EQUAL(2,4,0)
301 alignas(Tex::BatchAlign)
float rnd[Tex::BatchWidth];
305 int firstchannel = 0;
313 int anisotropic = 32;
314 int conservative_filter = 1;
316 const float *missingcolor =
nullptr;
323 friend class pvt::TextureSystemImpl;
388 bool conservative_filter;
429 friend class pvt::TextureSystemImpl;
497 bool teardown_imagecache =
false);
686 TypeDesc type,
void *val)
const = 0;
749 virtual Perthread* get_perthread_info(Perthread* thread_info =
nullptr) = 0;
753 virtual Perthread* create_thread_info() = 0;
756 virtual void destroy_thread_info(Perthread* threadinfo) = 0;
768 Perthread *thread_info=
nullptr) = 0;
771 Perthread *thread_info=
nullptr) {
779 virtual bool good(TextureHandle* texture_handle) = 0;
784 virtual ustring filename_from_handle(TextureHandle*
handle) = 0;
870 float s,
float t,
float dsdx,
float dtdx,
871 float dsdy,
float dtdy,
872 int nchannels,
float *
result,
873 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
877 virtual bool texture (TextureHandle *texture_handle,
879 float s,
float t,
float dsdx,
float dtdx,
880 float dsdy,
float dtdy,
881 int nchannels,
float *
result,
882 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
967 int nchannels,
float *
result,
968 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
969 float *dresultdr=
nullptr) = 0;
973 virtual bool texture3d (TextureHandle *texture_handle,
977 int nchannels,
float *
result,
978 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
979 float *dresultdr=
nullptr) = 0;
989 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
993 virtual bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
997 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1058 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1062 virtual bool environment (TextureHandle *texture_handle,
1066 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1122 const float *dsdx,
const float *dtdx,
1123 const float *dsdy,
const float *dtdy,
1124 int nchannels,
float *
result,
1125 float *dresultds=
nullptr,
1126 float *dresultdt=
nullptr) = 0;
1129 virtual bool texture (TextureHandle *texture_handle,
1132 const float *dsdx,
const float *dtdx,
1133 const float *dsdy,
const float *dtdy,
1134 int nchannels,
float *
result,
1135 float *dresultds=
nullptr,
1136 float *dresultdt=
nullptr) = 0;
1138 #ifndef OIIO_DOXYGEN
1143 Runflag *runflags,
int beginactive,
int endactive,
1147 int nchannels,
float *
result,
1148 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1150 virtual
bool texture (TextureHandle *texture_handle,
1152 Runflag *runflags,
int beginactive,
int endactive,
1156 int nchannels,
float *result,
1157 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1208 virtual bool texture3d (
ustring filename,
1210 const float *
P,
const float *dPdx,
1211 const float *dPdy,
const float *dPdz,
1212 int nchannels,
float *result,
1213 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1214 float *dresultdr=
nullptr) = 0;
1217 virtual bool texture3d (TextureHandle *texture_handle,
1218 Perthread *thread_info,
1220 const float *
P,
const float *dPdx,
1221 const float *dPdy,
const float *dPdz,
1222 int nchannels,
float *result,
1223 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1224 float *dresultdr=
nullptr) = 0;
1226 #ifndef OIIO_DOXYGEN
1231 Runflag *runflags,
int beginactive,
int endactive,
1236 int nchannels,
float *result,
1237 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1238 float *dresultdr=
nullptr) = 0;
1240 virtual
bool texture3d (TextureHandle *texture_handle,
1242 Runflag *runflags,
int beginactive,
int endactive,
1247 int nchannels,
float *result,
1248 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1249 float *dresultdr=
nullptr) = 0;
1300 virtual bool environment (
ustring filename,
1302 const float *
R,
const float *dRdx,
const float *dRdy,
1303 int nchannels,
float *result,
1304 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1307 virtual bool environment (TextureHandle *texture_handle, Perthread *thread_info,
1309 const float *
R,
const float *dRdx,
const float *dRdy,
1310 int nchannels,
float *result,
1311 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1313 #ifndef OIIO_DOXYGEN
1319 Runflag *runflags,
int beginactive,
int endactive,
1323 int nchannels,
float *result,
1324 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1326 virtual
bool environment (TextureHandle *texture_handle,
1328 Runflag *runflags,
int beginactive,
int endactive,
1332 int nchannels,
float *result,
1333 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1337 virtual bool shadow (
ustring filename,
1339 const float *P,
const float *dPdx,
const float *dPdy,
1340 float *result,
float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1341 virtual bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
1343 const float *P,
const float *dPdx,
const float *dPdy,
1344 float *result,
float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1346 #ifndef OIIO_DOXYGEN
1351 Runflag *runflags,
int beginactive,
int endactive,
1356 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1358 virtual
bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
1360 Runflag *runflags,
int beginactive,
int endactive,
1365 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1562 virtual bool get_texture_info (
ustring filename,
int subimage,
1568 virtual bool get_texture_info (TextureHandle *texture_handle,
1569 Perthread *thread_info,
int subimage,
1588 virtual bool get_imagespec (
ustring filename,
int subimage,
1593 virtual bool get_imagespec (TextureHandle *texture_handle,
1594 Perthread *thread_info,
int subimage,
1622 virtual const ImageSpec *imagespec (TextureHandle *texture_handle,
1623 Perthread *thread_info =
nullptr,
1624 int subimage=0) = 0;
1668 int miplevel,
int xbegin,
int xend,
1669 int ybegin,
int yend,
int zbegin,
int zend,
1670 int chbegin,
int chend,
1675 virtual bool get_texels (TextureHandle *texture_handle,
1677 int miplevel,
int xbegin,
int xend,
1678 int ybegin,
int yend,
int zbegin,
int zend,
1679 int chbegin,
int chend,
1691 virtual bool is_udim(
ustring filename) = 0;
1696 virtual bool is_udim(TextureHandle* udimfile) = 0;
1704 virtual TextureHandle* resolve_udim(
ustring udimpattern,
1705 float s,
float t) = 0;
1712 virtual TextureHandle* resolve_udim(TextureHandle* udimfile,
1713 Perthread* thread_info,
1714 float s,
float t) = 0;
1727 virtual void inventory_udim(
ustring udimpattern,
1728 std::vector<ustring>& filenames,
1729 int& nutiles,
int& nvtiles) = 0;
1736 virtual void inventory_udim(TextureHandle* udimfile,
1737 Perthread* thread_info,
1738 std::vector<ustring>& filenames,
1739 int& nutiles,
int& nvtiles) = 0;
1750 virtual void invalidate (
ustring filename,
bool force =
true) = 0;
1754 virtual void invalidate_all (
bool force=
false) = 0;
1765 virtual void close_all () = 0;
1796 virtual void reset_stats () = 0;
1813 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?
GT_API const UT_StringHolder filename
float rnd
Stratified sample value.
OIIO_API Wrap decode_wrapmode(ustring name)
float twidth
Multiplier for derivatives.
TextureHandle * get_texture_handle(const std::wstring &filename, Perthread *thread_info=nullptr)
Get a TextureHandle using a UTF-16 encoded wstring filename.
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)
GLsizei const GLchar *const * string
Force bilinear lookup within a mip level.
Use two MIPmap levels w/ 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
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.
Wrap twrap
Wrap mode in the t direction.
OIIO_API void parse_wrapmodes(const char *wrapmodes, Wrap &swrapcode, Wrap &twrapcode)
IMATH_NAMESPACE::V2f float
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.
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)
Vec3< float > V3f
Vec3 of float.
Force bilinear lookup within a mip level.
OIIO_API bool getattribute(string_view name, TypeDesc type, void *val)
Bicubic when magnifying, else bilinear.
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.
SIM_API const UT_StringHolder force
Use two MIPmap levels w/ anisotropic.
float bias
Bias for shadows (DEPRECATED?)
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.
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)
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