21 #define OIIO_TEXTURESYSTEM_SUPPORTS_CLOSE 1
34 class TextureSystemImpl;
111 #ifndef OIIO_TEXTURE_SIMD_BATCH_WIDTH
112 # define OIIO_TEXTURE_SIMD_BATCH_WIDTH 16
119 static constexpr
int BatchAlign = BatchWidth *
sizeof(float);
137 #if OIIO_TEXTURE_SIMD_BATCH_WIDTH == 4
138 static constexpr
RunMask RunMaskOn = 0xf;
139 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 8
140 static constexpr
RunMask RunMaskOn = 0xff;
141 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 16
142 static constexpr
RunMask RunMaskOn = 0xffff;
143 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 32
144 static constexpr
RunMask RunMaskOn = 0xffffffff;
145 #elif OIIO_TEXTURE_SIMD_BATCH_WIDTH == 64
146 static constexpr
RunMask RunMaskOn = 0xffffffffffffffffULL;
148 # error "Not a valid OIIO_TEXTURE_SIMD_BATCH_WIDTH choice"
209 : firstchannel(0), subimage(0),
210 swrap(WrapDefault), twrap(WrapDefault),
211 mipmode(MipModeDefault), interpmode(InterpSmartBicubic),
212 anisotropic(32), conservative_filter(true),
213 sblur(0.0
f), tblur(0.0
f), swidth(1.0
f), twidth(1.0
f),
214 fill(0.0
f), missingcolor(nullptr),
217 rwrap(WrapDefault), rblur(0.0
f), rwidth(1.0
f),
274 friend class pvt::TextureSystemImpl;
287 alignas(Tex::BatchAlign)
float sblur[Tex::BatchWidth];
288 alignas(Tex::BatchAlign)
float tblur[Tex::BatchWidth];
289 alignas(Tex::BatchAlign)
float rblur[Tex::BatchWidth];
290 alignas(Tex::BatchAlign)
float swidth[Tex::BatchWidth];
291 alignas(Tex::BatchAlign)
float twidth[Tex::BatchWidth];
292 alignas(Tex::BatchAlign)
float rwidth[Tex::BatchWidth];
296 int firstchannel = 0;
304 int anisotropic = 32;
305 int conservative_filter = 1;
307 const float *missingcolor =
nullptr;
314 friend class pvt::TextureSystemImpl;
418 friend class pvt::TextureSystemImpl;
486 bool teardown_imagecache =
false);
675 TypeDesc type,
void *val)
const = 0;
738 virtual Perthread* get_perthread_info(Perthread* thread_info =
nullptr) = 0;
742 virtual Perthread* create_thread_info() = 0;
745 virtual void destroy_thread_info(Perthread* threadinfo) = 0;
757 Perthread *thread_info=
nullptr) = 0;
762 virtual bool good(TextureHandle* texture_handle) = 0;
848 float s,
float t,
float dsdx,
float dtdx,
849 float dsdy,
float dtdy,
850 int nchannels,
float *
result,
851 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
855 virtual bool texture (TextureHandle *texture_handle,
857 float s,
float t,
float dsdx,
float dtdx,
858 float dsdy,
float dtdy,
859 int nchannels,
float *result,
860 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
945 int nchannels,
float *result,
946 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
947 float *dresultdr=
nullptr) = 0;
951 virtual bool texture3d (TextureHandle *texture_handle,
955 int nchannels,
float *result,
956 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
957 float *dresultdr=
nullptr) = 0;
967 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
971 virtual bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
975 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1035 const Imath::V3f &dRdy,
int nchannels,
float *result,
1036 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1040 virtual bool environment (TextureHandle *texture_handle,
1043 const Imath::V3f &dRdy,
int nchannels,
float *result,
1044 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1100 const float *dsdx,
const float *dtdx,
1101 const float *dsdy,
const float *dtdy,
1102 int nchannels,
float *result,
1103 float *dresultds=
nullptr,
1104 float *dresultdt=
nullptr) = 0;
1107 virtual bool texture (TextureHandle *texture_handle,
1110 const float *dsdx,
const float *dtdx,
1111 const float *dsdy,
const float *dtdy,
1112 int nchannels,
float *result,
1113 float *dresultds=
nullptr,
1114 float *dresultdt=
nullptr) = 0;
1119 Runflag *runflags,
int beginactive,
int endactive,
1123 int nchannels,
float *result,
1124 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1125 virtual bool texture (TextureHandle *texture_handle,
1127 Runflag *runflags,
int beginactive,
int endactive,
1131 int nchannels,
float *result,
1132 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1182 virtual bool texture3d (
ustring filename,
1184 const float *P,
const float *dPdx,
1185 const float *dPdy,
const float *dPdz,
1186 int nchannels,
float *result,
1187 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1188 float *dresultdr=
nullptr) = 0;
1191 virtual bool texture3d (TextureHandle *texture_handle,
1192 Perthread *thread_info,
1194 const float *P,
const float *dPdx,
1195 const float *dPdy,
const float *dPdz,
1196 int nchannels,
float *result,
1197 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1198 float *dresultdr=
nullptr) = 0;
1203 Runflag *runflags,
int beginactive,
int endactive,
1208 int nchannels,
float *result,
1209 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1210 float *dresultdr=
nullptr) = 0;
1211 virtual bool texture3d (TextureHandle *texture_handle,
1213 Runflag *runflags,
int beginactive,
int endactive,
1218 int nchannels,
float *result,
1219 float *dresultds=
nullptr,
float *dresultdt=
nullptr,
1220 float *dresultdr=
nullptr) = 0;
1270 virtual bool environment (
ustring filename,
1272 const float *R,
const float *dRdx,
const float *dRdy,
1273 int nchannels,
float *result,
1274 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1277 virtual bool environment (TextureHandle *texture_handle, Perthread *thread_info,
1279 const float *R,
const float *dRdx,
const float *dRdy,
1280 int nchannels,
float *result,
1281 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1287 Runflag *runflags,
int beginactive,
int endactive,
1291 int nchannels,
float *result,
1292 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1293 virtual bool environment (TextureHandle *texture_handle,
1295 Runflag *runflags,
int beginactive,
int endactive,
1299 int nchannels,
float *result,
1300 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1303 virtual bool shadow (
ustring filename,
1305 const float *P,
const float *dPdx,
const float *dPdy,
1306 float *result,
float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1307 virtual bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
1309 const float *P,
const float *dPdx,
const float *dPdy,
1310 float *result,
float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1315 Runflag *runflags,
int beginactive,
int endactive,
1320 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1321 virtual bool shadow (TextureHandle *texture_handle, Perthread *thread_info,
1323 Runflag *runflags,
int beginactive,
int endactive,
1328 float *dresultds=
nullptr,
float *dresultdt=
nullptr) = 0;
1524 virtual bool get_texture_info (
ustring filename,
int subimage,
1530 virtual bool get_texture_info (TextureHandle *texture_handle,
1531 Perthread *thread_info,
int subimage,
1550 virtual bool get_imagespec (
ustring filename,
int subimage,
1555 virtual bool get_imagespec (TextureHandle *texture_handle,
1556 Perthread *thread_info,
int subimage,
1584 virtual const ImageSpec *imagespec (TextureHandle *texture_handle,
1585 Perthread *thread_info =
nullptr,
1586 int subimage=0) = 0;
1630 int miplevel,
int xbegin,
int xend,
1631 int ybegin,
int yend,
int zbegin,
int zend,
1632 int chbegin,
int chend,
1637 virtual bool get_texels (TextureHandle *texture_handle,
1639 int miplevel,
int xbegin,
int xend,
1640 int ybegin,
int yend,
int zbegin,
int zend,
1641 int chbegin,
int chend,
1642 TypeDesc format,
void *result) = 0;
1655 virtual void invalidate (
ustring filename,
bool force =
true) = 0;
1659 virtual void invalidate_all (
bool force=
false) = 0;
1670 virtual void close_all () = 0;
1698 virtual void reset_stats () = 0;
1715 void operator delete(
void* ) {}
Use just one mipmap level.
Periodic, but only for powers of 2!!!
GT_API const UT_StringHolder filename
float twidth
Multiplier for derivatives.
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)
Force bilinear lookup within a mip level.
Use two MIPmap levels w/ anisotropic.
VaryingRef< float > fill
Fill value for missing channels.
int anisotropic
Maximum anisotropic ratio.
Use two MIPmap levels (trilinear)
GLuint const GLchar * name
static Wrap decode_wrapmode(const char *name)
int subimage
Subimage or face ID.
Wrap swrap
Wrap mode in the s direction.
Force cubic lookup within a mip level.
VaryingRef< float > tblur
Blur amount.
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.
OIIO_API std::string geterror()
bool conservative_filter
True == over-blur rather than alias.
VaryingRef< float > rblur
Blur amount in the r direction.
Wrap twrap
Wrap mode in the t direction.
OIIO_API void parse_wrapmodes(const char *wrapmodes, Wrap &swrapcode, Wrap &twrapcode)
GLint GLint GLsizei GLint GLenum GLenum type
static Wrap decode_wrapmode(const char *name)
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.
GLsizei const GLchar *const * string
static void parse_wrapmodes(const char *wrapmodes, TextureOptions::Wrap &swrapcode, TextureOptions::Wrap &twrapcode)
Default high-quality lookup.
InterpMode interpmode
Interpolation mode.
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!
int firstchannel
First channel of the lookup.
Force bilinear lookup within a mip level.
int anisotropic
Maximum anisotropic ratio.
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.
VaryingRef< int > samples
Number of samples.
GLint GLint GLsizei GLint GLenum format
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 maxifying, 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.
float bias
Bias for shadows.
Wrap rwrap
Wrap mode in the r direction.
static Wrap decode_wrapmode(ustring name)
bool conservative_filter
True == over-blur rather than alias.
Force cubic lookup within a mip level.
VaryingRef< float > twidth
Multiplier for derivatives.
OIIO_API bool attribute(string_view name, TypeDesc type, const void *val)
Use the default found in the file.
Wrap twrap
Wrap mode in the t direction.
Periodic, but only for powers of 2!!!
VaryingRef< float > time
Time.
#define OIIO_NAMESPACE_END
float time
Time (for time-dependent texture lookups)
Use just one mipmap level.
Classes for SIMD processing.
VaryingRef< float > bias
Bias.
VaryingRef< float > rwidth
Multiplier for derivatives in r direction.
static Wrap decode_wrapmode(ustring name)
ustring subimagename
Subimage name.
VaryingRef< float > missingcolor
Color for missing texture.
Periodic with shared border (env)
Wrap swrap
Wrap mode in the s direction.
OIIO_API Wrap decode_wrapmode(const char *name)
Use the default found in the file.
ustring subimagename
Subimage name.
Use the default found in the file.
Use just one mipmap level.
Just use highest-res image, no MIP mapping.
#define OIIO_NAMESPACE_BEGIN
FMT_NOINLINE OutputIt fill(OutputIt it, size_t n, const fill_t< Char > &fill)