Revert "Support depth32float sampling on D3D12"

This reverts commit 071fe56ffe.

Reason for revert: SamplerRender/D3D12 has flaky crashes

Original change's description:
> Support depth32float sampling on D3D12
> 
> Bug: dawn:367
> Change-Id: I026e718130cbd92427c6292045fd041c878d4f77
> Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/20840
> Commit-Queue: Austin Eng <enga@chromium.org>
> Reviewed-by: Stephen White <senorblanco@chromium.org>

TBR=cwallez@chromium.org,senorblanco@chromium.org,enga@chromium.org

Change-Id: I35df2ac35986d4a32437a52b70b025a370302651
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: dawn:367
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/21320
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2020-05-07 20:38:37 +00:00 committed by Commit Bot service account
parent d785988172
commit 4fe8ead090
3 changed files with 18 additions and 32 deletions

View File

@ -38,38 +38,26 @@ namespace dawn_native { namespace d3d12 {
: SamplerBase(device, descriptor) { : SamplerBase(device, descriptor) {
// https://msdn.microsoft.com/en-us/library/windows/desktop/dn770367(v=vs.85).aspx // https://msdn.microsoft.com/en-us/library/windows/desktop/dn770367(v=vs.85).aspx
// hex value, decimal value, min linear, mag linear, mip linear // hex value, decimal value, min linear, mag linear, mip linear
// D3D12_FILTER_MIN_MAG_MIP_POINT = 0 0 0 0 0 // D3D12_FILTER_MIN_MAG_MIP_POINT = 0 0 0 0 0
// D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1 1 0 0 1 // D3D12_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1 1 0 0 1
// D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4 4 0 1 0 // D3D12_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4 4 0 1 0
// D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5 5 0 1 1 // D3D12_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5 5 0 1 1
// D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10 16 1 0 0 // D3D12_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10 16 1 0 0
// D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11 17 1 0 1 // D3D12_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11 17 1 0 1
// D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14 20 1 1 0 // D3D12_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14 20 1 1 0
// D3D12_FILTER_MIN_MAG_MIP_LINEAR = 0x15 21 1 1 1 // D3D12_FILTER_MIN_MAG_MIP_LINEAR = 0x15 21 1 1 1
// D3D12_FILTER_COMPARISON_MIN_MAG_MIP_POINT, = 0x80 128
// D3D12_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR, = 0x81 129
// D3D12_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT, = 0x84 132
// D3D12_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR, = 0x85 133
// D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT, = 0x90 144
// D3D12_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR,= 0x91 145
// D3D12_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT, = 0x94 148
// D3D12_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR, = 0x95 149
// if mip mode is linear, add 0x1 // if mip mode is linear, add 1
// if mag mode is linear, add 0x4 // if mag mode is linear, add 4
// if min mode is linear, add 0x10 // if min mode is linear, add 16
// if comparison, add 0x80
uint8_t mode = 0; uint8_t mode = 0;
if (descriptor->compare != wgpu::CompareFunction::Undefined) {
mode += 0x80;
}
switch (descriptor->minFilter) { switch (descriptor->minFilter) {
case wgpu::FilterMode::Nearest: case wgpu::FilterMode::Nearest:
break; break;
case wgpu::FilterMode::Linear: case wgpu::FilterMode::Linear:
mode += 0x10; mode += 16;
break; break;
} }
@ -77,7 +65,7 @@ namespace dawn_native { namespace d3d12 {
case wgpu::FilterMode::Nearest: case wgpu::FilterMode::Nearest:
break; break;
case wgpu::FilterMode::Linear: case wgpu::FilterMode::Linear:
mode += 0x4; mode += 4;
break; break;
} }
@ -85,7 +73,7 @@ namespace dawn_native { namespace d3d12 {
case wgpu::FilterMode::Nearest: case wgpu::FilterMode::Nearest:
break; break;
case wgpu::FilterMode::Linear: case wgpu::FilterMode::Linear:
mode += 0x1; mode += 1;
break; break;
} }

View File

@ -772,11 +772,6 @@ namespace dawn_native { namespace d3d12 {
TextureView::TextureView(TextureBase* texture, const TextureViewDescriptor* descriptor) TextureView::TextureView(TextureBase* texture, const TextureViewDescriptor* descriptor)
: TextureViewBase(texture, descriptor) { : TextureViewBase(texture, descriptor) {
mSrvDesc.Format = D3D12TextureFormat(descriptor->format); mSrvDesc.Format = D3D12TextureFormat(descriptor->format);
if (descriptor->format == wgpu::TextureFormat::Depth32Float) {
// TODO(enga): This will need to be much more nuanced when WebGPU has
// texture view compatibility rules.
mSrvDesc.Format = DXGI_FORMAT_R32_FLOAT;
}
mSrvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING; mSrvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
// Currently we always use D3D12_TEX2D_ARRAY_SRV because we cannot specify base array layer // Currently we always use D3D12_TEX2D_ARRAY_SRV because we cannot specify base array layer

View File

@ -505,4 +505,7 @@ TEST_P(DepthSamplingTest, CompareFunctionsNonNormalizedContentsCompute) {
} }
} }
DAWN_INSTANTIATE_TEST(DepthSamplingTest, D3D12Backend(), MetalBackend(), OpenGLBackend(), VulkanBackend()); // TODO(crbug.com/dawn/367): Does not work on D3D12 because we need to reinterpret the texture view
// as R32Float to sample it. See tables here:
// https://docs.microsoft.com/en-us/windows/win32/direct3ddxgi/hardware-support-for-direct3d-12-1-formats
DAWN_INSTANTIATE_TEST(DepthSamplingTest, MetalBackend(), OpenGLBackend(), VulkanBackend());