24 #ifndef PXR_IMAGING_HD_ST_TEXTURE_OBJECT_H 25 #define PXR_IMAGING_HD_ST_TEXTURE_OBJECT_H 28 #include "pxr/imaging/hdSt/api.h" 30 #include "pxr/imaging/hdSt/textureIdentifier.h" 31 #include "pxr/imaging/hd/enums.h" 32 #include "pxr/imaging/hd/types.h" 34 #include "pxr/imaging/hgi/handle.h" 42 PXR_NAMESPACE_OPEN_SCOPE
46 class HdSt_TextureObjectRegistry;
51 using HdStTextureObjectSharedPtr = std::shared_ptr<class HdStTextureObject>;
59 public std::enable_shared_from_this<HdStTextureObject>
85 virtual bool IsValid()
const = 0;
98 HdSt_TextureObjectRegistry * textureObjectRegistry);
104 Hgi* _GetHgi()
const;
120 virtual void _Load() = 0;
144 friend class HdSt_TextureObjectRegistry;
146 HdSt_TextureObjectRegistry *
const _textureObjectRegistry;
148 size_t _targetMemory;
172 return _wrapParameters;
181 HdSt_TextureObjectRegistry * textureObjectRegistry);
183 void _SetWrapParameters(
184 const std::pair<HdWrap, HdWrap> &wrapParameters);
190 void _GenerateMipmaps();
191 void _DestroyTexture();
194 std::pair<HdWrap, HdWrap> _wrapParameters;
196 HgiTextureHandle _gpuTexture;
207 HdStAssetUvTextureObject(
209 HdSt_TextureObjectRegistry *textureObjectRegistry);
212 ~HdStAssetUvTextureObject()
override;
219 void _Load()
override;
238 HdSt_TextureObjectRegistry *textureObjectRegistry);
262 return _samplingTransform;
273 void _Load()
override;
279 std::unique_ptr<HdStTextureCpuData> _cpuData;
282 HgiTextureHandle _gpuTexture;
286 template<HdTextureType textureType>
287 struct HdSt_TypedTextureObjectHelper;
294 template<HdTextureType textureType>
296 typename HdSt_TypedTextureObjectHelper<textureType>::type;
299 struct HdSt_TypedTextureObjectHelper<HdTextureType::Uv> {
304 struct HdSt_TypedTextureObjectHelper<HdTextureType::Field> {
308 PXR_NAMESPACE_CLOSE_SCOPE
virtual HDST_API void _Load()=0
Load texture to CPU (thread-safe)
HDST_API void _AddToTotalTextureMemory(const HgiTextureHandle &texture)
Compute memory of texture and add to total texture memory amount maintained by registry.
virtual HDST_API HdTextureType GetTextureType() const =0
Get texture type.
Standard pointer typedefs.
size_t GetTargetMemory() const
Get the target memory for the texture.
Base class for additional information to identify a texture in a file that can contain several textur...
HgiTextureHandle const & GetTexture() const
Get the handle to the actual GPU resource.
HDST_API void SetTargetMemory(size_t)
Set the target memory (in bytes).
Base class for a texture object.
A template alias such that, e.g., HdStUvTextureObject can be accessed as HdStTypedTextureObject<HdTex...
Describes the properties needed to create a GPU texture.
Represents CPU data that can be stored in a HdStUvTextureObject, mostly, likely during the load phase...
const GfMatrix4d & GetSamplingTransform() const
The sampling transform.
Class to identify a texture file or a texture within the texture file (e.g., a frame in a movie).
SourceColorSpace
Specifies the source color space in which the texture is encoded, with "Auto" indicating the texture ...
Stores a 4x4 matrix of double elements.
A central registry of all GPU resources.
HDST_API void _SubtractFromTotalTextureMemory(const HgiTextureHandle &texture)
Compute memory of texture and subtract to total texture memory amount maintained by registry.
HDST_API void _AdjustTotalTextureMemory(int64_t memDiff)
Add signed number to total texture memory amount maintained by registry.
const GfBBox3d & GetBoundingBox() const
The box the texture fills out.
virtual HDST_API void _Commit()=0
Commit texture to GPU (not thread-safe)
Hydra Graphics Interface.
A uvw texture with a bounding box describing how to transform it.
virtual HDST_API bool IsValid() const =0
Is texture valid? Only correct after commit phase.
HgiTextureHandle const & GetTexture() const
Get the handle to the actual GPU resource.
const HdStTextureIdentifier & GetTextureIdentifier() const
Get texture identifier.
HDST_API HdTextureType GetTextureType() const override final
Get texture type.
A base class for uv textures.
Basic type: arbitrarily oriented 3D bounding box.
const std::pair< HdWrap, HdWrap > & GetWrapParameters() const
Opinion about wrapS and wrapT parameters from the texture file.