Loading...
Searching...
No Matches
textureHandle.h
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef HD_ST_TEXTURE_HANDLE_H
8#define HD_ST_TEXTURE_HANDLE_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdSt/api.h"
12
13#include "pxr/imaging/hd/enums.h"
14#include "pxr/imaging/hd/types.h"
15
16#include <memory>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20using HdStShaderCodePtr =
21 std::weak_ptr<class HdStShaderCode>;
22using HdStTextureObjectSharedPtr =
23 std::shared_ptr<class HdStTextureObject>;
24using HdStSamplerObjectSharedPtr =
25 std::shared_ptr<class HdStSamplerObject>;
26
27using HdStTextureHandleSharedPtr =
28 std::shared_ptr<class HdStTextureHandle>;
29
30class HdSt_TextureHandleRegistry;
31
44{
45public:
47 HDST_API
49 HdStTextureObjectSharedPtr const &textureObject,
50 const HdSamplerParameters &samplerParams,
51 size_t memoryRequest,
52 HdStShaderCodePtr const & shaderCode,
53 HdSt_TextureHandleRegistry *textureHandleRegistry);
54
55 HDST_API
57
61 HdStTextureObjectSharedPtr const &GetTextureObject() const {
62 return _textureObject;
63 }
64
68 HdStSamplerObjectSharedPtr const &GetSamplerObject() const {
69 return _samplerObject;
70 }
71
75 return _samplerParams;
76 }
77
80 size_t GetMemoryRequest() const {
81 return _memoryRequest;
82 }
83
86 HdStShaderCodePtr const &GetShaderCode() const {
87 return _shaderCode;
88 }
89
92 HDST_API
94
97 bool UseBindlessHandles() const;
98
99private:
100 HdStTextureObjectSharedPtr _textureObject;
101 HdStSamplerObjectSharedPtr _samplerObject;
102 HdSamplerParameters _samplerParams;
103 size_t _memoryRequest;
104 HdStShaderCodePtr _shaderCode;
105 HdSt_TextureHandleRegistry *_textureHandleRegistry;
106};
107
108PXR_NAMESPACE_CLOSE_SCOPE
109
110#endif
Collection of standard parameters such as wrap modes to sample a texture.
Definition: types.h:110
Represents a texture and sampler that will be allocated and loaded from a texture file during commit,...
Definition: textureHandle.h:44
HdSamplerParameters const & GetSamplerParameters() const
Get sampler parameters.
Definition: textureHandle.h:74
HdStSamplerObjectSharedPtr const & GetSamplerObject() const
Get sampler object.
Definition: textureHandle.h:68
HdStTextureObjectSharedPtr const & GetTextureObject() const
Get texture object.
Definition: textureHandle.h:61
size_t GetMemoryRequest() const
Get how much memory this handle requested for the texture.
Definition: textureHandle.h:80
bool UseBindlessHandles() const
Get whether bindless texture handles are enabled.
HDST_API void ReallocateSamplerIfNecessary()
Allocate sampler for this handle (not thread-safe).
HdStShaderCodePtr const & GetShaderCode() const
Get the shader code associated with this handle.
Definition: textureHandle.h:86
HDST_API HdStTextureHandle(HdStTextureObjectSharedPtr const &textureObject, const HdSamplerParameters &samplerParams, size_t memoryRequest, HdStShaderCodePtr const &shaderCode, HdSt_TextureHandleRegistry *textureHandleRegistry)
See HdStResourceRegistry::AllocateTextureHandle for details.