sampler.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 PXR_IMAGING_HGI_SAMPLER_H
8 #define PXR_IMAGING_HGI_SAMPLER_H
9 
10 #include "pxr/pxr.h"
11 
12 #include "pxr/base/tf/envSetting.h"
13 
14 #include "pxr/imaging/hgi/api.h"
15 #include "pxr/imaging/hgi/enums.h"
16 #include "pxr/imaging/hgi/handle.h"
17 #include "pxr/imaging/hgi/types.h"
18 
19 #include <string>
20 #include <vector>
21 
22 PXR_NAMESPACE_OPEN_SCOPE
23 
28 HGI_API
29 extern TfEnvSetting<int> HGI_MAX_ANISOTROPY;
30 
62 {
64  : magFilter(HgiSamplerFilterNearest)
65  , minFilter(HgiSamplerFilterNearest)
66  , mipFilter(HgiMipFilterNotMipmapped)
67  , addressModeU(HgiSamplerAddressModeClampToEdge)
68  , addressModeV(HgiSamplerAddressModeClampToEdge)
69  , addressModeW(HgiSamplerAddressModeClampToEdge)
70  , borderColor(HgiBorderColorTransparentBlack)
71  , enableCompare(false)
72  , compareFunction(HgiCompareFunctionNever)
73  , maxAnisotropy(16)
74  {}
75 
76  std::string debugName;
77  HgiSamplerFilter magFilter;
78  HgiSamplerFilter minFilter;
79  HgiMipFilter mipFilter;
80  HgiSamplerAddressMode addressModeU;
81  HgiSamplerAddressMode addressModeV;
82  HgiSamplerAddressMode addressModeW;
83  HgiBorderColor borderColor;
84  bool enableCompare;
85  HgiCompareFunction compareFunction;
86  uint32_t maxAnisotropy;
87 };
88 
89 HGI_API
90 bool operator==(
91  const HgiSamplerDesc& lhs,
92  const HgiSamplerDesc& rhs);
93 
94 HGI_API
95 bool operator!=(
96  const HgiSamplerDesc& lhs,
97  const HgiSamplerDesc& rhs);
98 
99 
108 {
109 public:
110  HGI_API
111  virtual ~HgiSampler();
112 
114  HGI_API
115  HgiSamplerDesc const& GetDescriptor() const;
116 
127  HGI_API
128  virtual uint64_t GetRawResource() const = 0;
129 
130 protected:
131  HGI_API
132  HgiSampler(HgiSamplerDesc const& desc);
133 
134  HgiSamplerDesc _descriptor;
135 
136 private:
137  HgiSampler() = delete;
138  HgiSampler & operator=(const HgiSampler&) = delete;
139  HgiSampler(const HgiSampler&) = delete;
140 };
141 
143 using HgiSamplerHandleVector = std::vector<HgiSamplerHandle>;
144 
145 
146 PXR_NAMESPACE_CLOSE_SCOPE
147 
148 #endif
virtual HGI_API uint64_t GetRawResource() const =0
This function returns the handle to the Hgi backend's gpu resource, cast to a uint64_t.
AR_API bool operator!=(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
AR_API bool operator==(const ArAssetInfo &lhs, const ArAssetInfo &rhs)
Describes the properties needed to create a GPU sampler.
Definition: sampler.h:61
Represents a graphics platform independent GPU sampler resource that perform texture sampling operati...
Definition: sampler.h:107
HGI_API HgiSamplerDesc const & GetDescriptor() const
The descriptor describes the object.
Environment setting variable.