Enable anisotropic filtering in Dawn and D3D.

D3D: the filter mode was being enabled but the max was always 1.

Dawn: Everything was plumbed but caps wasn't enabled.

Bug: skia:13036
Change-Id: Ib432bb8bc4fa28eddd827dd8337d2592617a6f70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/535413
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2022-04-30 10:01:26 -04:00 committed by SkCQ
parent fe01e985a7
commit ab7b006ea6
4 changed files with 6 additions and 3 deletions

View File

@ -93,6 +93,7 @@ GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createSampler(
GrD3DGpu* gpu,
D3D12_FILTER filter,
float maxLOD,
unsigned int maxAnisotropy,
D3D12_TEXTURE_ADDRESS_MODE addressModeU,
D3D12_TEXTURE_ADDRESS_MODE addressModeV) {
const GrD3DDescriptorHeap::CPUHandle& descriptor = fSamplerDescriptorPool.allocateHandle(gpu);
@ -102,7 +103,7 @@ GrD3DDescriptorHeap::CPUHandle GrD3DCpuDescriptorManager::createSampler(
desc.AddressV = addressModeV;
desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
desc.MipLODBias = 0;
desc.MaxAnisotropy = 1;
desc.MaxAnisotropy = maxAnisotropy;
desc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
// desc.BorderColor initialized to { 0, 0, 0, 0 } by default initializer, above.
desc.MinLOD = 0;

View File

@ -41,6 +41,7 @@ public:
GrD3DDescriptorHeap::CPUHandle createSampler(GrD3DGpu*,
D3D12_FILTER filter,
float maxLOD,
unsigned int maxAnisotropy,
D3D12_TEXTURE_ADDRESS_MODE addressModeU,
D3D12_TEXTURE_ADDRESS_MODE addressModeV);
void recycleSampler(const GrD3DDescriptorHeap::CPUHandle&);

View File

@ -174,10 +174,10 @@ D3D12_CPU_DESCRIPTOR_HANDLE GrD3DResourceProvider::findOrCreateCompatibleSampler
: 0.f;
D3D12_TEXTURE_ADDRESS_MODE addressModeU = wrap_mode_to_d3d_address_mode(params.wrapModeX());
D3D12_TEXTURE_ADDRESS_MODE addressModeV = wrap_mode_to_d3d_address_mode(params.wrapModeY());
unsigned int maxAnisotropy = params.maxAniso();
D3D12_CPU_DESCRIPTOR_HANDLE sampler =
fCpuDescriptorManager.createSampler(
fGpu, filter, maxLOD, addressModeU, addressModeV).fHandle;
fGpu, filter, maxLOD, maxAnisotropy, addressModeU, addressModeV).fHandle;
fSamplers.set(key, sampler);
return sampler;
}

View File

@ -15,6 +15,7 @@
GrDawnCaps::GrDawnCaps(const GrContextOptions& contextOptions) : INHERITED(contextOptions) {
fMipmapSupport = true;
fAnisoSupport = true;
fBufferMapThreshold = SK_MaxS32; // FIXME: get this from Dawn?
fShaderCaps = std::make_unique<GrShaderCaps>();
fMaxTextureSize = fMaxRenderTargetSize = 8192; // FIXME