7#ifndef PXR_IMAGING_HD_ST_TEXTURE_OBJECT_H
8#define PXR_IMAGING_HD_ST_TEXTURE_OBJECT_H
11#include "pxr/imaging/hdSt/api.h"
13#include "pxr/imaging/hdSt/textureIdentifier.h"
14#include "pxr/imaging/hdSt/enums.h"
15#include "pxr/imaging/hd/types.h"
17#include "pxr/imaging/hgi/handle.h"
25PXR_NAMESPACE_OPEN_SCOPE
29class HdSt_TextureObjectRegistry;
34using HdStTextureObjectSharedPtr = std::shared_ptr<class HdStTextureObject>;
42 public std::enable_shared_from_this<HdStTextureObject>
85 HdSt_TextureObjectRegistry * textureObjectRegistry);
131 friend class HdSt_TextureObjectRegistry;
133 HdSt_TextureObjectRegistry *
const _textureObjectRegistry;
135 size_t _targetMemory;
160 return _wrapParameters;
173 HdSt_TextureObjectRegistry * textureObjectRegistry);
176 void _SetWrapParameters(
177 const
std::pair<HdWrap, HdWrap> &wrapParameters);
187 void _GenerateMipmaps();
189 void _DestroyTexture();
192 std::pair<HdWrap, HdWrap> _wrapParameters;
195 HdStTextureType _textureType;
206 HdStAssetUvTextureObject(
208 HdSt_TextureObjectRegistry *textureObjectRegistry);
211 ~HdStAssetUvTextureObject()
override;
218 void _Load()
override;
237 HdSt_TextureObjectRegistry *textureObjectRegistry);
261 return _samplingTransform;
281 std::unique_ptr<HdStTextureCpuData> _cpuData;
288template<HdStTextureType textureType>
289struct HdSt_TypedTextureObjectHelper;
296template<HdStTextureType textureType>
298 typename HdSt_TypedTextureObjectHelper<textureType>::type;
301struct HdSt_TypedTextureObjectHelper<HdStTextureType::Uv> {
306struct HdSt_TypedTextureObjectHelper<HdStTextureType::Field> {
311struct HdSt_TypedTextureObjectHelper<HdStTextureType::Cubemap> {
315PXR_NAMESPACE_CLOSE_SCOPE
Basic type: arbitrarily oriented 3D bounding box.
Stores a 4x4 matrix of double elements.
A uvw texture with a bounding box describing how to transform it.
HDST_API void _Load() override
Load texture to CPU (thread-safe)
HDST_API bool IsValid() const override
Is texture valid? Only correct after commit phase.
HDST_API void _Commit() override
Commit texture to GPU (not thread-safe)
HDST_API size_t GetCommittedSize() const override
Returns the actual amount of memory committed to the GPU.
const GfBBox3d & GetBoundingBox() const
The box the texture fills out.
HDST_API HdStTextureType GetTextureType() const override
Get texture type.
HgiTextureHandle const & GetTexture() const
Get the handle to the actual GPU resource.
const GfMatrix4d & GetSamplingTransform() const
The sampling transform.
A central registry of all GPU resources.
Base class for additional information to identify a texture in a file that can contain several textur...
Represents CPU data that can be stored in a HdStUvTextureObject, mostly, likely during the load phase...
Class to identify a texture file or a texture within the texture file (e.g., a frame in a movie).
Base class for a texture object.
size_t GetTargetMemory() const
Get the target memory for the texture.
virtual HDST_API size_t GetCommittedSize() const =0
Returns the actual amount of memory committed to the GPU.
virtual HDST_API HdStTextureType GetTextureType() const =0
Get texture type.
HDST_API void _AdjustTotalTextureMemory(int64_t memDiff)
Add signed number to total texture memory amount maintained by registry.
HDST_API void _AddToTotalTextureMemory(const HgiTextureHandle &texture)
Compute memory of texture and add to total texture memory amount maintained by registry.
virtual HDST_API void _Load()=0
Load texture to CPU (thread-safe)
HDST_API void _SubtractFromTotalTextureMemory(const HgiTextureHandle &texture)
Compute memory of texture and subtract to total texture memory amount maintained by registry.
HDST_API void SetTargetMemory(size_t)
Set the target memory (in bytes).
virtual HDST_API bool IsValid() const =0
Is texture valid? Only correct after commit phase.
const HdStTextureIdentifier & GetTextureIdentifier() const
Get texture identifier.
virtual HDST_API void _Commit()=0
Commit texture to GPU (not thread-safe)
A template alias such that, e.g., HdStUvTextureObject can be accessed as HdStTypedTextureObject<HdStT...
A base class for uv textures (including cubemaps).
HDST_API HdStTextureType GetTextureType() const override final
Get texture type.
HDST_API size_t GetCommittedSize() const override
Returns the actual amount of memory committed to the GPU.
const std::pair< HdWrap, HdWrap > & GetWrapParameters() const
Opinion about wrapS and wrapT parameters from the texture file.
HgiTextureHandle const & GetTexture() const
Get the handle to the actual GPU resource.
Hydra Graphics Interface.
SourceColorSpace
Specifies the source color space in which the texture is encoded, with "Auto" indicating the texture ...
Standard pointer typedefs.
Describes the properties needed to create a GPU texture.