1999-01-03 18:00:19 +01:00
|
|
|
/* Direct3D Texture
|
2002-03-10 00:29:33 +01:00
|
|
|
* Copyright (c) 1998 Lionel ULMER
|
|
|
|
*
|
|
|
|
* This file contains the implementation of interface Direct3DTexture2.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
|
|
#include "config.h"
|
2001-10-14 18:18:52 +02:00
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
1999-01-03 18:00:19 +01:00
|
|
|
#include "winerror.h"
|
1999-02-02 17:14:23 +01:00
|
|
|
#include "wine/obj_base.h"
|
1999-01-03 18:00:19 +01:00
|
|
|
#include "ddraw.h"
|
|
|
|
#include "d3d.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-01-03 18:00:19 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
#include "mesa_private.h"
|
1999-01-03 18:00:19 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
#define D3DDPRIVATE(x) mesa_d3dd_private*odev=(mesa_d3dd_private*)(x)->private
|
|
|
|
#define D3DTPRIVATE(x) mesa_d3dt_private*dtpriv=(mesa_d3dt_private*)(x)->private
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ddraw);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
1999-01-23 13:32:46 +01:00
|
|
|
/* Define this if you want to save to a file all the textures used by a game
|
|
|
|
(can be funny to see how they managed to cram all the pictures in
|
|
|
|
texture memory) */
|
|
|
|
#undef TEXTURE_SNOOP
|
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
#ifdef TEXTURE_SNOOP
|
2000-02-12 14:20:20 +01:00
|
|
|
#include <stdio.h>
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
#define SNOOP_PALETTED() \
|
|
|
|
{ \
|
|
|
|
FILE *f; \
|
|
|
|
char buf[32]; \
|
|
|
|
int x, y; \
|
|
|
|
\
|
2000-04-09 16:30:50 +02:00
|
|
|
sprintf(buf, "%ld.pnm", dtpriv->tex_name); \
|
1999-04-06 09:10:48 +02:00
|
|
|
f = fopen(buf, "wb"); \
|
|
|
|
fprintf(f, "P6\n%ld %ld\n255\n", src_d->dwWidth, src_d->dwHeight); \
|
|
|
|
for (y = 0; y < src_d->dwHeight; y++) { \
|
|
|
|
for (x = 0; x < src_d->dwWidth; x++) { \
|
|
|
|
unsigned char c = ((unsigned char *) src_d->y.lpSurface)[y * src_d->dwWidth + x]; \
|
|
|
|
fputc(table[c][0], f); \
|
|
|
|
fputc(table[c][1], f); \
|
|
|
|
fputc(table[c][2], f); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
fclose(f); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define SNOOP_5650() \
|
|
|
|
{ \
|
|
|
|
FILE *f; \
|
|
|
|
char buf[32]; \
|
|
|
|
int x, y; \
|
|
|
|
\
|
2000-04-09 16:30:50 +02:00
|
|
|
sprintf(buf, "%ld.pnm", dtpriv->tex_name); \
|
1999-04-06 09:10:48 +02:00
|
|
|
f = fopen(buf, "wb"); \
|
|
|
|
fprintf(f, "P6\n%ld %ld\n255\n", src_d->dwWidth, src_d->dwHeight); \
|
|
|
|
for (y = 0; y < src_d->dwHeight; y++) { \
|
|
|
|
for (x = 0; x < src_d->dwWidth; x++) { \
|
|
|
|
unsigned short c = ((unsigned short *) src_d->y.lpSurface)[y * src_d->dwWidth + x]; \
|
|
|
|
fputc((c & 0xF800) >> 8, f); \
|
|
|
|
fputc((c & 0x07E0) >> 3, f); \
|
|
|
|
fputc((c & 0x001F) << 3, f); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
fclose(f); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define SNOOP_5551() \
|
|
|
|
{ \
|
|
|
|
FILE *f; \
|
|
|
|
char buf[32]; \
|
|
|
|
int x, y; \
|
|
|
|
\
|
2000-04-09 16:30:50 +02:00
|
|
|
sprintf(buf, "%ld.pnm", dtpriv->tex_name); \
|
1999-04-06 09:10:48 +02:00
|
|
|
f = fopen(buf, "wb"); \
|
|
|
|
fprintf(f, "P6\n%ld %ld\n255\n", src_d->dwWidth, src_d->dwHeight); \
|
|
|
|
for (y = 0; y < src_d->dwHeight; y++) { \
|
|
|
|
for (x = 0; x < src_d->dwWidth; x++) { \
|
|
|
|
unsigned short c = ((unsigned short *) src_d->y.lpSurface)[y * src_d->dwWidth + x]; \
|
|
|
|
fputc((c & 0xF800) >> 8, f); \
|
|
|
|
fputc((c & 0x07C0) >> 3, f); \
|
|
|
|
fputc((c & 0x003E) << 2, f); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
fclose(f); \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define SNOOP_PALETTED()
|
|
|
|
#define SNOOP_5650()
|
|
|
|
#define SNOOP_5551()
|
|
|
|
#endif
|
|
|
|
|
2000-07-16 16:40:35 +02:00
|
|
|
extern ICOM_VTABLE(IDirect3DTexture2) mesa_texture2_vtable;
|
|
|
|
extern ICOM_VTABLE(IDirect3DTexture) mesa_texture_vtable;
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* Texture2 Creation functions
|
|
|
|
*/
|
2001-01-04 23:44:55 +01:00
|
|
|
LPDIRECT3DTEXTURE2 d3dtexture2_create(IDirectDrawSurfaceImpl* surf)
|
1999-01-03 18:00:19 +01:00
|
|
|
{
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirect3DTexture2Impl* tex;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
tex = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture2Impl));
|
|
|
|
tex->ref = 1;
|
2000-07-16 16:40:35 +02:00
|
|
|
ICOM_VTBL(tex) = &mesa_texture2_vtable;
|
1999-03-27 17:56:13 +01:00
|
|
|
tex->surface = surf;
|
2000-07-16 16:40:35 +02:00
|
|
|
|
|
|
|
tex->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dt_private));
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
return (LPDIRECT3DTEXTURE2)tex;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* Texture Creation functions
|
|
|
|
*/
|
2001-01-04 23:44:55 +01:00
|
|
|
LPDIRECT3DTEXTURE d3dtexture_create(IDirectDrawSurfaceImpl* surf)
|
1999-01-03 18:00:19 +01:00
|
|
|
{
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirect3DTexture2Impl* tex;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
tex = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirect3DTexture2Impl));
|
|
|
|
tex->ref = 1;
|
2000-07-16 16:40:35 +02:00
|
|
|
ICOM_VTBL(tex) = (ICOM_VTABLE(IDirect3DTexture2)*)&mesa_texture_vtable;
|
1999-03-27 17:56:13 +01:00
|
|
|
tex->surface = surf;
|
2000-07-16 16:40:35 +02:00
|
|
|
|
|
|
|
tex->private = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(mesa_d3dt_private));
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
return (LPDIRECT3DTEXTURE)tex;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* IDirectSurface callback methods
|
|
|
|
*/
|
|
|
|
HRESULT WINAPI SetColorKey_cb(IDirect3DTexture2Impl *texture, DWORD dwFlags, LPDDCOLORKEY ckey )
|
|
|
|
{
|
|
|
|
DDSURFACEDESC *tex_d;
|
2000-04-09 16:30:50 +02:00
|
|
|
D3DTPRIVATE(texture);
|
1999-04-06 09:10:48 +02:00
|
|
|
int bpp;
|
|
|
|
GLuint current_texture;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-06-26 21:09:08 +02:00
|
|
|
TRACE("(%p) : colorkey callback\n", texture);
|
1999-04-06 09:10:48 +02:00
|
|
|
|
|
|
|
/* Get the texture description */
|
2001-01-04 23:44:55 +01:00
|
|
|
tex_d = (DDSURFACEDESC *)&(texture->surface->surface_desc);
|
1999-04-06 09:10:48 +02:00
|
|
|
bpp = (tex_d->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8 ?
|
|
|
|
1 /* 8 bit of palette index */:
|
2001-01-04 23:44:55 +01:00
|
|
|
tex_d->ddpfPixelFormat.u1.dwRGBBitCount / 8 /* RGB bits for each colors */ );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
/* Now, save the current texture */
|
1999-05-13 20:53:05 +02:00
|
|
|
ENTER_GL();
|
1999-04-06 09:10:48 +02:00
|
|
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture);
|
|
|
|
|
|
|
|
/* If the GetHandle was not done yet, it's an error */
|
2000-04-09 16:30:50 +02:00
|
|
|
if (dtpriv->tex_name == 0) {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Unloaded texture !\n");
|
1999-05-13 20:53:05 +02:00
|
|
|
LEAVE_GL();
|
1999-04-06 09:10:48 +02:00
|
|
|
return DD_OK;
|
|
|
|
}
|
2000-04-09 16:30:50 +02:00
|
|
|
glBindTexture(GL_TEXTURE_2D, dtpriv->tex_name);
|
1999-04-06 09:10:48 +02:00
|
|
|
|
|
|
|
if (tex_d->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) {
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("Todo Paletted\n");
|
1999-04-06 09:10:48 +02:00
|
|
|
} else if (tex_d->ddpfPixelFormat.dwFlags & DDPF_RGB) {
|
2001-01-04 23:44:55 +01:00
|
|
|
if (tex_d->ddpfPixelFormat.u1.dwRGBBitCount == 8) {
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("Todo 3_3_2_0\n");
|
2001-01-04 23:44:55 +01:00
|
|
|
} else if (tex_d->ddpfPixelFormat.u1.dwRGBBitCount == 16) {
|
|
|
|
if (tex_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000000) {
|
1999-04-06 09:10:48 +02:00
|
|
|
/* Now transform the 5_6_5 into a 5_5_5_1 surface to support color keying */
|
|
|
|
unsigned short *dest = (unsigned short *) HeapAlloc(GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
tex_d->dwWidth * tex_d->dwHeight * bpp);
|
2001-01-04 23:44:55 +01:00
|
|
|
unsigned short *src = (unsigned short *) tex_d->lpSurface;
|
1999-04-06 09:10:48 +02:00
|
|
|
int x, y;
|
|
|
|
|
|
|
|
for (y = 0; y < tex_d->dwHeight; y++) {
|
|
|
|
for (x = 0; x < tex_d->dwWidth; x++) {
|
|
|
|
unsigned short cpixel = src[x + y * tex_d->dwWidth];
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
if ((dwFlags & DDCKEY_SRCBLT) &&
|
|
|
|
(cpixel >= ckey->dwColorSpaceLowValue) &&
|
|
|
|
(cpixel <= ckey->dwColorSpaceHighValue)) /* No alpha bit => this pixel is transparent */
|
|
|
|
dest[x + y * tex_d->dwWidth] = (cpixel & ~0x003F) | ((cpixel & 0x001F) << 1) | 0x0000;
|
|
|
|
else /* Alpha bit is set => this pixel will be seen */
|
2002-06-01 01:06:46 +02:00
|
|
|
dest[x + y * tex_d->dwWidth] = (cpixel & ~0x003F) | ((cpixel & 0x001F) << 1) | 0x0001;
|
1999-04-06 09:10:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
tex_d->dwWidth, tex_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
GL_UNSIGNED_SHORT_5_5_5_1,
|
|
|
|
dest);
|
|
|
|
|
|
|
|
/* Frees the temporary surface */
|
|
|
|
HeapFree(GetProcessHeap(),0,dest);
|
2001-01-04 23:44:55 +01:00
|
|
|
} else if (tex_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000001) {
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("Todo 5_5_5_1\n");
|
2001-01-04 23:44:55 +01:00
|
|
|
} else if (tex_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x0000000F) {
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("Todo 4_4_4_4\n");
|
1999-04-06 09:10:48 +02:00
|
|
|
} else {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Unhandled texture format (bad Aplha channel for a 16 bit texture)\n");
|
1999-04-06 09:10:48 +02:00
|
|
|
}
|
2001-01-04 23:44:55 +01:00
|
|
|
} else if (tex_d->ddpfPixelFormat.u1.dwRGBBitCount == 24) {
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("Todo 8_8_8_0\n");
|
2001-01-04 23:44:55 +01:00
|
|
|
} else if (tex_d->ddpfPixelFormat.u1.dwRGBBitCount == 32) {
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("Todo 8_8_8_8\n");
|
1999-04-06 09:10:48 +02:00
|
|
|
} else {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Unhandled texture format (bad RGB count)\n");
|
1999-04-06 09:10:48 +02:00
|
|
|
}
|
|
|
|
} else {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Unhandled texture format (neither RGB nor INDEX)\n");
|
1999-04-06 09:10:48 +02:00
|
|
|
}
|
1999-05-13 20:53:05 +02:00
|
|
|
LEAVE_GL();
|
1999-04-06 09:10:48 +02:00
|
|
|
|
|
|
|
return DD_OK;
|
|
|
|
}
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* IDirect3DTexture2 methods
|
|
|
|
*/
|
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
HRESULT WINAPI IDirect3DTexture2Impl_QueryInterface(LPDIRECT3DTEXTURE2 iface,
|
1999-01-03 18:00:19 +01:00
|
|
|
REFIID riid,
|
|
|
|
LPVOID* ppvObj)
|
|
|
|
{
|
1999-03-27 17:56:13 +01:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-01-18 06:09:49 +01:00
|
|
|
FIXME("(%p)->(%s,%p): stub\n", This, debugstr_guid(riid),ppvObj);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-03 18:00:19 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
ULONG WINAPI IDirect3DTexture2Impl_AddRef(LPDIRECT3DTEXTURE2 iface)
|
1999-01-03 18:00:19 +01:00
|
|
|
{
|
1999-03-27 17:56:13 +01:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
1999-06-26 21:09:08 +02:00
|
|
|
TRACE("(%p)->()incrementing from %lu.\n", This, This->ref );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
return ++(This->ref);
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
ULONG WINAPI IDirect3DTexture2Impl_Release(LPDIRECT3DTEXTURE2 iface)
|
1999-01-03 18:00:19 +01:00
|
|
|
{
|
1999-03-27 17:56:13 +01:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
2000-04-09 16:30:50 +02:00
|
|
|
D3DTPRIVATE(This);
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("(%p)->() decrementing from %lu.\n", This, This->ref );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
if (!--(This->ref)) {
|
1999-01-17 17:55:11 +01:00
|
|
|
/* Delete texture from OpenGL */
|
1999-05-13 20:53:05 +02:00
|
|
|
ENTER_GL();
|
2000-04-09 16:30:50 +02:00
|
|
|
glDeleteTextures(1, &(dtpriv->tex_name));
|
1999-05-13 20:53:05 +02:00
|
|
|
LEAVE_GL();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-17 17:55:11 +01:00
|
|
|
/* Release surface */
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirectDrawSurface4_Release((IDirectDrawSurface4*)This->surface);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
1999-01-03 18:00:19 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-27 17:56:13 +01:00
|
|
|
return This->ref;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IDirect3DTexture methods ***/
|
2000-04-09 16:30:50 +02:00
|
|
|
HRESULT WINAPI IDirect3DTextureImpl_GetHandle(LPDIRECT3DTEXTURE iface,
|
1999-01-03 18:00:19 +01:00
|
|
|
LPDIRECT3DDEVICE lpD3DDevice,
|
|
|
|
LPD3DTEXTUREHANDLE lpHandle)
|
|
|
|
{
|
2000-04-09 16:30:50 +02:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
|
|
|
D3DTPRIVATE(This);
|
|
|
|
IDirect3DDeviceImpl* ilpD3DDevice=(IDirect3DDeviceImpl*)lpD3DDevice;
|
|
|
|
FIXME("(%p)->(%p,%p): stub\n", This, ilpD3DDevice, lpHandle);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
*lpHandle = (D3DTEXTUREHANDLE) This;
|
1999-01-23 13:32:46 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
/* Now, bind a new texture */
|
|
|
|
ilpD3DDevice->set_context(ilpD3DDevice);
|
|
|
|
This->D3Ddevice = (void *) ilpD3DDevice;
|
2002-10-16 20:57:52 +02:00
|
|
|
ENTER_GL();
|
2000-04-09 16:30:50 +02:00
|
|
|
if (dtpriv->tex_name == 0)
|
|
|
|
glGenTextures(1, &(dtpriv->tex_name));
|
|
|
|
LEAVE_GL();
|
|
|
|
|
2002-10-16 20:57:52 +02:00
|
|
|
/* Associate the texture with the device and perform the appropriate AddRef/Release */
|
|
|
|
/* FIXME: Is there only one or several textures associated with the device ? */
|
|
|
|
if (ilpD3DDevice->current_texture)
|
|
|
|
IDirect3DTexture2Impl_Release((LPDIRECT3DTEXTURE2)ilpD3DDevice->current_texture);
|
|
|
|
IDirect3DTexture2Impl_AddRef((LPDIRECT3DTEXTURE2)iface);
|
|
|
|
ilpD3DDevice->current_texture = (IDirect3DTexture2Impl*)iface;
|
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
TRACE("OpenGL texture handle is : %d\n", dtpriv->tex_name);
|
|
|
|
|
|
|
|
return D3D_OK;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
HRESULT WINAPI IDirect3DTextureImpl_Initialize(LPDIRECT3DTEXTURE iface,
|
1999-01-03 18:00:19 +01:00
|
|
|
LPDIRECT3DDEVICE lpD3DDevice,
|
|
|
|
LPDIRECTDRAWSURFACE lpSurface)
|
|
|
|
{
|
1999-03-27 17:56:13 +01:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
1999-06-26 21:09:08 +02:00
|
|
|
TRACE("(%p)->(%p,%p)\n", This, lpD3DDevice, lpSurface);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
|
|
|
return DDERR_ALREADYINITIALIZED;
|
|
|
|
}
|
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
HRESULT WINAPI IDirect3DTextureImpl_Unload(LPDIRECT3DTEXTURE iface)
|
1999-01-03 18:00:19 +01:00
|
|
|
{
|
1999-03-27 17:56:13 +01:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("(%p)->(): stub\n", This);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
return D3D_OK;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IDirect3DTexture2 methods ***/
|
2000-04-09 16:30:50 +02:00
|
|
|
HRESULT WINAPI IDirect3DTexture2Impl_GetHandle(LPDIRECT3DTEXTURE2 iface,
|
1999-01-03 18:00:19 +01:00
|
|
|
LPDIRECT3DDEVICE2 lpD3DDevice2,
|
|
|
|
LPD3DTEXTUREHANDLE lpHandle)
|
|
|
|
{
|
2000-04-09 16:30:50 +02:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
|
|
|
D3DTPRIVATE(This);
|
|
|
|
IDirect3DDevice2Impl* ilpD3DDevice2=(IDirect3DDevice2Impl*)lpD3DDevice2;
|
|
|
|
TRACE("(%p)->(%p,%p)\n", This, ilpD3DDevice2, lpHandle);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
/* For 32 bits OSes, handles = pointers */
|
|
|
|
*lpHandle = (D3DTEXTUREHANDLE) This;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
/* Now, bind a new texture */
|
|
|
|
ilpD3DDevice2->set_context(ilpD3DDevice2);
|
|
|
|
This->D3Ddevice = (void *) ilpD3DDevice2;
|
2002-10-16 20:57:52 +02:00
|
|
|
ENTER_GL();
|
2000-04-09 16:30:50 +02:00
|
|
|
if (dtpriv->tex_name == 0)
|
|
|
|
glGenTextures(1, &(dtpriv->tex_name));
|
|
|
|
LEAVE_GL();
|
|
|
|
|
2002-10-16 20:57:52 +02:00
|
|
|
/* Associate the texture with the device and perform the appropriate AddRef/Release */
|
|
|
|
/* FIXME: Is there only one or several textures associated with the device ? */
|
|
|
|
if (ilpD3DDevice2->current_texture)
|
|
|
|
IDirect3DTexture2Impl_Release((LPDIRECT3DTEXTURE2)ilpD3DDevice2->current_texture);
|
|
|
|
IDirect3DTexture2Impl_AddRef(iface);
|
|
|
|
ilpD3DDevice2->current_texture = (IDirect3DTexture2Impl*)iface;
|
|
|
|
|
2000-04-09 16:30:50 +02:00
|
|
|
TRACE("OpenGL texture handle is : %d\n", dtpriv->tex_name);
|
|
|
|
|
|
|
|
return D3D_OK;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Common methods */
|
2000-04-09 16:30:50 +02:00
|
|
|
HRESULT WINAPI IDirect3DTexture2Impl_PaletteChanged(
|
|
|
|
LPDIRECT3DTEXTURE2 iface, DWORD dwStart, DWORD dwCount
|
|
|
|
) {
|
1999-03-27 17:56:13 +01:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
1999-06-26 21:09:08 +02:00
|
|
|
FIXME("(%p)->(%8ld,%8ld): stub\n", This, dwStart, dwCount);
|
1999-01-03 18:00:19 +01:00
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
return D3D_OK;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
1999-01-23 13:32:46 +01:00
|
|
|
/* NOTE : if you experience crashes in this function, you must have a buggy
|
|
|
|
version of Mesa. See the file d3dtexture.c for a cure */
|
2000-04-09 16:30:50 +02:00
|
|
|
HRESULT WINAPI IDirect3DTexture2Impl_Load(
|
|
|
|
LPDIRECT3DTEXTURE2 iface, LPDIRECT3DTEXTURE2 lpD3DTexture2
|
|
|
|
) {
|
1999-03-27 17:56:13 +01:00
|
|
|
ICOM_THIS(IDirect3DTexture2Impl,iface);
|
2000-04-09 16:30:50 +02:00
|
|
|
D3DTPRIVATE(This);
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirect3DTexture2Impl* ilpD3DTexture2=(IDirect3DTexture2Impl*)lpD3DTexture2;
|
1999-01-17 17:32:32 +01:00
|
|
|
DDSURFACEDESC *src_d, *dst_d;
|
2000-07-16 16:40:35 +02:00
|
|
|
static void (*ptr_ColorTableEXT) (GLenum target, GLenum internalformat,
|
|
|
|
GLsizei width, GLenum format, GLenum type, const GLvoid *table) = NULL;
|
2001-03-21 21:31:26 +01:00
|
|
|
#if 0
|
2000-07-16 16:40:35 +02:00
|
|
|
static BOOL color_table_queried = FALSE;
|
2001-03-21 21:31:26 +01:00
|
|
|
#endif
|
|
|
|
|
1999-06-26 21:09:08 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, ilpD3DTexture2);
|
|
|
|
TRACE("Copied surface %p to surface %p\n", ilpD3DTexture2->surface, This->surface);
|
1999-01-23 13:32:46 +01:00
|
|
|
|
2002-09-25 05:18:17 +02:00
|
|
|
if ( This->surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD )
|
|
|
|
/* If the surface is not allocated and its location is not yet specified,
|
|
|
|
force it to video memory */
|
|
|
|
if ( !(This->surface->surface_desc.ddsCaps.dwCaps & (DDSCAPS_SYSTEMMEMORY|DDSCAPS_VIDEOMEMORY)) )
|
|
|
|
This->surface->surface_desc.ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
|
|
|
|
|
1999-01-23 13:32:46 +01:00
|
|
|
/* Suppress the ALLOCONLOAD flag */
|
2001-01-04 23:44:55 +01:00
|
|
|
This->surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
|
|
|
/* Copy one surface on the other */
|
2001-01-04 23:44:55 +01:00
|
|
|
dst_d = (DDSURFACEDESC *)&(This->surface->surface_desc);
|
|
|
|
src_d = (DDSURFACEDESC *)&(ilpD3DTexture2->surface->surface_desc);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
/* Install the callbacks to the destination surface */
|
2001-01-04 23:44:55 +01:00
|
|
|
This->surface->texture = This;
|
|
|
|
This->surface->SetColorKey_cb = SetColorKey_cb;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
if ((src_d->dwWidth != dst_d->dwWidth) || (src_d->dwHeight != dst_d->dwHeight)) {
|
|
|
|
/* Should also check for same pixel format, lPitch, ... */
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Error in surface sizes\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
return D3DERR_TEXTURE_LOAD_FAILED;
|
|
|
|
} else {
|
1999-03-27 17:56:13 +01:00
|
|
|
/* LPDIRECT3DDEVICE2 d3dd = (LPDIRECT3DDEVICE2) This->D3Ddevice; */
|
1999-01-17 17:32:32 +01:00
|
|
|
/* I should put a macro for the calculus of bpp */
|
|
|
|
int bpp = (src_d->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8 ?
|
|
|
|
1 /* 8 bit of palette index */:
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->ddpfPixelFormat.u1.dwRGBBitCount / 8 /* RGB bits for each colors */ );
|
1999-01-17 17:55:11 +01:00
|
|
|
GLuint current_texture;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
/* Copy the main memry texture into the surface that corresponds to the OpenGL
|
|
|
|
texture object. */
|
2001-01-04 23:44:55 +01:00
|
|
|
memcpy(dst_d->lpSurface, src_d->lpSurface, src_d->dwWidth * src_d->dwHeight * bpp);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-05-13 20:53:05 +02:00
|
|
|
ENTER_GL();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
/* Now, load the texture */
|
1999-01-17 17:55:11 +01:00
|
|
|
/* d3dd->set_context(d3dd); We need to set the context somehow.... */
|
|
|
|
glGetIntegerv(GL_TEXTURE_BINDING_2D, ¤t_texture);
|
1999-01-23 13:32:46 +01:00
|
|
|
|
|
|
|
/* If the GetHandle was not done, get the texture name here */
|
2000-04-09 16:30:50 +02:00
|
|
|
if (dtpriv->tex_name == 0)
|
|
|
|
glGenTextures(1, &(dtpriv->tex_name));
|
|
|
|
glBindTexture(GL_TEXTURE_2D, dtpriv->tex_name);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
|
|
|
if (src_d->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) {
|
1999-01-23 13:32:46 +01:00
|
|
|
/* ****************
|
|
|
|
Paletted Texture
|
|
|
|
**************** */
|
2002-10-16 20:57:52 +02:00
|
|
|
IDirectDrawPaletteImpl* pal = ilpD3DTexture2->surface->palette;
|
1999-01-17 17:32:32 +01:00
|
|
|
BYTE table[256][4];
|
|
|
|
int i;
|
2000-07-16 16:40:35 +02:00
|
|
|
|
2001-01-04 23:44:55 +01:00
|
|
|
#if 0
|
2000-07-16 16:40:35 +02:00
|
|
|
if (color_table_queried == FALSE) {
|
|
|
|
ptr_ColorTableEXT =
|
2000-07-23 21:27:21 +02:00
|
|
|
((Mesa_DeviceCapabilities *) ((x11_dd_private *) This->surface->s.ddraw->d->private)->device_capabilities)->ptr_ColorTableEXT;
|
2000-07-16 16:40:35 +02:00
|
|
|
}
|
2001-01-04 23:44:55 +01:00
|
|
|
#endif
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-17 17:55:11 +01:00
|
|
|
if (pal == NULL) {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Palettized texture Loading with a NULL palette !\n");
|
1999-05-13 20:53:05 +02:00
|
|
|
LEAVE_GL();
|
1999-01-17 17:55:11 +01:00
|
|
|
return D3DERR_TEXTURE_LOAD_FAILED;
|
|
|
|
}
|
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
/* Get the surface's palette */
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
table[i][0] = pal->palents[i].peRed;
|
|
|
|
table[i][1] = pal->palents[i].peGreen;
|
|
|
|
table[i][2] = pal->palents[i].peBlue;
|
2001-01-04 23:44:55 +01:00
|
|
|
if ((This->surface->surface_desc.dwFlags & DDSD_CKSRCBLT) &&
|
|
|
|
(i >= This->surface->surface_desc.ddckCKSrcBlt.dwColorSpaceLowValue) &&
|
|
|
|
(i <= This->surface->surface_desc.ddckCKSrcBlt.dwColorSpaceHighValue))
|
1999-01-17 17:55:11 +01:00
|
|
|
table[i][3] = 0x00;
|
|
|
|
else
|
1999-01-17 17:32:32 +01:00
|
|
|
table[i][3] = 0xFF;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
/* Texture snooping */
|
|
|
|
SNOOP_PALETTED();
|
2000-01-05 02:51:02 +01:00
|
|
|
|
2000-07-16 16:40:35 +02:00
|
|
|
if (ptr_ColorTableEXT != NULL) {
|
|
|
|
/* use Paletted Texture Extension */
|
|
|
|
ptr_ColorTableEXT(GL_TEXTURE_2D, /* target */
|
|
|
|
GL_RGBA, /* internal format */
|
|
|
|
256, /* table size */
|
|
|
|
GL_RGBA, /* table format */
|
|
|
|
GL_UNSIGNED_BYTE, /* table type */
|
|
|
|
table); /* the color table */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-16 16:40:35 +02:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, /* target */
|
|
|
|
0, /* level */
|
|
|
|
GL_COLOR_INDEX8_EXT, /* internal format */
|
|
|
|
src_d->dwWidth, src_d->dwHeight, /* width, height */
|
|
|
|
0, /* border */
|
|
|
|
GL_COLOR_INDEX, /* texture format */
|
|
|
|
GL_UNSIGNED_BYTE, /* texture type */
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->lpSurface); /* the texture */
|
2000-07-16 16:40:35 +02:00
|
|
|
} else {
|
|
|
|
DWORD *surface = (DWORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, src_d->dwWidth * src_d->dwHeight * sizeof(DWORD));
|
|
|
|
DWORD i;
|
2001-01-04 23:44:55 +01:00
|
|
|
BYTE *src = (BYTE *) src_d->lpSurface, *dst = (BYTE *) surface;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-16 16:40:35 +02:00
|
|
|
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
|
|
|
|
BYTE color = *src++;
|
|
|
|
*dst++ = table[color][0];
|
|
|
|
*dst++ = table[color][1];
|
|
|
|
*dst++ = table[color][2];
|
|
|
|
*dst++ = table[color][3];
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-16 16:40:35 +02:00
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
GL_UNSIGNED_BYTE,
|
|
|
|
surface);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-07-16 16:40:35 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, surface);
|
|
|
|
}
|
1999-01-23 13:32:46 +01:00
|
|
|
} else if (src_d->ddpfPixelFormat.dwFlags & DDPF_RGB) {
|
|
|
|
/* ************
|
|
|
|
RGB Textures
|
|
|
|
************ */
|
2001-01-04 23:44:55 +01:00
|
|
|
if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 8) {
|
1999-01-23 13:32:46 +01:00
|
|
|
/* **********************
|
2002-06-01 01:06:46 +02:00
|
|
|
GL_UNSIGNED_BYTE_3_3_2
|
1999-01-23 13:32:46 +01:00
|
|
|
********************** */
|
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGB,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGB,
|
|
|
|
GL_UNSIGNED_BYTE_3_3_2,
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->lpSurface);
|
|
|
|
} else if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 16) {
|
|
|
|
if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000000) {
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-04-06 09:10:48 +02:00
|
|
|
/* Texture snooping */
|
|
|
|
SNOOP_5650();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-23 13:32:46 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGB,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGB,
|
|
|
|
GL_UNSIGNED_SHORT_5_6_5,
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->lpSurface);
|
|
|
|
} else if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000001) {
|
1999-04-06 09:10:48 +02:00
|
|
|
/* Texture snooping */
|
|
|
|
SNOOP_5551();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-23 13:32:46 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
GL_UNSIGNED_SHORT_5_5_5_1,
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->lpSurface);
|
|
|
|
} else if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x0000000F) {
|
1999-01-23 13:32:46 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
GL_UNSIGNED_SHORT_4_4_4_4,
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->lpSurface);
|
|
|
|
} else if (src_d->ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00008000) {
|
2000-08-28 21:31:18 +02:00
|
|
|
/* Converting the 1555 format in 5551 packed */
|
|
|
|
WORD *surface = (WORD *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, src_d->dwWidth * src_d->dwHeight * sizeof(WORD));
|
|
|
|
DWORD i;
|
2001-01-04 23:44:55 +01:00
|
|
|
WORD *src = (WORD *) src_d->lpSurface, *dst = surface;
|
2000-08-28 21:31:18 +02:00
|
|
|
|
|
|
|
for (i = 0; i < src_d->dwHeight * src_d->dwWidth; i++) {
|
|
|
|
*dst++ = (((*src & 0x8000) >> 15) |
|
|
|
|
((*src & 0x7FFF) << 1));
|
|
|
|
src++;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2000-08-28 21:31:18 +02:00
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
GL_UNSIGNED_SHORT_5_5_5_1,
|
|
|
|
surface);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, surface);
|
1999-01-23 13:32:46 +01:00
|
|
|
} else {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Unhandled texture format (bad Aplha channel for a 16 bit texture)\n");
|
1999-01-23 13:32:46 +01:00
|
|
|
}
|
2001-01-04 23:44:55 +01:00
|
|
|
} else if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 24) {
|
1999-01-23 13:32:46 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGB,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGB,
|
|
|
|
GL_UNSIGNED_BYTE,
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->lpSurface);
|
|
|
|
} else if (src_d->ddpfPixelFormat.u1.dwRGBBitCount == 32) {
|
1999-01-23 13:32:46 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
src_d->dwWidth, src_d->dwHeight,
|
|
|
|
0,
|
|
|
|
GL_RGBA,
|
|
|
|
GL_UNSIGNED_BYTE,
|
2001-01-04 23:44:55 +01:00
|
|
|
src_d->lpSurface);
|
1999-01-23 13:32:46 +01:00
|
|
|
} else {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Unhandled texture format (bad RGB count)\n");
|
1999-01-23 13:32:46 +01:00
|
|
|
}
|
1999-01-17 17:32:32 +01:00
|
|
|
} else {
|
1999-06-26 21:09:08 +02:00
|
|
|
ERR("Unhandled texture format (neither RGB nor INDEX)\n");
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
1999-01-17 17:55:11 +01:00
|
|
|
|
|
|
|
glBindTexture(GL_TEXTURE_2D, current_texture);
|
1999-05-13 20:53:05 +02:00
|
|
|
|
|
|
|
LEAVE_GL();
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-17 17:55:11 +01:00
|
|
|
return D3D_OK;
|
1999-01-03 18:00:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* IDirect3DTexture2 VTable
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
ICOM_VTABLE(IDirect3DTexture2) mesa_texture2_vtable =
|
1999-05-22 13:41:38 +02:00
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
1999-01-03 18:00:19 +01:00
|
|
|
/*** IUnknown methods ***/
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirect3DTexture2Impl_QueryInterface,
|
|
|
|
IDirect3DTexture2Impl_AddRef,
|
|
|
|
IDirect3DTexture2Impl_Release,
|
1999-01-03 18:00:19 +01:00
|
|
|
/*** IDirect3DTexture methods ***/
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirect3DTexture2Impl_GetHandle,
|
|
|
|
IDirect3DTexture2Impl_PaletteChanged,
|
|
|
|
IDirect3DTexture2Impl_Load
|
1999-01-03 18:00:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* IDirect3DTexture VTable
|
|
|
|
*/
|
2000-07-16 16:40:35 +02:00
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
2001-01-04 23:59:48 +01:00
|
|
|
# define XCAST(fun) (typeof(mesa_texture_vtable.fun))
|
2000-07-16 16:40:35 +02:00
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
ICOM_VTABLE(IDirect3DTexture) mesa_texture_vtable =
|
1999-05-22 13:41:38 +02:00
|
|
|
{
|
|
|
|
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
1999-01-03 18:00:19 +01:00
|
|
|
/*** IUnknown methods ***/
|
2000-07-16 16:40:35 +02:00
|
|
|
XCAST(QueryInterface)IDirect3DTexture2Impl_QueryInterface,
|
|
|
|
XCAST(AddRef)IDirect3DTexture2Impl_AddRef,
|
|
|
|
XCAST(Release)IDirect3DTexture2Impl_Release,
|
1999-01-03 18:00:19 +01:00
|
|
|
/*** IDirect3DTexture methods ***/
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirect3DTextureImpl_Initialize,
|
|
|
|
IDirect3DTextureImpl_GetHandle,
|
2000-07-16 16:40:35 +02:00
|
|
|
XCAST(PaletteChanged)IDirect3DTexture2Impl_PaletteChanged,
|
|
|
|
XCAST(Load)IDirect3DTexture2Impl_Load,
|
1999-03-27 17:56:13 +01:00
|
|
|
IDirect3DTextureImpl_Unload
|
1999-01-03 18:00:19 +01:00
|
|
|
};
|
2000-07-16 16:40:35 +02:00
|
|
|
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
|
|
|
#undef XCAST
|
|
|
|
#endif
|