HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
textureBinder.h
Go to the documentation of this file.
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 PXR_IMAGING_HD_ST_TEXTURE_BINDER_H
25 #define PXR_IMAGING_HD_ST_TEXTURE_BINDER_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hdSt/api.h"
30 
32 
33 using HdBufferSpecVector = std::vector<struct HdBufferSpec>;
35 
36 /// \class HdSt_TextureBinder
37 ///
38 /// A class helping HdStShaderCode with binding textures.
39 ///
40 /// This class helps binding textures or populating the shader
41 /// bar with texture sampler handles if bindless textures are used. It
42 /// also includes writing texture metadata such as the sampling
43 /// transform to the shader bar.
44 ///
46 public:
47  using NamedTextureHandle =
51 
52  /// Add buffer specs necessary for the textures (e.g., for
53  /// bindless texture sampler handles or sampling transform).
54  ///
55  static void
58  HdBufferSpecVector * specs,
59  bool doublesSupported);
60 
61  /// Compute buffer sources for shader bar.
62  ///
63  /// This works in conjunction with GetBufferSpecs, but unlike
64  /// GetBufferSpecs is extracting information from the texture
65  /// handles and thus can only be called after the textures have
66  /// been committed in
67  /// HdStShaderCode::AddResourcesFromTextures().
68  ///
69  static void
73  bool doublesSupported);
74 
75  /// Bind textures.
76  ///
77  static void
79  HdSt_ResourceBinder const &binder,
81 
82  /// Unbind textures.
83  ///
84  static void
86  HdSt_ResourceBinder const &binder,
88 
89  /// Get Bindings Descs
90  ///
91  static void
93  HdSt_ResourceBinder const &binder,
94  HgiResourceBindingsDesc * bindingsDesc,
96 
97 };
98 
100 
101 #endif // PXR_IMAGING_HD_ST_TEXTURE_BINDER_H
static void UnbindResources(HdSt_ResourceBinder const &binder, const NamedTextureHandleVector &textures)
HdStShaderCode::NamedTextureHandleVector NamedTextureHandleVector
Definition: textureBinder.h:50
static void GetBindingDescs(HdSt_ResourceBinder const &binder, HgiResourceBindingsDesc *bindingsDesc, const NamedTextureHandleVector &textures)
std::vector< HdBufferSourceSharedPtr > HdBufferSourceSharedPtrVector
Definition: bufferSource.h:44
GLsizei GLenum * sources
Definition: glcorearb.h:2542
std::vector< struct HdBufferSpec > HdBufferSpecVector
static void BindResources(HdSt_ResourceBinder const &binder, const NamedTextureHandleVector &textures)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
std::vector< NamedTextureHandle > NamedTextureHandleVector
Definition: shaderCode.h:160
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
static void GetBufferSpecs(const NamedTextureHandleVector &textures, HdBufferSpecVector *specs, bool doublesSupported)
const GLuint * textures
Definition: glcorearb.h:416
static void ComputeBufferSources(const NamedTextureHandleVector &textures, HdBufferSourceSharedPtrVector *sources, bool doublesSupported)