Loading...
Searching...
No Matches
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
36PXR_NAMESPACE_OPEN_SCOPE
37
38
65{
67 : magFilter(HgiSamplerFilterNearest)
68 , minFilter(HgiSamplerFilterNearest)
69 , mipFilter(HgiMipFilterNotMipmapped)
70 , addressModeU(HgiSamplerAddressModeClampToEdge)
71 , addressModeV(HgiSamplerAddressModeClampToEdge)
72 , addressModeW(HgiSamplerAddressModeClampToEdge)
73 , borderColor(HgiBorderColorTransparentBlack)
74 , enableCompare(false)
75 , compareFunction(HgiCompareFunctionNever)
76 {}
77
78 std::string debugName;
79 HgiSamplerFilter magFilter;
80 HgiSamplerFilter minFilter;
81 HgiMipFilter mipFilter;
82 HgiSamplerAddressMode addressModeU;
83 HgiSamplerAddressMode addressModeV;
84 HgiSamplerAddressMode addressModeW;
85 HgiBorderColor borderColor;
86 bool enableCompare;
87 HgiCompareFunction compareFunction;
88};
89
90HGI_API
91bool operator==(
92 const HgiSamplerDesc& lhs,
93 const HgiSamplerDesc& rhs);
94
95HGI_API
96bool operator!=(
97 const HgiSamplerDesc& lhs,
98 const HgiSamplerDesc& rhs);
99
100
109{
110public:
111 HGI_API
112 virtual ~HgiSampler();
113
115 HGI_API
117
128 HGI_API
129 virtual uint64_t GetRawResource() const = 0;
130
131protected:
132 HGI_API
133 HgiSampler(HgiSamplerDesc const& desc);
134
135 HgiSamplerDesc _descriptor;
136
137private:
138 HgiSampler() = delete;
139 HgiSampler & operator=(const HgiSampler&) = delete;
140 HgiSampler(const HgiSampler&) = delete;
141};
142
144using HgiSamplerHandleVector = std::vector<HgiSamplerHandle>;
145
146
147PXR_NAMESPACE_CLOSE_SCOPE
148
149#endif
Represents a graphics platform independent GPU sampler resource that perform texture sampling operati...
Definition: sampler.h:109
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.
Describes the properties needed to create a GPU sampler.
Definition: sampler.h:65