Loading...
Searching...
No Matches
textureHandle.h
1//
2// Copyright 2020 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef HD_ST_TEXTURE_HANDLE_H
25#define HD_ST_TEXTURE_HANDLE_H
26
27#include "pxr/pxr.h"
28#include "pxr/imaging/hdSt/api.h"
29
30#include "pxr/imaging/hd/enums.h"
31#include "pxr/imaging/hd/types.h"
32
33#include <memory>
34
35PXR_NAMESPACE_OPEN_SCOPE
36
37using HdStShaderCodePtr =
38 std::weak_ptr<class HdStShaderCode>;
39using HdStTextureObjectSharedPtr =
40 std::shared_ptr<class HdStTextureObject>;
41using HdStSamplerObjectSharedPtr =
42 std::shared_ptr<class HdStSamplerObject>;
43
44using HdStTextureHandleSharedPtr =
45 std::shared_ptr<class HdStTextureHandle>;
46
47class HdSt_TextureHandleRegistry;
48
61{
62public:
64 HDST_API
66 HdStTextureObjectSharedPtr const &textureObject,
67 const HdSamplerParameters &samplerParams,
68 size_t memoryRequest,
69 HdStShaderCodePtr const & shaderCode,
70 HdSt_TextureHandleRegistry *textureHandleRegistry);
71
72 HDST_API
74
78 HdStTextureObjectSharedPtr const &GetTextureObject() const {
79 return _textureObject;
80 }
81
85 HdStSamplerObjectSharedPtr const &GetSamplerObject() const {
86 return _samplerObject;
87 }
88
92 return _samplerParams;
93 }
94
97 size_t GetMemoryRequest() const {
98 return _memoryRequest;
99 }
100
103 HdStShaderCodePtr const &GetShaderCode() const {
104 return _shaderCode;
105 }
106
109 HDST_API
111
114 bool UseBindlessHandles() const;
115
116private:
117 HdStTextureObjectSharedPtr _textureObject;
118 HdStSamplerObjectSharedPtr _samplerObject;
119 HdSamplerParameters _samplerParams;
120 size_t _memoryRequest;
121 HdStShaderCodePtr _shaderCode;
122 HdSt_TextureHandleRegistry *_textureHandleRegistry;
123};
124
125PXR_NAMESPACE_CLOSE_SCOPE
126
127#endif
Collection of standard parameters such as wrap modes to sample a texture.
Definition: types.h:127
Represents a texture and sampler that will be allocated and loaded from a texture file during commit,...
Definition: textureHandle.h:61
HdSamplerParameters const & GetSamplerParameters() const
Get sampler parameters.
Definition: textureHandle.h:91
HdStSamplerObjectSharedPtr const & GetSamplerObject() const
Get sampler object.
Definition: textureHandle.h:85
HdStTextureObjectSharedPtr const & GetTextureObject() const
Get texture object.
Definition: textureHandle.h:78
size_t GetMemoryRequest() const
Get how much memory this handle requested for the texture.
Definition: textureHandle.h:97
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.
HDST_API HdStTextureHandle(HdStTextureObjectSharedPtr const &textureObject, const HdSamplerParameters &samplerParams, size_t memoryRequest, HdStShaderCodePtr const &shaderCode, HdSt_TextureHandleRegistry *textureHandleRegistry)
See HdStResourceRegistry::AllocateTextureHandle for details.