There is room for future work, but nothing that needs to be in this patchset IMHO:
1) Check how multiple ForceUpdate / Clear calls influence the returned list of rectangles
2) Check which d3drmdevice interface is passed to the update callbacks
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5161#note_62911
Stefan Dösinger (@stefan) commented about dlls/d3drm/tests/d3drm.c:
> + DWORD clip_list_size;
> + RGNDATA *clip_list;
> + HWND window;
> + HRESULT hr;
> +
> + window = create_window();
> +
> + /* Set up device */
> + hr = DirectDrawCreateClipper(0, &clipper, NULL);
> + ok(hr == DD_OK, "Cannot get IDirectDrawClipper interface, hr %#lx.\n", hr);
> + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window);
> + ok(hr == DD_OK, "Cannot set HWnd to Clipper, hr %#lx.\n", hr);
> + hr = Direct3DRMCreate(&d3drm1);
> + ok(SUCCEEDED(hr), "Cannot create IDirect3DRM instance, hr %#lx.\n", hr);
> + hr = IDirect3DRM_CreateDeviceFromClipper(d3drm1, clipper, &driver, dev_width, dev_height, &device1);
> + ok(hr == D3DRM_OK, "Cannot create IDirect3DRMDevice interface, hr %#lx.\n", hr);
This is more a curiosity rather than something that needs to be addressed in this patch: Dies CreateDeviceFromClipper fail if the clipper has no window (but instead a cliplist or simply nothing)?
I would expect it to fail, but otoh SetCooperativeLevel on a NULL HWND works in DDSCL_NORMAL I think.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5161#note_62909
Stefan Dösinger (@stefan) commented about dlls/d3drm/tests/d3drm.c:
>
> IDirect3DRM_Release(d3drm1);
> }
> +
> +struct update_rect_context
> +{
> + int rect_count;
> + D3DRECT rect;
> +};
> +
> +static void CDECL update_cb_modify_rect(IDirect3DRMDevice *device, void *arg, int rect_count, D3DRECT *update_rects)
> +{
> + if (rect_count > 0)
> + update_rects[0].x1 = 999999;
> +}
> +static void CDECL update_cb_get_rect(IDirect3DRMDevice *device, void *arg, int rect_count, D3DRECT *update_rects)
Suggestion: Check if *device is indeed the IDirect3DRMDevice (QI IID_IDirect3DRMDevice from it and compare pointers). We have cases in plain ddraw where callbacks and getters return the interface passed in instead of what the header says and applications depend on it.
IOW, if you register the callback with IDirect3DRMDevice3::AddUpdateCallback you may or may not get an IDirect3DRMDevice3 * here.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5161#note_62908
Stefan Dösinger (@stefan) commented about dlls/d3drm/device.c:
> }
>
> object->primary_surface = primary_surface;
> - object->clipper = clipper;
> - IDirectDrawClipper_AddRef(clipper);
I am wondering if this breaks the tests (test_create_device_from_clipper1 checks the refcount), but the IDirectDrawSurface::SetClipper holds a reference itself. So we're probably fine with not holding a ref ourselves, especially if we don't use the clipper object anywhere.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/5161#note_62907
This applies on top of !662, the last four commits belong here.
Here we compute a topological order (plus some additional properties) of the shader blocks. Eventually the blocks will be emitted precisely in this order, after having been enriched with structured control flow information.
--
v4: vkd3d-shader/ir: Keep loops contiguous in the topological sort.
vkd3d-shader/ir: Dump the topological order of the control flow graph.
vkd3d-shader/ir: Topologically sort the control flow graph.
vkd3d-shader/ir: Allow adding to a block list without checking for duplicates.
https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/672