Remove marking of CreatePipelineAsync as unsafe.

We are going to send another PSA about new APIs in Dawn/Chromium and
want developers to be able to use CreatePipelineAsync. The
implementation is safe, it just doesn't offload the work to a different
thread yet.

Bug: dawn:529
Change-Id: Ia093e46f8c3d389fd42eb5c1ad6b94ab8e64957b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/46448
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2021-04-01 21:52:13 +00:00 committed by Commit Bot service account
parent 0e92e9bf3c
commit 61fbb28547
2 changed files with 0 additions and 65 deletions

View File

@ -805,14 +805,6 @@ namespace dawn_native {
void DeviceBase::APICreateComputePipelineAsync(const ComputePipelineDescriptor* descriptor,
WGPUCreateComputePipelineAsyncCallback callback,
void* userdata) {
if (IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) {
callback(WGPUCreatePipelineAsyncStatus_Error, nullptr,
"CreateComputePipelineAsync is disallowed because it isn't completely "
"implemented yet.",
userdata);
return;
}
ResultOrError<Ref<ComputePipelineBase>> maybeResult =
CreateComputePipelineInternal(descriptor);
if (maybeResult.IsError()) {
@ -852,14 +844,6 @@ namespace dawn_native {
void DeviceBase::APICreateRenderPipelineAsync(const RenderPipelineDescriptor2* descriptor,
WGPUCreateRenderPipelineAsyncCallback callback,
void* userdata) {
if (IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) {
callback(WGPUCreatePipelineAsyncStatus_Error, nullptr,
"CreateRenderPipelineAsync is disallowed because it isn't completely "
"implemented yet.",
userdata);
return;
}
ResultOrError<Ref<RenderPipelineBase>> maybeResult =
CreateRenderPipelineInternal(descriptor);
if (maybeResult.IsError()) {

View File

@ -212,52 +212,3 @@ TEST_F(UnsafeAPIValidationTest, OcclusionQueryDisallowed) {
ASSERT_DEVICE_ERROR(encoder.Finish());
}
}
// Check that CreateComputePipelineAsync is disallowed as part of unsafe APIs
TEST_F(UnsafeAPIValidationTest, CreateComputePipelineAsyncDisallowed) {
wgpu::ComputePipelineDescriptor desc;
desc.computeStage.module = utils::CreateShaderModule(device, R"(
[[stage(compute)]] fn main() -> void {
})");
desc.computeStage.entryPoint = "main";
// Control case: CreateComputePipeline is allowed.
device.CreateComputePipeline(&desc);
testing::MockCallback<WGPUCreateComputePipelineAsyncCallback> callback;
EXPECT_CALL(callback,
Call(WGPUCreatePipelineAsyncStatus_Error, nullptr, testing::NotNull(), this));
// Error case: CreateComputePipelineAsync is disallowed.
device.CreateComputePipelineAsync(&desc, callback.Callback(), callback.MakeUserdata(this));
WaitForAllOperations(device);
}
// Check that CreateRenderPipelineAsync is disallowed as part of unsafe APIs
TEST_F(UnsafeAPIValidationTest, CreateRenderPipelineAsyncDisallowed) {
utils::ComboRenderPipelineDescriptor2 desc;
desc.vertex.module = utils::CreateShaderModule(device, R"(
[[builtin(position)]] var<out> Position : vec4<f32>;
[[stage(vertex)]] fn main() -> void {
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
})");
desc.cFragment.module = utils::CreateShaderModule(device, R"(
[[location(0)]] var<out> o_color : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
o_color = vec4<f32>(0.0, 1.0, 0.0, 1.0);
})");
desc.cTargets[0].format = wgpu::TextureFormat::RGBA8Unorm;
// Control case: CreateRenderPipeline is allowed.
device.CreateRenderPipeline2(&desc);
// TODO(bajones): Enable this when the deprecation warning is re-enabled in Device.cpp.
// EXPECT_DEPRECATION_WARNING(device.CreateRenderPipeline(&desc));
testing::MockCallback<WGPUCreateRenderPipelineAsyncCallback> callback;
EXPECT_CALL(callback,
Call(WGPUCreatePipelineAsyncStatus_Error, nullptr, testing::NotNull(), this));
// Error case: CreateRenderPipelineAsync is disallowed.
device.CreateRenderPipelineAsync(&desc, callback.Callback(), callback.MakeUserdata(this));
WaitForAllOperations(device);
}