Commit 40dd9692 authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- first draft of D3DCLIPSTATUS8 handling (not really used for now)

- add a new DEBUG_SINGLE_MODE #define (for debug caps needs) - better traces for surface dumping - much better Texture support on Utilities functions and on CheckDeviceType - D3DRS_ZVISIBLE as unsupported (as seen in msdn)
parent dfbf36d3
......@@ -1095,8 +1095,9 @@ struct IDirect3DStateBlockImpl {
SAVEDSTATES Changed;
SAVEDSTATES Set;
/* ClipPlane */
/* Clipping */
double clipplane[MAX_CLIPPLANES][4];
D3DCLIPSTATUS8 clip_status;
/* Stream Source */
UINT stream_stride[MAX_STREAMS];
......
......@@ -330,7 +330,8 @@ UINT WINAPI IDirect3DDevice8Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE8 i
HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(LPDIRECT3DDEVICE8 iface, DWORD Bytes) {
ICOM_THIS(IDirect3DDevice8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(LPDIRECT3DDEVICE8 iface, IDirect3D8** ppD3D8) {
ICOM_THIS(IDirect3DDevice8Impl,iface);
......@@ -480,7 +481,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
}
HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) {
ICOM_THIS(IDirect3DDevice8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface,
CONST RECT* pSourceRect, CONST RECT* pDestRect,
......@@ -2492,6 +2494,15 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
if (disable & D3DCLIPPLANE3) { glDisable(GL_CLIP_PLANE3); checkGLcall("glDisable(clip plane 3)"); }
if (disable & D3DCLIPPLANE4) { glDisable(GL_CLIP_PLANE4); checkGLcall("glDisable(clip plane 4)"); }
if (disable & D3DCLIPPLANE5) { glDisable(GL_CLIP_PLANE5); checkGLcall("glDisable(clip plane 5)"); }
/** update clipping status */
if (enable) {
This->StateBlock->clip_status.ClipUnion = 0;
This->StateBlock->clip_status.ClipIntersection = 0xFFFFFFFF;
} else {
This->StateBlock->clip_status.ClipUnion = 0;
This->StateBlock->clip_status.ClipIntersection = 0;
}
}
break;
......@@ -3000,9 +3011,34 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
}
break;
/* Unhandled yet...! */
case D3DRS_LASTPIXEL :
{
if (Value) {
TRACE("Last Pixel Drawing Enabled\n");
} else {
FIXME("Last Pixel Drawing Disabled, not handled yet\n");
}
}
break;
case D3DRS_SOFTWAREVERTEXPROCESSING :
{
if (Value) {
TRACE("Software Processing Enabled\n");
} else {
TRACE("Software Processing Disabled\n");
}
}
break;
/** not supported */
case D3DRS_ZVISIBLE :
{
LEAVE_GL();
return D3DERR_INVALIDCALL;
}
/* Unhandled yet...! */
case D3DRS_EDGEANTIALIAS :
case D3DRS_WRAP0 :
case D3DRS_WRAP1 :
......@@ -3012,7 +3048,6 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
case D3DRS_WRAP5 :
case D3DRS_WRAP6 :
case D3DRS_WRAP7 :
case D3DRS_SOFTWAREVERTEXPROCESSING :
case D3DRS_POINTSPRITEENABLE :
case D3DRS_MULTISAMPLEANTIALIAS :
case D3DRS_MULTISAMPLEMASK :
......@@ -3022,7 +3057,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
case D3DRS_POSITIONORDER :
case D3DRS_NORMALORDER :
/*Put back later: FIXME("(%p)->(%d,%ld) not handled yet\n", This, State, Value); */
TRACE("(%p)->(%d,%ld) not handled yet\n", This, State, Value);
FIXME("(%p)->(%d,%ld) not handled yet\n", This, State, Value);
break;
default:
FIXME("(%p)->(%d,%ld) unrecognized\n", This, State, Value);
......@@ -3097,11 +3132,23 @@ HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(LPDIRECT3DDEVICE8 iface,
HRESULT WINAPI IDirect3DDevice8Impl_SetClipStatus(LPDIRECT3DDEVICE8 iface, CONST D3DCLIPSTATUS8* pClipStatus) {
ICOM_THIS(IDirect3DDevice8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
if (NULL == pClipStatus) {
return D3DERR_INVALIDCALL;
}
This->UpdateStateBlock->clip_status.ClipUnion = pClipStatus->ClipUnion;
This->UpdateStateBlock->clip_status.ClipIntersection = pClipStatus->ClipIntersection;
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(LPDIRECT3DDEVICE8 iface, D3DCLIPSTATUS8* pClipStatus) {
ICOM_THIS(IDirect3DDevice8Impl,iface);
FIXME("(%p) : stub\n", This); return D3D_OK;
FIXME("(%p) : stub\n", This);
if (NULL == pClipStatus) {
return D3DERR_INVALIDCALL;
}
pClipStatus->ClipUnion = This->UpdateStateBlock->clip_status.ClipUnion;
pClipStatus->ClipIntersection = This->UpdateStateBlock->clip_status.ClipIntersection;
return D3D_OK;
}
HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(LPDIRECT3DDEVICE8 iface, DWORD Stage,IDirect3DBaseTexture8** ppTexture) {
ICOM_THIS(IDirect3DDevice8Impl,iface);
......
......@@ -264,6 +264,10 @@ HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier (LPDIRECT3D8 iface,
return D3D_OK;
}
/*#define DEBUG_SINGLE_MODE*/
#undef DEBUG_SINGLE_MODE
UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,
UINT Adapter) {
ICOM_THIS(IDirect3D8Impl,iface);
......@@ -275,12 +279,16 @@ UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,
}
if (Adapter == 0) { /* Display */
DEVMODEW DevModeW;
int i = 0;
#if !defined( DEBUG_SINGLE_MODE )
DEVMODEW DevModeW;
while (EnumDisplaySettingsExW(NULL, i, &DevModeW, 0)) {
i++;
}
#else
i = 1;
#endif
TRACE_(d3d_caps)("(%p}->(Adapter: %d) => %d\n", This, Adapter, i);
return i;
} else {
......@@ -296,13 +304,16 @@ HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface,
TRACE_(d3d_caps)("(%p}->(Adapter:%d, mode:%d, pMode:%p)\n", This, Adapter, Mode, pMode);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
if (NULL == pMode ||
Adapter >= IDirect3D8Impl_GetAdapterCount(iface) ||
Mode >= IDirect3D8Impl_GetAdapterModeCount(iface, Adapter)) {
return D3DERR_INVALIDCALL;
}
if (Adapter == 0) { /* Display */
HDC hdc;
int bpp = 0;
#if !defined( DEBUG_SINGLE_MODE )
HDC hdc;
DEVMODEW DevModeW;
if (EnumDisplaySettingsExW(NULL, Mode, &DevModeW, 0))
......@@ -333,6 +344,14 @@ HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface,
case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
default: pMode->Format = D3DFMT_UNKNOWN;
}
#else
if (Mode > 0) return D3DERR_INVALIDCALL;
pMode->Width = 800;
pMode->Height = 600;
pMode->RefreshRate = D3DADAPTER_DEFAULT;
pMode->Format = D3DFMT_A8R8G8B8;
bpp = 32;
#endif
TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x,%s) bpp %u\n", pMode->Width, pMode->Height, pMode->RefreshRate, pMode->Format, debug_d3dformat(pMode->Format), bpp);
} else {
......@@ -347,7 +366,8 @@ HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface,
ICOM_THIS(IDirect3D8Impl,iface);
TRACE_(d3d_caps)("(%p}->(Adapter: %d, pMode: %p)\n", This, Adapter, pMode);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
if (NULL == pMode ||
Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
......@@ -393,6 +413,11 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 iface,
DisplayFormat, debug_d3dformat(DisplayFormat),
BackBufferFormat, debug_d3dformat(BackBufferFormat),
Windowed);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
/*
switch (DisplayFormat) {
case D3DFMT_A8R8G8B8:
......@@ -401,7 +426,13 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 iface,
break;
}
*/
switch (DisplayFormat) {
/*case D3DFMT_R5G6B5:*/
case D3DFMT_R3G3B2:
return D3DERR_NOTAVAILABLE;
default:
break;
}
return D3D_OK;
}
......@@ -409,7 +440,7 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
ICOM_THIS(IDirect3D8Impl,iface);
TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s))\n",
TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s)) ",
This,
Adapter,
DeviceType, debug_d3ddevicetype(DeviceType),
......@@ -418,11 +449,16 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
RType, debug_d3dressourcetype(RType),
CheckFormat, debug_d3dformat(CheckFormat));
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
switch (CheckFormat) {
case D3DFMT_DXT1:
case D3DFMT_DXT3:
case D3DFMT_DXT5:
TRACE_(d3d_caps)("[OK]\n");
return D3D_OK;
default:
break; /* Avoid compiler warnings */
......@@ -430,25 +466,62 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface,
}
switch (CheckFormat) {
case D3DFMT_UYVY:
case D3DFMT_YUY2:
/*****
* check supported using GL_SUPPORT
*/
case D3DFMT_DXT1:
case D3DFMT_DXT2:
case D3DFMT_DXT3:
case D3DFMT_DXT4:
case D3DFMT_DXT5:
case D3DFMT_X8L8V8U8:
case D3DFMT_L6V5U5:
/*case D3DFMT_V8U8:*/
case D3DFMT_L8:
/*****
* supported
*/
/*case D3DFMT_R5G6B5: */
/*case D3DFMT_X1R5G5B5:*/
/*case D3DFMT_A1R5G5B5: */
/*case D3DFMT_A4R4G4B4:*/
/*****
* unsupported
*/
/* color buffer */
/*case D3DFMT_X8R8G8B8:*/
case D3DFMT_A8R3G3B2:
/* Paletted */
case D3DFMT_P8:
case D3DFMT_A8P8:
/* Luminance */
case D3DFMT_L8:
case D3DFMT_A8L8:
case D3DFMT_A4L4:
/* Bump */
/*case D3DFMT_V8U8:*/
/*case D3DFMT_V16U16:*/
case D3DFMT_L6V5U5:
case D3DFMT_X8L8V8U8:
case D3DFMT_Q8W8V8U8:
case D3DFMT_W11V11U10:
/****
* currently hard to support
*/
case D3DFMT_UYVY:
case D3DFMT_YUY2:
/* Since we do not support these formats right now, don't pretend to. */
TRACE_(d3d_caps)("[FAILED]\n");
return D3DERR_NOTAVAILABLE;
default:
break;
}
TRACE_(d3d_caps)("[OK]\n");
return D3D_OK;
}
......@@ -464,6 +537,10 @@ HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(LPDIRECT3D8 iface,
Windowed,
MultiSampleType);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
if (D3DMULTISAMPLE_NONE == MultiSampleType)
return D3D_OK;
return D3DERR_NOTAVAILABLE;
......@@ -481,6 +558,10 @@ HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(LPDIRECT3D8 iface,
RenderTargetFormat, debug_d3dformat(RenderTargetFormat),
DepthStencilFormat, debug_d3dformat(DepthStencilFormat));
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
#if 0
switch (DepthStencilFormat) {
case D3DFMT_D24X4S4:
......@@ -508,6 +589,10 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D
TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType: %x, pCaps: %p)\n", This, Adapter, DeviceType, pCaps);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
/* Note: GL seems to trap if GetDeviceCaps is called before any HWND's created
ie there is no GL Context - Get a default rendering context to enable the
function query some info from GL */
......@@ -780,6 +865,11 @@ HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D
HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter) {
ICOM_THIS(IDirect3D8Impl,iface);
FIXME_(d3d_caps)("(%p)->(Adptr:%d)\n", This, Adapter);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return NULL;
}
return D3D_OK;
}
......@@ -800,9 +890,9 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
TRACE_(d3d_caps)("(%p, %p)\n", This, display);
if (NULL != display) {
test = glXQueryVersion(NULL, &major, &minor);
test = glXQueryVersion(display, &major, &minor);
This->gl_info.glx_version = ((major & 0x0000FFFF) << 16) | (minor & 0x0000FFFF);
gl_string = glXGetClientString(NULL, GLX_VENDOR);
gl_string = glXGetClientString(display, GLX_VENDOR);
} else {
gl_string = glGetString(GL_VENDOR);
}
......@@ -1109,6 +1199,10 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
if (Adapter >= IDirect3D8Impl_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
/* Allocate the storage for the device */
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DDevice8Impl));
if (NULL == object) {
......
......@@ -178,6 +178,10 @@ HRESULT WINAPI IDirect3DDeviceImpl_InitStartupStateBlock(IDirect3DDevice8Impl* T
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_POSITIONORDER, D3DORDER_CUBIC);
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_NORMALORDER, D3DORDER_LINEAR);
/** clipping status */
This->StateBlock->clip_status.ClipUnion = 0;
This->StateBlock->clip_status.ClipIntersection = 0xFFFFFFFF;
/* Texture Stage States - Put directly into state block, we will call function below */
for (i = 0; i < GL_LIMITS(textures); i++) {
memcpy(&This->StateBlock->transforms[D3DTS_TEXTURE0 + i], &idmatrix, sizeof(idmatrix));
......
......@@ -591,9 +591,11 @@ HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenu
FIXME("Using DXT1/3/5 without advertized support\n");
}
} 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, d3dfmt=%s, intfmt=%x, w=%d, h=%d,0=%d, glFmt=%x, glType=%x, Mem=%p\n",
gl_target,
gl_level,
debug_d3dformat(This->myDesc.Format),
D3DFmt2GLIntFmt(This->Device, This->myDesc.Format),
This->myDesc.Width,
This->myDesc.Height,
......@@ -623,9 +625,16 @@ HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenu
char buffer[4096];
++gen;
if ((gen % 10) == 0) {
snprintf(buffer, sizeof(buffer), "/tmp/surface%u_level%u_%u.ppm", gl_target, gl_level, gen);
snprintf(buffer, sizeof(buffer), "/tmp/surface%p_type%u_level%u_%u.ppm", This, gl_target, gl_level, gen);
IDirect3DSurface8Impl_SaveSnapshot((LPDIRECT3DSURFACE8) This, buffer);
}
/*
* debugging crash code
if (gen == 250) {
void** test = NULL;
*test = 0;
}
*/
}
#endif
}
......
......@@ -376,30 +376,41 @@ SHORT D3DFmtGetBpp(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
switch (fmt) {
/* color buffer */
case D3DFMT_P8: retVal = 1; break;
case D3DFMT_R3G3B2: retVal = 1; break;
case D3DFMT_V8U8: retVal = 2; break;
case D3DFMT_R5G6B5: retVal = 2; break;
case D3DFMT_R8G8B8: retVal = 3; break;
case D3DFMT_A1R5G5B5: 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;
case D3DFMT_X8R8G8B8: retVal = 4; break;
/* Paletted */
case D3DFMT_P8: retVal = 1; break;
case D3DFMT_A8P8: retVal = 2; break;
/* depth/stencil buffer */
case D3DFMT_D16_LOCKABLE: retVal = 2; break;
case D3DFMT_D16: retVal = 2; break;
case D3DFMT_D32: retVal = 4; 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;
/* Luminance */
case D3DFMT_L8: retVal = 1; break;
case D3DFMT_A4L4: retVal = 1; break;
case D3DFMT_A8L8: retVal = 2; break;
/* Bump */
case D3DFMT_V8U8: retVal = 2; break;
case D3DFMT_L6V5U5: retVal = 2; break;
case D3DFMT_V16U16: retVal = 4; break;
case D3DFMT_X8L8V8U8: retVal = 4; break;
/* Compressed */
case D3DFMT_DXT1: retVal = 1; break; /* Actually 8 bytes per 16 pixels - Special cased later */
case D3DFMT_DXT3: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
case D3DFMT_DXT5: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
/* to see */
case D3DFMT_A8: retVal = 1; break;
/* unknown */
case D3DFMT_UNKNOWN:
/* Guess at the highest value of the above */
......@@ -431,16 +442,30 @@ GLint D3DFmt2GLIntFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
if (retVal == 0) {
switch (fmt) {
/* Paletted */
case D3DFMT_P8: retVal = GL_COLOR_INDEX8_EXT; break;
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX8_EXT; break;
/* Luminance */
case D3DFMT_L8: retVal = GL_LUMINANCE8; break;
case D3DFMT_A8L8: retVal = GL_LUMINANCE8_ALPHA8; break;
case D3DFMT_A4L4: retVal = GL_LUMINANCE4_ALPHA4; break;
/* Bump */
case D3DFMT_V8U8: 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_V16U16: retVal = GL_COLOR_INDEX; break;
case D3DFMT_L6V5U5: retVal = GL_COLOR_INDEX8_EXT; break;
case D3DFMT_X8L8V8U8: retVal = GL_COLOR_INDEX; break;
/* color buffer */
case D3DFMT_R3G3B2: retVal = GL_R3_G3_B2; break;
case D3DFMT_R5G6B5: retVal = GL_RGB5; break; /* fixme: internal format 6 for g? */
case D3DFMT_R8G8B8: retVal = GL_RGB8; break;
case D3DFMT_A1R5G5B5: retVal = GL_RGB5_A1; break;
case D3DFMT_X1R5G5B5: retVal = GL_RGB5_A1; break;
case D3DFMT_A4R4G4B4: retVal = GL_RGBA4; break;
case D3DFMT_X4R4G4B4: retVal = GL_RGBA4; break;
case D3DFMT_A8R8G8B8: retVal = GL_RGBA8; break;
case D3DFMT_X8R8G8B8: retVal = GL_RGBA8; break;
/* to see */
case D3DFMT_A8: retVal = GL_ALPHA8; break;
default:
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
retVal = GL_RGB8;
......@@ -466,16 +491,30 @@ GLenum D3DFmt2GLFmt(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
if (retVal == 0) {
switch (fmt) {
/* Paletted */
case D3DFMT_P8: retVal = GL_COLOR_INDEX; break;
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX; break;
/* Luminance */
case D3DFMT_L8: retVal = GL_LUMINANCE; break;
case D3DFMT_A8L8: retVal = GL_LUMINANCE_ALPHA; break;
case D3DFMT_A4L4: retVal = GL_LUMINANCE_ALPHA; break;
/* Bump */
case D3DFMT_V8U8: retVal = GL_COLOR_INDEX; break;
case D3DFMT_V16U16: retVal = GL_COLOR_INDEX; break;
case D3DFMT_L6V5U5: retVal = GL_COLOR_INDEX; break;
case D3DFMT_X8L8V8U8: retVal = GL_COLOR_INDEX; break;
/* color buffer */
case D3DFMT_R3G3B2: retVal = GL_BGR; break;
case D3DFMT_R5G6B5: retVal = GL_RGB; break;
case D3DFMT_R8G8B8: retVal = GL_RGB; break;
case D3DFMT_A1R5G5B5: retVal = GL_BGRA; break;
case D3DFMT_X1R5G5B5: retVal = GL_BGRA; break;
case D3DFMT_A4R4G4B4: retVal = GL_BGRA; break;
case D3DFMT_X4R4G4B4: 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;
/* to see */
case D3DFMT_A8: retVal = GL_ALPHA; break;
default:
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
retVal = GL_BGR;
......@@ -502,16 +541,30 @@ GLenum D3DFmt2GLType(IDirect3DDevice8Impl* This, D3DFORMAT fmt) {
if (retVal == 0) {
switch (fmt) {
/* Paletted */
case D3DFMT_P8: retVal = GL_UNSIGNED_BYTE; break;
case D3DFMT_A8P8: retVal = GL_UNSIGNED_BYTE; break;
/* Luminance */
case D3DFMT_L8: retVal = GL_UNSIGNED_BYTE; break;
case D3DFMT_A8L8: retVal = GL_UNSIGNED_BYTE; break;
case D3DFMT_A4L4: retVal = GL_UNSIGNED_BYTE; break;
/* Bump */
case D3DFMT_V8U8: 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_V16U16: retVal = GL_UNSIGNED_SHORT; break;
case D3DFMT_L6V5U5: retVal = GL_UNSIGNED_SHORT_5_5_5_1; break;
case D3DFMT_X8L8V8U8: retVal = GL_UNSIGNED_BYTE; break;
/* Color buffer */
case D3DFMT_R3G3B2: retVal = GL_UNSIGNED_BYTE_2_3_3_REV; 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;
case D3DFMT_X1R5G5B5: retVal = GL_UNSIGNED_SHORT_1_5_5_5_REV; break;
case D3DFMT_A4R4G4B4: retVal = GL_UNSIGNED_SHORT_4_4_4_4_REV; break;
case D3DFMT_X4R4G4B4: retVal = GL_UNSIGNED_SHORT_4_4_4_4_REV; break;
case D3DFMT_A8R8G8B8: retVal = GL_UNSIGNED_INT_8_8_8_8_REV; break;
case D3DFMT_X8R8G8B8: retVal = GL_UNSIGNED_INT_8_8_8_8_REV; break;
/* to see */
case D3DFMT_A8: retVal = GL_ALPHA; break;
default:
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
retVal = GL_UNSIGNED_BYTE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment