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

wined3d: Remove WINED3D_BLT_DEPTH_FILL support from wined3d_texture_blit().

parent aec8015c
......@@ -543,41 +543,6 @@ static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum wined
return TRUE;
}
static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const RECT *rect, float depth)
{
struct wined3d_resource *resource = &surface->container->resource;
struct wined3d_device *device = resource->device;
const struct wined3d_blitter_ops *blitter;
struct wined3d_rendertarget_view *view;
struct wined3d_view_desc view_desc;
HRESULT hr;
if (!(blitter = wined3d_select_blitter(&device->adapter->gl_info, &device->adapter->d3d_info,
WINED3D_BLIT_OP_DEPTH_FILL, NULL, 0, 0, NULL, rect, resource->usage, resource->pool, resource->format)))
{
FIXME("No blitter is capable of performing the requested depth fill operation.\n");
return WINED3DERR_INVALIDCALL;
}
view_desc.format_id = resource->format->id;
view_desc.flags = 0;
view_desc.u.texture.level_idx = surface->texture_level;
view_desc.u.texture.level_count = 1;
view_desc.u.texture.layer_idx = surface->texture_layer;
view_desc.u.texture.layer_count = 1;
if (FAILED(hr = wined3d_rendertarget_view_create(&view_desc,
resource, NULL, &wined3d_null_parent_ops, &view)))
{
ERR("Failed to create rendertarget view, hr %#x.\n", hr);
return hr;
}
hr = blitter->depth_fill(device, view, rect, WINED3DCLEAR_ZBUFFER, depth, 0);
wined3d_rendertarget_view_decref(view);
return hr;
}
static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, DWORD src_location, const RECT *src_rect,
struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect)
{
......@@ -3423,11 +3388,11 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
struct wined3d_box dst_box = {dst_rect->left, dst_rect->top, dst_rect->right, dst_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 src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
struct wined3d_texture *dst_texture = dst_surface->container;
struct wined3d_texture *src_texture = src_surface->container;
struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
struct wined3d_texture *src_texture = NULL;
unsigned int src_sub_resource_idx = 0;
DWORD src_ds_flags, dst_ds_flags;
BOOL scale, convert;
......@@ -3435,7 +3400,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
| WINED3D_BLT_SRC_CKEY
| WINED3D_BLT_SRC_CKEY_OVERRIDE
| WINED3D_BLT_WAIT
| WINED3D_BLT_DEPTH_FILL
| WINED3D_BLT_DO_NOT_WAIT
| WINED3D_BLT_ALPHA_TEST;
......@@ -3447,7 +3411,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
if (fx)
{
TRACE("fx %#x.\n", fx->fx);
TRACE("fill_color 0x%08x.\n", fx->fill_color);
TRACE("dst_color_key {0x%08x, 0x%08x}.\n",
fx->dst_color_key.color_space_low_value,
fx->dst_color_key.color_space_high_value);
......@@ -3456,12 +3419,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
fx->src_color_key.color_space_high_value);
}
if (src_surface)
{
src_texture = src_surface->container;
src_sub_resource_idx = surface_get_sub_resource_idx(src_surface);
}
if (!fx || !(fx->fx))
flags &= ~WINED3D_BLT_FX;
......@@ -3509,11 +3466,7 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto fallback;
}
if (src_texture)
src_swapchain = src_texture->swapchain;
else
src_swapchain = NULL;
src_swapchain = src_texture->swapchain;
dst_swapchain = dst_texture->swapchain;
/* This isn't strictly needed. FBO blits for example could deal with
......@@ -3527,38 +3480,20 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
goto fallback;
}
scale = src_texture
&& (src_rect->right - src_rect->left != dst_rect->right - dst_rect->left
|| src_rect->bottom - src_rect->top != dst_rect->bottom - dst_rect->top);
convert = src_texture && src_texture->resource.format->id != dst_texture->resource.format->id;
scale = src_rect->right - src_rect->left != dst_rect->right - dst_rect->left
|| src_rect->bottom - src_rect->top != dst_rect->bottom - dst_rect->top;
convert = src_texture->resource.format->id != dst_texture->resource.format->id;
dst_ds_flags = dst_texture->resource.format_flags
& (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
if (src_texture)
src_ds_flags = src_texture->resource.format_flags
& (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
else
src_ds_flags = 0;
src_ds_flags = src_texture->resource.format_flags
& (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
if (src_ds_flags || dst_ds_flags)
{
if (flags & WINED3D_BLT_DEPTH_FILL)
{
struct wined3d_color color;
TRACE("Depth fill.\n");
if (!wined3d_format_convert_color_to_float(dst_texture->resource.format, NULL, fx->fill_color, &color))
return WINED3DERR_INVALIDCALL;
if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, color.r)))
return WINED3D_OK;
}
else if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding,
if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, src_texture->resource.draw_binding,
src_rect, dst_surface, dst_texture->resource.draw_binding, dst_rect)))
{
return WINED3D_OK;
}
}
else
{
......@@ -3695,8 +3630,6 @@ fallback:
return WINED3D_OK;
cpu:
if (flags & WINED3D_BLT_DEPTH_FILL)
return surface_cpu_blt_colour_fill(dst_texture, dst_sub_resource_idx, &dst_box, fx->fill_color);
return surface_cpu_blt(dst_texture, dst_sub_resource_idx, &dst_box,
src_texture, src_sub_resource_idx, &src_box, flags, fx, filter);
}
......@@ -2751,40 +2751,36 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
|| dst_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D)
return WINED3DERR_INVALIDCALL;
if (src_sub_resource_idx >= src_texture->level_count * src_texture->layer_count
|| src_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D)
return WINED3DERR_INVALIDCALL;
dst_format_flags = dst_texture->resource.format_flags;
if (FAILED(hr = wined3d_texture_check_box_dimensions(dst_texture,
dst_sub_resource_idx % dst_texture->level_count, &dst_box)))
return hr;
if (src_texture)
{
if (src_sub_resource_idx >= src_texture->level_count * src_texture->layer_count
|| src_texture->resource.type != WINED3D_RTYPE_TEXTURE_2D)
return WINED3DERR_INVALIDCALL;
src_format_flags = src_texture->resource.format_flags;
if (FAILED(hr = wined3d_texture_check_box_dimensions(src_texture,
src_sub_resource_idx % src_texture->level_count, &src_box)))
return hr;
}
src_format_flags = src_texture->resource.format_flags;
if (FAILED(hr = wined3d_texture_check_box_dimensions(src_texture,
src_sub_resource_idx % src_texture->level_count, &src_box)))
return hr;
if (dst_texture->sub_resources[dst_sub_resource_idx].map_count
|| (src_texture && src_texture->sub_resources[src_sub_resource_idx].map_count))
|| src_texture->sub_resources[src_sub_resource_idx].map_count)
{
WARN("Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.\n");
return WINEDDERR_SURFACEBUSY;
}
if ((src_format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
!= (dst_format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
&& !(flags & WINED3D_BLT_DEPTH_FILL))
!= (dst_format_flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)))
{
WARN("Rejecting depth/stencil blit between incompatible formats.\n");
return WINED3DERR_INVALIDCALL;
}
wined3d_cs_emit_blt_sub_resource(dst_texture->resource.device->cs, &dst_texture->resource, dst_sub_resource_idx,
&dst_box, src_texture ? &src_texture->resource : NULL, src_sub_resource_idx, &src_box, flags, fx, filter);
&dst_box, &src_texture->resource, src_sub_resource_idx, &src_box, flags, fx, filter);
return WINED3D_OK;
}
......
......@@ -5042,65 +5042,6 @@ static float color_to_float(DWORD color, DWORD size, DWORD offset)
return (float)color / (float)mask;
}
BOOL wined3d_format_convert_color_to_float(const struct wined3d_format *format,
const struct wined3d_palette *palette, DWORD color, struct wined3d_color *float_color)
{
switch (format->id)
{
case WINED3DFMT_B8G8R8_UNORM:
case WINED3DFMT_B8G8R8A8_UNORM:
case WINED3DFMT_B8G8R8X8_UNORM:
case WINED3DFMT_B5G6R5_UNORM:
case WINED3DFMT_B5G5R5X1_UNORM:
case WINED3DFMT_B5G5R5A1_UNORM:
case WINED3DFMT_B4G4R4A4_UNORM:
case WINED3DFMT_B2G3R3_UNORM:
case WINED3DFMT_R8_UNORM:
case WINED3DFMT_A8_UNORM:
case WINED3DFMT_B2G3R3A8_UNORM:
case WINED3DFMT_B4G4R4X4_UNORM:
case WINED3DFMT_R10G10B10A2_UNORM:
case WINED3DFMT_R10G10B10A2_SNORM:
case WINED3DFMT_R8G8B8A8_UNORM:
case WINED3DFMT_R8G8B8X8_UNORM:
case WINED3DFMT_R16G16_UNORM:
case WINED3DFMT_B10G10R10A2_UNORM:
float_color->r = color_to_float(color, format->red_size, format->red_offset);
float_color->g = color_to_float(color, format->green_size, format->green_offset);
float_color->b = color_to_float(color, format->blue_size, format->blue_offset);
float_color->a = color_to_float(color, format->alpha_size, format->alpha_offset);
return TRUE;
case WINED3DFMT_P8_UINT:
if (palette)
{
float_color->r = palette->colors[color].rgbRed / 255.0f;
float_color->g = palette->colors[color].rgbGreen / 255.0f;
float_color->b = palette->colors[color].rgbBlue / 255.0f;
}
else
{
float_color->r = 0.0f;
float_color->g = 0.0f;
float_color->b = 0.0f;
}
float_color->a = color / 255.0f;
return TRUE;
case WINED3DFMT_S1_UINT_D15_UNORM:
case WINED3DFMT_D16_UNORM:
case WINED3DFMT_D24_UNORM_S8_UINT:
case WINED3DFMT_X8D24_UNORM:
case WINED3DFMT_D32_UNORM:
float_color->r = color_to_float(color, format->depth_size, 0);
return TRUE;
default:
ERR("Unhandled conversion from %s to floating point.\n", debug_d3dformat(format->id));
return FALSE;
}
}
void wined3d_format_get_float_color_key(const struct wined3d_format *format,
const struct wined3d_color_key *key, struct wined3d_color *float_colors)
{
......
......@@ -3908,8 +3908,6 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format,
UINT alignment, UINT width, UINT height, UINT depth) DECLSPEC_HIDDEN;
DWORD wined3d_format_convert_from_float(const struct wined3d_format *format,
const struct wined3d_color *color) DECLSPEC_HIDDEN;
BOOL wined3d_format_convert_color_to_float(const struct wined3d_format *format,
const struct wined3d_palette *palette, DWORD color, struct wined3d_color *float_color) DECLSPEC_HIDDEN;
void wined3d_format_get_float_color_key(const struct wined3d_format *format,
const struct wined3d_color_key *key, struct wined3d_color *float_colors) DECLSPEC_HIDDEN;
const struct wined3d_color_key_conversion * wined3d_format_get_color_key_conversion(
......
......@@ -1315,10 +1315,9 @@ enum wined3d_shader_byte_code_format
#define WINED3D_BLT_SRC_CKEY 0x00008000
#define WINED3D_BLT_SRC_CKEY_OVERRIDE 0x00010000
#define WINED3D_BLT_WAIT 0x01000000
#define WINED3D_BLT_DEPTH_FILL 0x02000000
#define WINED3D_BLT_DO_NOT_WAIT 0x08000000
#define WINED3D_BLT_ALPHA_TEST 0x80000000
#define WINED3D_BLT_MASK 0x0b01ea00
#define WINED3D_BLT_MASK 0x0901ea00
/* dwFlags for GetBltStatus */
#define WINEDDGBS_CANBLT 0x00000001
......@@ -1912,7 +1911,6 @@ struct wined3d_color_key
struct wined3d_blt_fx
{
DWORD fx;
DWORD fill_color;
struct wined3d_color_key dst_color_key;
struct wined3d_color_key src_color_key;
};
......
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