Mark Create*PipelineAsync as unsafe because it is WIP
Bug: dawn:529 Change-Id: I31c8571d327d1d2b198357eb365706bc8097b12a Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41721 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
2d3c2e3553
commit
423e3f6896
|
@ -709,6 +709,14 @@ namespace dawn_native {
|
||||||
WGPUCreateComputePipelineAsyncCallback callback,
|
WGPUCreateComputePipelineAsyncCallback callback,
|
||||||
void* userdata) {
|
void* userdata) {
|
||||||
ComputePipelineBase* result = nullptr;
|
ComputePipelineBase* result = nullptr;
|
||||||
|
|
||||||
|
if (IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) {
|
||||||
|
ConsumedError(
|
||||||
|
DAWN_VALIDATION_ERROR("CreateComputePipelineAsync is disallowed because it isn't "
|
||||||
|
"completely implemented yet."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MaybeError maybeError = CreateComputePipelineInternal(&result, descriptor);
|
MaybeError maybeError = CreateComputePipelineInternal(&result, descriptor);
|
||||||
if (maybeError.IsError()) {
|
if (maybeError.IsError()) {
|
||||||
std::unique_ptr<ErrorData> error = maybeError.AcquireError();
|
std::unique_ptr<ErrorData> error = maybeError.AcquireError();
|
||||||
|
@ -753,6 +761,14 @@ namespace dawn_native {
|
||||||
WGPUCreateRenderPipelineAsyncCallback callback,
|
WGPUCreateRenderPipelineAsyncCallback callback,
|
||||||
void* userdata) {
|
void* userdata) {
|
||||||
RenderPipelineBase* result = nullptr;
|
RenderPipelineBase* result = nullptr;
|
||||||
|
|
||||||
|
if (IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) {
|
||||||
|
ConsumedError(
|
||||||
|
DAWN_VALIDATION_ERROR("CreateRenderPipelineAsync is disallowed because it isn't "
|
||||||
|
"completely implemented yet."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MaybeError maybeError = CreateRenderPipelineInternal(&result, descriptor);
|
MaybeError maybeError = CreateRenderPipelineInternal(&result, descriptor);
|
||||||
if (maybeError.IsError()) {
|
if (maybeError.IsError()) {
|
||||||
std::unique_ptr<ErrorData> error = maybeError.AcquireError();
|
std::unique_ptr<ErrorData> error = maybeError.AcquireError();
|
||||||
|
|
|
@ -211,3 +211,54 @@ TEST_F(UnsafeAPIValidationTest, OcclusionQueryDisallowed) {
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
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::CreateShaderModuleFromWGSL(device, R"(
|
||||||
|
[[stage(compute)]] fn main() -> void {
|
||||||
|
})");
|
||||||
|
desc.computeStage.entryPoint = "main";
|
||||||
|
|
||||||
|
// Control case: CreateComputePipeline is allowed.
|
||||||
|
device.CreateComputePipeline(&desc);
|
||||||
|
|
||||||
|
// Error case: CreateComputePipelineAsync is disallowed.
|
||||||
|
ASSERT_DEVICE_ERROR(device.CreateComputePipelineAsync(
|
||||||
|
&desc,
|
||||||
|
[](WGPUCreatePipelineAsyncStatus status, WGPUComputePipeline returnPipeline,
|
||||||
|
const char* message, void* userdata) {
|
||||||
|
// Status can be Error or Unkown (when using the wire).
|
||||||
|
EXPECT_NE(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Success, status);
|
||||||
|
},
|
||||||
|
nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that CreateRenderPipelineAsync is disallowed as part of unsafe APIs
|
||||||
|
TEST_F(UnsafeAPIValidationTest, CreateRenderPipelineAsyncDisallowed) {
|
||||||
|
utils::ComboRenderPipelineDescriptor desc(device);
|
||||||
|
desc.vertexStage.module = utils::CreateShaderModuleFromWGSL(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.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(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.cColorStates[0].format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
|
// Control case: CreateRenderPipeline is allowed.
|
||||||
|
device.CreateRenderPipeline(&desc);
|
||||||
|
|
||||||
|
// Error case: CreateRenderPipelineAsync is disallowed.
|
||||||
|
ASSERT_DEVICE_ERROR(device.CreateRenderPipelineAsync(
|
||||||
|
&desc,
|
||||||
|
[](WGPUCreatePipelineAsyncStatus status, WGPURenderPipeline returnPipeline,
|
||||||
|
const char* message, void* userdata) {
|
||||||
|
// Status can be Error or Unkown (when using the wire).
|
||||||
|
EXPECT_NE(WGPUCreatePipelineAsyncStatus::WGPUCreatePipelineAsyncStatus_Success, status);
|
||||||
|
},
|
||||||
|
nullptr));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue