mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Fix incorrect return status of Create*PipelineAsync when device is lost
This patch fixes the incorrect return status of Create*PipelineAsync when device is lost by explicitly calling and clearing all the Create*PipelineAsync callbacks in DeviceBase::HandleError() when the device is lost. BUG=dawn:529 TEST=dawn_end2end_tests Change-Id: I67a8047b2e5a54f6f85c5a4cbcf420b744ac0d5c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/49080 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
cf569e2c58
commit
045a02adc0
@@ -554,6 +554,26 @@ TEST_P(DeviceLostTest, DeviceLostDoesntCallUncapturedError) {
|
||||
device.LoseForTesting();
|
||||
}
|
||||
|
||||
// Test that WGPUCreatePipelineAsyncStatus_DeviceLost can be correctly returned when device is lost
|
||||
// before the callback of Create*PipelineAsync() is called.
|
||||
TEST_P(DeviceLostTest, DeviceLostBeforeCreatePipelineAsyncCallback) {
|
||||
wgpu::ShaderModule csModule = utils::CreateShaderModule(device, R"(
|
||||
[[stage(compute)]] fn main() {
|
||||
})");
|
||||
|
||||
wgpu::ComputePipelineDescriptor descriptor;
|
||||
descriptor.computeStage.module = csModule;
|
||||
descriptor.computeStage.entryPoint = "main";
|
||||
|
||||
auto callback = [](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
||||
const char* message, void* userdata) {
|
||||
EXPECT_EQ(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_DeviceLost, status);
|
||||
};
|
||||
|
||||
device.CreateComputePipelineAsync(&descriptor, callback, nullptr);
|
||||
SetCallbackAndLoseForTesting();
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(DeviceLostTest,
|
||||
D3D12Backend(),
|
||||
MetalBackend(),
|
||||
|
||||
Reference in New Issue
Block a user