Update DXTn patches to better handle when libtxc_dxtn is missing or support is not compiled in.

This commit is contained in:
Sebastian Lackner 2015-01-10 03:28:30 +01:00
parent ec40c1c8d0
commit 87fd17de51
7 changed files with 264 additions and 211 deletions

1
debian/changelog vendored
View File

@ -6,6 +6,7 @@ wine-staging (1.7.34) UNRELEASED; urgency=low
* Fix issue in user32-WndProc patch which caused crashes for some 16-bit apps.
* Fix issue in ws2_32-WriteWatches patch which can cause exceptions on the signal stack.
* Fix issue with invalid handles being incorrect when a new process is created.
* Update DXTn patches to better handle when libtxc_dxtn is missing or support is not compiled in.
* Added patch for WSARecv to call SetLastError on success.
* Added patch for CreateProcess to prioritize the working directory over the system search path.
* Added patch with stubs for WinSqm[Start|End]Session.

View File

@ -1,12 +1,12 @@
From 0808d72ca1d94c68fcf07379195e086d24383d43 Mon Sep 17 00:00:00 2001
From 5dc54490906f945778a858ecb757cf39500d0b40 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Sat, 1 Nov 2014 13:08:05 +0100
Subject: d3dx9_36: Add dxtn support.
---
dlls/d3dx9_36/Makefile.in | 2 +-
dlls/d3dx9_36/surface.c | 101 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 95 insertions(+), 8 deletions(-)
dlls/d3dx9_36/surface.c | 104 ++++++++++++++++++++++++++++++++++++++++++----
2 files changed, 98 insertions(+), 8 deletions(-)
diff --git a/dlls/d3dx9_36/Makefile.in b/dlls/d3dx9_36/Makefile.in
index 5958c57..aa387b5 100644
@ -21,7 +21,7 @@ index 5958c57..aa387b5 100644
C_SRCS = \
core.c \
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index f187031..9a1e1cb 100644
index f187031..70dc0cd 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -18,6 +18,7 @@
@ -41,22 +41,25 @@ index f187031..9a1e1cb 100644
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
@@ -1716,6 +1719,24 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic
@@ -1716,6 +1719,27 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic
}
}
+typedef BOOL (*dxtn_conversion_func)(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+
+static dxtn_conversion_func get_dxtn_conversion_func(D3DFORMAT format, BOOL encode)
+{
+ switch (format)
+ {
+ case D3DFMT_DXT1:
+ if (!wined3d_dxtn_supported()) return NULL;
+ return encode ? wined3d_dxt1_encode : wined3d_dxt1_decode;
+ case D3DFMT_DXT3:
+ if (!wined3d_dxtn_supported()) return NULL;
+ return encode ? wined3d_dxt3_encode : wined3d_dxt3_decode;
+ case D3DFMT_DXT5:
+ if (!wined3d_dxtn_supported()) return NULL;
+ return encode ? wined3d_dxt5_encode : wined3d_dxt5_decode;
+ default:
+ return NULL;
@ -66,7 +69,7 @@ index f187031..9a1e1cb 100644
/************************************************************
* D3DXLoadSurfaceFromMemory
*
@@ -1757,6 +1778,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1757,6 +1781,7 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
D3DSURFACE_DESC surfdesc;
D3DLOCKED_RECT lockrect;
struct volume src_size, dst_size;
@ -74,7 +77,7 @@ index f187031..9a1e1cb 100644
TRACE("(%p, %p, %s, %p, %#x, %u, %p, %s %#x, 0x%08x)\n",
dst_surface, dst_palette, wine_dbgstr_rect(dst_rect), src_memory, src_format,
@@ -1838,8 +1860,15 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1838,8 +1863,15 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
}
else /* Stretching or format conversion. */
{
@ -92,7 +95,7 @@ index f187031..9a1e1cb 100644
{
FIXME("Format conversion missing %#x -> %#x\n", src_format, surfdesc.Format);
return E_NOTIMPL;
@@ -1848,10 +1877,52 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1848,10 +1880,52 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
if (FAILED(IDirect3DSurface9_LockRect(dst_surface, &lockrect, dst_rect, 0)))
return D3DXERR_INVALIDDATA;
@ -147,7 +150,7 @@ index f187031..9a1e1cb 100644
}
else /* if ((filter & 0xf) == D3DX_FILTER_POINT) */
{
@@ -1860,14 +1931,30 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
@@ -1860,14 +1934,30 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
/* Always apply a point filter until D3DX_FILTER_LINEAR,
* D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */
@ -182,5 +185,5 @@ index f187031..9a1e1cb 100644
/************************************************************
--
2.1.3
2.2.1

View File

@ -1081,7 +1081,7 @@ if [ "$enable_wined3d_DXTn" -eq 1 ]; then
patch_apply wined3d-DXTn/0002-wined3d-Improve-DXTn-support-and-export-conversion-f.patch
patch_apply wined3d-DXTn/0003-wined3d-add-DXT1-to-B4G4R4A4-DXT1-to-B5G5R5A1-and-DX.patch
(
echo '+ { "Michael Müller", "wined3d: Add support for DXTn software decoding through libtxc_dxtn.", 1 },';
echo '+ { "Michael Müller", "wined3d: Add support for DXTn software decoding through libtxc_dxtn.", 2 },';
echo '+ { "Christian Costa", "wined3d: Improve DXTn support and export conversion functions for d3dx9_36.", 1 },';
echo '+ { "Michael Müller", "wined3d: add DXT1 to B4G4R4A4, DXT1 to B5G5R5A1 and DXT3 to B4G4R4A4 conversion.", 1 },';
) >> "$patchlist"

View File

@ -7086,7 +7086,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return WINED3D_OK;
}
@@ -2424,6 +2865,7 @@
@@ -2433,6 +2874,7 @@
static struct wined3d_texture *surface_convert_format(struct wined3d_surface *source, enum wined3d_format_id to_fmt)
{
@ -7094,7 +7094,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
void *dst_data = NULL, *src_data = NULL;
UINT src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch;
const struct d3dfmt_converter_desc *conv;
@@ -2432,6 +2874,13 @@
@@ -2441,6 +2883,13 @@
struct wined3d_surface *dst;
struct wined3d_context *context = NULL;
struct wined3d_device *device = source->resource.device;
@ -7108,7 +7108,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
conv = find_converter(source->resource.format->id, to_fmt);
if (!conv)
@@ -2455,6 +2904,7 @@
@@ -2464,6 +2913,7 @@
}
dst = surface_from_resource(wined3d_texture_get_sub_resource(ret, 0));
@ -7116,7 +7116,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
wined3d_resource_get_pitch(&source->resource, &src_row_pitch, &src_slice_pitch);
wined3d_resource_get_pitch(&ret->resource, &dst_row_pitch, &dst_slice_pitch);
@@ -2495,6 +2945,32 @@
@@ -2504,6 +2954,32 @@
if (context)
context_release(context);
return NULL;
@ -7149,7 +7149,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
static HRESULT _Blt_ColorFill(BYTE *buf, unsigned int width, unsigned int height,
@@ -2562,6 +3038,7 @@
@@ -2571,6 +3047,7 @@
HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface)
{
@ -7157,7 +7157,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
HRESULT hr;
TRACE("surface %p.\n", surface);
@@ -2579,6 +3056,39 @@
@@ -2588,6 +3065,39 @@
{
struct wined3d_box box;
const struct wined3d_format *format = surface->resource.format;
@ -7197,7 +7197,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if ((format->flags & WINED3DFMT_FLAG_BLOCKS) && rect
&& !surface_check_block_align(surface, rect))
@@ -2590,6 +3100,13 @@
@@ -2599,6 +3109,13 @@
return WINED3DERR_INVALIDCALL;
}
@ -7211,7 +7211,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
/* Performance optimization: Count how often a surface is mapped, if it is
* mapped regularly do not throw away the system memory copy. This avoids
* the need to download the surface from OpenGL all the time. The surface
@@ -2605,6 +3122,7 @@
@@ -2614,6 +3131,7 @@
}
}
@ -7219,7 +7219,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (rect)
{
surface->lockedRect = *rect;
@@ -2669,22 +3187,121 @@
@@ -2678,22 +3196,121 @@
WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(surface->resource.format->id));
return WINED3DERR_INVALIDCALL;
}
@ -7353,7 +7353,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
void wined3d_surface_releasedc_cs(struct wined3d_surface *surface)
@@ -2710,6 +3327,35 @@
@@ -2719,6 +3336,35 @@
if (context)
context_release(context);
}
@ -7389,7 +7389,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
@@ -2729,6 +3375,7 @@
@@ -2738,6 +3384,7 @@
surface->resource.map_count--;
surface->flags &= ~SFLAG_DCINUSE;
@ -7397,7 +7397,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
wined3d_cs_emit_releasedc(surface->resource.device->cs, surface);
return WINED3D_OK;
@@ -2764,6 +3411,40 @@
@@ -2773,6 +3420,40 @@
context = context_acquire(device, surface);
}
@ -7438,7 +7438,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
context_apply_blit_state(context, device);
gl_info = context->gl_info;
@@ -2851,12 +3532,16 @@
@@ -2860,12 +3541,16 @@
checkGLcall("glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0)");
}
@ -7455,7 +7455,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
/* Read the framebuffer contents into a texture. Note that this function
@@ -2916,6 +3601,85 @@
@@ -2925,6 +3610,85 @@
}
}
@ -7541,7 +7541,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
/* Does a direct frame buffer -> texture copy. Stretching is done with single
* pixel copy calls. */
static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface,
@@ -3022,8 +3786,13 @@
@@ -3031,8 +3795,13 @@
/* The texture is now most up to date - If the surface is a render target
* and has a drawable, this path is never entered. */
@ -7555,7 +7555,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
/* Uses the hardware to stretch and flip the image */
@@ -3091,7 +3860,11 @@
@@ -3100,7 +3869,11 @@
checkGLcall("glEnable(texture_target)");
/* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */
@ -7567,7 +7567,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
/* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag
@@ -3289,6 +4062,7 @@
@@ -3298,6 +4071,7 @@
checkGLcall("glDeleteTextures(1, &backup)");
}
@ -7575,7 +7575,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (wined3d_settings.cs_multithreaded)
gl_info->gl_ops.gl.p_glFinish();
else if (wined3d_settings.strict_draw_ordering)
@@ -3300,6 +4074,17 @@
@@ -3309,6 +4083,17 @@
* and has a drawable, this path is never entered. */
wined3d_resource_validate_location(&dst_surface->resource, WINED3D_LOCATION_TEXTURE_RGB);
wined3d_resource_invalidate_location(&dst_surface->resource, ~WINED3D_LOCATION_TEXTURE_RGB);
@ -7593,7 +7593,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
/* Front buffer coordinates are always full screen coordinates, but our GL
@@ -3330,6 +4115,7 @@
@@ -3339,6 +4124,7 @@
rect->bottom = drawable_height - rect->bottom;
}
@ -7601,7 +7601,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
/* Context activation is done by the caller. */
static void surface_blt_to_drawable(const struct wined3d_device *device,
struct wined3d_context *old_ctx,
@@ -3364,6 +4150,26 @@
@@ -3373,6 +4159,26 @@
/* Make sure the surface is up-to-date. This should probably use
* wined3d_resource_load_location() and worry about the destination
* surface too, unless we're overwriting it completely. */
@ -7628,7 +7628,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
wined3d_texture_load(src_surface->container, context, FALSE);
/* Activate the destination context, set it up for blitting */
@@ -3406,6 +4212,7 @@
@@ -3415,6 +4221,7 @@
/* Leave the opengl state valid for blitting */
device->blitter->unset_shader(context->gl_info);
@ -7636,7 +7636,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (wined3d_settings.cs_multithreaded)
gl_info->gl_ops.gl.p_glFinish();
else if (wined3d_settings.strict_draw_ordering
@@ -3419,6 +4226,14 @@
@@ -3428,6 +4235,14 @@
context = context_acquire(device, restore_rt);
context_release(context);
}
@ -7651,7 +7651,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const struct wined3d_color *color)
@@ -3442,9 +4257,15 @@
@@ -3451,9 +4266,15 @@
enum wined3d_texture_filter_type filter)
{
struct wined3d_device *device = dst_surface->resource.device;
@ -7667,7 +7667,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, blt_fx %p, filter %s.\n",
dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect),
@@ -3569,7 +4390,9 @@
@@ -3578,7 +4399,9 @@
/* Blit from offscreen surface to render target */
struct wined3d_color_key old_blt_key = src_surface->container->src_blt_color_key;
DWORD old_color_key_flags = src_surface->container->color_key_flags;
@ -7677,7 +7677,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface);
@@ -3603,6 +4426,7 @@
@@ -3612,6 +4435,7 @@
wined3d_texture_set_color_key(src_surface->container, WINEDDCKEY_SRCBLT, NULL);
}
@ -7685,7 +7685,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
context = context_acquire(device, dst_surface);
surface_blt_to_drawable(device, context, filter,
flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_ALPHATEST),
@@ -3615,6 +4439,18 @@
@@ -3624,6 +4448,18 @@
wined3d_resource_validate_location(&dst_surface->resource, dst_surface->container->resource.draw_binding);
wined3d_resource_invalidate_location(&dst_surface->resource, ~dst_surface->container->resource.draw_binding);
@ -7704,7 +7704,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return WINED3D_OK;
}
@@ -3689,6 +4525,7 @@
@@ -3698,6 +4534,7 @@
{
TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h);
@ -7712,7 +7712,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (((surface->resource.locations & WINED3D_LOCATION_TEXTURE_RGB) && !(location & WINED3D_LOCATION_TEXTURE_RGB))
|| (!(surface->resource.locations & WINED3D_LOCATION_TEXTURE_RGB)
&& (location & WINED3D_LOCATION_TEXTURE_RGB)))
@@ -3697,6 +4534,15 @@
@@ -3706,6 +4543,15 @@
surface->ds_current_size.cx = w;
surface->ds_current_size.cy = h;
surface->resource.locations = location;
@ -7728,7 +7728,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
/* Context activation is done by the caller. */
@@ -3711,7 +4557,11 @@
@@ -3720,7 +4566,11 @@
/* TODO: Make this work for modes other than FBO */
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return;
@ -7740,7 +7740,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
w = surface->ds_current_size.cx;
h = surface->ds_current_size.cy;
@@ -3737,7 +4587,11 @@
@@ -3746,7 +4596,11 @@
return;
}
@ -7752,7 +7752,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
TRACE("Surface was discarded, no need copy data.\n");
switch (location)
@@ -3754,6 +4608,7 @@
@@ -3763,6 +4617,7 @@
default:
FIXME("Unhandled location %#x\n", location);
}
@ -7760,7 +7760,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
surface->resource.locations &= ~WINED3D_LOCATION_DISCARDED;
surface->resource.locations |= location;
surface->ds_current_size.cx = surface->resource.width;
@@ -3765,6 +4620,19 @@
@@ -3774,6 +4629,19 @@
{
FIXME("No up to date depth stencil location.\n");
surface->resource.locations |= location;
@ -7780,7 +7780,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
surface->ds_current_size.cx = surface->resource.width;
surface->ds_current_size.cy = surface->resource.height;
return;
@@ -3829,9 +4697,13 @@
@@ -3838,9 +4706,13 @@
context_invalidate_state(context, STATE_FRAMEBUFFER);
@ -7794,7 +7794,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
}
else if (location == WINED3D_LOCATION_DRAWABLE)
@@ -3847,9 +4719,13 @@
@@ -3856,9 +4728,13 @@
context_invalidate_state(context, STATE_FRAMEBUFFER);
@ -7808,7 +7808,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
gl_info->gl_ops.gl.p_glFlush(); /* Flush to ensure ordering across contexts. */
}
else
@@ -3857,6 +4733,7 @@
@@ -3866,6 +4742,7 @@
ERR("Invalid location (%#x) specified.\n", location);
}
@ -7816,7 +7816,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
surface->resource.locations |= location;
surface->ds_current_size.cx = surface->resource.width;
surface->ds_current_size.cy = surface->resource.height;
@@ -3902,6 +4779,135 @@
@@ -3911,6 +4788,135 @@
TRACE("Surface was discarded, nothing to do.\n");
return WINED3D_OK;
}
@ -7952,7 +7952,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO
&& wined3d_resource_is_offscreen(&surface->container->resource))
@@ -3911,6 +4917,7 @@
@@ -3920,6 +4926,7 @@
}
surface_get_rect(surface, NULL, &r);
@ -7960,7 +7960,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_TEXTURE_RGB);
surface_blt_to_drawable(surface->resource.device, context,
WINED3D_TEXF_POINT, FALSE, surface, &r, surface, &r);
@@ -3979,6 +4986,66 @@
@@ -3988,6 +4995,66 @@
RECT rect = {0, 0, surface->resource.width, surface->resource.height};
surface_blt_fbo(device, context, WINED3D_TEXF_POINT, surface, src_location,
@ -8027,7 +8027,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
&rect, surface, dst_location, &rect);
return WINED3D_OK;
@@ -3988,6 +5055,7 @@
@@ -3997,6 +5064,7 @@
if (srgb)
{
@ -8035,7 +8035,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if ((surface->resource.locations & (WINED3D_LOCATION_TEXTURE_RGB | surface->resource.map_binding))
== WINED3D_LOCATION_TEXTURE_RGB)
{
@@ -4016,6 +5084,39 @@
@@ -4025,6 +5093,39 @@
wined3d_resource_prepare_system_memory(&surface->resource);
wined3d_resource_load_location(&surface->resource, context, WINED3D_LOCATION_SYSMEM);
}
@ -8075,7 +8075,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
wined3d_texture_prepare_texture(texture, context, srgb);
wined3d_texture_bind_and_dirtify(texture, context, srgb);
@@ -4037,7 +5138,11 @@
@@ -4046,7 +5147,11 @@
/* Don't use PBOs for converted surfaces. During PBO conversion we look at
* WINED3D_TEXTURE_CONVERTED but it isn't set (yet) in all cases it is
* getting called. */
@ -8087,7 +8087,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
TRACE("Removing the pbo attached to surface %p.\n", surface);
@@ -4046,6 +5151,7 @@
@@ -4055,6 +5160,7 @@
else
surface->resource.map_binding = WINED3D_LOCATION_SYSMEM;
@ -8095,7 +8095,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
wined3d_resource_prepare_map_memory(&surface->resource, context);
wined3d_resource_load_location(&surface->resource, context, surface->resource.map_binding);
wined3d_resource_free_bo(&surface->resource);
@@ -4053,6 +5159,14 @@
@@ -4062,6 +5168,14 @@
}
wined3d_resource_get_memory(&surface->resource, surface->resource.locations, &data);
@ -8110,7 +8110,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (format.convert)
{
/* This code is entered for texture formats which need a fixup. */
@@ -4099,6 +5213,7 @@
@@ -4108,6 +5222,7 @@
wined3d_surface_upload_data(surface, gl_info, &format, &src_rect,
src_row_pitch, &dst_point, srgb, wined3d_const_bo_address(&data));
@ -8118,7 +8118,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
HeapFree(GetProcessHeap(), 0, mem);
return WINED3D_OK;
@@ -4122,6 +5237,31 @@
@@ -4131,6 +5246,31 @@
struct wined3d_context *context, DWORD location)
{
struct wined3d_surface *surface = surface_from_resource(resource);
@ -8150,7 +8150,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
HRESULT hr;
TRACE("surface %p, location %s.\n", surface, wined3d_debug_location(location));
@@ -4129,6 +5269,7 @@
@@ -4138,6 +5278,7 @@
if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
{
if (location == WINED3D_LOCATION_TEXTURE_RGB
@ -8158,7 +8158,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
&& surface->resource.locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED))
{
surface_load_ds_location(surface, context, location);
@@ -4148,11 +5289,53 @@
@@ -4157,11 +5298,53 @@
}
}
@ -8214,7 +8214,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
switch (location)
@@ -4161,6 +5344,7 @@
@@ -4170,6 +5353,7 @@
case WINED3D_LOCATION_USER_MEMORY:
case WINED3D_LOCATION_SYSMEM:
case WINED3D_LOCATION_BUFFER:
@ -8222,7 +8222,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
surface_load_sysmem(surface, context, location);
break;
@@ -4178,6 +5362,24 @@
@@ -4187,6 +5371,24 @@
if (FAILED(hr = surface_load_texture(surface, context,
location == WINED3D_LOCATION_TEXTURE_SRGB)))
return;
@ -8247,7 +8247,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
break;
default:
@@ -4185,12 +5387,21 @@
@@ -4194,12 +5396,21 @@
break;
}
@ -8269,7 +8269,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; }
@@ -4284,6 +5495,7 @@
@@ -4293,6 +5504,7 @@
const RECT *dst_rect, const struct wined3d_color *color)
{
const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
@ -8277,7 +8277,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
struct wined3d_rendertarget_view view, *view_ptr = &view;
struct wined3d_fb_state fb = {&view_ptr, NULL, 1};
struct wined3d_texture *texture = dst_surface->container;
@@ -4304,6 +5516,21 @@
@@ -4313,6 +5525,21 @@
view.sub_resource_idx = dst_surface->texture_layer * texture->level_count + dst_surface->texture_level;
device_clear_render_targets(device, 1, &fb, 1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
@ -8299,7 +8299,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return WINED3D_OK;
}
@@ -4312,6 +5539,7 @@
@@ -4321,6 +5548,7 @@
const RECT *dst_rect, float depth)
{
const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
@ -8307,7 +8307,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
struct wined3d_rendertarget_view view;
struct wined3d_fb_state fb = {NULL, &view};
struct wined3d_texture *texture = dst_surface->container;
@@ -4327,6 +5555,20 @@
@@ -4336,6 +5564,20 @@
view.sub_resource_idx = dst_surface->texture_layer * texture->level_count + dst_surface->texture_level;
device_clear_render_targets(device, 0, &fb, 1, dst_rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0);
@ -8328,7 +8328,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return WINED3D_OK;
}
@@ -4484,6 +5726,7 @@
@@ -4493,6 +5735,7 @@
int bpp, srcheight, srcwidth, dstheight, dstwidth, width;
const struct wined3d_format *src_format, *dst_format;
struct wined3d_texture *src_texture = NULL;
@ -8336,7 +8336,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
void *src_data = NULL, *dst_data = NULL;
UINT src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch;
const BYTE *sbase = NULL;
@@ -4514,6 +5757,23 @@
@@ -4523,6 +5766,23 @@
wined3d_resource_get_pitch(&dst_surface->resource, &dst_row_pitch, &dst_slice_pitch);
src_data = dst_data;
src_row_pitch = dst_row_pitch;
@ -8360,7 +8360,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
src_format = dst_surface->resource.format;
dst_format = src_format;
}
@@ -4522,12 +5782,14 @@
@@ -4531,12 +5791,14 @@
dst_format = dst_surface->resource.format;
if (src_surface)
{
@ -8375,7 +8375,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (dst_surface->resource.format->id != src_surface->resource.format->id)
{
if (!(src_texture = surface_convert_format(src_surface, dst_format->id)))
@@ -4538,9 +5800,13 @@
@@ -4547,9 +5809,13 @@
}
src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, 0));
}
@ -8389,7 +8389,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
src_format = src_surface->resource.format;
}
else
@@ -4548,8 +5814,12 @@
@@ -4557,8 +5823,12 @@
src_format = dst_format;
}
@ -8402,7 +8402,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
bpp = dst_surface->resource.format->byte_count;
@@ -4560,12 +5830,24 @@
@@ -4569,12 +5839,24 @@
width = (dst_rect->right - dst_rect->left) * bpp;
if (src_surface)
@ -8427,7 +8427,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (src_format->flags & dst_format->flags & WINED3DFMT_FLAG_BLOCKS)
{
@@ -4600,7 +5882,11 @@
@@ -4609,7 +5891,11 @@
}
hr = surface_cpu_blt_compressed(sbase, dbuf,
@ -8439,7 +8439,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
src_format, flags, fx);
goto release;
}
@@ -4608,7 +5894,11 @@
@@ -4617,7 +5903,11 @@
/* First, all the 'source-less' blits */
if (flags & WINEDDBLT_COLORFILL)
{
@ -8451,7 +8451,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
flags &= ~WINEDDBLT_COLORFILL;
}
@@ -4622,12 +5912,21 @@
@@ -4631,12 +5921,21 @@
switch (fx->dwROP)
{
case BLACKNESS:
@ -8473,7 +8473,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
break;
case SRCCOPY: /* Well, we do that below? */
break;
@@ -4678,6 +5977,7 @@
@@ -4687,6 +5986,7 @@
for (y = 0; y < dstheight; ++y)
{
memcpy(dbuf, sbuf, width);
@ -8481,7 +8481,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
sbuf += src_row_pitch;
dbuf += dst_row_pitch;
}
@@ -4691,6 +5991,21 @@
@@ -4700,6 +6000,21 @@
{
sbuf -= src_row_pitch;
dbuf -= dst_row_pitch;
@ -8503,7 +8503,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
memcpy(dbuf, sbuf, width);
}
}
@@ -4700,8 +6015,13 @@
@@ -4709,8 +6024,13 @@
for (y = 0; y < dstheight; ++y)
{
memmove(dbuf, sbuf, width);
@ -8517,7 +8517,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
}
}
@@ -4710,9 +6030,15 @@
@@ -4719,9 +6039,15 @@
/* Stretching in y direction only. */
for (y = sy = 0; y < dstheight; ++y, sy += yinc)
{
@ -8533,7 +8533,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
}
}
@@ -4722,6 +6048,7 @@
@@ -4731,6 +6057,7 @@
int last_sy = -1;
for (y = sy = 0; y < dstheight; ++y, sy += yinc)
{
@ -8541,7 +8541,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
sbuf = sbase + (sy >> 16) * src_row_pitch;
if ((sy >> 16) == (last_sy >> 16))
@@ -4729,6 +6056,15 @@
@@ -4738,6 +6065,15 @@
/* This source row is the same as last source row -
* Copy the already stretched row. */
memcpy(dbuf, dbuf - dst_row_pitch, width);
@ -8557,7 +8557,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
else
{
@@ -4775,6 +6111,7 @@
@@ -4784,6 +6120,7 @@
}
#undef STRETCH_ROW
}
@ -8565,7 +8565,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
dbuf += dst_row_pitch;
last_sy = sy;
}
@@ -4783,6 +6120,16 @@
@@ -4792,6 +6129,16 @@
else
{
LONG dstyinc = dst_row_pitch, dstxinc = bpp;
@ -8582,7 +8582,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
DWORD keylow = 0xffffffff, keyhigh = 0, keymask = 0xffffffff;
DWORD destkeylow = 0x0, destkeyhigh = 0xffffffff, destkeymask = 0xffffffff;
if (flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE))
@@ -4832,7 +6179,11 @@
@@ -4841,7 +6188,11 @@
LONG tmpxy;
dTopLeft = dbuf;
dTopRight = dbuf + ((dstwidth - 1) * bpp);
@ -8594,7 +8594,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp);
if (fx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY)
@@ -4909,6 +6260,7 @@
@@ -4918,6 +6269,7 @@
flags &= ~(WINEDDBLT_DDFX);
}
@ -8602,7 +8602,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
#define COPY_COLORKEY_FX(type) \
do { \
const type *s; \
@@ -4930,6 +6282,29 @@
@@ -4939,6 +6291,29 @@
d = (type *)(((BYTE *)d) + dstyinc); \
} \
} while(0)
@ -8632,7 +8632,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
switch (bpp)
{
@@ -4948,7 +6323,11 @@
@@ -4957,7 +6332,11 @@
BYTE *d = dbuf, *dx;
for (y = sy = 0; y < dstheight; ++y, sy += yinc)
{
@ -8644,7 +8644,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
dx = d;
for (x = sx = 0; x < dstwidth; ++x, sx+= xinc)
{
@@ -4979,10 +6358,12 @@
@@ -4988,10 +6367,12 @@
}
}
@ -8657,7 +8657,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
error:
if (flags && FIXME_ON(d3d_surface))
{
@@ -4990,6 +6371,7 @@
@@ -4999,6 +6380,7 @@
}
release:
@ -8665,7 +8665,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (dst_data)
{
wined3d_resource_release_map_ptr(&dst_surface->resource, context);
@@ -5008,6 +6390,14 @@
@@ -5017,6 +6399,14 @@
wined3d_texture_decref(src_texture);
if (context)
context_release(context);
@ -8680,7 +8680,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return hr;
}
@@ -5042,6 +6432,7 @@
@@ -5051,6 +6441,7 @@
cpu_blit_depth_fill,
};
@ -8688,7 +8688,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
void surface_blt_ugly(struct wined3d_surface *dst_surface, const RECT *dst_rect,
struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags,
const WINEDDBLTFX *fx, enum wined3d_texture_filter_type filter)
@@ -5049,6 +6440,16 @@
@@ -5058,6 +6449,16 @@
struct wined3d_swapchain *src_swapchain, *dst_swapchain;
struct wined3d_device *device = dst_surface->resource.device;
DWORD src_ds_flags, dst_ds_flags;
@ -8705,7 +8705,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
BOOL scale, convert;
static const DWORD simple_blit = WINEDDBLT_ASYNC
@@ -5057,6 +6458,106 @@
@@ -5066,6 +6467,106 @@
| WINEDDBLT_DEPTHFILL
| WINEDDBLT_DONOTWAIT;
@ -8812,7 +8812,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (!device->d3d_initialized)
{
WARN("D3D not initialized, using fallback.\n");
@@ -5099,8 +6600,13 @@
@@ -5108,8 +6609,13 @@
}
scale = src_surface
@ -8826,7 +8826,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
convert = src_surface && src_surface->resource.format->id != dst_surface->resource.format->id;
dst_ds_flags = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL);
@@ -5118,6 +6624,7 @@
@@ -5127,6 +6633,7 @@
TRACE("Depth fill.\n");
if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth))
@ -8834,7 +8834,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return;
if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, dst_rect, depth)))
@@ -5136,6 +6643,32 @@
@@ -5145,6 +6652,32 @@
* implement those in the CPU blitter at the moment. */
if ((dst_surface->resource.locations & dst_surface->resource.map_binding)
&& (!src_surface || (src_surface->resource.locations & src_surface->resource.map_binding)))
@ -8867,7 +8867,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
if (scale)
TRACE("Not doing sysmem blit because of scaling.\n");
@@ -5154,6 +6687,7 @@
@@ -5163,6 +6696,7 @@
if (!surface_convert_color_to_float(dst_surface, fx->u5.dwFillColor, &color))
goto fallback;
@ -8875,7 +8875,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
if (SUCCEEDED(surface_color_fill(dst_surface, dst_rect, &color)))
return;
}
@@ -5164,6 +6698,18 @@
@@ -5173,6 +6707,18 @@
/* Upload */
if ((src_surface->resource.locations & WINED3D_LOCATION_SYSMEM)
&& !(dst_surface->resource.locations & WINED3D_LOCATION_SYSMEM))
@ -8894,7 +8894,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
{
if (scale)
TRACE("Not doing upload because of scaling.\n");
@@ -5171,6 +6717,7 @@
@@ -5180,6 +6726,7 @@
TRACE("Not doing upload because of format conversion.\n");
else
{
@ -8902,7 +8902,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
POINT dst_point = {dst_rect->left, dst_rect->top};
if (SUCCEEDED(surface_upload_from_surface(dst_surface, &dst_point, src_surface, src_rect)))
@@ -5183,6 +6730,15 @@
@@ -5192,6 +6739,15 @@
context_release(context);
}
return;
@ -8918,7 +8918,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
}
}
@@ -5207,6 +6763,7 @@
@@ -5216,6 +6772,7 @@
wined3d_swapchain_present(dst_swapchain, NULL, NULL, dst_swapchain->win_handle, NULL, 0);
dst_swapchain->desc.swap_effect = swap_effect;
@ -8926,7 +8926,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
return;
}
@@ -5403,6 +6960,50 @@
@@ -5412,6 +6969,50 @@
wined3d_surface_location_invalidated,
wined3d_surface_load_location,
};
@ -8977,7 +8977,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_texture *container,
const struct wined3d_resource_desc *desc, GLenum target, unsigned int level, unsigned int layer, DWORD flags)
@@ -5470,7 +7071,11 @@
@@ -5479,7 +7080,11 @@
}
surface->container = container;
@ -8989,7 +8989,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
list_init(&surface->renderbuffers);
list_init(&surface->overlays);
@@ -5502,9 +7107,14 @@
@@ -5511,9 +7116,14 @@
if (surface->resource.map_binding == WINED3D_LOCATION_DIB)
{
wined3d_resource_free_sysmem(&surface->resource);
@ -9004,7 +9004,7 @@ diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
}
return hr;
@@ -5531,7 +7141,11 @@
@@ -5540,7 +7150,11 @@
if (FAILED(hr = surface_init(object, container, desc, target, level, layer, flags)))
{
WARN("Failed to initialize surface, returning %#x.\n", hr);

View File

@ -1,26 +1,35 @@
From fe8ff690267d0e3dbc4d7731dce1276bee2f037e Mon Sep 17 00:00:00 2001
From 6d4d989e34576a46c5b513b92bd8dbc84aaf199a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 20 Sep 2014 02:48:07 +0200
Subject: wined3d: Add support for DXTn software decoding through libtxc_dxtn.
(rev 2)
Changes in rev 2:
* Do not use dxtn library when some imports are missing.
* Do not advertise dxtn converter functions when they are not supported (because
of missing library or support not compiled in).
---
configure.ac | 9 ++
dlls/wined3d/Makefile.in | 1 +
dlls/wined3d/dxtn.c | 325 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 70 +++++++++
dlls/wined3d/dxtn.c | 332 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 80 ++++++++++
dlls/wined3d/wined3d_main.c | 5 +
dlls/wined3d/wined3d_private.h | 8 +
6 files changed, 418 insertions(+)
dlls/wined3d/wined3d_private.h | 13 ++
6 files changed, 440 insertions(+)
create mode 100644 dlls/wined3d/dxtn.c
diff --git a/configure.ac b/configure.ac
index ea016b1..c982f39 100644
index 8263c66..dd89c17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,2 +76,3 @@ AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner
@@ -74,6 +74,7 @@ AC_ARG_WITH(pthread, AS_HELP_STRING([--without-pthread],[do not use the pthrea
[if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF]))
+AC_ARG_WITH(txc_dxtn, AS_HELP_STRING([--without-txc_dxtn],[do not use txc_dxtn lib (DXTn software support)]))
AC_ARG_WITH(v4l, AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
@@ -1698,6 +1699,14 @@ fi
WINE_NOTICE_WITH(tiff,[test "x$ac_cv_lib_soname_tiff" = "x"],
[libtiff ${notice_platform}development files not found, TIFF won't be supported.])
@ -50,10 +59,10 @@ index 655800b..ee0615f 100644
nvidia_texture_shader.c \
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
new file mode 100644
index 0000000..91b0c3d
index 0000000..eccce4e
--- /dev/null
+++ b/dlls/wined3d/dxtn.c
@@ -0,0 +1,325 @@
@@ -0,0 +1,332 @@
+/*
+ * Copyright 2014 Michael Müller
+ *
@ -213,11 +222,8 @@ index 0000000..91b0c3d
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!pfetch_2d_texel_rgba_dxt1)
+ {
+ FIXME("Failed to decode DXT1 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -236,11 +242,8 @@ index 0000000..91b0c3d
+BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!ptx_compress_dxtn)
+ {
+ FIXME("Failed to encode DXT1 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -267,11 +270,8 @@ index 0000000..91b0c3d
+BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!ptx_compress_dxtn)
+ {
+ FIXME("Failed to encode DXT3 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -292,11 +292,8 @@ index 0000000..91b0c3d
+BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!ptx_compress_dxtn)
+ {
+ FIXME("Failed to encode DXT5 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -323,12 +320,28 @@ index 0000000..91b0c3d
+ return FALSE;
+ }
+
+ #define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(txc_dxtn_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f);}
+ #define LOAD_FUNCPTR(f) \
+ if (!(p##f = wine_dlsym(txc_dxtn_handle, #f, NULL, 0))) \
+ { \
+ ERR("Can't find symbol %s in %s, DXTn software support unavailable.\n", #f, SONAME_LIBTXC_DXTN); \
+ goto error; \
+ }
+
+ LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt1);
+ LOAD_FUNCPTR(tx_compress_dxtn);
+ #undef LOAD_FUNCPTR
+
+ #undef LOAD_FUNCPTR
+ return TRUE;
+
+error:
+ wine_dlclose(txc_dxtn_handle, NULL, 0);
+ txc_dxtn_handle = NULL;
+ return FALSE;
+}
+
+BOOL wined3d_dxtn_supported(void)
+{
+ return (txc_dxtn_handle != NULL);
+}
+
+void wined3d_dxtn_free(void)
@ -342,7 +355,6 @@ index 0000000..91b0c3d
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert DXT1 texture. Wine is compiled without DXT1 support.\n");
+ return FALSE;
+}
+
@ -350,21 +362,18 @@ index 0000000..91b0c3d
+BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert to DXT1 texture. Wine is compiled without DXT1 support.\n");
+ return FALSE;
+}
+
+BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert to DXT3 texture. Wine is compiled without DXT3 support.\n");
+ return FALSE;
+}
+
+BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert to DXT5 texture. Wine is compiled without DXT5 support.\n");
+ return FALSE;
+}
+
@ -373,6 +382,13 @@ index 0000000..91b0c3d
+ return FALSE;
+}
+
+BOOL wined3d_dxtn_supported(void)
+{
+ static int once;
+ if (!once++) FIXME("Wine is compiled without DXTn support, expect texture problems.\n");
+ return FALSE;
+}
+
+void wined3d_dxtn_free(void)
+{
+ /* nothing to do */
@ -381,10 +397,10 @@ index 0000000..91b0c3d
+#endif
\ No newline at end of file
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 092cbe6..2f9d323 100644
index fb27c8a..b9f6a12 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2415,6 +2415,66 @@ static void convert_yuy2_r5g6b5(const BYTE *src, BYTE *dst,
@@ -2416,6 +2416,66 @@ static void convert_yuy2_r5g6b5(const BYTE *src, BYTE *dst,
}
}
@ -451,10 +467,12 @@ index 092cbe6..2f9d323 100644
struct d3dfmt_converter_desc
{
enum wined3d_format_id from, to;
@@ -2429,6 +2489,16 @@ static const struct d3dfmt_converter_desc converters[] =
{WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_B8G8R8A8_UNORM, convert_a8r8g8b8_x8r8g8b8},
{WINED3DFMT_YUY2, WINED3DFMT_B8G8R8X8_UNORM, convert_yuy2_x8r8g8b8},
@@ -2432,6 +2492,20 @@ static const struct d3dfmt_converter_desc converters[] =
{WINED3DFMT_YUY2, WINED3DFMT_B5G6R5_UNORM, convert_yuy2_r5g6b5},
};
+static const struct d3dfmt_converter_desc dxtn_converters[] =
+{
+ {WINED3DFMT_DXT1, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt1_a8r8g8b8},
+ {WINED3DFMT_DXT1, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt1_x8r8g8b8},
+ {WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_DXT1, convert_a8r8g8b8_dxt1},
@ -465,9 +483,24 @@ index 092cbe6..2f9d323 100644
+ {WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_DXT3, convert_x8r8g8b8_dxt3},
+ {WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_DXT5, convert_a8r8g8b8_dxt5},
+ {WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_DXT5, convert_x8r8g8b8_dxt5}
};
+};
+
static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_format_id from,
enum wined3d_format_id to)
{
@@ -2443,6 +2517,12 @@ static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_fo
return &converters[i];
}
+ for (i = 0; i < (sizeof(dxtn_converters) / sizeof(*dxtn_converters)); ++i)
+ {
+ if (dxtn_converters[i].from == from && dxtn_converters[i].to == to)
+ return wined3d_dxtn_supported() ? &dxtn_converters[i] : NULL;
+ }
+
return NULL;
}
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 758ba43..08021a2 100644
--- a/dlls/wined3d/wined3d_main.c
@ -492,24 +525,29 @@ index 758ba43..08021a2 100644
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index f4ded4f..c1df04c 100644
index 047946b..75ec61d 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3120,6 +3120,14 @@ static inline void context_apply_state(struct wined3d_context *context,
@@ -3170,6 +3170,19 @@ static inline void context_apply_state(struct wined3d_context *context,
state_table[rep].apply(context, state, rep);
}
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
+BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
+BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
+BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
+
+BOOL wined3d_dxtn_init(void);
+void wined3d_dxtn_free(void);
+BOOL wined3d_dxtn_init(void) DECLSPEC_HIDDEN;
+BOOL wined3d_dxtn_supported(void) DECLSPEC_HIDDEN;
+void wined3d_dxtn_free(void) DECLSPEC_HIDDEN;
+
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
#define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL"
--
1.9.1
2.2.1

View File

@ -1,19 +1,19 @@
From 4222334f4c1f6107fc323149456c8684ace91a86 Mon Sep 17 00:00:00 2001
From 417bd12edc493639c12f1e0199e55609fc1f7711 Mon Sep 17 00:00:00 2001
From: Christian Costa <titan.costa@gmail.com>
Date: Tue, 4 Nov 2014 22:41:45 +0100
Subject: wined3d: Improve DXTn support and export conversion functions for
d3dx9_36.
---
dlls/wined3d/dxtn.c | 128 +++++++++++++++++++++++++++++++++++++++++
dlls/wined3d/surface.c | 32 +++++++++++
dlls/wined3d/wined3d.spec | 7 +++
dlls/wined3d/wined3d_private.h | 5 --
include/wine/wined3d.h | 7 +++
5 files changed, 174 insertions(+), 5 deletions(-)
dlls/wined3d/dxtn.c | 121 ++++++++++++++++++++++++++++++++++++++++-
dlls/wined3d/surface.c | 31 +++++++++++
dlls/wined3d/wined3d.spec | 8 +++
dlls/wined3d/wined3d_private.h | 10 ----
include/wine/wined3d.h | 14 +++++
5 files changed, 173 insertions(+), 11 deletions(-)
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
index 9c5eef9..c9889cc 100644
index eccce4e..6623e64 100644
--- a/dlls/wined3d/dxtn.c
+++ b/dlls/wined3d/dxtn.c
@@ -27,6 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
@ -96,18 +96,15 @@ index 9c5eef9..c9889cc 100644
static inline BOOL x8r8g8b8_to_dxtn(const BYTE *src, BYTE *dst, DWORD pitch_in,
DWORD pitch_out, unsigned int w, unsigned int h, GLenum destformat, BOOL alpha)
{
@@ -177,6 +243,52 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
@@ -174,6 +240,46 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return FALSE;
}
+BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!pfetch_2d_texel_rgba_dxt3)
+ {
+ FIXME("Failed to decode DXT3 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -126,11 +123,8 @@ index 9c5eef9..c9889cc 100644
+BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ if (!pfetch_2d_texel_rgba_dxt5)
+ {
+ FIXME("Failed to decode DXT5 image, there is a problem with %s.\n", SONAME_LIBTXC_DXTN);
+ if (!txc_dxtn_handle)
+ return FALSE;
+ }
+
+ switch (format)
+ {
@ -149,37 +143,41 @@ index 9c5eef9..c9889cc 100644
BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
enum wined3d_format_id format, unsigned int w, unsigned int h)
{
@@ -269,6 +381,8 @@ BOOL wined3d_dxtn_init(void)
@@ -263,6 +369,8 @@ BOOL wined3d_dxtn_init(void)
}
#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(txc_dxtn_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f);}
LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt1);
+ LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt3);
+ LOAD_FUNCPTR(fetch_2d_texel_rgba_dxt5);
LOAD_FUNCPTR(tx_compress_dxtn);
#undef LOAD_FUNCPTR
@@ -298,6 +412,13 @@ BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
#undef LOAD_FUNCPTR
@@ -293,19 +401,30 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return FALSE;
}
-
BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
enum wined3d_format_id format, unsigned int w, unsigned int h)
{
return FALSE;
}
+BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert DXT3 texture. Wine is compiled without DXT3 support.\n");
+ return FALSE;
+}
+
BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
enum wined3d_format_id format, unsigned int w, unsigned int h)
{
@@ -305,6 +426,13 @@ BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return FALSE;
}
+BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h)
+{
+ FIXME("Failed to convert DXT5 texture. Wine is compiled without DXT5 support.\n");
+ return FALSE;
+}
+
@ -187,10 +185,10 @@ index 9c5eef9..c9889cc 100644
enum wined3d_format_id format, unsigned int w, unsigned int h)
{
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 2f9d323..e224df4 100644
index c91ba74..4fc917d 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2427,6 +2427,30 @@ static void convert_dxt1_x8r8g8b8(const BYTE *src, BYTE *dst,
@@ -2428,6 +2428,30 @@ static void convert_dxt1_x8r8g8b8(const BYTE *src, BYTE *dst,
wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
}
@ -221,11 +219,10 @@ index 2f9d323..e224df4 100644
static void convert_a8r8g8b8_dxt1(const BYTE *src, BYTE *dst,
DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
{
@@ -2489,8 +2513,16 @@ static const struct d3dfmt_converter_desc converters[] =
{WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_B8G8R8A8_UNORM, convert_a8r8g8b8_x8r8g8b8},
{WINED3DFMT_YUY2, WINED3DFMT_B8G8R8X8_UNORM, convert_yuy2_x8r8g8b8},
{WINED3DFMT_YUY2, WINED3DFMT_B5G6R5_UNORM, convert_yuy2_r5g6b5},
+
@@ -2494,8 +2518,15 @@ static const struct d3dfmt_converter_desc converters[] =
static const struct d3dfmt_converter_desc dxtn_converters[] =
{
+ /* decode DXT */
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt1_a8r8g8b8},
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt1_x8r8g8b8},
@ -239,14 +236,15 @@ index 2f9d323..e224df4 100644
{WINED3DFMT_B8G8R8X8_UNORM, WINED3DFMT_DXT1, convert_x8r8g8b8_dxt1},
{WINED3DFMT_B5G5R5A1_UNORM, WINED3DFMT_DXT1, convert_a1r5g5b5_dxt1},
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 7a77003..eca8875 100644
index 7a77003..9ce4981 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -288,3 +288,10 @@
@@ -288,3 +288,11 @@
@ cdecl wined3d_volume_map(ptr ptr ptr long)
@ cdecl wined3d_volume_preload(ptr)
@ cdecl wined3d_volume_unmap(ptr)
+
+@ cdecl wined3d_dxtn_supported()
+@ cdecl wined3d_dxt1_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt1_encode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt3_decode(ptr ptr long long long long long)
@ -254,37 +252,50 @@ index 7a77003..eca8875 100644
+@ cdecl wined3d_dxt5_decode(ptr ptr long long long long long)
+@ cdecl wined3d_dxt5_encode(ptr ptr long long long long long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e47f5ce..8112cbc 100644
index 75ec61d..6ebb210 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -3151,11 +3151,6 @@ static inline void context_apply_state(struct wined3d_context *context,
@@ -3170,17 +3170,7 @@ static inline void context_apply_state(struct wined3d_context *context,
state_table[rep].apply(context, state, rep);
}
-BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
-BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
- enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
-BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
- enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
-BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
- enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
-BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
- enum wined3d_format_id format, unsigned int w, unsigned int h) DECLSPEC_HIDDEN;
-
BOOL wined3d_dxtn_init(void);
void wined3d_dxtn_free(void);
BOOL wined3d_dxtn_init(void) DECLSPEC_HIDDEN;
-BOOL wined3d_dxtn_supported(void) DECLSPEC_HIDDEN;
void wined3d_dxtn_free(void) DECLSPEC_HIDDEN;
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 0cf26e1..3e3ac86 100644
index 6e06388..92e8169 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2590,4 +2590,11 @@ static inline unsigned int wined3d_log2i(unsigned int x)
@@ -2597,4 +2597,18 @@ static inline unsigned int wined3d_log2i(unsigned int x)
#endif
}
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt1_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt3_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt5_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxt5_encode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
+ enum wined3d_format_id format, unsigned int w, unsigned int h);
+BOOL wined3d_dxtn_supported(void);
+
#endif /* __WINE_WINED3D_H */
--
1.9.1
2.2.1

View File

@ -1,4 +1,4 @@
From 845cd7d5bb57a9d54987de39073f2efd2de5ccc4 Mon Sep 17 00:00:00 2001
From 69d910d52fb2c6a98a6658faa2efa9b95982e68b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 26 Nov 2014 14:24:57 +0100
Subject: wined3d: add DXT1 to B4G4R4A4, DXT1 to B5G5R5A1 and DXT3 to B4G4R4A4
@ -10,7 +10,7 @@ Subject: wined3d: add DXT1 to B4G4R4A4, DXT1 to B5G5R5A1 and DXT3 to B4G4R4A4
2 files changed, 150 insertions(+)
diff --git a/dlls/wined3d/dxtn.c b/dlls/wined3d/dxtn.c
index c9889cc..fa8c789 100644
index 6623e64..57da0df 100644
--- a/dlls/wined3d/dxtn.c
+++ b/dlls/wined3d/dxtn.c
@@ -64,6 +64,70 @@ static inline BOOL dxt1_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in,
@ -123,7 +123,7 @@ index c9889cc..fa8c789 100644
static inline BOOL dxt5_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in,
DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
{
@@ -235,6 +331,14 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
@@ -232,6 +328,14 @@ BOOL wined3d_dxt1_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return dxt1_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, TRUE);
case WINED3DFMT_B8G8R8X8_UNORM:
return dxt1_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, FALSE);
@ -138,7 +138,7 @@ index c9889cc..fa8c789 100644
default:
break;
}
@@ -258,6 +362,10 @@ BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
@@ -252,6 +356,10 @@ BOOL wined3d_dxt3_decode(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch
return dxt3_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, TRUE);
case WINED3DFMT_B8G8R8X8_UNORM:
return dxt3_to_x8r8g8b8(src, dst, pitch_in, pitch_out, w, h, FALSE);
@ -150,10 +150,10 @@ index c9889cc..fa8c789 100644
break;
}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index e224df4..a123ffd 100644
index 4fc917d..689fc0e 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -2427,6 +2427,30 @@ static void convert_dxt1_x8r8g8b8(const BYTE *src, BYTE *dst,
@@ -2428,6 +2428,30 @@ static void convert_dxt1_x8r8g8b8(const BYTE *src, BYTE *dst,
wined3d_dxt1_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
}
@ -184,7 +184,7 @@ index e224df4..a123ffd 100644
static void convert_dxt3_a8r8g8b8(const BYTE *src, BYTE *dst,
DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
{
@@ -2439,6 +2463,18 @@ static void convert_dxt3_x8r8g8b8(const BYTE *src, BYTE *dst,
@@ -2440,6 +2464,18 @@ static void convert_dxt3_x8r8g8b8(const BYTE *src, BYTE *dst,
wined3d_dxt3_decode(src, dst, pitch_in, pitch_out, WINED3DFMT_B8G8R8X8_UNORM, w, h);
}
@ -203,7 +203,7 @@ index e224df4..a123ffd 100644
static void convert_dxt5_a8r8g8b8(const BYTE *src, BYTE *dst,
DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h)
{
@@ -2517,8 +2553,14 @@ static const struct d3dfmt_converter_desc converters[] =
@@ -2521,8 +2557,14 @@ static const struct d3dfmt_converter_desc dxtn_converters[] =
/* decode DXT */
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8A8_UNORM, convert_dxt1_a8r8g8b8},
{WINED3DFMT_DXT1, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt1_x8r8g8b8},
@ -219,5 +219,5 @@ index e224df4..a123ffd 100644
{WINED3DFMT_DXT5, WINED3DFMT_B8G8R8X8_UNORM, convert_dxt5_x8r8g8b8},
--
1.9.1
2.2.1