39 TRACE(
"Converting %ux%u pixels, pitches %u %u\n",
w,
h, pitch_in, pitch_out);
41 for (
y = 0;
y <
h; ++
y)
44 for (
x = 0;
x <
w; ++
x)
51 dst_line[
x] = (
color & 0xff00ff00) | ((
color & 0xff) << 16) |
52 ((
color & 0xff0000) >> 16);
56 dst_line[
x] = 0xff000000 | ((
color & 0xff) << 16) |
71 TRACE(
"Converting %ux%u pixels, pitches %u %u\n",
w,
h, pitch_in, pitch_out);
73 for (
y = 0;
y <
h; ++
y)
76 for (
x = 0;
x <
w; ++
x)
83 dst_line[
x] = ((
color & 0xf0000000) >> 16) | ((
color & 0xf00000) >> 20) |
84 ((
color & 0xf000) >> 8) | ((
color & 0xf0) << 4);
88 dst_line[
x] = 0xf000 | ((
color & 0xf00000) >> 20) |
89 ((
color & 0xf000) >> 8) | ((
color & 0xf0) << 4);
103 TRACE(
"Converting %ux%u pixels, pitches %u %u\n",
w,
h, pitch_in, pitch_out);
105 for (
y = 0;
y <
h; ++
y)
108 for (
x = 0;
x <
w; ++
x)
115 dst_line[
x] = ((
color & 0x80000000) >> 16) | ((
color & 0xf80000) >> 19) |
116 ((
color & 0xf800) >> 6) | ((
color & 0xf8) << 7);
120 dst_line[
x] = 0x8000 | ((
color & 0xf80000) >> 19) |
121 ((
color & 0xf800) >> 6) | ((
color & 0xf8) << 7);
135 TRACE(
"Converting %ux%u pixels, pitches %u %u\n",
w,
h, pitch_in, pitch_out);
137 for (
y = 0;
y <
h; ++
y)
140 for (
x = 0;
x <
w; ++
x)
147 dst_line[
x] = (
color & 0xff00ff00) | ((
color & 0xff) << 16) |
148 ((
color & 0xff0000) >> 16);
152 dst_line[
x] = 0xff000000 | ((
color & 0xff) << 16) |
153 (
color & 0xff00) | ((
color & 0xff0000) >> 16);
167 TRACE(
"Converting %ux%u pixels, pitches %u %u\n",
w,
h, pitch_in, pitch_out);
169 for (
y = 0;
y <
h; ++
y)
172 for (
x = 0;
x <
w; ++
x)
179 dst_line[
x] = ((
color & 0xf0000000) >> 16) | ((
color & 0xf00000) >> 20) |
180 ((
color & 0xf000) >> 8) | ((
color & 0xf0) << 4);
184 dst_line[
x] = 0xf000 | ((
color & 0xf00000) >> 20) |
185 ((
color & 0xf000) >> 8) | ((
color & 0xf0) << 4);
199 TRACE(
"Converting %ux%u pixels, pitches %u %u\n",
w,
h, pitch_in, pitch_out);
201 for (
y = 0;
y <
h; ++
y)
204 for (
x = 0;
x <
w; ++
x)
211 dst_line[
x] = (
color & 0xff00ff00) | ((
color & 0xff) << 16) |
212 ((
color & 0xff0000) >> 16);
216 dst_line[
x] = 0xff000000 | ((
color & 0xff) << 16) |
217 (
color & 0xff00) | ((
color & 0xff0000) >> 16);
231 TRACE(
"Converting %ux%u pixels, pitches %u %u\n",
w,
h, pitch_in, pitch_out);
236 ERR(
"Failed to allocate memory for conversion\n");
240 for (
y = 0;
y <
h; ++
y)
244 for (
x = 0;
x <
w; ++
x)
249 dst_line[
x] = (
color & 0xff00ff00) | ((
color & 0xff) << 16) |
250 ((
color & 0xff0000) >> 16);
254 dst_line[
x] = 0xff000000 | ((
color & 0xff) << 16) |
255 (
color & 0xff00) | ((
color & 0xff0000) >> 16);
268 static const unsigned char convert_5to8[] =
270 0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3a,
271 0x42, 0x4a, 0x52, 0x5a, 0x63, 0x6b, 0x73, 0x7b,
272 0x84, 0x8c, 0x94, 0x9c, 0xa5, 0xad, 0xb5, 0xbd,
273 0xc5, 0xce, 0xd6, 0xde, 0xe6, 0xef, 0xf7, 0xff,
279 TRACE(
"Converting %ux%u pixels, pitches %u %u.\n",
w,
h, pitch_in, pitch_out);
284 ERR(
"Failed to allocate memory for conversion\n");
288 for (
y = 0;
y <
h; ++
y)
290 const WORD *src_line = (
const WORD *)(
src +
y * pitch_in);
292 for (
x = 0;
x <
w; ++
x)
297 dst_line[
x] = ((
color & 0x8000) ? 0xff000000 : 0) |
298 convert_5to8[(
color & 0x001f)] << 16 |
299 convert_5to8[(
color & 0x03e0) >> 5] << 8 |
300 convert_5to8[(
color & 0x7c00) >> 10];
304 dst_line[
x] = 0xff000000 |
305 convert_5to8[(
color & 0x001f)] << 16 |
306 convert_5to8[(
color & 0x03e0) >> 5] << 8 |
307 convert_5to8[(
color & 0x7c00) >> 10];
463 static const char *soname[] =
465#ifdef SONAME_LIBTXC_DXTN
470 "libtxc_dxtn_s2tc.dylib",
473 "libtxc_dxtn_s2tc.so.0"
477 for (
i = 0;
i <
sizeof(soname)/
sizeof(soname[0]);
i++)
485 FIXME(
"Wine cannot find the txc_dxtn library, DXTn software support unavailable.\n");
489 #define LOAD_FUNCPTR(f) \
490 if (!(p##f = wine_dlsym(txc_dxtn_handle, #f, NULL, 0))) \
492 ERR("Can't find symbol %s , DXTn software support unavailable.\n", #f); \
void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, const GLubyte *srcPixData, GLenum destFormat, GLubyte *dest, GLint dstRowStride)
void fetch_2d_texel_rgba_dxt3(GLint srcRowStride, const GLubyte *pixdata, GLint i, GLint j, GLvoid *texel)
void fetch_2d_texel_rgba_dxt1(GLint srcRowStride, const GLubyte *pixdata, GLint i, GLint j, GLvoid *texel)
void fetch_2d_texel_rgba_dxt5(GLint srcRowStride, const GLubyte *pixdata, GLint i, GLint j, GLvoid *texel)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
const char * debug_d3dformat(enum wined3d_format_id format_id)
#define HeapFree(x, y, z)
static BOOL dxt1_to_x4r4g4b4(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
static void(* pfetch_2d_texel_rgba_dxt5)(int srcRowStride, const BYTE *pixData, int i, int j, DWORD *texel)
static BOOL dxt1_to_x1r5g5b5(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
static BOOL dxt5_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
static 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)
static BOOL dxt3_to_x4r4g4b4(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
static void(* pfetch_2d_texel_rgba_dxt1)(int srcRowStride, const BYTE *pixData, int i, int j, DWORD *texel)
BOOL wined3d_dxtn_init(void)
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)
void wined3d_dxtn_free(void)
static BOOL dxt3_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
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)
static void * txc_dxtn_handle
static BOOL dxt1_to_x8r8g8b8(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h, BOOL alpha)
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)
static void(* pfetch_2d_texel_rgba_dxt3)(int srcRowStride, const BYTE *pixData, int i, int j, DWORD *texel)
static void(* ptx_compress_dxtn)(int comps, int width, int height, const BYTE *srcPixData, GLenum destformat, BYTE *dest, int dstRowStride)
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)
static BOOL x1r5g5b5_to_dxtn(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h, GLenum destformat, BOOL alpha)
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_dxtn_supported(void)
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)
GLint GLint GLint GLint GLint x
GLclampf GLclampf GLclampf alpha
GLint GLint GLint GLint GLint GLint y
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
GLubyte GLubyte GLubyte GLubyte w
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
void * wine_dlopen(const char *filename, int flag, char *error, size_t errorsize)
int wine_dlclose(void *handle, char *error, size_t errorsize)
#define SONAME_LIBTXC_DXTN
@ WINED3DFMT_B4G4R4A4_UNORM
@ WINED3DFMT_B8G8R8A8_UNORM
@ WINED3DFMT_B8G8R8X8_UNORM
@ WINED3DFMT_B5G5R5X1_UNORM
@ WINED3DFMT_B5G5R5A1_UNORM
@ WINED3DFMT_B4G4R4X4_UNORM