- some cleanups
- more cubetextures fixes (now d3d8 sdk cubemap sample work almost perfectly) - add a new debug function "debug_d3dpool" and use it - add a new param (the device) for the conversions functions (because we need to check caps to see how to convert) - some crashes fixed in render to surface code with no stencil-depth surface - a very simple cliplane fix - a stupid palettes fix (stupid language) - begin of anisotropic filter support - begin of compressed textures support - a very useful debug functions: IDirect3DSurface8Impl_SaveSnapshot to dump surfaces as png ;) - many useful surfaces debug code (using SaveSnapshot)
This commit is contained in:
parent
4e3100825f
commit
0b5e9d9feb
@ -135,31 +135,31 @@ void WINAPI IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8
|
|||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
|
ICOM_THIS(IDirect3DCubeTexture8Impl,iface);
|
||||||
TRACE("(%p) : About to load texture\n", This);
|
TRACE("(%p) : About to load texture: dirtified(%d)\n", This, This->Dirty);
|
||||||
for (i = 0; i < This->levels; i++) {
|
for (i = 0; i < This->levels; i++) {
|
||||||
if (i == 0 && This->surfaces[0][i]->textureName != 0 && This->Dirty == FALSE) {
|
if (i == 0 && This->surfaces[0][0]->textureName != 0 && This->Dirty == FALSE) {
|
||||||
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
glEnable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||||
#if defined(GL_VERSION_1_3)
|
#if defined(GL_VERSION_1_3)
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, This->surfaces[0][i]->textureName);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, This->surfaces[0][0]->textureName);
|
||||||
#else
|
#else
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, This->surfaces[0][i]->textureName);
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, This->surfaces[0][0]->textureName);
|
||||||
#endif
|
#endif
|
||||||
checkGLcall("glBindTexture");
|
checkGLcall("glBindTexture");
|
||||||
TRACE("Texture %p (level %d) given name %d\n", This->surfaces[0][i], i, This->surfaces[0][i]->textureName);
|
TRACE("Texture %p (level %d) given name %d\n", This->surfaces[0][0], i, This->surfaces[0][0]->textureName);
|
||||||
/* No need to walk through all mip-map levels, since already all assigned */
|
/* No need to walk through all mip-map levels, since already all assigned */
|
||||||
i = This->levels;
|
i = This->levels;
|
||||||
} else {
|
} else {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (This->surfaces[0][i]->textureName == 0) {
|
if (This->surfaces[0][0]->textureName == 0) {
|
||||||
glGenTextures(1, &This->surfaces[0][i]->textureName);
|
glGenTextures(1, &This->surfaces[0][0]->textureName);
|
||||||
checkGLcall("glGenTextures");
|
checkGLcall("glGenTextures");
|
||||||
TRACE("Texture %p (level %d) given name %d\n", This->surfaces[0][i], i, This->surfaces[0][i]->textureName);
|
TRACE("Texture %p (level %d) given name %d\n", This->surfaces[0][i], i, This->surfaces[0][0]->textureName);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(GL_VERSION_1_3)
|
#if defined(GL_VERSION_1_3)
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP, This->surfaces[0][i]->textureName);
|
glBindTexture(GL_TEXTURE_CUBE_MAP, This->surfaces[0][0]->textureName);
|
||||||
#else
|
#else
|
||||||
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, This->surfaces[0][i]->textureName);
|
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, This->surfaces[0][0]->textureName);
|
||||||
#endif
|
#endif
|
||||||
checkGLcall("glBindTexture");
|
checkGLcall("glBindTexture");
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ void WINAPI IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < 6; j++) {
|
for (j = 0; j < 6; j++) {
|
||||||
IDirect3DSurface8Impl_CreateGLTexture((LPDIRECT3DSURFACE8) This->surfaces[j][i], cube_targets[j], i);
|
IDirect3DSurface8Impl_LoadTexture((LPDIRECT3DSURFACE8) This->surfaces[j][i], cube_targets[j], i);
|
||||||
#if 0
|
#if 0
|
||||||
TRACE("Calling glTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,d=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
TRACE("Calling glTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,d=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||||
cube_targets[j],
|
cube_targets[j],
|
||||||
@ -195,6 +195,12 @@ void WINAPI IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8
|
|||||||
fmt2glType(This->format),
|
fmt2glType(This->format),
|
||||||
This->surfaces[j][i]->allocatedMemory);
|
This->surfaces[j][i]->allocatedMemory);
|
||||||
checkGLcall("glTexImage2D");
|
checkGLcall("glTexImage2D");
|
||||||
|
#endif
|
||||||
|
#if 0
|
||||||
|
static int gen = 0;
|
||||||
|
char buffer[4096];
|
||||||
|
snprintf(buffer, sizeof(buffer), "/tmp/cube%d_face%d_level%d_%d.png", This->surfaces[0][0]->textureName, j, i, ++gen);
|
||||||
|
IDirect3DSurface8Impl_SaveSnapshot((LPDIRECT3DSURFACE8) This->surfaces[j][i], buffer);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/* Removed glTexParameterf now TextureStageStates are initialized at startup */
|
/* Removed glTexParameterf now TextureStageStates are initialized at startup */
|
||||||
|
@ -168,6 +168,7 @@ typedef enum _GL_SupportedExt {
|
|||||||
EXT_PALETTED_TEXTURE,
|
EXT_PALETTED_TEXTURE,
|
||||||
EXT_SECONDARY_COLOR,
|
EXT_SECONDARY_COLOR,
|
||||||
EXT_TEXTURE_COMPRESSION_S3TC,
|
EXT_TEXTURE_COMPRESSION_S3TC,
|
||||||
|
EXT_TEXTURE_FILTER_ANISOTROPIC,
|
||||||
EXT_TEXTURE_LOD,
|
EXT_TEXTURE_LOD,
|
||||||
EXT_TEXTURE_LOD_BIAS,
|
EXT_TEXTURE_LOD_BIAS,
|
||||||
EXT_VERTEX_WEIGHTING,
|
EXT_VERTEX_WEIGHTING,
|
||||||
@ -608,7 +609,8 @@ extern HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D
|
|||||||
extern HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface);
|
extern HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface);
|
||||||
|
|
||||||
/* internal Interfaces */
|
/* internal Interfaces */
|
||||||
extern HRESULT WINAPI IDirect3DSurface8Impl_CreateGLTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level);
|
extern HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level);
|
||||||
|
extern HRESULT WINAPI IDirect3DSurface8Impl_SaveSnapshot(LPDIRECT3DSURFACE8 iface, const char* filename);
|
||||||
|
|
||||||
|
|
||||||
/* ------------------ */
|
/* ------------------ */
|
||||||
@ -1228,15 +1230,11 @@ extern DWORD WINAPI IDirect3DPixelShaderImpl_GetVersion(IDirect3DPixelShaderImpl
|
|||||||
* to see how not defined it here
|
* to see how not defined it here
|
||||||
*/
|
*/
|
||||||
void setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage);
|
void setupTextureStates(LPDIRECT3DDEVICE8 iface, DWORD Stage);
|
||||||
SHORT bytesPerPixel(D3DFORMAT fmt);
|
|
||||||
GLint fmt2glintFmt(D3DFORMAT fmt);
|
|
||||||
GLenum fmt2glFmt(D3DFORMAT fmt);
|
|
||||||
GLenum fmt2glType(D3DFORMAT fmt);
|
|
||||||
|
|
||||||
SHORT D3DFmtGetBpp(D3DFORMAT fmt);
|
SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
|
||||||
GLint D3DFmt2GLIntFmt(D3DFORMAT fmt);
|
GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
|
||||||
GLenum D3DFmt2GLFmt(D3DFORMAT fmt);
|
GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
|
||||||
GLenum D3DFmt2GLType(D3DFORMAT fmt);
|
GLenum D3DFmt2GLType(IDirect3DDevice8Impl* This, D3DFORMAT fmt);
|
||||||
|
|
||||||
GLenum D3DFmt2GLDepthFmt(D3DFORMAT fmt);
|
GLenum D3DFmt2GLDepthFmt(D3DFORMAT fmt);
|
||||||
GLenum D3DFmt2GLDepthType(D3DFORMAT fmt);
|
GLenum D3DFmt2GLDepthType(D3DFORMAT fmt);
|
||||||
@ -1259,5 +1257,6 @@ const char* debug_d3dusage(DWORD usage);
|
|||||||
const char* debug_d3dformat(D3DFORMAT fmt);
|
const char* debug_d3dformat(D3DFORMAT fmt);
|
||||||
const char* debug_d3dressourcetype(D3DRESOURCETYPE res);
|
const char* debug_d3dressourcetype(D3DRESOURCETYPE res);
|
||||||
const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
|
const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType);
|
||||||
|
const char* debug_d3dpool(D3DPOOL Pool);
|
||||||
|
|
||||||
#endif /* __WINE_D3DX8_PRIVATE_H */
|
#endif /* __WINE_D3DX8_PRIVATE_H */
|
||||||
|
@ -1399,7 +1399,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(LPDIRECT3DDEVICE8 ifac
|
|||||||
volume->myDesc.Type = D3DRTYPE_VOLUME;
|
volume->myDesc.Type = D3DRTYPE_VOLUME;
|
||||||
volume->myDesc.Pool = Pool;
|
volume->myDesc.Pool = Pool;
|
||||||
volume->myDesc.Usage = Usage;
|
volume->myDesc.Usage = Usage;
|
||||||
volume->bytesPerPixel = D3DFmtGetBpp(Format);
|
volume->bytesPerPixel = D3DFmtGetBpp(This, Format);
|
||||||
volume->myDesc.Size = (Width * volume->bytesPerPixel) * Height * Depth;
|
volume->myDesc.Size = (Width * volume->bytesPerPixel) * Height * Depth;
|
||||||
volume->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, volume->myDesc.Size);
|
volume->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, volume->myDesc.Size);
|
||||||
|
|
||||||
@ -1465,8 +1465,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(LPDIRECT3DDEVICE8 iface,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Created surface level %d @ %p, memory at %p\n", i, object->surfaces[j][i], object->surfaces[j][i]->allocatedMemory);
|
TRACE("Created surface level %d @ %p, memory at %p\n", i, object->surfaces[j][i], object->surfaces[j][i]->allocatedMemory);
|
||||||
tmpW = max(1, tmpW / 2);
|
|
||||||
}
|
}
|
||||||
|
tmpW = max(1, tmpW / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("(%p) : Iface@%p\n", This, object);
|
TRACE("(%p) : Iface@%p\n", This, object);
|
||||||
@ -1546,7 +1546,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateRenderTarget(LPDIRECT3DDEVICE8 iface
|
|||||||
object->myDesc.Usage = D3DUSAGE_RENDERTARGET;
|
object->myDesc.Usage = D3DUSAGE_RENDERTARGET;
|
||||||
object->myDesc.Pool = D3DPOOL_DEFAULT;
|
object->myDesc.Pool = D3DPOOL_DEFAULT;
|
||||||
object->myDesc.MultiSampleType = MultiSample;
|
object->myDesc.MultiSampleType = MultiSample;
|
||||||
object->bytesPerPixel = D3DFmtGetBpp(Format);
|
object->bytesPerPixel = D3DFmtGetBpp(This, Format);
|
||||||
object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
|
object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
|
||||||
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->myDesc.Size);
|
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->myDesc.Size);
|
||||||
object->lockable = Lockable;
|
object->lockable = Lockable;
|
||||||
@ -1579,7 +1579,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE
|
|||||||
object->myDesc.Usage = D3DUSAGE_DEPTHSTENCIL;
|
object->myDesc.Usage = D3DUSAGE_DEPTHSTENCIL;
|
||||||
object->myDesc.Pool = D3DPOOL_DEFAULT;
|
object->myDesc.Pool = D3DPOOL_DEFAULT;
|
||||||
object->myDesc.MultiSampleType = MultiSample;
|
object->myDesc.MultiSampleType = MultiSample;
|
||||||
object->bytesPerPixel = D3DFmtGetBpp(Format);
|
object->bytesPerPixel = D3DFmtGetBpp(This, Format);
|
||||||
object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
|
object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
|
||||||
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->myDesc.Size);
|
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->myDesc.Size);
|
||||||
object->lockable = (D3DFMT_D16_LOCKABLE == Format) ? TRUE : FALSE;
|
object->lockable = (D3DFMT_D16_LOCKABLE == Format) ? TRUE : FALSE;
|
||||||
@ -1607,7 +1607,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateImageSurface(LPDIRECT3DDEVICE8 iface
|
|||||||
object->myDesc.Type = D3DRTYPE_SURFACE;
|
object->myDesc.Type = D3DRTYPE_SURFACE;
|
||||||
object->myDesc.Usage = 0;
|
object->myDesc.Usage = 0;
|
||||||
object->myDesc.Pool = D3DPOOL_SYSTEMMEM;
|
object->myDesc.Pool = D3DPOOL_SYSTEMMEM;
|
||||||
object->bytesPerPixel = D3DFmtGetBpp(Format);
|
object->bytesPerPixel = D3DFmtGetBpp(This, Format);
|
||||||
object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
|
object->myDesc.Size = (Width * object->bytesPerPixel) * Height;
|
||||||
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->myDesc.Size);
|
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->myDesc.Size);
|
||||||
object->lockable = TRUE;
|
object->lockable = TRUE;
|
||||||
@ -1888,7 +1888,20 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 iface, I
|
|||||||
IDirect3DDevice8Impl_CleanRender(iface);
|
IDirect3DDevice8Impl_CleanRender(iface);
|
||||||
|
|
||||||
if ((IDirect3DSurface8Impl*) pRenderTarget == This->frontBuffer && (IDirect3DSurface8Impl*) pNewZStencil == This->depthStencilBuffer) {
|
if ((IDirect3DSurface8Impl*) pRenderTarget == This->frontBuffer && (IDirect3DSurface8Impl*) pNewZStencil == This->depthStencilBuffer) {
|
||||||
|
IDirect3DSurface8Impl* tmp;
|
||||||
|
|
||||||
TRACE("retoring SetRenderTarget defaults\n");
|
TRACE("retoring SetRenderTarget defaults\n");
|
||||||
|
|
||||||
|
tmp = This->renderTarget;
|
||||||
|
This->renderTarget = (IDirect3DSurface8Impl*) This->frontBuffer;
|
||||||
|
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) This->renderTarget);
|
||||||
|
IDirect3DSurface8Impl_Release((LPDIRECT3DSURFACE8) tmp);
|
||||||
|
|
||||||
|
tmp = This->stencilBufferTarget;
|
||||||
|
This->stencilBufferTarget = (IDirect3DSurface8Impl*) This->depthStencilBuffer;
|
||||||
|
if (NULL != This->stencilBufferTarget) IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) This->stencilBufferTarget);
|
||||||
|
if (NULL != tmp) IDirect3DSurface8Impl_Release((LPDIRECT3DSURFACE8) tmp);
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1917,7 +1930,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDEVICE8 i
|
|||||||
|
|
||||||
/* Note inc ref on returned surface */
|
/* Note inc ref on returned surface */
|
||||||
*ppZStencilSurface = (LPDIRECT3DSURFACE8) This->stencilBufferTarget;
|
*ppZStencilSurface = (LPDIRECT3DSURFACE8) This->stencilBufferTarget;
|
||||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppZStencilSurface);
|
if (NULL != *ppZStencilSurface) IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppZStencilSurface);
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@ -1941,10 +1954,36 @@ HRESULT WINAPI IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface) {
|
|||||||
getchar(); */
|
getchar(); */
|
||||||
|
|
||||||
if (This->frontBuffer != This->renderTarget) {
|
if (This->frontBuffer != This->renderTarget) {
|
||||||
|
{
|
||||||
|
GLenum prev_read;
|
||||||
|
glGetIntegerv(GL_READ_BUFFER, &prev_read);
|
||||||
|
vcheckGLcall("glIntegerv");
|
||||||
|
glReadBuffer(GL_BACK);
|
||||||
|
vcheckGLcall("glReadBuffer");
|
||||||
|
{
|
||||||
|
long j;
|
||||||
|
long pitch = This->renderTarget->myDesc.Width * This->renderTarget->bytesPerPixel;
|
||||||
|
for (j = 0; j < This->renderTarget->myDesc.Height; ++j) {
|
||||||
|
glReadPixels(0,
|
||||||
|
This->renderTarget->myDesc.Height - j - 1,
|
||||||
|
This->renderTarget->myDesc.Width,
|
||||||
|
1,
|
||||||
|
D3DFmt2GLFmt(This, This->renderTarget->myDesc.Format),
|
||||||
|
D3DFmt2GLType(This, This->renderTarget->myDesc.Format),
|
||||||
|
This->renderTarget->allocatedMemory + j * pitch);
|
||||||
|
vcheckGLcall("glReadPixels");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
glReadBuffer(prev_read);
|
||||||
|
vcheckGLcall("glReadBuffer");
|
||||||
|
}
|
||||||
|
|
||||||
IDirect3DBaseTexture8* cont = NULL;
|
IDirect3DBaseTexture8* cont = NULL;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
hr = IDirect3DSurface8_GetContainer((LPDIRECT3DSURFACE8) This->renderTarget, &IID_IDirect3DBaseTexture8, (void**) &cont);
|
hr = IDirect3DSurface8_GetContainer((LPDIRECT3DSURFACE8) This->renderTarget, &IID_IDirect3DBaseTexture8, (void**) &cont);
|
||||||
if (SUCCEEDED(hr) && NULL != cont) {
|
if (SUCCEEDED(hr) && NULL != cont) {
|
||||||
|
/** always dirtify for now. we must find a better way to see that surface have been modified */
|
||||||
|
IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE);
|
||||||
IDirect3DBaseTexture8_PreLoad(cont);
|
IDirect3DBaseTexture8_PreLoad(cont);
|
||||||
IDirect3DBaseTexture8_Release(cont);
|
IDirect3DBaseTexture8_Release(cont);
|
||||||
cont = NULL;
|
cont = NULL;
|
||||||
@ -2680,8 +2719,11 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetClipPlane(LPDIRECT3DDEVICE8 iface, DWOR
|
|||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glLoadMatrixf((float *) &This->StateBlock->transforms[D3DTS_VIEW].u.m[0][0]);
|
glLoadMatrixf((float *) &This->StateBlock->transforms[D3DTS_VIEW].u.m[0][0]);
|
||||||
|
|
||||||
TRACE("Clipplane [%f,%f,%f,%f]\n", This->UpdateStateBlock->clipplane[Index][0], This->UpdateStateBlock->clipplane[Index][1],
|
TRACE("Clipplane [%f,%f,%f,%f]\n",
|
||||||
This->UpdateStateBlock->clipplane[Index][2], This->UpdateStateBlock->clipplane[Index][3]);
|
This->UpdateStateBlock->clipplane[Index][0],
|
||||||
|
This->UpdateStateBlock->clipplane[Index][1],
|
||||||
|
This->UpdateStateBlock->clipplane[Index][2],
|
||||||
|
This->UpdateStateBlock->clipplane[Index][3]);
|
||||||
glClipPlane(GL_CLIP_PLANE0 + Index, This->UpdateStateBlock->clipplane[Index]);
|
glClipPlane(GL_CLIP_PLANE0 + Index, This->UpdateStateBlock->clipplane[Index]);
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
@ -2700,9 +2742,9 @@ HRESULT WINAPI IDirect3DDevice8Impl_GetClipPlane(LPDIRECT3DDEVICE8 iface, DWOR
|
|||||||
}
|
}
|
||||||
|
|
||||||
pPlane[0] = This->StateBlock->clipplane[Index][0];
|
pPlane[0] = This->StateBlock->clipplane[Index][0];
|
||||||
pPlane[1] = This->StateBlock->clipplane[Index][0];
|
pPlane[1] = This->StateBlock->clipplane[Index][1];
|
||||||
pPlane[2] = This->StateBlock->clipplane[Index][0];
|
pPlane[2] = This->StateBlock->clipplane[Index][2];
|
||||||
pPlane[3] = This->StateBlock->clipplane[Index][0];
|
pPlane[3] = This->StateBlock->clipplane[Index][3];
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State,DWORD Value) {
|
HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State,DWORD Value) {
|
||||||
@ -2850,12 +2892,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||||||
case D3DRS_AMBIENT :
|
case D3DRS_AMBIENT :
|
||||||
{
|
{
|
||||||
float col[4];
|
float col[4];
|
||||||
#if 0
|
|
||||||
col[0] = ((Value >> 16) & 0xFF) / 255.0;
|
|
||||||
col[1] = ((Value >> 8) & 0xFF) / 255.0;
|
|
||||||
col[2] = ((Value >> 0) & 0xFF) / 255.0;
|
|
||||||
col[3] = ((Value >> 24) & 0xFF) / 255.0;
|
|
||||||
#endif
|
|
||||||
D3DCOLORTOGLFLOAT4(Value, col);
|
D3DCOLORTOGLFLOAT4(Value, col);
|
||||||
TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
|
TRACE("Setting ambient to (%f,%f,%f,%f)\n", col[0], col[1], col[2], col[3]);
|
||||||
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
|
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, col);
|
||||||
@ -3791,6 +3827,14 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 ifa
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case D3DTSS_MAXANISOTROPY :
|
||||||
|
{
|
||||||
|
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) {
|
||||||
|
glTexParameteri(This->StateBlock->textureDimensions[Stage], GL_TEXTURE_MAX_ANISOTROPY_EXT, This->StateBlock->texture_state[Stage][D3DTSS_MAXANISOTROPY]);
|
||||||
|
checkGLcall("glTexParameteri GL_TEXTURE_MAX_ANISOTROPY_EXT ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case D3DTSS_MAGFILTER :
|
case D3DTSS_MAGFILTER :
|
||||||
if (Value == D3DTEXF_POINT) {
|
if (Value == D3DTEXF_POINT) {
|
||||||
@ -4007,6 +4051,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 ifa
|
|||||||
* we can use GL_SUBTRACT_ARB here
|
* we can use GL_SUBTRACT_ARB here
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case D3DTOP_ADDSMOOTH :
|
case D3DTOP_ADDSMOOTH :
|
||||||
case D3DTOP_BLENDDIFFUSEALPHA :
|
case D3DTOP_BLENDDIFFUSEALPHA :
|
||||||
case D3DTOP_BLENDTEXTUREALPHA :
|
case D3DTOP_BLENDTEXTUREALPHA :
|
||||||
@ -4264,7 +4309,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 ifa
|
|||||||
|
|
||||||
case D3DTSS_MIPMAPLODBIAS :
|
case D3DTSS_MIPMAPLODBIAS :
|
||||||
case D3DTSS_MAXMIPLEVEL :
|
case D3DTSS_MAXMIPLEVEL :
|
||||||
case D3DTSS_MAXANISOTROPY :
|
|
||||||
case D3DTSS_BUMPENVLSCALE :
|
case D3DTSS_BUMPENVLSCALE :
|
||||||
case D3DTSS_BUMPENVLOFFSET :
|
case D3DTSS_BUMPENVLOFFSET :
|
||||||
case D3DTSS_RESULTARG :
|
case D3DTSS_RESULTARG :
|
||||||
@ -4288,12 +4332,12 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetPaletteEntries(LPDIRECT3DDEVICE8 iface,
|
|||||||
ICOM_THIS(IDirect3DDevice8Impl,iface);
|
ICOM_THIS(IDirect3DDevice8Impl,iface);
|
||||||
FIXME("(%p) : setting p[%u] <= RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber,
|
FIXME("(%p) : setting p[%u] <= RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber,
|
||||||
pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
|
pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
|
||||||
memcpy(&This->palettes[PaletteNumber], pEntries, 256 * sizeof(PALETTEENTRY));
|
memcpy(This->palettes[PaletteNumber], pEntries, 256 * sizeof(PALETTEENTRY));
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
HRESULT WINAPI IDirect3DDevice8Impl_GetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) {
|
HRESULT WINAPI IDirect3DDevice8Impl_GetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) {
|
||||||
ICOM_THIS(IDirect3DDevice8Impl,iface);
|
ICOM_THIS(IDirect3DDevice8Impl,iface);
|
||||||
memcpy(pEntries, &This->palettes[PaletteNumber], 256 * sizeof(PALETTEENTRY));
|
memcpy(pEntries, This->palettes[PaletteNumber], 256 * sizeof(PALETTEENTRY));
|
||||||
FIXME("(%p) : returning p[%u] => RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber,
|
FIXME("(%p) : returning p[%u] => RGBA(%02x,%02x,%02x,%02x)\n", This, PaletteNumber,
|
||||||
pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
|
pEntries->peRed, pEntries->peGreen, pEntries->peBlue, pEntries->peFlags);
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
@ -4309,7 +4353,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8
|
|||||||
256, /* table size */
|
256, /* table size */
|
||||||
GL_RGBA, /* table format */
|
GL_RGBA, /* table format */
|
||||||
GL_UNSIGNED_BYTE, /* table type */
|
GL_UNSIGNED_BYTE, /* table type */
|
||||||
&This->palettes[PaletteNumber]);
|
This->palettes[PaletteNumber]);
|
||||||
checkGLcall("glColorTableEXT");
|
checkGLcall("glColorTableEXT");
|
||||||
} else {
|
} else {
|
||||||
/* Delayed palette handling ... waiting for software emulation into preload code */
|
/* Delayed palette handling ... waiting for software emulation into preload code */
|
||||||
@ -4896,7 +4940,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_ActiveRender(LPDIRECT3DDEVICE8 iface,
|
|||||||
int attribs[256];
|
int attribs[256];
|
||||||
int nAttribs = 0;
|
int nAttribs = 0;
|
||||||
D3DFORMAT BackBufferFormat = ((IDirect3DSurface8Impl*) RenderSurface)->myDesc.Format;
|
D3DFORMAT BackBufferFormat = ((IDirect3DSurface8Impl*) RenderSurface)->myDesc.Format;
|
||||||
D3DFORMAT StencilBufferFormat = ((IDirect3DSurface8Impl*) StencilSurface)->myDesc.Format;
|
D3DFORMAT StencilBufferFormat = (NULL != StencilSurface) ? ((IDirect3DSurface8Impl*) StencilSurface)->myDesc.Format : 0;
|
||||||
UINT Width = ((IDirect3DSurface8Impl*) RenderSurface)->myDesc.Width;
|
UINT Width = ((IDirect3DSurface8Impl*) RenderSurface)->myDesc.Width;
|
||||||
UINT Height = ((IDirect3DSurface8Impl*) RenderSurface)->myDesc.Height;
|
UINT Height = ((IDirect3DSurface8Impl*) RenderSurface)->myDesc.Height;
|
||||||
IDirect3DSurface8Impl* tmp;
|
IDirect3DSurface8Impl* tmp;
|
||||||
@ -5021,14 +5065,15 @@ HRESULT WINAPI IDirect3DDevice8Impl_ActiveRender(LPDIRECT3DDEVICE8 iface,
|
|||||||
vcheckGLcall("glReadBuffer");
|
vcheckGLcall("glReadBuffer");
|
||||||
{
|
{
|
||||||
long j;
|
long j;
|
||||||
|
long pitch = This->renderTarget->myDesc.Width * This->renderTarget->bytesPerPixel;
|
||||||
for (j = 0; j < This->renderTarget->myDesc.Height; ++j) {
|
for (j = 0; j < This->renderTarget->myDesc.Height; ++j) {
|
||||||
glReadPixels(0,
|
glReadPixels(0,
|
||||||
This->renderTarget->myDesc.Height - j - 1,
|
This->renderTarget->myDesc.Height - j - 1,
|
||||||
This->renderTarget->myDesc.Width,
|
This->renderTarget->myDesc.Width,
|
||||||
1,
|
1,
|
||||||
D3DFmt2GLFmt(This->renderTarget->myDesc.Format),
|
D3DFmt2GLFmt(This, This->renderTarget->myDesc.Format),
|
||||||
D3DFmt2GLType(This->renderTarget->myDesc.Format),
|
D3DFmt2GLType(This, This->renderTarget->myDesc.Format),
|
||||||
This->renderTarget->allocatedMemory);
|
This->renderTarget->allocatedMemory + j * pitch);
|
||||||
vcheckGLcall("glReadPixels");
|
vcheckGLcall("glReadPixels");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5064,8 +5109,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_ActiveRender(LPDIRECT3DDEVICE8 iface,
|
|||||||
|
|
||||||
tmp = This->stencilBufferTarget;
|
tmp = This->stencilBufferTarget;
|
||||||
This->stencilBufferTarget = (IDirect3DSurface8Impl*) StencilSurface;
|
This->stencilBufferTarget = (IDirect3DSurface8Impl*) StencilSurface;
|
||||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) This->stencilBufferTarget);
|
if (NULL != This->stencilBufferTarget) IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) This->stencilBufferTarget);
|
||||||
IDirect3DSurface8Impl_Release((LPDIRECT3DSURFACE8) tmp);
|
if (NULL != tmp) IDirect3DSurface8Impl_Release((LPDIRECT3DSURFACE8) tmp);
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
|
|
||||||
|
@ -603,8 +603,13 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps (LPDIRECT3D8 iface,
|
|||||||
pCaps->MaxStreams = 2; /* HACK: Some games want at least 2 */
|
pCaps->MaxStreams = 2; /* HACK: Some games want at least 2 */
|
||||||
pCaps->MaxStreamStride = 1024;
|
pCaps->MaxStreamStride = 1024;
|
||||||
|
|
||||||
|
#if 1
|
||||||
pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
|
pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
|
||||||
pCaps->MaxVertexShaderConst = D3D8_VSHADER_MAX_CONSTANTS;
|
pCaps->MaxVertexShaderConst = D3D8_VSHADER_MAX_CONSTANTS;
|
||||||
|
#else
|
||||||
|
pCaps->VertexShaderVersion = 0;
|
||||||
|
pCaps->MaxVertexShaderConst = D3D8_VSHADER_MAX_CONSTANTS;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
pCaps->PixelShaderVersion = D3DPS_VERSION(1,1);
|
pCaps->PixelShaderVersion = D3DPS_VERSION(1,1);
|
||||||
@ -837,9 +842,9 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
|||||||
object->renderTarget = object->frontBuffer;
|
object->renderTarget = object->frontBuffer;
|
||||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->renderTarget);
|
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->renderTarget);
|
||||||
object->stencilBufferTarget = object->depthStencilBuffer;
|
object->stencilBufferTarget = object->depthStencilBuffer;
|
||||||
if (NULL != object->stencilBufferTarget)
|
if (NULL != object->stencilBufferTarget) {
|
||||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
|
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
|
||||||
|
}
|
||||||
|
|
||||||
/* Now override the surface's Flip method (if in double buffering) ?COPIED from DDRAW!?
|
/* Now override the surface's Flip method (if in double buffering) ?COPIED from DDRAW!?
|
||||||
((x11_ds_private *) surface->private)->opengl_flip = TRUE;
|
((x11_ds_private *) surface->private)->opengl_flip = TRUE;
|
||||||
@ -876,7 +881,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
|||||||
checkGLcall("glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
|
checkGLcall("glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
|
||||||
|
|
||||||
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
|
||||||
checkGLcall("glLightModel (GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR);");
|
checkGLcall("glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize openGL extension related variables
|
* Initialize openGL extension related variables
|
||||||
@ -955,6 +960,9 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
|||||||
} else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) {
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) {
|
||||||
FIXME(" FOUND: EXT Texture S3TC compression support\n");
|
FIXME(" FOUND: EXT Texture S3TC compression support\n");
|
||||||
This->gl_info.supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE;
|
This->gl_info.supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE;
|
||||||
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_filter_anisotropic") == 0) {
|
||||||
|
FIXME(" FOUND: EXT Texture Anisotropic filter support\n");
|
||||||
|
This->gl_info.supported[EXT_TEXTURE_FILTER_ANISOTROPIC] = TRUE;
|
||||||
} else if (strcmp(ThisExtn, "GL_EXT_texture_lod") == 0) {
|
} else if (strcmp(ThisExtn, "GL_EXT_texture_lod") == 0) {
|
||||||
FIXME(" FOUND: EXT Texture LOD support\n");
|
FIXME(" FOUND: EXT Texture LOD support\n");
|
||||||
This->gl_info.supported[EXT_TEXTURE_LOD] = TRUE;
|
This->gl_info.supported[EXT_TEXTURE_LOD] = TRUE;
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "winuser.h"
|
#include "winuser.h"
|
||||||
#include "wingdi.h"
|
#include "wingdi.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "d3d8_private.h"
|
#include "d3d8_private.h"
|
||||||
|
|
||||||
@ -204,8 +205,8 @@ HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKE
|
|||||||
This->lockedRect.bottom - j - 1,
|
This->lockedRect.bottom - j - 1,
|
||||||
This->lockedRect.right - This->lockedRect.left,
|
This->lockedRect.right - This->lockedRect.left,
|
||||||
1,
|
1,
|
||||||
D3DFmt2GLFmt(This->myDesc.Format),
|
D3DFmt2GLFmt(This->Device, This->myDesc.Format),
|
||||||
D3DFmt2GLType(This->myDesc.Format),
|
D3DFmt2GLType(This->Device, This->myDesc.Format),
|
||||||
pLockedRect->pBits);
|
pLockedRect->pBits);
|
||||||
vcheckGLcall("glReadPixels");
|
vcheckGLcall("glReadPixels");
|
||||||
}
|
}
|
||||||
@ -398,12 +399,14 @@ ICOM_VTABLE(IDirect3DSurface8) Direct3DSurface8_Vtbl =
|
|||||||
IDirect3DSurface8Impl_UnlockRect,
|
IDirect3DSurface8Impl_UnlockRect,
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT WINAPI IDirect3DSurface8Impl_CreateGLTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level) {
|
HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level) {
|
||||||
ICOM_THIS(IDirect3DSurface8Impl,iface);
|
ICOM_THIS(IDirect3DSurface8Impl,iface);
|
||||||
|
|
||||||
|
if ((This->myDesc.Format == D3DFMT_P8 || This->myDesc.Format == D3DFMT_A8P8)
|
||||||
if ((This->myDesc.Format == D3DFMT_P8 || This->myDesc.Format == D3DFMT_A8P8) &&
|
#if defined(GL_EXT_paletted_texture)
|
||||||
!GL_SUPPORT_DEV(EXT_PALETTED_TEXTURE, This->Device)) {
|
&& !GL_SUPPORT_DEV(EXT_PALETTED_TEXTURE, This->Device)
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
/**
|
/**
|
||||||
* wanted a paletted texture and not really support it in HW
|
* wanted a paletted texture and not really support it in HW
|
||||||
* so software emulation code begin
|
* so software emulation code begin
|
||||||
@ -450,27 +453,133 @@ HRESULT WINAPI IDirect3DSurface8Impl_CreateGLTexture(LPDIRECT3DSURFACE8 iface, G
|
|||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (This->myDesc.Format == D3DFMT_DXT1 ||
|
||||||
|
This->myDesc.Format == D3DFMT_DXT3 ||
|
||||||
|
This->myDesc.Format == D3DFMT_DXT5) {
|
||||||
|
#if defined(GL_EXT_texture_compression_s3tc)
|
||||||
|
if (GL_SUPPORT_DEV(EXT_TEXTURE_COMPRESSION_S3TC, This->Device)) {
|
||||||
|
TRACE("Calling glCompressedTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, sz=%d, Mem=%p\n",
|
||||||
|
gl_target,
|
||||||
|
gl_level,
|
||||||
|
D3DFmt2GLIntFmt(This->Device, This->myDesc.Format),
|
||||||
|
This->myDesc.Width,
|
||||||
|
This->myDesc.Height,
|
||||||
|
0,
|
||||||
|
This->myDesc.Size,
|
||||||
|
This->allocatedMemory);
|
||||||
|
glCompressedTexImage2DARB(gl_target,
|
||||||
|
gl_level,
|
||||||
|
D3DFmt2GLIntFmt(This->Device, This->myDesc.Format),
|
||||||
|
This->myDesc.Width,
|
||||||
|
This->myDesc.Height,
|
||||||
|
0,
|
||||||
|
This->myDesc.Size,
|
||||||
|
This->allocatedMemory);
|
||||||
|
checkGLcall("glCommpressedTexTexImage2D");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
TRACE("Calling glTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
TRACE("Calling glTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||||
gl_target,
|
gl_target,
|
||||||
gl_level,
|
gl_level,
|
||||||
D3DFmt2GLIntFmt(This->myDesc.Format),
|
D3DFmt2GLIntFmt(This->Device, This->myDesc.Format),
|
||||||
This->myDesc.Width,
|
This->myDesc.Width,
|
||||||
This->myDesc.Height,
|
This->myDesc.Height,
|
||||||
0,
|
0,
|
||||||
D3DFmt2GLFmt(This->myDesc.Format),
|
D3DFmt2GLFmt(This->Device, This->myDesc.Format),
|
||||||
D3DFmt2GLType(This->myDesc.Format),
|
D3DFmt2GLType(This->Device, This->myDesc.Format),
|
||||||
This->allocatedMemory);
|
This->allocatedMemory);
|
||||||
glTexImage2D(gl_target,
|
glTexImage2D(gl_target,
|
||||||
gl_level,
|
gl_level,
|
||||||
D3DFmt2GLIntFmt(This->myDesc.Format),
|
D3DFmt2GLIntFmt(This->Device, This->myDesc.Format),
|
||||||
This->myDesc.Width,
|
This->myDesc.Width,
|
||||||
This->myDesc.Height,
|
This->myDesc.Height,
|
||||||
0,
|
0,
|
||||||
D3DFmt2GLFmt(This->myDesc.Format),
|
D3DFmt2GLFmt(This->Device, This->myDesc.Format),
|
||||||
D3DFmt2GLType(This->myDesc.Format),
|
D3DFmt2GLType(This->Device, This->myDesc.Format),
|
||||||
This->allocatedMemory);
|
This->allocatedMemory);
|
||||||
checkGLcall("glTexImage2D");
|
checkGLcall("glTexImage2D");
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
static int gen = 0;
|
||||||
|
char buffer[4096];
|
||||||
|
++gen;
|
||||||
|
if ((gen % 10) == 0) {
|
||||||
|
snprintf(buffer, sizeof(buffer), "/tmp/surface%d_level%d_%d.png", gl_target, gl_level, gen);
|
||||||
|
IDirect3DSurface8Impl_SaveSnapshot((LPDIRECT3DSURFACE8) This, buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
HRESULT WINAPI IDirect3DSurface8Impl_SaveSnapshot(LPDIRECT3DSURFACE8 iface, const char* filename) {
|
||||||
|
FILE* f = NULL;
|
||||||
|
int i;
|
||||||
|
ICOM_THIS(IDirect3DSurface8Impl,iface);
|
||||||
|
|
||||||
|
f = fopen(filename, "w+");
|
||||||
|
if (NULL == f) {
|
||||||
|
ERR("opening of %s failed with: %s\n", filename, strerror(errno));
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("opened %s\n", filename);
|
||||||
|
|
||||||
|
fprintf(f, "P6\n%u %u\n255\n", This->myDesc.Width, This->myDesc.Height);
|
||||||
|
switch (This->myDesc.Format) {
|
||||||
|
case D3DFMT_X8R8G8B8:
|
||||||
|
case D3DFMT_A8R8G8B8:
|
||||||
|
{
|
||||||
|
DWORD color;
|
||||||
|
for (i = 0; i < This->myDesc.Width * This->myDesc.Height; i++) {
|
||||||
|
color = ((DWORD*) This->allocatedMemory)[i];
|
||||||
|
fputc((color >> 16) & 0xFF, f);
|
||||||
|
fputc((color >> 8) & 0xFF, f);
|
||||||
|
fputc((color >> 0) & 0xFF, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case D3DFMT_R8G8B8:
|
||||||
|
{
|
||||||
|
BYTE* color;
|
||||||
|
for (i = 0; i < This->myDesc.Width * This->myDesc.Height; i++) {
|
||||||
|
color = ((BYTE*) This->allocatedMemory) + (3 * i);
|
||||||
|
fputc((color[0]) & 0xFF, f);
|
||||||
|
fputc((color[1]) & 0xFF, f);
|
||||||
|
fputc((color[2]) & 0xFF, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case D3DFMT_A1R5G5B5:
|
||||||
|
{
|
||||||
|
WORD color;
|
||||||
|
for (i = 0; i < This->myDesc.Width * This->myDesc.Height; i++) {
|
||||||
|
color = ((WORD*) This->allocatedMemory)[i];
|
||||||
|
fputc((color >> 10) & 0xFF, f);
|
||||||
|
fputc((color >> 5) & 0xFF, f);
|
||||||
|
fputc((color >> 0) & 0xFF, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case D3DFMT_R5G6B5:
|
||||||
|
{
|
||||||
|
WORD color;
|
||||||
|
for (i = 0; i < This->myDesc.Width * This->myDesc.Height; i++) {
|
||||||
|
color = ((WORD*) This->allocatedMemory)[i];
|
||||||
|
fputc((color >> 11) & 0xFF, f);
|
||||||
|
fputc((color >> 5) & 0xFF, f);
|
||||||
|
fputc((color >> 0) & 0xFF, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FIXME("Unimplemented dump mode format(%u,%s)\n", This->myDesc.Format, debug_d3dformat(This->myDesc.Format));
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
return D3D_OK;
|
||||||
|
}
|
||||||
|
@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
|||||||
HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface, REFIID riid, LPVOID *ppobj)
|
HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface, REFIID riid, LPVOID *ppobj)
|
||||||
{
|
{
|
||||||
ICOM_THIS(IDirect3DTexture8Impl,iface);
|
ICOM_THIS(IDirect3DTexture8Impl,iface);
|
||||||
TRACE("(%p) : QueryInterface\n", This);
|
TRACE("(%p) : QueryInterface for %s\n", This, debugstr_guid(riid));
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
|
|| IsEqualGUID(riid, &IID_IDirect3DBaseTexture8)
|
||||||
@ -44,7 +44,7 @@ HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface,REF
|
|||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
|
WARN("(%p)->(%s,%p) not found\n", This, debugstr_guid(riid), ppobj);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IDirect3DSurface8Impl_CreateGLTexture((LPDIRECT3DSURFACE8) This->surfaces[i], GL_TEXTURE_2D, i);
|
IDirect3DSurface8Impl_LoadTexture((LPDIRECT3DSURFACE8) This->surfaces[i], GL_TEXTURE_2D, i);
|
||||||
#if 0
|
#if 0
|
||||||
TRACE("Calling glTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
TRACE("Calling glTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
@ -194,7 +194,8 @@ HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 ifa
|
|||||||
TRACE("(%p) Level (%d)\n", This, Level);
|
TRACE("(%p) Level (%d)\n", This, Level);
|
||||||
return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8) This->surfaces[Level], pDesc);
|
return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8) This->surfaces[Level], pDesc);
|
||||||
} else {
|
} else {
|
||||||
FIXME("(%p) Level (%d)\n", This, Level);
|
FIXME("Levels seems too high?!!\n");
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
@ -218,6 +219,7 @@ HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface,
|
|||||||
TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
|
TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
|
||||||
} else {
|
} else {
|
||||||
FIXME("Levels seems too high?!!\n");
|
FIXME("Levels seems too high?!!\n");
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
@ -230,8 +232,9 @@ HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(LPDIRECT3DTEXTURE8 iface
|
|||||||
TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
|
TRACE("(%p) Level (%d) success(%lu)\n", This, Level, hr);
|
||||||
} else {
|
} else {
|
||||||
FIXME("Levels seems too high?!!\n");
|
FIXME("Levels seems too high?!!\n");
|
||||||
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
return D3D_OK;
|
return hr;
|
||||||
}
|
}
|
||||||
HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT* pDirtyRect) {
|
HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT* pDirtyRect) {
|
||||||
ICOM_THIS(IDirect3DTexture8Impl,iface);
|
ICOM_THIS(IDirect3DTexture8Impl,iface);
|
||||||
|
@ -158,101 +158,23 @@ const char* debug_d3dprimitivetype(D3DPRIMITIVETYPE PrimitiveType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* debug_d3dpool(D3DPOOL Pool) {
|
||||||
|
switch (Pool) {
|
||||||
|
#define POOL_TO_STR(p) case p: return #p;
|
||||||
|
POOL_TO_STR(D3DPOOL_DEFAULT);
|
||||||
|
POOL_TO_STR(D3DPOOL_MANAGED);
|
||||||
|
POOL_TO_STR(D3DPOOL_SYSTEMMEM);
|
||||||
|
POOL_TO_STR(D3DPOOL_SCRATCH);
|
||||||
|
#undef POOL_TO_STR
|
||||||
|
default:
|
||||||
|
FIXME("Unrecognized %u D3DPOOL!\n", Pool);
|
||||||
|
return "unrecognized";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple utility routines used for dx -> gl mapping of byte formats
|
* Simple utility routines used for dx -> gl mapping of byte formats
|
||||||
*/
|
*/
|
||||||
SHORT bytesPerPixel(D3DFORMAT fmt) {
|
|
||||||
SHORT retVal;
|
|
||||||
|
|
||||||
switch (fmt) {
|
|
||||||
/* color buffer */
|
|
||||||
case D3DFMT_P8: retVal = 1; break;
|
|
||||||
case D3DFMT_R3G3B2: retVal = 1; break;
|
|
||||||
case D3DFMT_R5G6B5: retVal = 2; break;
|
|
||||||
case D3DFMT_X1R5G5B5: retVal = 2; break;
|
|
||||||
case D3DFMT_A4R4G4B4: retVal = 2; break;
|
|
||||||
case D3DFMT_X4R4G4B4: retVal = 2; break;
|
|
||||||
case D3DFMT_A1R5G5B5: retVal = 2; break;
|
|
||||||
case D3DFMT_R8G8B8: retVal = 3; break;
|
|
||||||
case D3DFMT_X8R8G8B8: retVal = 4; break;
|
|
||||||
case D3DFMT_A8R8G8B8: retVal = 4; break;
|
|
||||||
/* depth/stencil buffer */
|
|
||||||
case D3DFMT_D16_LOCKABLE: retVal = 2; break;
|
|
||||||
case D3DFMT_D16: retVal = 2; break;
|
|
||||||
case D3DFMT_D15S1: retVal = 2; break;
|
|
||||||
case D3DFMT_D24X4S4: retVal = 4; break;
|
|
||||||
case D3DFMT_D24S8: retVal = 4; break;
|
|
||||||
case D3DFMT_D24X8: retVal = 4; break;
|
|
||||||
case D3DFMT_D32: retVal = 4; break;
|
|
||||||
/* unknown */
|
|
||||||
case D3DFMT_UNKNOWN:
|
|
||||||
/* Guess at the highest value of the above */
|
|
||||||
TRACE("D3DFMT_UNKNOWN - Guessing at 4 bytes/pixel %u\n", fmt);
|
|
||||||
retVal = 4;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
|
||||||
retVal = 4;
|
|
||||||
}
|
|
||||||
TRACE("bytes/Pxl for fmt(%u,%s) = %d\n", fmt, debug_d3dformat(fmt), retVal);
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLint fmt2glintFmt(D3DFORMAT fmt) {
|
|
||||||
GLint retVal;
|
|
||||||
|
|
||||||
switch (fmt) {
|
|
||||||
case D3DFMT_A4R4G4B4: retVal = GL_RGBA4; break;
|
|
||||||
case D3DFMT_A8R8G8B8: retVal = GL_RGBA8; break;
|
|
||||||
case D3DFMT_X8R8G8B8: retVal = GL_RGB8; break;
|
|
||||||
case D3DFMT_R8G8B8: retVal = GL_RGB8; break;
|
|
||||||
case D3DFMT_R5G6B5: retVal = GL_RGB5; break; /* fixme: internal format 6 for g? */
|
|
||||||
case D3DFMT_A1R5G5B5: retVal = GL_RGB5_A1; break;
|
|
||||||
default:
|
|
||||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
|
||||||
retVal = GL_RGB8;
|
|
||||||
}
|
|
||||||
TRACE("fmt2glintFmt for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLenum fmt2glFmt(D3DFORMAT fmt) {
|
|
||||||
GLenum retVal;
|
|
||||||
|
|
||||||
switch (fmt) {
|
|
||||||
case D3DFMT_A4R4G4B4: retVal = GL_BGRA; break;
|
|
||||||
case D3DFMT_A8R8G8B8: retVal = GL_BGRA; break;
|
|
||||||
case D3DFMT_X8R8G8B8: retVal = GL_BGRA; break;
|
|
||||||
case D3DFMT_R8G8B8: retVal = GL_BGR; break;
|
|
||||||
case D3DFMT_R5G6B5: retVal = GL_RGB; break;
|
|
||||||
case D3DFMT_A1R5G5B5: retVal = GL_BGRA; break;
|
|
||||||
default:
|
|
||||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
|
||||||
retVal = GL_BGR;
|
|
||||||
}
|
|
||||||
TRACE("fmt2glFmt for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLenum fmt2glType(D3DFORMAT fmt) {
|
|
||||||
GLenum retVal;
|
|
||||||
|
|
||||||
switch (fmt) {
|
|
||||||
case D3DFMT_A4R4G4B4: retVal = GL_UNSIGNED_SHORT_4_4_4_4_REV; break;
|
|
||||||
case D3DFMT_A8R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
|
||||||
case D3DFMT_X8R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
|
||||||
case D3DFMT_R5G6B5: retVal = GL_UNSIGNED_SHORT_5_6_5; break;
|
|
||||||
case D3DFMT_R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
|
||||||
case D3DFMT_A1R5G5B5: retVal = GL_UNSIGNED_SHORT_1_5_5_5_REV; break;
|
|
||||||
default:
|
|
||||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
|
||||||
retVal = GL_UNSIGNED_BYTE;
|
|
||||||
}
|
|
||||||
TRACE("fmt2glType for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
int D3DPrimitiveListGetVertexSize(D3DPRIMITIVETYPE PrimitiveType, int iNumPrim) {
|
int D3DPrimitiveListGetVertexSize(D3DPRIMITIVETYPE PrimitiveType, int iNumPrim) {
|
||||||
switch (PrimitiveType) {
|
switch (PrimitiveType) {
|
||||||
case D3DPT_POINTLIST: return iNumPrim;
|
case D3DPT_POINTLIST: return iNumPrim;
|
||||||
@ -328,20 +250,141 @@ GLenum D3DFmt2GLDepthType(D3DFORMAT fmt) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SHORT D3DFmtGetBpp(D3DFORMAT fmt) {
|
SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
||||||
return bytesPerPixel(fmt);
|
SHORT retVal;
|
||||||
|
|
||||||
|
switch (fmt) {
|
||||||
|
/* color buffer */
|
||||||
|
case D3DFMT_P8: retVal = 1; break;
|
||||||
|
case D3DFMT_R3G3B2: retVal = 1; break;
|
||||||
|
case D3DFMT_R5G6B5: retVal = 2; break;
|
||||||
|
case D3DFMT_X1R5G5B5: retVal = 2; break;
|
||||||
|
case D3DFMT_A4R4G4B4: retVal = 2; break;
|
||||||
|
case D3DFMT_X4R4G4B4: retVal = 2; break;
|
||||||
|
case D3DFMT_A1R5G5B5: retVal = 2; break;
|
||||||
|
case D3DFMT_R8G8B8: retVal = 3; break;
|
||||||
|
case D3DFMT_X8R8G8B8: retVal = 4; break;
|
||||||
|
case D3DFMT_A8R8G8B8: retVal = 4; break;
|
||||||
|
/* depth/stencil buffer */
|
||||||
|
case D3DFMT_D16_LOCKABLE: retVal = 2; break;
|
||||||
|
case D3DFMT_D16: retVal = 2; break;
|
||||||
|
case D3DFMT_D15S1: retVal = 2; break;
|
||||||
|
case D3DFMT_D24X4S4: retVal = 4; break;
|
||||||
|
case D3DFMT_D24S8: retVal = 4; break;
|
||||||
|
case D3DFMT_D24X8: retVal = 4; break;
|
||||||
|
case D3DFMT_D32: retVal = 4; break;
|
||||||
|
/* unknown */
|
||||||
|
case D3DFMT_UNKNOWN:
|
||||||
|
/* Guess at the highest value of the above */
|
||||||
|
TRACE("D3DFMT_UNKNOWN - Guessing at 4 bytes/pixel %u\n", fmt);
|
||||||
|
retVal = 4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||||
|
retVal = 4;
|
||||||
|
}
|
||||||
|
TRACE("bytes/Pxl for fmt(%u,%s) = %d\n", fmt, debug_d3dformat(fmt), retVal);
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLint D3DFmt2GLIntFmt(D3DFORMAT fmt) {
|
GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
||||||
return fmt2glintFmt(fmt);
|
GLint retVal;
|
||||||
|
|
||||||
|
switch (fmt) {
|
||||||
|
case D3DFMT_P8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||||
|
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||||
|
|
||||||
|
case D3DFMT_A4R4G4B4: retVal = GL_RGBA4; break;
|
||||||
|
case D3DFMT_A8R8G8B8: retVal = GL_RGBA8; break;
|
||||||
|
case D3DFMT_X8R8G8B8: retVal = GL_RGB8; break;
|
||||||
|
case D3DFMT_R8G8B8: retVal = GL_RGB8; break;
|
||||||
|
case D3DFMT_R5G6B5: retVal = GL_RGB5; break; /* fixme: internal format 6 for g? */
|
||||||
|
case D3DFMT_A1R5G5B5: retVal = GL_RGB5_A1; break;
|
||||||
|
default:
|
||||||
|
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||||
|
retVal = GL_RGB8;
|
||||||
|
}
|
||||||
|
#if defined(GL_EXT_texture_compression_s3tc)
|
||||||
|
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||||
|
switch (fmt) {
|
||||||
|
case D3DFMT_DXT1: retVal = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
|
||||||
|
case D3DFMT_DXT3: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||||
|
case D3DFMT_DXT5: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||||
|
default:
|
||||||
|
/* stupid compiler */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
TRACE("fmt2glintFmt for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum D3DFmt2GLFmt(D3DFORMAT fmt) {
|
GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
||||||
return fmt2glFmt(fmt);
|
GLenum retVal;
|
||||||
|
|
||||||
|
switch (fmt) {
|
||||||
|
case D3DFMT_P8: retVal = GL_COLOR_INDEX; break;
|
||||||
|
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX; break;
|
||||||
|
|
||||||
|
case D3DFMT_A4R4G4B4: retVal = GL_BGRA; break;
|
||||||
|
case D3DFMT_A8R8G8B8: retVal = GL_BGRA; break;
|
||||||
|
case D3DFMT_X8R8G8B8: retVal = GL_BGRA; break;
|
||||||
|
case D3DFMT_R8G8B8: retVal = GL_BGR; break;
|
||||||
|
case D3DFMT_R5G6B5: retVal = GL_RGB; break;
|
||||||
|
case D3DFMT_A1R5G5B5: retVal = GL_BGRA; break;
|
||||||
|
default:
|
||||||
|
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||||
|
retVal = GL_BGR;
|
||||||
|
}
|
||||||
|
#if defined(GL_EXT_texture_compression_s3tc)
|
||||||
|
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||||
|
switch (fmt) {
|
||||||
|
case D3DFMT_DXT1: retVal = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
|
||||||
|
case D3DFMT_DXT3: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||||
|
case D3DFMT_DXT5: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||||
|
default:
|
||||||
|
/* stupid compiler */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
TRACE("fmt2glFmt for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLenum D3DFmt2GLType(D3DFORMAT fmt) {
|
GLenum D3DFmt2GLType(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
|
||||||
return fmt2glType(fmt);
|
GLenum retVal;
|
||||||
|
|
||||||
|
switch (fmt) {
|
||||||
|
case D3DFMT_P8: retVal = GL_UNSIGNED_BYTE; break;
|
||||||
|
case D3DFMT_A8P8: retVal = GL_UNSIGNED_BYTE; break;
|
||||||
|
|
||||||
|
case D3DFMT_A4R4G4B4: retVal = GL_UNSIGNED_SHORT_4_4_4_4_REV; break;
|
||||||
|
case D3DFMT_A8R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
||||||
|
case D3DFMT_X8R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
||||||
|
case D3DFMT_R5G6B5: retVal = GL_UNSIGNED_SHORT_5_6_5; break;
|
||||||
|
case D3DFMT_R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
||||||
|
case D3DFMT_A1R5G5B5: retVal = GL_UNSIGNED_SHORT_1_5_5_5_REV; break;
|
||||||
|
default:
|
||||||
|
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||||
|
retVal = GL_UNSIGNED_BYTE;
|
||||||
|
}
|
||||||
|
#if defined(GL_EXT_texture_compression_s3tc)
|
||||||
|
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||||
|
switch (fmt) {
|
||||||
|
case D3DFMT_DXT1: retVal = 0; break;
|
||||||
|
case D3DFMT_DXT3: retVal = 0; break;
|
||||||
|
case D3DFMT_DXT5: retVal = 0; break;
|
||||||
|
default:
|
||||||
|
/* stupid compiler */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
TRACE("fmt2glType for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SOURCEx_RGB_EXT(DWORD arg) {
|
int SOURCEx_RGB_EXT(DWORD arg) {
|
||||||
|
@ -140,23 +140,23 @@ void WINAPI IDirect3DVolumeTexture8Impl_PreLoad(LPDIRECT3DVOLUMETEXTU
|
|||||||
TRACE("Calling glTexImage3D %x i=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
TRACE("Calling glTexImage3D %x i=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||||
GL_TEXTURE_3D,
|
GL_TEXTURE_3D,
|
||||||
i,
|
i,
|
||||||
fmt2glintFmt(This->format),
|
D3DFmt2GLIntFmt(This->Device, This->format),
|
||||||
This->volumes[i]->myDesc.Width,
|
This->volumes[i]->myDesc.Width,
|
||||||
This->volumes[i]->myDesc.Height,
|
This->volumes[i]->myDesc.Height,
|
||||||
This->volumes[i]->myDesc.Depth,
|
This->volumes[i]->myDesc.Depth,
|
||||||
0,
|
0,
|
||||||
fmt2glFmt(This->format),
|
D3DFmt2GLFmt(This->Device, This->format),
|
||||||
fmt2glType(This->format),
|
D3DFmt2GLType(This->Device, This->format),
|
||||||
This->volumes[i]->allocatedMemory);
|
This->volumes[i]->allocatedMemory);
|
||||||
glTexImage3D(GL_TEXTURE_3D,
|
glTexImage3D(GL_TEXTURE_3D,
|
||||||
i,
|
i,
|
||||||
fmt2glintFmt(This->format),
|
D3DFmt2GLIntFmt(This->Device, This->format),
|
||||||
This->volumes[i]->myDesc.Width,
|
This->volumes[i]->myDesc.Width,
|
||||||
This->volumes[i]->myDesc.Height,
|
This->volumes[i]->myDesc.Height,
|
||||||
This->volumes[i]->myDesc.Depth,
|
This->volumes[i]->myDesc.Depth,
|
||||||
0,
|
0,
|
||||||
fmt2glFmt(This->format),
|
D3DFmt2GLFmt(This->Device, This->format),
|
||||||
fmt2glType(This->format),
|
D3DFmt2GLType(This->Device, This->format),
|
||||||
This->volumes[i]->allocatedMemory);
|
This->volumes[i]->allocatedMemory);
|
||||||
checkGLcall("glTexImage3D");
|
checkGLcall("glTexImage3D");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user