d3d11: fix and enable ExternalTextureTests

Bug: dawn:1705
Change-Id: I29fbb5bebbc217a4f95a51e24ec295d6e3cd6e8e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132740
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Peng Huang <penghuang@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Peng Huang 2023-05-16 02:43:53 +00:00 committed by Dawn LUCI CQ
parent c29e10c442
commit 64df2e6235
2 changed files with 22 additions and 0 deletions

View File

@ -125,6 +125,27 @@ ResultOrError<d3d::CompiledShader> ShaderModule::Compile(
bindingRemapper.binding_points.emplace(srcBindingPoint, dstBindingPoint);
}
}
// Tint will add two bindings (plane1, params) for one external texture binding.
// We need to remap the binding points for the two bindings.
// we cannot specified the final slot of those two bindings in
// req.hlsl.externalTextureOptions because the final slots may be conflict with
// existing other bindings, and then they will be remapped again with bindingRemapper
// incorrectly. So we have to use intermediate binding slots in
// req.hlsl.externalTextureOptions, and then map them to the final slots with
// bindingRemapper.
for (const auto& [_, expansion] : groupLayout->GetExternalTextureBindingExpansionMap()) {
uint32_t plane1Slot = indices[groupLayout->GetBindingIndex(expansion.plane1)];
uint32_t paramsSlot = indices[groupLayout->GetBindingIndex(expansion.params)];
bindingRemapper.binding_points.emplace(
tint::writer::BindingPoint{static_cast<uint32_t>(group),
static_cast<uint32_t>(expansion.plane1)},
tint::writer::BindingPoint{0u, plane1Slot});
bindingRemapper.binding_points.emplace(
tint::writer::BindingPoint{static_cast<uint32_t>(group),
static_cast<uint32_t>(expansion.params)},
tint::writer::BindingPoint{0u, paramsSlot});
}
}
std::optional<tint::ast::transform::SubstituteOverride::Config> substituteOverrideConfig;

View File

@ -996,6 +996,7 @@ TEST_P(ExternalTextureTests, CropMultiplanar) {
}
DAWN_INSTANTIATE_TEST(ExternalTextureTests,
D3D11Backend(),
D3D12Backend(),
MetalBackend(),
OpenGLBackend(),