wined3d: Don't force going through a texture when downloading from renderbuffers.

It can be unnecessary at best and unsupported at worst (e.g. no
ARB_texture_multisample or MultisampleTextures setting disabled).
This commit is contained in:
Matteo Bruni 2022-01-17 15:00:04 +01:00 committed by Alexandre Julliard
parent 0b5bd25415
commit 510e262676
2 changed files with 11 additions and 10 deletions

View file

@ -359,6 +359,9 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i
uint8_t *offset;
unsigned int i;
TRACE("texture %p, sub_resource_idx %u, context %p, src_location %s, dst_location %s.\n",
texture, sub_resource_idx, context, wined3d_debug_location(src_location), wined3d_debug_location(dst_location));
/* dst_location was already prepared by the caller. */
wined3d_texture_get_bo_address(texture, sub_resource_idx, &data, dst_location);
offset = data.addr;
@ -382,10 +385,9 @@ void texture2d_read_from_framebuffer(struct wined3d_texture *texture, unsigned i
resource, sub_resource_idx, NULL, 0, src_location);
}
/* Select the correct read buffer, and give some debug output.
* There is no need to keep track of the current read buffer or reset it,
* every part of the code that reads sets the read buffer as desired.
*/
/* Select the correct read buffer, and give some debug output. There is no
* need to keep track of the current read buffer or reset it, every part
* of the code that reads pixels sets the read buffer as desired. */
if (src_location != WINED3D_LOCATION_DRAWABLE || wined3d_resource_is_offscreen(resource))
{
/* Mapping the primary render target which is not on a swapchain.

View file

@ -2974,18 +2974,17 @@ static BOOL wined3d_texture_gl_load_sysmem(struct wined3d_texture_gl *texture_gl
sub_resource = &texture_gl->t.sub_resources[sub_resource_idx];
/* We cannot download data from multisample textures directly. */
if (wined3d_texture_gl_is_multisample_location(texture_gl, WINED3D_LOCATION_TEXTURE_RGB))
{
if (wined3d_texture_gl_is_multisample_location(texture_gl, WINED3D_LOCATION_TEXTURE_RGB)
|| sub_resource->locations & WINED3D_LOCATION_RB_MULTISAMPLE)
wined3d_texture_load_location(&texture_gl->t, sub_resource_idx, &context_gl->c, WINED3D_LOCATION_RB_RESOLVED);
if (sub_resource->locations & WINED3D_LOCATION_RB_RESOLVED)
{
texture2d_read_from_framebuffer(&texture_gl->t, sub_resource_idx, &context_gl->c,
WINED3D_LOCATION_RB_RESOLVED, dst_location);
return TRUE;
}
if (sub_resource->locations & (WINED3D_LOCATION_RB_MULTISAMPLE | WINED3D_LOCATION_RB_RESOLVED))
wined3d_texture_load_location(&texture_gl->t, sub_resource_idx, &context_gl->c, WINED3D_LOCATION_TEXTURE_RGB);
/* Download the sub-resource to system memory. */
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
{
unsigned int row_pitch, slice_pitch, level;