2018-07-18 09:40:26 +00:00
|
|
|
// Copyright 2017 The Dawn Authors
|
2017-04-20 18:38:20 +00:00
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2018-07-24 14:42:33 +00:00
|
|
|
#ifndef DAWNNATIVE_SAMPLER_H_
|
|
|
|
#define DAWNNATIVE_SAMPLER_H_
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2018-07-24 11:53:51 +00:00
|
|
|
#include "dawn_native/Error.h"
|
2018-10-15 12:54:30 +00:00
|
|
|
#include "dawn_native/ObjectBase.h"
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2018-07-25 15:03:23 +00:00
|
|
|
#include "dawn_native/dawn_platform.h"
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2018-07-24 14:45:45 +00:00
|
|
|
namespace dawn_native {
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2018-05-17 21:09:07 +00:00
|
|
|
class DeviceBase;
|
2018-03-29 18:02:52 +00:00
|
|
|
|
2018-07-25 15:03:23 +00:00
|
|
|
MaybeError ValidateSamplerDescriptor(DeviceBase* device, const SamplerDescriptor* descriptor);
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2018-10-15 12:54:30 +00:00
|
|
|
class SamplerBase : public ObjectBase {
|
2018-05-17 21:09:07 +00:00
|
|
|
public:
|
2019-05-20 18:16:34 +00:00
|
|
|
SamplerBase(DeviceBase* device,
|
|
|
|
const SamplerDescriptor* descriptor,
|
|
|
|
bool blueprint = false);
|
|
|
|
~SamplerBase() override;
|
2019-02-13 13:09:18 +00:00
|
|
|
|
|
|
|
static SamplerBase* MakeError(DeviceBase* device);
|
|
|
|
|
2019-05-20 18:16:34 +00:00
|
|
|
// Functors necessary for the unordered_set<SamplerBase*>-based cache.
|
|
|
|
struct HashFunc {
|
|
|
|
size_t operator()(const SamplerBase* module) const;
|
|
|
|
};
|
|
|
|
struct EqualityFunc {
|
|
|
|
bool operator()(const SamplerBase* a, const SamplerBase* b) const;
|
|
|
|
};
|
|
|
|
|
2019-02-13 13:09:18 +00:00
|
|
|
private:
|
|
|
|
SamplerBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
2019-05-20 18:16:34 +00:00
|
|
|
|
|
|
|
// TODO(cwallez@chromium.org): Store a crypto hash of the items instead?
|
2019-10-23 11:57:41 +00:00
|
|
|
wgpu::AddressMode mAddressModeU;
|
|
|
|
wgpu::AddressMode mAddressModeV;
|
|
|
|
wgpu::AddressMode mAddressModeW;
|
|
|
|
wgpu::FilterMode mMagFilter;
|
|
|
|
wgpu::FilterMode mMinFilter;
|
|
|
|
wgpu::FilterMode mMipmapFilter;
|
2019-05-20 18:16:34 +00:00
|
|
|
float mLodMinClamp;
|
|
|
|
float mLodMaxClamp;
|
2019-10-23 11:57:41 +00:00
|
|
|
wgpu::CompareFunction mCompareFunction;
|
2019-05-20 18:16:34 +00:00
|
|
|
bool mIsBlueprint = false;
|
2017-04-20 18:38:20 +00:00
|
|
|
};
|
|
|
|
|
2018-07-24 14:45:45 +00:00
|
|
|
} // namespace dawn_native
|
2017-04-20 18:38:20 +00:00
|
|
|
|
2018-07-24 14:42:33 +00:00
|
|
|
#endif // DAWNNATIVE_SAMPLER_H_
|