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 terms set forth in the LICENSE.txt file available at
5 // https://openusd.org/license.
6 //
7 #ifndef PXR_IMAGING_HD_ST_TEXTURE_BINDER_H
8 #define PXR_IMAGING_HD_ST_TEXTURE_BINDER_H
9 
10 #include "pxr/pxr.h"
11 #include "pxr/imaging/hdSt/api.h"
13 
15 
16 using HdBufferSpecVector = std::vector<struct HdBufferSpec>;
18 
19 /// \class HdSt_TextureBinder
20 ///
21 /// A class helping HdStShaderCode with binding textures.
22 ///
23 /// This class helps binding textures or populating the shader
24 /// bar with texture sampler handles if bindless textures are used. It
25 /// also includes writing texture metadata such as the sampling
26 /// transform to the shader bar.
27 ///
29 public:
30  using NamedTextureHandle =
34 
35  /// Add buffer specs necessary for the textures (e.g., for
36  /// bindless texture sampler handles or sampling transform).
37  ///
38  static void
41  HdBufferSpecVector * specs,
42  bool doublesSupported);
43 
44  /// Compute buffer sources for shader bar.
45  ///
46  /// This works in conjunction with GetBufferSpecs, but unlike
47  /// GetBufferSpecs is extracting information from the texture
48  /// handles and thus can only be called after the textures have
49  /// been committed in
50  /// HdStShaderCode::AddResourcesFromTextures().
51  ///
52  static void
56  bool doublesSupported);
57 
58  /// Bind textures.
59  ///
60  static void
62  HdSt_ResourceBinder const &binder,
64 
65  /// Unbind textures.
66  ///
67  static void
69  HdSt_ResourceBinder const &binder,
71 
72  /// Get Bindings Descs
73  ///
74  static void
76  HdSt_ResourceBinder const &binder,
77  HgiResourceBindingsDesc * bindingsDesc,
79 
80 };
81 
83 
84 #endif // PXR_IMAGING_HD_ST_TEXTURE_BINDER_H
static void UnbindResources(HdSt_ResourceBinder const &binder, const NamedTextureHandleVector &textures)
HdStShaderCode::NamedTextureHandleVector NamedTextureHandleVector
Definition: textureBinder.h:33
static void GetBindingDescs(HdSt_ResourceBinder const &binder, HgiResourceBindingsDesc *bindingsDesc, const NamedTextureHandleVector &textures)
std::vector< HdBufferSourceSharedPtr > HdBufferSourceSharedPtrVector
Definition: bufferSource.h:27
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:1425
std::vector< NamedTextureHandle > NamedTextureHandleVector
Definition: shaderCode.h:144
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
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)