Skip to content

Commit

Permalink
fix(cloud-picture): initWebGPUCPJobEntity should set window
Browse files Browse the repository at this point in the history
  • Loading branch information
yyc-git committed Sep 14, 2020
1 parent 8e11d5a commit 1130503
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let load = window => {
)
->map(
swapChainFormat => {
(adapter, device, context, queue, swapChainFormat)
(window, adapter, device, context, queue, swapChainFormat)
},
_,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ let exec = () => {
})
->WebGPUCoreRunAPI.load
->WonderBsMost.Most.map(
((adapter, device, context, queue, swapChainFormat)) => {
((window, adapter, device, context, queue, swapChainFormat)) => {
let swapChain =
WebGPUCoreDpRunAPI.unsafeGet().context.configureSwapChain(
{"device": device, "format": swapChainFormat},
context,
);

WebGPUCPRepo.setWindow(window);
WebGPUCPRepo.setDevice(device);
WebGPUCPRepo.setAdapter(adapter);
WebGPUCPRepo.setContext(context);
Expand Down
22 changes: 22 additions & 0 deletions test/run/cloud_picture/integration/initWebGPUCPJob_test.re
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,28 @@ let _ =
(),
);
});
testPromise("set window", () => {
let (
(width, height),
(window, adapter, device, swapChainFormat, swapChain, queue, context),
(
make,
requestAdapter,
requestDeviceStubData,
getSwapChainPreferredFormatStubData,
configureSwapChainStubData,
getContext,
getQueue,
),
) =
_prepare(sandbox);

DirectorCPTool.init(
~handleSuccessFunc=
() => {WebGPUCPTool.getWindow()->OptionSt.getExn->expect == window},
(),
);
});
testPromise(
"set device, adapter, context, queue, swapChainFormat, swapChain", () => {
let (
Expand Down

0 comments on commit 1130503

Please sign in to comment.