dawn.json: remove leftovers from implementation-based swapchains.

This also removes the need for special casing the swapchain creation
proc in the fuzzers because it is no longer possible to have a valid
CreateSwapChain call since the wire can't create a surface (which is no
longer optional).

Bug: dawn:269
Change-Id: Icc6ed5e82c1d5382628d71d212640d238cfba348
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126425
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
This commit is contained in:
Corentin Wallez 2023-04-07 14:59:55 +00:00 committed by Dawn LUCI CQ
parent a48ba981ea
commit 087deedbc8
4 changed files with 1 additions and 44 deletions

View File

@ -1124,16 +1124,6 @@
},
{
"name": "create swap chain",
"tags": ["dawn"],
"returns": "swap chain",
"args": [
{"name": "surface", "type": "surface", "optional": true},
{"name": "descriptor", "type": "swap chain descriptor", "annotation": "const*"}
]
},
{
"name": "create swap chain",
"tags": ["upstream", "emscripten"],
"returns": "swap chain",
"args": [
{"name": "surface", "type": "surface"},
@ -2599,16 +2589,6 @@
"swap chain": {
"category": "object",
"methods": [
{
"name": "configure",
"tags": ["dawn"],
"args": [
{"name": "format", "type": "texture format"},
{"name": "allowed usage", "type": "texture usage"},
{"name": "width", "type": "uint32_t"},
{"name": "height", "type": "uint32_t"}
]
},
{"name": "get current texture view", "returns": "texture view"},
{"name": "present"}
]
@ -2622,8 +2602,7 @@
{"name": "format", "type": "texture format"},
{"name": "width", "type": "uint32_t"},
{"name": "height", "type": "uint32_t"},
{"name": "present mode", "type": "present mode"},
{"name": "implementation", "type": "uint64_t", "default": 0, "tags": ["deprecated"]}
{"name": "present mode", "type": "present mode"}
]
},
"s type": {

View File

@ -48,18 +48,8 @@ class DevNull : public dawn::wire::CommandSerializer {
};
std::unique_ptr<dawn::native::Instance> sInstance;
WGPUProcDeviceCreateSwapChain sOriginalDeviceCreateSwapChain = nullptr;
static bool (*sAdapterSupported)(const dawn::native::Adapter&) = nullptr;
WGPUSwapChain ErrorDeviceCreateSwapChain(WGPUDevice device,
WGPUSurface surface,
const WGPUSwapChainDescriptor*) {
WGPUSwapChainDescriptor desc = {};
// A 0 implementation will trigger a swapchain creation error.
desc.implementation = 0;
return sOriginalDeviceCreateSwapChain(device, surface, &desc);
}
} // namespace
int DawnWireServerFuzzer::Initialize(int* argc, char*** argv) {
@ -99,13 +89,6 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
DawnProcTable procs = dawn::native::GetProcs();
// Swapchains receive a pointer to an implementation. The fuzzer will pass garbage in so we
// intercept calls to create swapchains and make sure they always return error swapchains.
// This is ok for fuzzing because embedders of dawn_wire would always define their own
// swapchain handling.
sOriginalDeviceCreateSwapChain = procs.deviceCreateSwapChain;
procs.deviceCreateSwapChain = ErrorDeviceCreateSwapChain;
// Override requestAdapter to find an adapter that the fuzzer supports.
procs.instanceRequestAdapter = [](WGPUInstance cInstance,
const WGPURequestAdapterOptions* options,

View File

@ -41,10 +41,6 @@ class ErrorSwapChain final : public SwapChainBase {
MaybeError ValidateSwapChainDescriptor(const DeviceBase* device,
const Surface* surface,
const SwapChainDescriptor* descriptor) {
DAWN_INVALID_IF(descriptor->implementation != 0,
"Implementation-based swapchains are no longer supported.");
DAWN_INVALID_IF(surface == nullptr, "At least one of surface or implementation must be set");
DAWN_INVALID_IF(surface->IsError(), "[Surface] is invalid.");
DAWN_TRY(ValidatePresentMode(descriptor->presentMode));

View File

@ -179,7 +179,6 @@ wgpu::Device CreateCppDawnDevice() {
swapChainDesc.width = kWidth;
swapChainDesc.height = kHeight;
swapChainDesc.presentMode = WGPUPresentMode_Mailbox;
swapChainDesc.implementation = 0;
WGPUSwapChain backendSwapChain =
backendProcs.deviceCreateSwapChain(backendDevice, surface, &swapChainDesc);