dawn-cmake/src/dawn/utils/WireHelper.h
Austin Eng 81b97656bc Update Dawn tests and fuzzers to create adapters/devices on the wire
Previously, the device/adapter were all created on the service-side
of a test, and then injected into the client side. Injected devices
and adapters do not support querying limits and features.

This CL changes setup so that adapter and device creation is always
initiated by the client - and the implementation on the service side
may be overridden for test fixture-specific behavior.

It also adds more fuzzing coverage since the fuzzers can now also
create adapters and devices.

Bug: dawn:689
Change-Id: Ief7faa1908ceae973dcb2f600bf4dd1cf5417704
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/91680
Reviewed-by: Loko Kung <lokokung@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
2022-05-28 01:31:07 +00:00

49 lines
1.5 KiB
C++

// Copyright 2021 The Dawn Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SRC_DAWN_UTILS_WIREHELPER_H_
#define SRC_DAWN_UTILS_WIREHELPER_H_
#include <cstdint>
#include <memory>
#include <utility>
#include "dawn/webgpu_cpp.h"
namespace utils {
class WireHelper {
public:
virtual ~WireHelper();
// Registers the instance on the wire, if present.
// Returns the wgpu::Instance which is the client instance on the wire, and
// the backend instance without the wire.
// The function should not take ownership of |backendInstance|.
virtual wgpu::Instance RegisterInstance(WGPUInstance backendInstance) = 0;
virtual void BeginWireTrace(const char* name) = 0;
virtual bool FlushClient() = 0;
virtual bool FlushServer() = 0;
};
std::unique_ptr<WireHelper> CreateWireHelper(const DawnProcTable& procs,
bool useWire,
const char* wireTraceDir = nullptr);
} // namespace utils
#endif // SRC_DAWN_UTILS_WIREHELPER_H_