All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sampler.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 PXR_IMAGING_HGI_SAMPLER_H
25 #define PXR_IMAGING_HGI_SAMPLER_H
26 
27 #include "pxr/pxr.h"
28 #include "pxr/imaging/hgi/api.h"
29 #include "pxr/imaging/hgi/enums.h"
30 #include "pxr/imaging/hgi/handle.h"
31 #include "pxr/imaging/hgi/types.h"
32 
33 #include <string>
34 #include <vector>
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 
59 {
61  : magFilter(HgiSamplerFilterNearest)
62  , minFilter(HgiSamplerFilterNearest)
63  , mipFilter(HgiMipFilterNotMipmapped)
64  , addressModeU(HgiSamplerAddressModeClampToEdge)
65  , addressModeV(HgiSamplerAddressModeClampToEdge)
66  , addressModeW(HgiSamplerAddressModeClampToEdge)
67  {}
68 
69  std::string debugName;
70  HgiSamplerFilter magFilter;
71  HgiSamplerFilter minFilter;
72  HgiMipFilter mipFilter;
73  HgiSamplerAddressMode addressModeU;
74  HgiSamplerAddressMode addressModeV;
75  HgiSamplerAddressMode addressModeW;
76 };
77 
78 HGI_API
79 bool operator==(
80  const HgiSamplerDesc& lhs,
81  const HgiSamplerDesc& rhs);
82 
83 HGI_API
84 bool operator!=(
85  const HgiSamplerDesc& lhs,
86  const HgiSamplerDesc& rhs);
87 
88 
97 {
98 public:
99  HGI_API
100  virtual ~HgiSampler();
101 
103  HGI_API
104  HgiSamplerDesc const& GetDescriptor() const;
105 
116  HGI_API
117  virtual uint64_t GetRawResource() const = 0;
118 
119 protected:
120  HGI_API
121  HgiSampler(HgiSamplerDesc const& desc);
122 
123  HgiSamplerDesc _descriptor;
124 
125 private:
126  HgiSampler() = delete;
127  HgiSampler & operator=(const HgiSampler&) = delete;
128  HgiSampler(const HgiSampler&) = delete;
129 };
130 
132 using HgiSamplerHandleVector = std::vector<HgiSamplerHandle>;
133 
134 
135 PXR_NAMESPACE_CLOSE_SCOPE
136 
137 #endif
virtual HGI_API uint64_t GetRawResource() const =0
This function returns the handle to the Hgi backend&#39;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:58
Represents a graphics platform independent GPU sampler resource that perform texture sampling operati...
Definition: sampler.h:96
HGI_API HgiSamplerDesc const & GetDescriptor() const
The descriptor describes the object.