On 23/11/2018 17:36, Henri Verbeet wrote:
On Tue, 20 Nov 2018 at 23:01, Axel Davy davyaxel0@gmail.com wrote:
On 20/11/2018 20:05, Henri Verbeet wrote:
Not directly, but I think we'd consider exposing an interface that's conceptually similar to Present. (I.e., "replace the contents of this window with the contents of this native drawable"), at least to internal DLLs like d3d9. The d3d9 dll could then pass a callback to Nine using that internal function to actually get things to the screen. There would be some details to work out, but I think that's an approach that may be worth exploring.
Of course I'd also still prefer Nine to be used as a wined3d backend instead of as a replacement for d3d9, but that's a mostly orthogonal issue.
How low-level would you see that interface similar to present ?
What I had in mind would be something similar to the following:
__wine_present_native_drawable(HWND window, ULONG_PTR drawable, unsigned int flags, const RECT *src, const POINT *dst, UINT64 msc, UINT64 divisor, UINT64 remainder);
Do you have a similar platform API (Mac ?) you would like to cover with this interface ?
I think passing the native drawable directly is not a good idea (because it requires to set up a callback system to get the updated status of that drawable).
Thus I would suggest an interface in the spirit of:
__wine_present_native_drawable(HWND window, wine_present_drawable *wine_drawable, unsigned int flags, const RECT *src, const POINT *dst, UINT64 msc, UINT64 divisor, UINT64 remainder);
wine_present_drawable * __wine_present_make_wine_drawable(ULONG_PTR drawable)
__wine_present_process_events(bool block_if_no_event); // basically a flush + process events
/* Those wouldn't process events, only check states */ __wine_present_is_drawable_released(wine_present_drawable *wine_drawable); __wine_present_is_drawable_presented(wine_present_drawable *wine_drawable); __wine_present_drawable_get_last_presented_msc(wine_present_drawable *wine_drawable); __wine_present_release_drawable(wine_present_drawable *wine_drawable);
and have then multithread safe ie multiple threads can call the functions without blocking. For example I can have a thread waiting with __wine_present_process_events(true), while another thread does __wine_present_native_drawable.
Would that work out ?
Axel