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:
parent
a48ba981ea
commit
087deedbc8
23
dawn.json
23
dawn.json
|
@ -1124,16 +1124,6 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "create swap chain",
|
"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",
|
"returns": "swap chain",
|
||||||
"args": [
|
"args": [
|
||||||
{"name": "surface", "type": "surface"},
|
{"name": "surface", "type": "surface"},
|
||||||
|
@ -2599,16 +2589,6 @@
|
||||||
"swap chain": {
|
"swap chain": {
|
||||||
"category": "object",
|
"category": "object",
|
||||||
"methods": [
|
"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": "get current texture view", "returns": "texture view"},
|
||||||
{"name": "present"}
|
{"name": "present"}
|
||||||
]
|
]
|
||||||
|
@ -2622,8 +2602,7 @@
|
||||||
{"name": "format", "type": "texture format"},
|
{"name": "format", "type": "texture format"},
|
||||||
{"name": "width", "type": "uint32_t"},
|
{"name": "width", "type": "uint32_t"},
|
||||||
{"name": "height", "type": "uint32_t"},
|
{"name": "height", "type": "uint32_t"},
|
||||||
{"name": "present mode", "type": "present mode"},
|
{"name": "present mode", "type": "present mode"}
|
||||||
{"name": "implementation", "type": "uint64_t", "default": 0, "tags": ["deprecated"]}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"s type": {
|
"s type": {
|
||||||
|
|
|
@ -48,18 +48,8 @@ class DevNull : public dawn::wire::CommandSerializer {
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<dawn::native::Instance> sInstance;
|
std::unique_ptr<dawn::native::Instance> sInstance;
|
||||||
WGPUProcDeviceCreateSwapChain sOriginalDeviceCreateSwapChain = nullptr;
|
|
||||||
static bool (*sAdapterSupported)(const dawn::native::Adapter&) = 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
|
} // namespace
|
||||||
|
|
||||||
int DawnWireServerFuzzer::Initialize(int* argc, char*** argv) {
|
int DawnWireServerFuzzer::Initialize(int* argc, char*** argv) {
|
||||||
|
@ -99,13 +89,6 @@ int DawnWireServerFuzzer::Run(const uint8_t* data,
|
||||||
|
|
||||||
DawnProcTable procs = dawn::native::GetProcs();
|
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.
|
// Override requestAdapter to find an adapter that the fuzzer supports.
|
||||||
procs.instanceRequestAdapter = [](WGPUInstance cInstance,
|
procs.instanceRequestAdapter = [](WGPUInstance cInstance,
|
||||||
const WGPURequestAdapterOptions* options,
|
const WGPURequestAdapterOptions* options,
|
||||||
|
|
|
@ -41,10 +41,6 @@ class ErrorSwapChain final : public SwapChainBase {
|
||||||
MaybeError ValidateSwapChainDescriptor(const DeviceBase* device,
|
MaybeError ValidateSwapChainDescriptor(const DeviceBase* device,
|
||||||
const Surface* surface,
|
const Surface* surface,
|
||||||
const SwapChainDescriptor* descriptor) {
|
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_INVALID_IF(surface->IsError(), "[Surface] is invalid.");
|
||||||
|
|
||||||
DAWN_TRY(ValidatePresentMode(descriptor->presentMode));
|
DAWN_TRY(ValidatePresentMode(descriptor->presentMode));
|
||||||
|
|
|
@ -179,7 +179,6 @@ wgpu::Device CreateCppDawnDevice() {
|
||||||
swapChainDesc.width = kWidth;
|
swapChainDesc.width = kWidth;
|
||||||
swapChainDesc.height = kHeight;
|
swapChainDesc.height = kHeight;
|
||||||
swapChainDesc.presentMode = WGPUPresentMode_Mailbox;
|
swapChainDesc.presentMode = WGPUPresentMode_Mailbox;
|
||||||
swapChainDesc.implementation = 0;
|
|
||||||
WGPUSwapChain backendSwapChain =
|
WGPUSwapChain backendSwapChain =
|
||||||
backendProcs.deviceCreateSwapChain(backendDevice, surface, &swapChainDesc);
|
backendProcs.deviceCreateSwapChain(backendDevice, surface, &swapChainDesc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue