mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Add maxAnisotropy to GPUSamplerDescriptor
Adds some maxAnisotropy implementation. Adds an end2end test, drawing a slanted plane with a texture of which each mipmap has a different color, with different maxAnisotropy values. You can get an idea of what it does at https://jsfiddle.net/t64kpu81/85/ Needs further CTS. Bug: dawn:568 Change-Id: I89ac56d8cf0fbb655358bf6effa016ddc1f8426f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/35143 Commit-Queue: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
c08276644f
commit
f8c5e4ab74
@@ -51,4 +51,75 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SamplerValidationTest, InvalidFilterAnisotropic) {
|
||||
wgpu::SamplerDescriptor kValidAnisoSamplerDesc = {};
|
||||
kValidAnisoSamplerDesc.maxAnisotropy = 2;
|
||||
kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Linear;
|
||||
kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Linear;
|
||||
kValidAnisoSamplerDesc.mipmapFilter = wgpu::FilterMode::Linear;
|
||||
{
|
||||
// when maxAnisotropy > 1, min, mag, mipmap filter should be linear
|
||||
device.CreateSampler(&kValidAnisoSamplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.minFilter = wgpu::FilterMode::Nearest;
|
||||
samplerDesc.magFilter = wgpu::FilterMode::Nearest;
|
||||
samplerDesc.mipmapFilter = wgpu::FilterMode::Nearest;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.minFilter = wgpu::FilterMode::Nearest;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.magFilter = wgpu::FilterMode::Nearest;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.mipmapFilter = wgpu::FilterMode::Nearest;
|
||||
ASSERT_DEVICE_ERROR(device.CreateSampler(&samplerDesc));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(SamplerValidationTest, ValidFilterAnisotropic) {
|
||||
wgpu::SamplerDescriptor kValidAnisoSamplerDesc = {};
|
||||
kValidAnisoSamplerDesc.maxAnisotropy = 2;
|
||||
kValidAnisoSamplerDesc.minFilter = wgpu::FilterMode::Linear;
|
||||
kValidAnisoSamplerDesc.magFilter = wgpu::FilterMode::Linear;
|
||||
kValidAnisoSamplerDesc.mipmapFilter = wgpu::FilterMode::Linear;
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = {};
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.maxAnisotropy = 16;
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.maxAnisotropy = 32;
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.maxAnisotropy = 0x7FFF;
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.maxAnisotropy = 0x8000;
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
{
|
||||
wgpu::SamplerDescriptor samplerDesc = kValidAnisoSamplerDesc;
|
||||
samplerDesc.maxAnisotropy = 0xFFFF;
|
||||
device.CreateSampler(&samplerDesc);
|
||||
}
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
Reference in New Issue
Block a user