Re: [4/4] wined3d: Trigger frontbuffer update in surface_cpu_blt.
On 16 June 2017 at 16:03, Sebastian Lackner <sebastian(a)fds-team.de> wrote:
In this case I'm not sure about the best way to fix it. Feel free to use a different approach if preferred (for example calling swapchain_frontbuffer_updated from context_unmap_bo_address).
Explicitly calling from surface_cpu_blt() is probably the right way to go.
@@ -3343,6 +3343,9 @@ release: context_unmap_bo_address(context, &dst_data, GL_PIXEL_UNPACK_BUFFER); if (!same_sub_resource) context_unmap_bo_address(context, &src_data, GL_PIXEL_UNPACK_BUFFER); + + swapchain_frontbuffer_updated(dst_texture, dst_sub_resource_idx, dst_box); Strictly speaking this is only necessary on success, but doing it unconditionally shouldn't hurt.
@@ -1979,6 +1979,22 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour return WINED3D_OK; }
+void swapchain_frontbuffer_updated(struct wined3d_texture *texture, unsigned int sub_resource_idx, + const struct wined3d_box *box) +{ + struct wined3d_texture_sub_resource *sub_resource; + + if (!texture->swapchain || texture->swapchain->front_buffer != texture) + return; + if (!(sub_resource = wined3d_texture_get_sub_resource(texture, sub_resource_idx))) + return; The sub-resource index should always be valid here. We validate it on entry into wined3d, and internally we should always pass valid indices.
+ if (sub_resource->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_TEXTURE_RGB)) + return; Perhaps more importantly, this check should be unnecessary for surface_cpu_blt(), since we always invalidate ~map_binding.
+ if (box) SetRect(&texture->swapchain->front_buffer_update, box->left, box->top, box->right, box->bottom); And with this line effectively being only used for surface_cpu_blt(), I'm not sure the swapchain_frontbuffer_updated() helper is really worth it.
participants (1)
-
Henri Verbeet