Add Toggle to use temp buffer in T2T copy with different dimensions

Bug: dawn:1216
Change-Id: I0fb7400af1bfeb5b05fd926c0b175421560f0c78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/120100
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2023-02-16 23:36:40 +00:00 committed by Dawn LUCI CQ
parent a7a90d077f
commit 7616dcb060
5 changed files with 27 additions and 14 deletions

View File

@ -299,6 +299,12 @@ static constexpr ToggleEnumAndInfoList kToggleNameAndInfoList = {{
"0, then copy from the temporary buffer to the destination. Now this toggle must be enabled "
"on the D3D12 platforms where programmable MSAA is not supported.",
"https://crbug.com/dawn/727", ToggleStage::Device}},
{Toggle::D3D12UseTempBufferInTextureToTextureCopyBetweenDifferentDimensions,
{"d3d12_use_temp_buffer_in_texture_to_texture_copy_between_different_dimensions",
"Use an intermediate temporary buffer when copying between textures of different dimensions. "
"Force-enabled on D3D12 when the driver does not have the "
"TextureCopyBetweenDimensionsSupported feature.",
"https://crbug.com/dawn/1216", ToggleStage::Device}},
{Toggle::ApplyClearBigIntegerColorValueWithDraw,
{"apply_clear_big_integer_color_value_with_draw",
"Apply the clear value of the color attachment with a draw call when load op is 'clear'. "

View File

@ -79,6 +79,7 @@ enum class Toggle {
D3D12AlwaysUseTypelessFormatsForCastableTexture,
D3D12AllocateExtraMemoryFor2DArrayColorTexture,
D3D12UseTempBufferInDepthStencilTextureAndBufferCopyWithNonZeroBufferOffset,
D3D12UseTempBufferInTextureToTextureCopyBetweenDifferentDimensions,
ApplyClearBigIntegerColorValueWithDraw,
MetalUseMockBlitEncoderForWriteTimestamp,
VulkanSplitCommandBufferOnDepthStencilComputeSampleAfterRenderPass,

View File

@ -553,6 +553,11 @@ void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
if (gpu_info::IsIntelGen9(vendorId, deviceId)) {
deviceToggles->ForceSet(Toggle::NoWorkaroundDstAlphaBlendDoesNotWork, true);
}
// TODO(http://crbug.com/dawn/1216): Actually query D3D12_FEATURE_DATA_D3D12_OPTIONS13.
// This is blocked on updating the Windows SDK.
deviceToggles->ForceSet(
Toggle::D3D12UseTempBufferInTextureToTextureCopyBetweenDifferentDimensions, true);
}
ResultOrError<Ref<DeviceBase>> Adapter::CreateDeviceImpl(const DeviceDescriptor* descriptor,

View File

@ -153,7 +153,12 @@ void RecordFirstIndexOffset(ID3D12GraphicsCommandList* commandList,
bool ShouldCopyUsingTemporaryBuffer(DeviceBase* device,
const TextureCopy& srcCopy,
const TextureCopy& dstCopy) {
// Currently we only need the workaround for an Intel D3D12 driver issue.
if (device->IsToggleEnabled(
Toggle::D3D12UseTempBufferInTextureToTextureCopyBetweenDifferentDimensions) &&
srcCopy.texture->GetDimension() != dstCopy.texture->GetDimension()) {
return true;
}
if (device->IsToggleEnabled(
Toggle::UseTempBufferInSmallFormatTextureToTextureCopyFromGreaterToLessMipLevel)) {
bool copyToLesserLevel = srcCopy.mipLevel > dstCopy.mipLevel;

View File

@ -2296,9 +2296,6 @@ TEST_P(CopyTests_T2T, Texture3DTo2DArrayFull) {
// Test that copying between 3D texture and 2D array textures works. It includes partial copy
// for src and/or dst texture, non-zero offset (copy origin), non-zero mip level.
TEST_P(CopyTests_T2T, Texture3DAnd2DArraySubRegion) {
// TODO(crbug.com/dawn/1216): Remove this suppression.
DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia());
// TODO(crbug.com/dawn/1426): Remove this suppression.
DAWN_SUPPRESS_TEST_IF(IsANGLE() && IsWindows() && IsIntel());
@ -2358,8 +2355,6 @@ TEST_P(CopyTests_T2T, Texture3DAnd2DArraySubRegion) {
// Test that copying whole 2D array to a 3D texture in one texture-to-texture-copy works.
TEST_P(CopyTests_T2T, Texture2DArrayTo3DFull) {
// TODO(crbug.com/dawn/1216): Remove this suppression.
DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia());
constexpr uint32_t kWidth = 256;
constexpr uint32_t kHeight = 128;
constexpr uint32_t kDepth = 6u;
@ -2400,8 +2395,6 @@ TEST_P(CopyTests_T2T, Texture3DTo2DArraySubRegion) {
// Test that copying subregion of a 2D array to a 3D texture to in one texture-to-texture-copy
// works.
TEST_P(CopyTests_T2T, Texture2DArrayTo3DSubRegion) {
// TODO(crbug.com/dawn/1216): Remove this suppression.
DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsNvidia());
constexpr uint32_t kWidth = 256;
constexpr uint32_t kHeight = 128;
constexpr uint32_t kDepth = 6u;
@ -2451,10 +2444,13 @@ TEST_P(CopyTests_T2T, Texture3DMipUnaligned) {
}
}
DAWN_INSTANTIATE_TEST_P(CopyTests_T2T,
DAWN_INSTANTIATE_TEST_P(
CopyTests_T2T,
{D3D12Backend(),
D3D12Backend({"use_temp_buffer_in_small_format_texture_to_texture_copy_"
"from_greater_to_less_mip_level"}),
D3D12Backend({"use_temp_buffer_in_small_format_texture_to_texture_copy_from_greater_to_less_"
"mip_level"}),
D3D12Backend(
{"d3d12_use_temp_buffer_in_texture_to_texture_copy_between_different_dimensions"}),
MetalBackend(), OpenGLBackend(), OpenGLESBackend(), VulkanBackend()},
{true, false});