Loading...
Searching...
No Matches
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
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
22PXR_NAMESPACE_OPEN_SCOPE
23
28HGI_API
29extern 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
89HGI_API
90bool operator==(
91 const HgiSamplerDesc& lhs,
92 const HgiSamplerDesc& rhs);
93
94HGI_API
95bool operator!=(
96 const HgiSamplerDesc& lhs,
97 const HgiSamplerDesc& rhs);
98
99
108{
109public:
110 HGI_API
111 virtual ~HgiSampler();
112
114 HGI_API
116
127 HGI_API
128 virtual uint64_t GetRawResource() const = 0;
129
130protected:
131 HGI_API
132 HgiSampler(HgiSamplerDesc const& desc);
133
134 HgiSamplerDesc _descriptor;
135
136private:
137 HgiSampler() = delete;
138 HgiSampler & operator=(const HgiSampler&) = delete;
139 HgiSampler(const HgiSampler&) = delete;
140};
141
143using HgiSamplerHandleVector = std::vector<HgiSamplerHandle>;
144
145
146PXR_NAMESPACE_CLOSE_SCOPE
147
148#endif
Represents a graphics platform independent GPU sampler resource that perform texture sampling operati...
Definition: sampler.h:108
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.
HGI_API HgiSamplerDesc const & GetDescriptor() const
The descriptor describes the object.
Environment setting variable.
Describes the properties needed to create a GPU sampler.
Definition: sampler.h:62