Deprecates use of filter mode for mipmap filters.
Change-Id: I77044ee7f0ce1b066dd8c8a1ee1b34e07f5e9766 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/128660 Commit-Queue: Loko Kung <lokokung@google.com> Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
parent
fd87e9d676
commit
abfa45baa4
|
@ -1593,7 +1593,6 @@
|
||||||
},
|
},
|
||||||
"mipmap filter mode": {
|
"mipmap filter mode": {
|
||||||
"category": "enum",
|
"category": "enum",
|
||||||
"tags": ["upstream"],
|
|
||||||
"values": [
|
"values": [
|
||||||
{"value": 0, "name": "nearest"},
|
{"value": 0, "name": "nearest"},
|
||||||
{"value": 1, "name": "linear"}
|
{"value": 1, "name": "linear"}
|
||||||
|
@ -2359,8 +2358,7 @@
|
||||||
{"name": "address mode w", "type": "address mode", "default": "clamp to edge"},
|
{"name": "address mode w", "type": "address mode", "default": "clamp to edge"},
|
||||||
{"name": "mag filter", "type": "filter mode", "default": "nearest"},
|
{"name": "mag filter", "type": "filter mode", "default": "nearest"},
|
||||||
{"name": "min filter", "type": "filter mode", "default": "nearest"},
|
{"name": "min filter", "type": "filter mode", "default": "nearest"},
|
||||||
{"name": "mipmap filter", "type": "filter mode", "default": "nearest", "tags": ["dawn", "emscripten"]},
|
{"name": "mipmap filter", "type": "mipmap filter mode", "default": "nearest"},
|
||||||
{"name": "mipmap filter", "type": "mipmap filter mode", "default": "nearest", "tags": ["upstream"]},
|
|
||||||
{"name": "lod min clamp", "type": "float", "default": "0.0f"},
|
{"name": "lod min clamp", "type": "float", "default": "0.0f"},
|
||||||
{"name": "lod max clamp", "type": "float", "default": "1000.0f"},
|
{"name": "lod max clamp", "type": "float", "default": "1000.0f"},
|
||||||
{"name": "compare", "type": "compare function", "default": "undefined"},
|
{"name": "compare", "type": "compare function", "default": "undefined"},
|
||||||
|
|
|
@ -69,9 +69,6 @@ typedef uint32_t {{c_prefix}}Flags;
|
||||||
typedef enum {{as_cType(type.name)}} {
|
typedef enum {{as_cType(type.name)}} {
|
||||||
{% for value in type.values %}
|
{% for value in type.values %}
|
||||||
{{as_cEnum(type.name, value.name)}} = 0x{{format(value.value, "08X")}},
|
{{as_cEnum(type.name, value.name)}} = 0x{{format(value.value, "08X")}},
|
||||||
{% if ("dawn" in enabled_tags) and (type == types["filter mode"]) %}
|
|
||||||
WGPUMipmapFilterMode_{{value.name.CamelCase()}} = 0x{{format(value.value, "08X")}},
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{as_cEnum(type.name, Name("force32"))}} = 0x7FFFFFFF
|
{{as_cEnum(type.name, Name("force32"))}} = 0x7FFFFFFF
|
||||||
} {{as_cType(type.name)}};
|
} {{as_cType(type.name)}};
|
||||||
|
@ -81,12 +78,6 @@ typedef uint32_t {{c_prefix}}Flags;
|
||||||
|
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
|
||||||
// Special case definition of MipmapFilterMode for Dawn side.
|
|
||||||
// TODO(lokokung) Remove once Chromium side is updated.
|
|
||||||
{% if 'dawn' in enabled_tags %}
|
|
||||||
typedef WGPUFilterMode WGPUMipmapFilterMode;
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
typedef struct {{c_prefix}}ChainedStruct {
|
typedef struct {{c_prefix}}ChainedStruct {
|
||||||
struct {{c_prefix}}ChainedStruct const * next;
|
struct {{c_prefix}}ChainedStruct const * next;
|
||||||
{{c_prefix}}SType sType;
|
{{c_prefix}}SType sType;
|
||||||
|
|
|
@ -49,12 +49,6 @@ namespace {{metadata.namespace}} {
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
// Special case definition of MipmapFilterMode for Dawn side.
|
|
||||||
// TODO(lokokung) Remove once Chromium side is updated.
|
|
||||||
{% if 'dawn' in enabled_tags %}
|
|
||||||
using MipmapFilterMode = FilterMode;
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% for type in by_category["bitmask"] %}
|
{% for type in by_category["bitmask"] %}
|
||||||
enum class {{as_cppType(type.name)}} : uint32_t {
|
enum class {{as_cppType(type.name)}} : uint32_t {
|
||||||
{% for value in type.values %}
|
{% for value in type.values %}
|
||||||
|
|
|
@ -40,7 +40,7 @@ MaybeError ValidateSamplerDescriptor(DeviceBase*, const SamplerDescriptor* descr
|
||||||
if (descriptor->maxAnisotropy > 1) {
|
if (descriptor->maxAnisotropy > 1) {
|
||||||
DAWN_INVALID_IF(descriptor->minFilter != wgpu::FilterMode::Linear ||
|
DAWN_INVALID_IF(descriptor->minFilter != wgpu::FilterMode::Linear ||
|
||||||
descriptor->magFilter != wgpu::FilterMode::Linear ||
|
descriptor->magFilter != wgpu::FilterMode::Linear ||
|
||||||
descriptor->mipmapFilter != wgpu::FilterMode::Linear,
|
descriptor->mipmapFilter != wgpu::MipmapFilterMode::Linear,
|
||||||
"One of minFilter (%s), magFilter (%s) or mipmapFilter (%s) is not %s "
|
"One of minFilter (%s), magFilter (%s) or mipmapFilter (%s) is not %s "
|
||||||
"while using anisotropic filter (maxAnisotropy is %f)",
|
"while using anisotropic filter (maxAnisotropy is %f)",
|
||||||
descriptor->magFilter, descriptor->minFilter, descriptor->mipmapFilter,
|
descriptor->magFilter, descriptor->minFilter, descriptor->mipmapFilter,
|
||||||
|
@ -52,7 +52,7 @@ MaybeError ValidateSamplerDescriptor(DeviceBase*, const SamplerDescriptor* descr
|
||||||
|
|
||||||
DAWN_TRY(ValidateFilterMode(descriptor->minFilter));
|
DAWN_TRY(ValidateFilterMode(descriptor->minFilter));
|
||||||
DAWN_TRY(ValidateFilterMode(descriptor->magFilter));
|
DAWN_TRY(ValidateFilterMode(descriptor->magFilter));
|
||||||
DAWN_TRY(ValidateFilterMode(descriptor->mipmapFilter));
|
DAWN_TRY(ValidateMipmapFilterMode(descriptor->mipmapFilter));
|
||||||
DAWN_TRY(ValidateAddressMode(descriptor->addressModeU));
|
DAWN_TRY(ValidateAddressMode(descriptor->addressModeU));
|
||||||
DAWN_TRY(ValidateAddressMode(descriptor->addressModeV));
|
DAWN_TRY(ValidateAddressMode(descriptor->addressModeV));
|
||||||
DAWN_TRY(ValidateAddressMode(descriptor->addressModeW));
|
DAWN_TRY(ValidateAddressMode(descriptor->addressModeW));
|
||||||
|
@ -116,7 +116,7 @@ bool SamplerBase::IsComparison() const {
|
||||||
|
|
||||||
bool SamplerBase::IsFiltering() const {
|
bool SamplerBase::IsFiltering() const {
|
||||||
return mMinFilter == wgpu::FilterMode::Linear || mMagFilter == wgpu::FilterMode::Linear ||
|
return mMinFilter == wgpu::FilterMode::Linear || mMagFilter == wgpu::FilterMode::Linear ||
|
||||||
mMipmapFilter == wgpu::FilterMode::Linear;
|
mMipmapFilter == wgpu::MipmapFilterMode::Linear;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t SamplerBase::ComputeContentHash() {
|
size_t SamplerBase::ComputeContentHash() {
|
||||||
|
|
|
@ -64,7 +64,7 @@ class SamplerBase : public ApiObjectBase, public CachedObject {
|
||||||
wgpu::AddressMode mAddressModeW;
|
wgpu::AddressMode mAddressModeW;
|
||||||
wgpu::FilterMode mMagFilter;
|
wgpu::FilterMode mMagFilter;
|
||||||
wgpu::FilterMode mMinFilter;
|
wgpu::FilterMode mMinFilter;
|
||||||
wgpu::FilterMode mMipmapFilter;
|
wgpu::MipmapFilterMode mMipmapFilter;
|
||||||
float mLodMinClamp;
|
float mLodMinClamp;
|
||||||
float mLodMaxClamp;
|
float mLodMaxClamp;
|
||||||
wgpu::CompareFunction mCompareFunction;
|
wgpu::CompareFunction mCompareFunction;
|
||||||
|
|
|
@ -44,6 +44,15 @@ D3D11_FILTER_TYPE D3D11FilterType(wgpu::FilterMode mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
D3D11_FILTER_TYPE D3D11MipmapFilterType(wgpu::MipmapFilterMode mode) {
|
||||||
|
switch (mode) {
|
||||||
|
case wgpu::MipmapFilterMode::Nearest:
|
||||||
|
return D3D11_FILTER_TYPE_POINT;
|
||||||
|
case wgpu::MipmapFilterMode::Linear:
|
||||||
|
return D3D11_FILTER_TYPE_LINEAR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
@ -57,7 +66,7 @@ MaybeError Sampler::Initialize(const SamplerDescriptor* descriptor) {
|
||||||
D3D11_SAMPLER_DESC samplerDesc = {};
|
D3D11_SAMPLER_DESC samplerDesc = {};
|
||||||
D3D11_FILTER_TYPE minFilter = D3D11FilterType(descriptor->minFilter);
|
D3D11_FILTER_TYPE minFilter = D3D11FilterType(descriptor->minFilter);
|
||||||
D3D11_FILTER_TYPE magFilter = D3D11FilterType(descriptor->magFilter);
|
D3D11_FILTER_TYPE magFilter = D3D11FilterType(descriptor->magFilter);
|
||||||
D3D11_FILTER_TYPE mipmapFilter = D3D11FilterType(descriptor->mipmapFilter);
|
D3D11_FILTER_TYPE mipmapFilter = D3D11MipmapFilterType(descriptor->mipmapFilter);
|
||||||
|
|
||||||
D3D11_FILTER_REDUCTION_TYPE reduction = descriptor->compare == wgpu::CompareFunction::Undefined
|
D3D11_FILTER_REDUCTION_TYPE reduction = descriptor->compare == wgpu::CompareFunction::Undefined
|
||||||
? D3D11_FILTER_REDUCTION_TYPE_STANDARD
|
? D3D11_FILTER_REDUCTION_TYPE_STANDARD
|
||||||
|
|
|
@ -63,10 +63,10 @@ Sampler::Sampler(Device* device, const SamplerDescriptor* descriptor)
|
||||||
|
|
||||||
D3D12_FILTER_TYPE mipmapFilter;
|
D3D12_FILTER_TYPE mipmapFilter;
|
||||||
switch (descriptor->mipmapFilter) {
|
switch (descriptor->mipmapFilter) {
|
||||||
case wgpu::FilterMode::Nearest:
|
case wgpu::MipmapFilterMode::Nearest:
|
||||||
mipmapFilter = D3D12_FILTER_TYPE_POINT;
|
mipmapFilter = D3D12_FILTER_TYPE_POINT;
|
||||||
break;
|
break;
|
||||||
case wgpu::FilterMode::Linear:
|
case wgpu::MipmapFilterMode::Linear:
|
||||||
mipmapFilter = D3D12_FILTER_TYPE_LINEAR;
|
mipmapFilter = D3D12_FILTER_TYPE_LINEAR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,11 @@ MTLSamplerMinMagFilter FilterModeToMinMagFilter(wgpu::FilterMode mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MTLSamplerMipFilter FilterModeToMipFilter(wgpu::FilterMode mode) {
|
MTLSamplerMipFilter FilterModeToMipFilter(wgpu::MipmapFilterMode mode) {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case wgpu::FilterMode::Nearest:
|
case wgpu::MipmapFilterMode::Nearest:
|
||||||
return MTLSamplerMipFilterNearest;
|
return MTLSamplerMipFilterNearest;
|
||||||
case wgpu::FilterMode::Linear:
|
case wgpu::MipmapFilterMode::Linear:
|
||||||
return MTLSamplerMipFilterLinear;
|
return MTLSamplerMipFilterLinear;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ MaybeError PipelineGL::InitializeBase(const OpenGLFunctions& gl,
|
||||||
SamplerDescriptor desc = {};
|
SamplerDescriptor desc = {};
|
||||||
ASSERT(desc.minFilter == wgpu::FilterMode::Nearest);
|
ASSERT(desc.minFilter == wgpu::FilterMode::Nearest);
|
||||||
ASSERT(desc.magFilter == wgpu::FilterMode::Nearest);
|
ASSERT(desc.magFilter == wgpu::FilterMode::Nearest);
|
||||||
ASSERT(desc.mipmapFilter == wgpu::FilterMode::Nearest);
|
ASSERT(desc.mipmapFilter == wgpu::MipmapFilterMode::Nearest);
|
||||||
mPlaceholderSampler =
|
mPlaceholderSampler =
|
||||||
ToBackend(layout->GetDevice()->GetOrCreateSampler(&desc).AcquireSuccess());
|
ToBackend(layout->GetDevice()->GetOrCreateSampler(&desc).AcquireSuccess());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,20 +31,20 @@ GLenum MagFilterMode(wgpu::FilterMode filter) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum MinFilterMode(wgpu::FilterMode minFilter, wgpu::FilterMode mipMapFilter) {
|
GLenum MinFilterMode(wgpu::FilterMode minFilter, wgpu::MipmapFilterMode mipMapFilter) {
|
||||||
switch (minFilter) {
|
switch (minFilter) {
|
||||||
case wgpu::FilterMode::Nearest:
|
case wgpu::FilterMode::Nearest:
|
||||||
switch (mipMapFilter) {
|
switch (mipMapFilter) {
|
||||||
case wgpu::FilterMode::Nearest:
|
case wgpu::MipmapFilterMode::Nearest:
|
||||||
return GL_NEAREST_MIPMAP_NEAREST;
|
return GL_NEAREST_MIPMAP_NEAREST;
|
||||||
case wgpu::FilterMode::Linear:
|
case wgpu::MipmapFilterMode::Linear:
|
||||||
return GL_NEAREST_MIPMAP_LINEAR;
|
return GL_NEAREST_MIPMAP_LINEAR;
|
||||||
}
|
}
|
||||||
case wgpu::FilterMode::Linear:
|
case wgpu::FilterMode::Linear:
|
||||||
switch (mipMapFilter) {
|
switch (mipMapFilter) {
|
||||||
case wgpu::FilterMode::Nearest:
|
case wgpu::MipmapFilterMode::Nearest:
|
||||||
return GL_LINEAR_MIPMAP_NEAREST;
|
return GL_LINEAR_MIPMAP_NEAREST;
|
||||||
case wgpu::FilterMode::Linear:
|
case wgpu::MipmapFilterMode::Linear:
|
||||||
return GL_LINEAR_MIPMAP_LINEAR;
|
return GL_LINEAR_MIPMAP_LINEAR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,11 +46,11 @@ VkFilter VulkanSamplerFilter(wgpu::FilterMode filter) {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSamplerMipmapMode VulkanMipMapMode(wgpu::FilterMode filter) {
|
VkSamplerMipmapMode VulkanMipMapMode(wgpu::MipmapFilterMode filter) {
|
||||||
switch (filter) {
|
switch (filter) {
|
||||||
case wgpu::FilterMode::Linear:
|
case wgpu::MipmapFilterMode::Linear:
|
||||||
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
return VK_SAMPLER_MIPMAP_MODE_LINEAR;
|
||||||
case wgpu::FilterMode::Nearest:
|
case wgpu::MipmapFilterMode::Nearest:
|
||||||
return VK_SAMPLER_MIPMAP_MODE_NEAREST;
|
return VK_SAMPLER_MIPMAP_MODE_NEAREST;
|
||||||
}
|
}
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
|
|
|
@ -1770,17 +1770,17 @@ bool Converter::Convert(wgpu::FilterMode& out, const interop::GPUFilterMode& in)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Converter::Convert(wgpu::FilterMode& out, const interop::GPUMipmapFilterMode& in) {
|
bool Converter::Convert(wgpu::MipmapFilterMode& out, const interop::GPUMipmapFilterMode& in) {
|
||||||
out = wgpu::FilterMode::Nearest;
|
out = wgpu::MipmapFilterMode::Nearest;
|
||||||
switch (in) {
|
switch (in) {
|
||||||
case interop::GPUMipmapFilterMode::kNearest:
|
case interop::GPUMipmapFilterMode::kNearest:
|
||||||
out = wgpu::FilterMode::Nearest;
|
out = wgpu::MipmapFilterMode::Nearest;
|
||||||
return true;
|
return true;
|
||||||
case interop::GPUMipmapFilterMode::kLinear:
|
case interop::GPUMipmapFilterMode::kLinear:
|
||||||
out = wgpu::FilterMode::Linear;
|
out = wgpu::MipmapFilterMode::Linear;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Napi::Error::New(env, "invalid value for GPUFilterMode").ThrowAsJavaScriptException();
|
Napi::Error::New(env, "invalid value for GPUMipmapFilterMode").ThrowAsJavaScriptException();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -249,7 +249,7 @@ class Converter {
|
||||||
|
|
||||||
[[nodiscard]] bool Convert(wgpu::FilterMode& out, const interop::GPUFilterMode& in);
|
[[nodiscard]] bool Convert(wgpu::FilterMode& out, const interop::GPUFilterMode& in);
|
||||||
|
|
||||||
[[nodiscard]] bool Convert(wgpu::FilterMode& out, const interop::GPUMipmapFilterMode& in);
|
[[nodiscard]] bool Convert(wgpu::MipmapFilterMode& out, const interop::GPUMipmapFilterMode& in);
|
||||||
|
|
||||||
[[nodiscard]] bool Convert(wgpu::ComputePipelineDescriptor& out,
|
[[nodiscard]] bool Convert(wgpu::ComputePipelineDescriptor& out,
|
||||||
const interop::GPUComputePipelineDescriptor& in);
|
const interop::GPUComputePipelineDescriptor& in);
|
||||||
|
|
|
@ -284,7 +284,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||||
wgpu::SamplerDescriptor samplerDescriptor = {};
|
wgpu::SamplerDescriptor samplerDescriptor = {};
|
||||||
samplerDescriptor.minFilter = wgpu::FilterMode::Nearest;
|
samplerDescriptor.minFilter = wgpu::FilterMode::Nearest;
|
||||||
samplerDescriptor.magFilter = wgpu::FilterMode::Nearest;
|
samplerDescriptor.magFilter = wgpu::FilterMode::Nearest;
|
||||||
samplerDescriptor.mipmapFilter = wgpu::FilterMode::Nearest;
|
samplerDescriptor.mipmapFilter = wgpu::MipmapFilterMode::Nearest;
|
||||||
samplerDescriptor.addressModeU = wgpu::AddressMode::ClampToEdge;
|
samplerDescriptor.addressModeU = wgpu::AddressMode::ClampToEdge;
|
||||||
samplerDescriptor.addressModeV = wgpu::AddressMode::ClampToEdge;
|
samplerDescriptor.addressModeV = wgpu::AddressMode::ClampToEdge;
|
||||||
samplerDescriptor.addressModeW = wgpu::AddressMode::ClampToEdge;
|
samplerDescriptor.addressModeW = wgpu::AddressMode::ClampToEdge;
|
||||||
|
|
|
@ -416,7 +416,7 @@ TEST_P(ObjectCachingTest, SamplerDeduplication) {
|
||||||
wgpu::Sampler otherSamplerMinFilter = device.CreateSampler(&otherSamplerDescMinFilter);
|
wgpu::Sampler otherSamplerMinFilter = device.CreateSampler(&otherSamplerDescMinFilter);
|
||||||
|
|
||||||
wgpu::SamplerDescriptor otherSamplerDescMipmapFilter;
|
wgpu::SamplerDescriptor otherSamplerDescMipmapFilter;
|
||||||
otherSamplerDescMipmapFilter.mipmapFilter = wgpu::FilterMode::Linear;
|
otherSamplerDescMipmapFilter.mipmapFilter = wgpu::MipmapFilterMode::Linear;
|
||||||
wgpu::Sampler otherSamplerMipmapFilter = device.CreateSampler(&otherSamplerDescMipmapFilter);
|
wgpu::Sampler otherSamplerMipmapFilter = device.CreateSampler(&otherSamplerDescMipmapFilter);
|
||||||
|
|
||||||
wgpu::SamplerDescriptor otherSamplerDescLodMinClamp;
|
wgpu::SamplerDescriptor otherSamplerDescLodMinClamp;
|
||||||
|
|
|
@ -147,7 +147,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
||||||
wgpu::SamplerDescriptor descriptor = {};
|
wgpu::SamplerDescriptor descriptor = {};
|
||||||
descriptor.minFilter = wgpu::FilterMode::Linear;
|
descriptor.minFilter = wgpu::FilterMode::Linear;
|
||||||
descriptor.magFilter = wgpu::FilterMode::Linear;
|
descriptor.magFilter = wgpu::FilterMode::Linear;
|
||||||
descriptor.mipmapFilter = wgpu::FilterMode::Linear;
|
descriptor.mipmapFilter = wgpu::MipmapFilterMode::Linear;
|
||||||
descriptor.maxAnisotropy = maxAnisotropy;
|
descriptor.maxAnisotropy = maxAnisotropy;
|
||||||
sampler = device.CreateSampler(&descriptor);
|
sampler = device.CreateSampler(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,7 +125,7 @@ class SamplerTest : public DawnTest {
|
||||||
wgpu::SamplerDescriptor descriptor = {};
|
wgpu::SamplerDescriptor descriptor = {};
|
||||||
descriptor.minFilter = wgpu::FilterMode::Nearest;
|
descriptor.minFilter = wgpu::FilterMode::Nearest;
|
||||||
descriptor.magFilter = wgpu::FilterMode::Nearest;
|
descriptor.magFilter = wgpu::FilterMode::Nearest;
|
||||||
descriptor.mipmapFilter = wgpu::FilterMode::Nearest;
|
descriptor.mipmapFilter = wgpu::MipmapFilterMode::Nearest;
|
||||||
descriptor.addressModeU = u.mMode;
|
descriptor.addressModeU = u.mMode;
|
||||||
descriptor.addressModeV = v.mMode;
|
descriptor.addressModeV = v.mMode;
|
||||||
descriptor.addressModeW = w.mMode;
|
descriptor.addressModeW = w.mMode;
|
||||||
|
|
|
@ -107,12 +107,13 @@ class TextureViewSamplingTest : public DawnTest {
|
||||||
mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
mRenderPass = utils::CreateBasicRenderPass(device, kRTSize, kRTSize);
|
||||||
|
|
||||||
wgpu::FilterMode kFilterMode = wgpu::FilterMode::Nearest;
|
wgpu::FilterMode kFilterMode = wgpu::FilterMode::Nearest;
|
||||||
|
wgpu::MipmapFilterMode kMipmapFilterMode = wgpu::MipmapFilterMode::Nearest;
|
||||||
wgpu::AddressMode kAddressMode = wgpu::AddressMode::ClampToEdge;
|
wgpu::AddressMode kAddressMode = wgpu::AddressMode::ClampToEdge;
|
||||||
|
|
||||||
wgpu::SamplerDescriptor samplerDescriptor = {};
|
wgpu::SamplerDescriptor samplerDescriptor = {};
|
||||||
samplerDescriptor.minFilter = kFilterMode;
|
samplerDescriptor.minFilter = kFilterMode;
|
||||||
samplerDescriptor.magFilter = kFilterMode;
|
samplerDescriptor.magFilter = kFilterMode;
|
||||||
samplerDescriptor.mipmapFilter = kFilterMode;
|
samplerDescriptor.mipmapFilter = kMipmapFilterMode;
|
||||||
samplerDescriptor.addressModeU = kAddressMode;
|
samplerDescriptor.addressModeU = kAddressMode;
|
||||||
samplerDescriptor.addressModeV = kAddressMode;
|
samplerDescriptor.addressModeV = kAddressMode;
|
||||||
samplerDescriptor.addressModeW = kAddressMode;
|
samplerDescriptor.addressModeW = kAddressMode;
|
||||||
|
|
|
@ -3033,7 +3033,7 @@ TEST_F(SamplerTypeBindingTest, SamplerAndBindGroupMatches) {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
wgpu::SamplerDescriptor desc;
|
wgpu::SamplerDescriptor desc;
|
||||||
desc.mipmapFilter = wgpu::FilterMode::Linear;
|
desc.mipmapFilter = wgpu::MipmapFilterMode::Linear;
|
||||||
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}});
|
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3061,7 +3061,7 @@ TEST_F(SamplerTypeBindingTest, SamplerAndBindGroupMatches) {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
wgpu::SamplerDescriptor desc;
|
wgpu::SamplerDescriptor desc;
|
||||||
desc.mipmapFilter = wgpu::FilterMode::Linear;
|
desc.mipmapFilter = wgpu::MipmapFilterMode::Linear;
|
||||||
ASSERT_DEVICE_ERROR(
|
ASSERT_DEVICE_ERROR(
|
||||||
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}}));
|
utils::MakeBindGroup(device, bindGroupLayout, {{0, device.CreateSampler(&desc)}}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ TEST_F(SamplerValidationTest, InvalidFilterAnisotropic) {
|
||||||
kValidAnisoSamplerDesc.maxAnisotropy = 2;
|
kValidAnisoSamplerDesc.maxAnisotropy = 2;
|
||||||
kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Linear;
|
kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Linear;
|
||||||
kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Linear;
|
kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Linear;
|
||||||
kValidAnisoSamplerDesc.mipmapFilter = wgpu::FilterMode::Linear;
|
kValidAnisoSamplerDesc.mipmapFilter = wgpu::MipmapFilterMode::Linear;
|
||||||
{
|
{
|
||||||
// when maxAnisotropy > 1, min, mag, mipmap filter should be linear
|
// when maxAnisotropy > 1, min, mag, mipmap filter should be linear
|
||||||
device.CreateSampler(&kValidAnisoSamplerDesc);
|
device.CreateSampler(&kValidAnisoSamplerDesc);
|
||||||
|
@ -67,7 +67,7 @@ TEST_F(SamplerValidationTest, InvalidFilterAnisotropic) {
|
||||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||||
samplerDesc.minFilter = wgpu::FilterMode::Nearest;
|
samplerDesc.minFilter = wgpu::FilterMode::Nearest;
|
||||||
samplerDesc.magFilter = wgpu::FilterMode::Nearest;
|
samplerDesc.magFilter = wgpu::FilterMode::Nearest;
|
||||||
samplerDesc.mipmapFilter = wgpu::FilterMode::Nearest;
|
samplerDesc.mipmapFilter = wgpu::MipmapFilterMode::Nearest;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ TEST_F(SamplerValidationTest, InvalidFilterAnisotropic) {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||||
samplerDesc.mipmapFilter = wgpu::FilterMode::Nearest;
|
samplerDesc.mipmapFilter = wgpu::MipmapFilterMode::Nearest;
|
||||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ TEST_F(SamplerValidationTest, ValidFilterAnisotropic) {
|
||||||
kValidAnisoSamplerDesc.maxAnisotropy = 2;
|
kValidAnisoSamplerDesc.maxAnisotropy = 2;
|
||||||
kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Linear;
|
kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Linear;
|
||||||
kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Linear;
|
kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Linear;
|
||||||
kValidAnisoSamplerDesc.mipmapFilter = wgpu::FilterMode::Linear;
|
kValidAnisoSamplerDesc.mipmapFilter = wgpu::MipmapFilterMode::Linear;
|
||||||
{ device.CreateSampler(); }
|
{ device.CreateSampler(); }
|
||||||
{
|
{
|
||||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||||
|
|
|
@ -240,7 +240,7 @@ TEST_F(WireArgumentTests, StructureOfValuesArgument) {
|
||||||
WGPUSamplerDescriptor descriptor = {};
|
WGPUSamplerDescriptor descriptor = {};
|
||||||
descriptor.magFilter = WGPUFilterMode_Linear;
|
descriptor.magFilter = WGPUFilterMode_Linear;
|
||||||
descriptor.minFilter = WGPUFilterMode_Nearest;
|
descriptor.minFilter = WGPUFilterMode_Nearest;
|
||||||
descriptor.mipmapFilter = WGPUFilterMode_Linear;
|
descriptor.mipmapFilter = WGPUMipmapFilterMode_Linear;
|
||||||
descriptor.addressModeU = WGPUAddressMode_ClampToEdge;
|
descriptor.addressModeU = WGPUAddressMode_ClampToEdge;
|
||||||
descriptor.addressModeV = WGPUAddressMode_Repeat;
|
descriptor.addressModeV = WGPUAddressMode_Repeat;
|
||||||
descriptor.addressModeW = WGPUAddressMode_MirrorRepeat;
|
descriptor.addressModeW = WGPUAddressMode_MirrorRepeat;
|
||||||
|
@ -256,7 +256,7 @@ TEST_F(WireArgumentTests, StructureOfValuesArgument) {
|
||||||
return desc->nextInChain == nullptr &&
|
return desc->nextInChain == nullptr &&
|
||||||
desc->magFilter == WGPUFilterMode_Linear &&
|
desc->magFilter == WGPUFilterMode_Linear &&
|
||||||
desc->minFilter == WGPUFilterMode_Nearest &&
|
desc->minFilter == WGPUFilterMode_Nearest &&
|
||||||
desc->mipmapFilter == WGPUFilterMode_Linear &&
|
desc->mipmapFilter == WGPUMipmapFilterMode_Linear &&
|
||||||
desc->addressModeU == WGPUAddressMode_ClampToEdge &&
|
desc->addressModeU == WGPUAddressMode_ClampToEdge &&
|
||||||
desc->addressModeV == WGPUAddressMode_Repeat &&
|
desc->addressModeV == WGPUAddressMode_Repeat &&
|
||||||
desc->addressModeW == WGPUAddressMode_MirrorRepeat &&
|
desc->addressModeW == WGPUAddressMode_MirrorRepeat &&
|
||||||
|
|
Loading…
Reference in New Issue