On 1/11/21 6:04 PM, Henri Verbeet wrote:
-static void release_resource_readback(struct resource_readback *rb) +static void get_surface_readback(IDXGISurface *surface, struct resource_readback *rb, BOOL d3d11) {
- ID3D10Texture2D_Unmap((ID3D10Texture2D *)rb->resource, 0);
- ID3D10Resource_Release(rb->resource);
- if (d3d11) get_d3d11_surface_readback(surface, rb);
- else get_d3d10_surface_readback(surface, rb);
+}
Passing the "d3d11" variable around everywhere is a little ugly. I think we can simply QueryInterface() for the ID3D11Resource and ID3D10Resource interfaces here and use the one that succeeds, without necessarily caring about how the device was created. However, if we were to pass something around here, it should probably be a d2d1_test_context structure.
I didn't really investigate but I had an issue while writing the first version of the patches, where on Windows you can query the D3D10 interface but if it's used to read the surface nothing is read. Probably because of the D3D10 / D3D11 context state swap mechanism that disables the other interface methods while still allowing to be called.
In the new version I just used the test context d3d11 flag to dispatch to the relevant interface version, as it was less rewrite to just pass it there.