Commit ce5b25b8 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Reduce indentation in the colour blit case in wined3d_surface_blt().

parent cad4badb
...@@ -3503,12 +3503,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -3503,12 +3503,15 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1}; struct wined3d_box src_box = {src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, 0, 1};
unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface); unsigned int dst_sub_resource_idx = surface_get_sub_resource_idx(dst_surface);
unsigned int src_sub_resource_idx = surface_get_sub_resource_idx(src_surface); unsigned int src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
struct wined3d_texture_sub_resource *src_sub_resource, *dst_sub_resource;
struct wined3d_texture *dst_texture = dst_surface->container; struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_texture *src_texture = src_surface->container; struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_device *device = dst_texture->resource.device; struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_swapchain *src_swapchain, *dst_swapchain; struct wined3d_swapchain *src_swapchain, *dst_swapchain;
const struct wined3d_color_key *colour_key = NULL;
DWORD src_ds_flags, dst_ds_flags; DWORD src_ds_flags, dst_ds_flags;
struct wined3d_context *context; struct wined3d_context *context;
enum wined3d_blit_op blit_op;
BOOL scale, convert; BOOL scale, convert;
DWORD dst_location; DWORD dst_location;
...@@ -3625,15 +3628,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -3625,15 +3628,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
return WINED3D_OK; return WINED3D_OK;
} }
else
{
struct wined3d_texture_sub_resource *src_sub_resource, *dst_sub_resource;
enum wined3d_blit_op blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
const struct wined3d_color_key *colour_key = NULL;
TRACE("Colour blit.\n"); TRACE("Colour blit.\n");
dst_sub_resource = surface_get_sub_resource(dst_surface); dst_sub_resource = &dst_texture->sub_resources[dst_sub_resource_idx];
src_sub_resource = &src_texture->sub_resources[src_sub_resource_idx]; src_sub_resource = &src_texture->sub_resources[src_sub_resource_idx];
/* In principle this would apply to depth blits as well, but we don't /* In principle this would apply to depth blits as well, but we don't
...@@ -3649,6 +3647,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -3649,6 +3647,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto cpu; goto cpu;
} }
blit_op = WINED3D_BLIT_OP_COLOR_BLIT;
if (flags & WINED3D_BLT_SRC_CKEY_OVERRIDE) if (flags & WINED3D_BLT_SRC_CKEY_OVERRIDE)
{ {
colour_key = &fx->src_color_key; colour_key = &fx->src_color_key;
...@@ -3679,8 +3678,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -3679,8 +3678,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
{ {
if (!wined3d_resource_is_offscreen(&dst_texture->resource)) if (!wined3d_resource_is_offscreen(&dst_texture->resource))
{ {
context = context_acquire(device, context = context_acquire(device, dst_texture, dst_sub_resource_idx);
dst_texture, dst_sub_resource_idx);
wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, wined3d_texture_load_location(dst_texture, dst_sub_resource_idx,
context, dst_texture->resource.draw_binding); context, dst_texture->resource.draw_binding);
context_release(context); context_release(context);
...@@ -3693,18 +3691,18 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -3693,18 +3691,18 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
&& dst_texture == dst_swapchain->front_buffer && dst_texture == dst_swapchain->front_buffer
&& src_texture == dst_swapchain->back_buffers[0]) && src_texture == dst_swapchain->back_buffers[0])
{ {
/* Use present for back -> front blits. The idea behind this is /* Use present for back -> front blits. The idea behind this is that
* that present is potentially faster than a blit, in particular * present is potentially faster than a blit, in particular when FBO
* when FBO blits aren't available. Some ddraw applications like * blits aren't available. Some ddraw applications like Half-Life and
* Half-Life and Prince of Persia 3D use Blt() from the backbuffer * Prince of Persia 3D use Blt() from the backbuffer to the
* to the frontbuffer instead of doing a Flip(). D3d8 and d3d9 * frontbuffer instead of doing a Flip(). D3d8 and d3d9 applications
* applications can't blit directly to the frontbuffer. */ * can't blit directly to the frontbuffer. */
enum wined3d_swap_effect swap_effect = dst_swapchain->desc.swap_effect; enum wined3d_swap_effect swap_effect = dst_swapchain->desc.swap_effect;
TRACE("Using present for backbuffer -> frontbuffer blit.\n"); TRACE("Using present for backbuffer -> frontbuffer blit.\n");
/* Set the swap effect to COPY, we don't want the backbuffer to /* Set the swap effect to COPY, we don't want the backbuffer to become
* become undefined. */ * undefined. */
dst_swapchain->desc.swap_effect = WINED3D_SWAP_EFFECT_COPY; dst_swapchain->desc.swap_effect = WINED3D_SWAP_EFFECT_COPY;
wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0); wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, 0);
dst_swapchain->desc.swap_effect = swap_effect; dst_swapchain->desc.swap_effect = swap_effect;
...@@ -3727,7 +3725,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst ...@@ -3727,7 +3725,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_location); wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~dst_location);
return WINED3D_OK; return WINED3D_OK;
}
fallback: fallback:
/* Special cases for render targets. */ /* Special cases for render targets. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment