It turns out it was actually dead code. The last remaining caller was the cross-swapchain blit case but surface_blt_special() actually rejected those (or any swapchain to swapchain blit).
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Right now a drawable -> texture CPU blit starts with calling surface_load_sysmem() on the drawable, which is a bit ugly since probably we don't ever want to download the drawable - it's a GPU-only access texture. A staging texture might be a solution.
dlls/wined3d/surface.c | 554 +---------------------------------------- 1 file changed, 4 insertions(+), 550 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 23dc2290480..de77df2ca07 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -876,547 +876,6 @@ void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, context_restore(context, restore_texture, restore_idx); }
-/* Does a direct frame buffer -> texture copy. Stretching is done with single - * pixel copy calls. */ -static void fb_copy_to_texture_direct(struct wined3d_texture_gl *dst_texture, unsigned int dst_sub_resource_idx, - const RECT *dst_rect_in, struct wined3d_texture_gl *src_texture, unsigned int src_sub_resource_idx, - const RECT *src_rect, enum wined3d_texture_filter_type filter) -{ - struct wined3d_device *device = dst_texture->t.resource.device; - unsigned int src_height, src_level, dst_level; - const struct wined3d_gl_info *gl_info; - struct wined3d_context_gl *context_gl; - float xrel, yrel; - struct wined3d_context *context; - BOOL upsidedown = FALSE; - RECT dst_rect = *dst_rect_in; - GLenum dst_target; - - /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag - * glCopyTexSubImage is a bit picky about the parameters we pass to it - */ - if(dst_rect.top > dst_rect.bottom) { - UINT tmp = dst_rect.bottom; - dst_rect.bottom = dst_rect.top; - dst_rect.top = tmp; - upsidedown = TRUE; - } - - context = context_acquire(device, &src_texture->t, src_sub_resource_idx); - context_gl = wined3d_context_gl(context); - gl_info = context_gl->gl_info; - wined3d_context_gl_apply_blit_state(context_gl, device); - wined3d_texture_load(&dst_texture->t, context, FALSE); - - /* Bind the target texture */ - wined3d_context_gl_bind_texture(context_gl, dst_texture->target, dst_texture->texture_rgb.name); - if (wined3d_resource_is_offscreen(&src_texture->t.resource)) - { - TRACE("Reading from an offscreen target\n"); - upsidedown = !upsidedown; - gl_info->gl_ops.gl.p_glReadBuffer(wined3d_context_gl_get_offscreen_gl_buffer(context_gl)); - } - else - { - gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(&src_texture->t)); - } - checkGLcall("glReadBuffer"); - - xrel = (float) (src_rect->right - src_rect->left) / (float) (dst_rect.right - dst_rect.left); - yrel = (float) (src_rect->bottom - src_rect->top) / (float) (dst_rect.bottom - dst_rect.top); - - if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) - { - FIXME_(d3d_perf)("Doing a pixel by pixel copy from the framebuffer to a texture.\n"); - - if (filter != WINED3D_TEXF_NONE && filter != WINED3D_TEXF_POINT) - ERR("Texture filtering not supported in direct blit.\n"); - } - else if ((filter != WINED3D_TEXF_NONE && filter != WINED3D_TEXF_POINT) - && ((yrel - 1.0f < -eps) || (yrel - 1.0f > eps))) - { - ERR("Texture filtering not supported in direct blit\n"); - } - - src_level = src_sub_resource_idx % src_texture->t.level_count; - dst_level = dst_sub_resource_idx % dst_texture->t.level_count; - - src_height = wined3d_texture_get_level_height(&src_texture->t, src_level); - dst_target = wined3d_texture_gl_get_sub_resource_target(dst_texture, dst_sub_resource_idx); - if (upsidedown - && !((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) - && !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps))) - { - /* Upside down copy without stretching is nice, one glCopyTexSubImage call will do. */ - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_level, - dst_rect.left /*xoffset */, dst_rect.top /* y offset */, - src_rect->left, src_height - src_rect->bottom, - dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top); - } - else - { - LONG row; - UINT yoffset = src_height - src_rect->top + dst_rect.top - 1; - /* I have to process this row by row to swap the image, - * otherwise it would be upside down, so stretching in y direction - * doesn't cost extra time - * - * However, stretching in x direction can be avoided if not necessary - */ - for(row = dst_rect.top; row < dst_rect.bottom; row++) { - if ((xrel - 1.0f < -eps) || (xrel - 1.0f > eps)) - { - /* Well, that stuff works, but it's very slow. - * find a better way instead - */ - LONG col; - - for (col = dst_rect.left; col < dst_rect.right; ++col) - { - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_level, - dst_rect.left + col /* x offset */, row /* y offset */, - src_rect->left + col * xrel, yoffset - (int) (row * yrel), 1, 1); - } - } - else - { - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(dst_target, dst_level, - dst_rect.left /* x offset */, row /* y offset */, - src_rect->left, yoffset - (int) (row * yrel), dst_rect.right - dst_rect.left, 1); - } - } - } - checkGLcall("glCopyTexSubImage2D"); - - context_release(context); - - /* The texture is now most up to date - If the surface is a render target - * and has a drawable, this path is never entered. */ - wined3d_texture_validate_location(&dst_texture->t, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); - wined3d_texture_invalidate_location(&dst_texture->t, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); -} - -/* Uses the hardware to stretch and flip the image */ -static void fb_copy_to_texture_hwstretch(struct wined3d_texture_gl *dst_texture, unsigned int dst_sub_resource_idx, - const RECT *dst_rect_in, struct wined3d_texture_gl *src_texture, unsigned int src_sub_resource_idx, - const RECT *src_rect, enum wined3d_texture_filter_type filter) -{ - unsigned int src_width, src_height, src_pow2_width, src_pow2_height, src_level; - struct wined3d_device *device = dst_texture->t.resource.device; - GLenum src_target, dst_target, texture_target; - GLuint src, backup = 0; - float left, right, top, bottom; /* Texture coordinates */ - const struct wined3d_gl_info *gl_info; - struct wined3d_context_gl *context_gl; - struct wined3d_context *context; - GLenum drawBuffer = GL_BACK; - GLenum offscreen_buffer; - BOOL noBackBufferBackup; - BOOL src_offscreen; - BOOL upsidedown = FALSE; - RECT dst_rect = *dst_rect_in; - - TRACE("Using hwstretch blit\n"); - - src_target = wined3d_texture_gl_get_sub_resource_target(src_texture, src_sub_resource_idx); - dst_target = wined3d_texture_gl_get_sub_resource_target(dst_texture, dst_sub_resource_idx); - - /* Activate the Proper context for reading from the source surface, set it up for blitting */ - context = context_acquire(device, &src_texture->t, src_sub_resource_idx); - context_gl = wined3d_context_gl(context); - gl_info = context_gl->gl_info; - wined3d_context_gl_apply_ffp_blit_state(context_gl, device); - wined3d_texture_load(&dst_texture->t, context, FALSE); - - offscreen_buffer = wined3d_context_gl_get_offscreen_gl_buffer(context_gl); - src_level = src_sub_resource_idx % src_texture->t.level_count; - src_width = wined3d_texture_get_level_width(&src_texture->t, src_level); - src_height = wined3d_texture_get_level_height(&src_texture->t, src_level); - src_pow2_width = wined3d_texture_get_level_pow2_width(&src_texture->t, src_level); - src_pow2_height = wined3d_texture_get_level_pow2_height(&src_texture->t, src_level); - - src_offscreen = wined3d_resource_is_offscreen(&src_texture->t.resource); - noBackBufferBackup = src_offscreen && wined3d_settings.offscreen_rendering_mode == ORM_FBO; - if (!noBackBufferBackup && !src_texture->texture_rgb.name) - { - /* Get it a description */ - wined3d_texture_load(&src_texture->t, context, FALSE); - } - - /* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring. - * This way we don't have to wait for the 2nd readback to finish to leave this function. - */ - if (context_gl->aux_buffers >= 2) - { - /* Got more than one aux buffer? Use the 2nd aux buffer */ - drawBuffer = GL_AUX1; - } - else if ((!src_offscreen || offscreen_buffer == GL_BACK) && context_gl->aux_buffers >= 1) - { - /* Only one aux buffer, but it isn't used (Onscreen rendering, or non-aux orm)? Use it! */ - drawBuffer = GL_AUX0; - } - - if (noBackBufferBackup) - { - gl_info->gl_ops.gl.p_glGenTextures(1, &backup); - checkGLcall("glGenTextures"); - wined3d_context_gl_bind_texture(context_gl, GL_TEXTURE_2D, backup); - texture_target = GL_TEXTURE_2D; - } - else - { - /* Backup the back buffer and copy the source buffer into a texture to draw an upside down stretched quad. If - * we are reading from the back buffer, the backup can be used as source texture - */ - texture_target = src_target; - wined3d_context_gl_bind_texture(context_gl, texture_target, src_texture->texture_rgb.name); - gl_info->gl_ops.gl.p_glEnable(texture_target); - checkGLcall("glEnable(texture_target)"); - - /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ - src_texture->t.sub_resources[src_sub_resource_idx].locations &= ~WINED3D_LOCATION_TEXTURE_RGB; - } - - /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag - * glCopyTexSubImage is a bit picky about the parameters we pass to it - */ - if(dst_rect.top > dst_rect.bottom) { - UINT tmp = dst_rect.bottom; - dst_rect.bottom = dst_rect.top; - dst_rect.top = tmp; - upsidedown = TRUE; - } - - if (src_offscreen) - { - TRACE("Reading from an offscreen target\n"); - upsidedown = !upsidedown; - gl_info->gl_ops.gl.p_glReadBuffer(offscreen_buffer); - } - else - { - gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(&src_texture->t)); - } - - /* TODO: Only back up the part that will be overwritten */ - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(texture_target, 0, 0, 0, 0, 0, src_width, src_height); - - checkGLcall("glCopyTexSubImage2D"); - - /* No issue with overriding these - the sampler is dirty due to blit usage */ - gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_MAG_FILTER, wined3d_gl_mag_filter(filter)); - checkGLcall("glTexParameteri"); - gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_MIN_FILTER, - wined3d_gl_min_mip_filter(filter, WINED3D_TEXF_NONE)); - checkGLcall("glTexParameteri"); - - if (!src_texture->t.swapchain || &src_texture->t == src_texture->t.swapchain->back_buffers[0]) - { - src = backup ? backup : src_texture->texture_rgb.name; - } - else - { - gl_info->gl_ops.gl.p_glReadBuffer(GL_FRONT); - checkGLcall("glReadBuffer(GL_FRONT)"); - - gl_info->gl_ops.gl.p_glGenTextures(1, &src); - checkGLcall("glGenTextures(1, &src)"); - wined3d_context_gl_bind_texture(context_gl, GL_TEXTURE_2D, src); - - /* TODO: Only copy the part that will be read. Use src_rect->left, - * src_rect->bottom as origin, but with the width watch out for power - * of 2 sizes. */ - gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, src_pow2_width, - src_pow2_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - checkGLcall("glTexImage2D"); - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, src_width, src_height); - - gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - checkGLcall("glTexParameteri"); - gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - checkGLcall("glTexParameteri"); - - gl_info->gl_ops.gl.p_glReadBuffer(GL_BACK); - checkGLcall("glReadBuffer(GL_BACK)"); - - if (texture_target != GL_TEXTURE_2D) - { - gl_info->gl_ops.gl.p_glDisable(texture_target); - gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D); - texture_target = GL_TEXTURE_2D; - } - } - checkGLcall("glEnd and previous"); - - left = src_rect->left; - right = src_rect->right; - - if (!upsidedown) - { - top = src_height - src_rect->top; - bottom = src_height - src_rect->bottom; - } - else - { - top = src_height - src_rect->bottom; - bottom = src_height - src_rect->top; - } - - if (src_texture->t.flags & WINED3D_TEXTURE_NORMALIZED_COORDS) - { - left /= src_pow2_width; - right /= src_pow2_width; - top /= src_pow2_height; - bottom /= src_pow2_height; - } - - /* draw the source texture stretched and upside down. The correct surface is bound already */ - gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - gl_info->gl_ops.gl.p_glTexParameteri(texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - wined3d_context_gl_set_draw_buffer(context_gl, drawBuffer); - gl_info->gl_ops.gl.p_glReadBuffer(drawBuffer); - - gl_info->gl_ops.gl.p_glBegin(GL_QUADS); - /* bottom left */ - gl_info->gl_ops.gl.p_glTexCoord2f(left, bottom); - gl_info->gl_ops.gl.p_glVertex2i(0, 0); - - /* top left */ - gl_info->gl_ops.gl.p_glTexCoord2f(left, top); - gl_info->gl_ops.gl.p_glVertex2i(0, dst_rect.bottom - dst_rect.top); - - /* top right */ - gl_info->gl_ops.gl.p_glTexCoord2f(right, top); - gl_info->gl_ops.gl.p_glVertex2i(dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top); - - /* bottom right */ - gl_info->gl_ops.gl.p_glTexCoord2f(right, bottom); - gl_info->gl_ops.gl.p_glVertex2i(dst_rect.right - dst_rect.left, 0); - gl_info->gl_ops.gl.p_glEnd(); - checkGLcall("glEnd and previous"); - - if (texture_target != dst_target) - { - gl_info->gl_ops.gl.p_glDisable(texture_target); - gl_info->gl_ops.gl.p_glEnable(dst_target); - texture_target = dst_target; - } - - /* Now read the stretched and upside down image into the destination texture */ - wined3d_context_gl_bind_texture(context_gl, texture_target, dst_texture->texture_rgb.name); - gl_info->gl_ops.gl.p_glCopyTexSubImage2D(texture_target, - 0, - dst_rect.left, dst_rect.top, /* xoffset, yoffset */ - 0, 0, /* We blitted the image to the origin */ - dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top); - checkGLcall("glCopyTexSubImage2D"); - - if (drawBuffer == GL_BACK) - { - /* Write the back buffer backup back. */ - if (backup) - { - if (texture_target != GL_TEXTURE_2D) - { - gl_info->gl_ops.gl.p_glDisable(texture_target); - gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_2D); - texture_target = GL_TEXTURE_2D; - } - wined3d_context_gl_bind_texture(context_gl, GL_TEXTURE_2D, backup); - } - else - { - if (texture_target != src_target) - { - gl_info->gl_ops.gl.p_glDisable(texture_target); - gl_info->gl_ops.gl.p_glEnable(src_target); - texture_target = src_target; - } - wined3d_context_gl_bind_texture(context_gl, src_target, src_texture->texture_rgb.name); - } - - gl_info->gl_ops.gl.p_glBegin(GL_QUADS); - /* top left */ - gl_info->gl_ops.gl.p_glTexCoord2f(0.0f, 0.0f); - gl_info->gl_ops.gl.p_glVertex2i(0, src_height); - - /* bottom left */ - gl_info->gl_ops.gl.p_glTexCoord2f(0.0f, (float)src_height / (float)src_pow2_height); - gl_info->gl_ops.gl.p_glVertex2i(0, 0); - - /* bottom right */ - gl_info->gl_ops.gl.p_glTexCoord2f((float)src_width / (float)src_pow2_width, - (float)src_height / (float)src_pow2_height); - gl_info->gl_ops.gl.p_glVertex2i(src_width, 0); - - /* top right */ - gl_info->gl_ops.gl.p_glTexCoord2f((float)src_width / (float)src_pow2_width, 0.0f); - gl_info->gl_ops.gl.p_glVertex2i(src_width, src_height); - gl_info->gl_ops.gl.p_glEnd(); - } - gl_info->gl_ops.gl.p_glDisable(texture_target); - checkGLcall("glDisable(texture_target)"); - - /* Cleanup */ - if (src != src_texture->texture_rgb.name && src != backup) - { - gl_info->gl_ops.gl.p_glDeleteTextures(1, &src); - checkGLcall("glDeleteTextures(1, &src)"); - } - if (backup) - { - gl_info->gl_ops.gl.p_glDeleteTextures(1, &backup); - checkGLcall("glDeleteTextures(1, &backup)"); - } - - context_release(context); - - /* The texture is now most up to date - If the surface is a render target - * and has a drawable, this path is never entered. */ - wined3d_texture_validate_location(&dst_texture->t, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB); - wined3d_texture_invalidate_location(&dst_texture->t, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB); -} - -static HRESULT wined3d_texture_blt_special(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx, - const RECT *dst_rect, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx, - const RECT *src_rect, DWORD flags, const struct wined3d_blt_fx *fx, enum wined3d_texture_filter_type filter) -{ - struct wined3d_swapchain *src_swapchain, *dst_swapchain; - const struct wined3d_rendertarget_view *rtv; - - TRACE("dst_texture %p, dst_sub_resource_idx %u, dst_rect %s, src_texture %p, " - "src_sub_resource_idx %u, src_rect %s, flags %#x, fx %p, filter %s.\n", - dst_texture, dst_sub_resource_idx, wine_dbgstr_rect(dst_rect), src_texture, src_sub_resource_idx, - wine_dbgstr_rect(src_rect), flags, fx, debug_d3dtexturefiltertype(filter)); - - if (dst_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D) - { - FIXME("Not implemented for %s resources.\n", debug_d3dresourcetype(dst_texture->resource.type)); - return WINED3DERR_INVALIDCALL; - } - - /* Get the swapchain. One of the surfaces has to be a primary surface. */ - if (!(dst_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)) - { - WARN("Destination resource is not GPU accessible, rejecting GL blit.\n"); - return WINED3DERR_INVALIDCALL; - } - - if (!(src_texture->resource.access & WINED3D_RESOURCE_ACCESS_GPU)) - { - WARN("Source resource is not GPU accessible, rejecting GL blit.\n"); - return WINED3DERR_INVALIDCALL; - } - - src_swapchain = src_texture->swapchain; - dst_swapchain = dst_texture->swapchain; - - /* Early sort out of cases where no render target is used */ - if (!(rtv = dst_texture->resource.device->fb.render_targets[0]) || (!src_swapchain && !dst_swapchain - && (&src_texture->resource != rtv->resource || src_sub_resource_idx != rtv->sub_resource_idx) - && (&dst_texture->resource != rtv->resource || dst_sub_resource_idx != rtv->sub_resource_idx))) - { - TRACE("No surface is render target, not using hardware blit.\n"); - return WINED3DERR_INVALIDCALL; - } - - /* No destination color keying supported */ - if (flags & (WINED3D_BLT_DST_CKEY | WINED3D_BLT_DST_CKEY_OVERRIDE)) - { - /* Can we support that with glBlendFunc if blitting to the frame buffer? */ - TRACE("Destination color key not supported in accelerated Blit, falling back to software\n"); - return WINED3DERR_INVALIDCALL; - } - - if (dst_swapchain && dst_swapchain == src_swapchain) - { - FIXME("Implement hardware blit between two surfaces on the same swapchain\n"); - return WINED3DERR_INVALIDCALL; - } - - if (dst_swapchain && src_swapchain) - { - FIXME("Implement hardware blit between two different swapchains\n"); - return WINED3DERR_INVALIDCALL; - } - - if (dst_swapchain) - { - /* Handled with regular texture -> swapchain blit */ - if (&src_texture->resource == rtv->resource && src_sub_resource_idx == rtv->sub_resource_idx) - TRACE("Blit from active render target to a swapchain\n"); - } - else if (src_swapchain && &dst_texture->resource == rtv->resource - && dst_sub_resource_idx == rtv->sub_resource_idx) - { - FIXME("Implement blit from a swapchain to the active render target\n"); - return WINED3DERR_INVALIDCALL; - } - - if (!dst_swapchain && (src_swapchain || (&src_texture->resource == rtv->resource - && src_sub_resource_idx == rtv->sub_resource_idx))) - { - unsigned int src_level, src_width, src_height; - /* Blit from render target to texture */ - BOOL stretchx; - - /* P8 read back is not implemented */ - if (src_texture->resource.format->id == WINED3DFMT_P8_UINT - || dst_texture->resource.format->id == WINED3DFMT_P8_UINT) - { - TRACE("P8 read back not supported by frame buffer to texture blit\n"); - return WINED3DERR_INVALIDCALL; - } - - if (flags & (WINED3D_BLT_SRC_CKEY | WINED3D_BLT_SRC_CKEY_OVERRIDE)) - { - TRACE("Color keying not supported by frame buffer to texture blit\n"); - return WINED3DERR_INVALIDCALL; - /* Destination color key is checked above */ - } - - if (dst_rect->right - dst_rect->left != src_rect->right - src_rect->left) - stretchx = TRUE; - else - stretchx = FALSE; - - /* Blt is a pretty powerful call, while glCopyTexSubImage2D is not. glCopyTexSubImage cannot - * flip the image nor scale it. - * - * -> If the app asks for an unscaled, upside down copy, just perform one glCopyTexSubImage2D call - * -> If the app wants an image width an unscaled width, copy it line per line - * -> If the app wants an image that is scaled on the x axis, and the destination rectangle is smaller - * than the frame buffer, draw an upside down scaled image onto the fb, read it back and restore the - * back buffer. This is slower than reading line per line, thus not used for flipping - * -> If the app wants a scaled image with a dest rect that is bigger than the fb, it has to be copied - * pixel by pixel. */ - src_level = src_sub_resource_idx % src_texture->level_count; - src_width = wined3d_texture_get_level_width(src_texture, src_level); - src_height = wined3d_texture_get_level_height(src_texture, src_level); - if (!stretchx || dst_rect->right - dst_rect->left > src_width - || dst_rect->bottom - dst_rect->top > src_height) - { - TRACE("No stretching in x direction, using direct framebuffer -> texture copy.\n"); - fb_copy_to_texture_direct(wined3d_texture_gl(dst_texture), dst_sub_resource_idx, dst_rect, - wined3d_texture_gl(src_texture), src_sub_resource_idx, src_rect, filter); - } - else - { - TRACE("Using hardware stretching to flip / stretch the texture.\n"); - fb_copy_to_texture_hwstretch(wined3d_texture_gl(dst_texture), dst_sub_resource_idx, dst_rect, - wined3d_texture_gl(src_texture), src_sub_resource_idx, src_rect, filter); - } - - return WINED3D_OK; - } - - /* Default: Fall back to the generic blt. Not an error, a TRACE is enough */ - TRACE("Didn't find any usable render target setup for hw blit, falling back to software\n"); - return WINED3DERR_INVALIDCALL; -} - /* Context activation is done by the caller. */ static void fbo_blitter_destroy(struct wined3d_blitter *blitter, struct wined3d_context *context) { @@ -2952,17 +2411,12 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_ src_swapchain = src_texture->swapchain; dst_swapchain = dst_texture->swapchain;
- /* This isn't strictly needed. FBO blits for example could deal with - * cross-swapchain blits by first downloading the source to a texture - * before switching to the destination context. We just have this here to - * not have to deal with the issue, since cross-swapchain blits should be - * rare. */ + /* TODO: We could support cross-swapchain blits by first downloading the + * source to a texture. */ if (src_swapchain && dst_swapchain && src_swapchain != dst_swapchain) { - FIXME("Using fallback for cross-swapchain blit.\n"); - if (SUCCEEDED(wined3d_texture_blt_special(dst_texture, dst_sub_resource_idx, &dst_rect, - src_texture, src_sub_resource_idx, &src_rect, flags, fx, filter))) - return WINED3D_OK; + FIXME("Cross-swapchain blit not supported.\n"); + return WINED3DERR_INVALIDCALL; }
scale = src_box->right - src_box->left != dst_box->right - dst_box->left