MetalDevice: Anisotropy should be minimum 1

This commit is contained in:
Stenzek 2023-12-04 21:22:02 +10:00
parent 2071addce0
commit 601d8ff629
No known key found for this signature in database
4 changed files with 5 additions and 7 deletions

View file

@ -197,7 +197,7 @@ std::unique_ptr<GPUSampler> D3D11Device::CreateSampler(const GPUSampler::Config&
desc.MinLOD = static_cast<float>(config.min_lod); desc.MinLOD = static_cast<float>(config.min_lod);
desc.MaxLOD = static_cast<float>(config.max_lod); desc.MaxLOD = static_cast<float>(config.max_lod);
if (config.anisotropy > 0) if (config.anisotropy > 1)
{ {
desc.Filter = D3D11_FILTER_ANISOTROPIC; desc.Filter = D3D11_FILTER_ANISOTROPIC;
desc.MaxAnisotropy = config.anisotropy; desc.MaxAnisotropy = config.anisotropy;

View file

@ -806,7 +806,7 @@ D3D12DescriptorHandle D3D12Device::GetSampler(const GPUSampler::Config& config)
desc.MinLOD = static_cast<float>(config.min_lod); desc.MinLOD = static_cast<float>(config.min_lod);
desc.MaxLOD = static_cast<float>(config.max_lod); desc.MaxLOD = static_cast<float>(config.max_lod);
if (config.anisotropy > 0) if (config.anisotropy > 1)
{ {
desc.Filter = D3D12_FILTER_ANISOTROPIC; desc.Filter = D3D12_FILTER_ANISOTROPIC;
desc.MaxAnisotropy = config.anisotropy; desc.MaxAnisotropy = config.anisotropy;

View file

@ -1264,7 +1264,7 @@ std::unique_ptr<GPUSampler> MetalDevice::CreateSampler(const GPUSampler::Config&
MTLSamplerMipFilterNotMipmapped; MTLSamplerMipFilterNotMipmapped;
desc.lodMinClamp = static_cast<float>(config.min_lod); desc.lodMinClamp = static_cast<float>(config.min_lod);
desc.lodMaxClamp = static_cast<float>(config.max_lod); desc.lodMaxClamp = static_cast<float>(config.max_lod);
desc.maxAnisotropy = config.anisotropy; desc.maxAnisotropy = std::max<u8>(config.anisotropy, 1);
if (config.address_u == GPUSampler::AddressMode::ClampToBorder || if (config.address_u == GPUSampler::AddressMode::ClampToBorder ||
config.address_v == GPUSampler::AddressMode::ClampToBorder || config.address_v == GPUSampler::AddressMode::ClampToBorder ||

View file

@ -376,10 +376,8 @@ std::unique_ptr<GPUSampler> OpenGLDevice::CreateSampler(const GPUSampler::Config
glSamplerParameterf(sampler, GL_TEXTURE_MIN_LOD, static_cast<float>(config.min_lod)); glSamplerParameterf(sampler, GL_TEXTURE_MIN_LOD, static_cast<float>(config.min_lod));
glSamplerParameterf(sampler, GL_TEXTURE_MAX_LOD, static_cast<float>(config.max_lod)); glSamplerParameterf(sampler, GL_TEXTURE_MAX_LOD, static_cast<float>(config.max_lod));
glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, config.GetBorderFloatColor().data()); glSamplerParameterfv(sampler, GL_TEXTURE_BORDER_COLOR, config.GetBorderFloatColor().data());
if (config.anisotropy) if (config.anisotropy > 1)
{ glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY, static_cast<float>(config.anisotropy.GetValue()));
// TODO
}
return std::unique_ptr<GPUSampler>(new OpenGLSampler(sampler)); return std::unique_ptr<GPUSampler>(new OpenGLSampler(sampler));
} }