Commit a0131a32 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Split up the format table.

parent 58080159
...@@ -576,7 +576,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U ...@@ -576,7 +576,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSurfaceImpl *object; /*NOTE: impl ref allowed since this is a create function */ IWineD3DSurfaceImpl *object; /*NOTE: impl ref allowed since this is a create function */
unsigned int Size = 1; unsigned int Size = 1;
const PixelFormatDesc *tableEntry = getFormatDescEntry(Format); const GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *tableEntry = getFormatDescEntry(Format, &glDesc);
TRACE("(%p) Create surface\n",This); TRACE("(%p) Create surface\n",This);
/** FIXME: Check ranges on the inputs are valid /** FIXME: Check ranges on the inputs are valid
...@@ -645,9 +646,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U ...@@ -645,9 +646,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U
object->currentDesc.MultiSampleQuality = MultisampleQuality; object->currentDesc.MultiSampleQuality = MultisampleQuality;
/* Setup some glformat defaults */ /* Setup some glformat defaults */
object->glDescription.glFormat = tableEntry->glFormat; object->glDescription.glFormat = glDesc->glFormat;
object->glDescription.glFormatInternal = tableEntry->glInternal; object->glDescription.glFormatInternal = glDesc->glInternal;
object->glDescription.glType = tableEntry->glType; object->glDescription.glType = glDesc->glType;
object->glDescription.textureName = 0; object->glDescription.textureName = 0;
object->glDescription.level = Level; object->glDescription.level = Level;
...@@ -922,7 +923,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, ...@@ -922,7 +923,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVolumeImpl *object; /** NOTE: impl ref allowed since this is a create function **/ IWineD3DVolumeImpl *object; /** NOTE: impl ref allowed since this is a create function **/
const PixelFormatDesc *formatDesc = getFormatDescEntry(Format); const StaticPixelFormatDesc *formatDesc = getFormatDescEntry(Format, NULL);
D3DCREATERESOURCEOBJECTINSTANCE(object, Volume, WINED3DRTYPE_VOLUME, ((Width * formatDesc->bpp) * Height * Depth)) D3DCREATERESOURCEOBJECTINSTANCE(object, Volume, WINED3DRTYPE_VOLUME, ((Width * formatDesc->bpp) * Height * Depth))
...@@ -2028,7 +2029,6 @@ static void WINAPI IWineD3DDeviceImpl_SetFullscreen(IWineD3DDevice *iface, BOOL ...@@ -2028,7 +2029,6 @@ static void WINAPI IWineD3DDeviceImpl_SetFullscreen(IWineD3DDevice *iface, BOOL
*/ */
static void WINAPI IWineD3DDeviceImpl_SetMultithreaded(IWineD3DDevice *iface) { static void WINAPI IWineD3DDeviceImpl_SetMultithreaded(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
FIXME("No thread safety in wined3d yet\n");
/*For now just store the flag(needed in case of ddraw) */ /*For now just store the flag(needed in case of ddraw) */
This->createParms.BehaviorFlags |= WINED3DCREATE_MULTITHREADED; This->createParms.BehaviorFlags |= WINED3DCREATE_MULTITHREADED;
...@@ -2040,7 +2040,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U ...@@ -2040,7 +2040,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U
DEVMODEW devmode; DEVMODEW devmode;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
LONG ret; LONG ret;
const PixelFormatDesc *formatDesc = getFormatDescEntry(pMode->Format); const StaticPixelFormatDesc *formatDesc = getFormatDescEntry(pMode->Format, NULL);
RECT clip_rc; RECT clip_rc;
TRACE("(%p)->(%d,%p) Mode=%dx%dx@%d, %s\n", This, iSwapChain, pMode, pMode->Width, pMode->Height, pMode->RefreshRate, debug_d3dformat(pMode->Format)); TRACE("(%p)->(%d,%p) Mode=%dx%dx@%d, %s\n", This, iSwapChain, pMode, pMode->Width, pMode->Height, pMode->RefreshRate, debug_d3dformat(pMode->Format));
...@@ -5985,11 +5985,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i ...@@ -5985,11 +5985,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
This->cursorHeight = pSur->currentDesc.Height; This->cursorHeight = pSur->currentDesc.Height;
if (SUCCEEDED(IWineD3DSurface_LockRect(pCursorBitmap, &rect, NULL, WINED3DLOCK_READONLY))) if (SUCCEEDED(IWineD3DSurface_LockRect(pCursorBitmap, &rect, NULL, WINED3DLOCK_READONLY)))
{ {
const PixelFormatDesc *tableEntry = getFormatDescEntry(WINED3DFMT_A8R8G8B8); const GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *tableEntry = getFormatDescEntry(WINED3DFMT_A8R8G8B8, &glDesc);
char *mem, *bits = (char *)rect.pBits; char *mem, *bits = (char *)rect.pBits;
GLint intfmt = tableEntry->glInternal; GLint intfmt = glDesc->glInternal;
GLint format = tableEntry->glFormat; GLint format = glDesc->glFormat;
GLint type = tableEntry->glType; GLint type = glDesc->glType;
INT height = This->cursorHeight; INT height = This->cursorHeight;
INT width = This->cursorWidth; INT width = This->cursorWidth;
INT bpp = tableEntry->bpp; INT bpp = tableEntry->bpp;
...@@ -6455,7 +6456,6 @@ static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IW ...@@ -6455,7 +6456,6 @@ static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IW
break; break;
} }
case WINED3DRTYPE_TEXTURE: case WINED3DRTYPE_TEXTURE:
case WINED3DRTYPE_CUBETEXTURE: case WINED3DRTYPE_CUBETEXTURE:
case WINED3DRTYPE_VOLUMETEXTURE: case WINED3DRTYPE_VOLUMETEXTURE:
......
...@@ -347,7 +347,7 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D ...@@ -347,7 +347,7 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *)stateblock->textures[0])->surfaces[0]; surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *)stateblock->textures[0])->surfaces[0];
if(surf->CKeyFlags & WINEDDSD_CKSRCBLT) { if(surf->CKeyFlags & WINEDDSD_CKSRCBLT) {
const PixelFormatDesc *fmt = getFormatDescEntry(surf->resource.format); const StaticPixelFormatDesc *fmt = getFormatDescEntry(surf->resource.format, NULL);
/* The surface conversion does not do color keying conversion for surfaces that have an alpha /* The surface conversion does not do color keying conversion for surfaces that have an alpha
* channel on their own. Likewise, the alpha test shouldn't be set up for color keying if the * channel on their own. Likewise, the alpha test shouldn't be set up for color keying if the
* surface has alpha bits * surface has alpha bits
...@@ -1783,7 +1783,7 @@ static void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D ...@@ -1783,7 +1783,7 @@ static void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D
IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *) stateblock->textures[0])->surfaces[0]; IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *) ((IWineD3DTextureImpl *) stateblock->textures[0])->surfaces[0];
if(surf->CKeyFlags & WINEDDSD_CKSRCBLT && if(surf->CKeyFlags & WINEDDSD_CKSRCBLT &&
getFormatDescEntry(surf->resource.format)->alphaMask == 0x00000000) { getFormatDescEntry(surf->resource.format, NULL)->alphaMask == 0x00000000) {
/* Color keying needs to pass alpha values from the texture through to have the alpha test work properly. /* Color keying needs to pass alpha values from the texture through to have the alpha test work properly.
* On the other hand applications can still use texture combiners apparently. This code takes care that apps * On the other hand applications can still use texture combiners apparently. This code takes care that apps
......
...@@ -275,11 +275,12 @@ void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int wi ...@@ -275,11 +275,12 @@ void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int wi
} }
if (!renderbuffer) { if (!renderbuffer) {
const PixelFormatDesc *format_entry = getFormatDescEntry(This->resource.format); const GlPixelFormatDesc *glDesc;
getFormatDescEntry(This->resource.format, &glDesc);
GL_EXTCALL(glGenRenderbuffersEXT(1, &renderbuffer)); GL_EXTCALL(glGenRenderbuffersEXT(1, &renderbuffer));
GL_EXTCALL(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, renderbuffer)); GL_EXTCALL(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, renderbuffer));
GL_EXTCALL(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, format_entry->glFormat, width, height)); GL_EXTCALL(glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, glDesc->glFormat, width, height));
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(renderbuffer_entry_t)); entry = HeapAlloc(GetProcessHeap(), 0, sizeof(renderbuffer_entry_t));
entry->width = width; entry->width = width;
...@@ -1261,7 +1262,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) { ...@@ -1261,7 +1262,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
DWORD *masks; DWORD *masks;
HRESULT hr; HRESULT hr;
RGBQUAD col[256]; RGBQUAD col[256];
const PixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format); const StaticPixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format, NULL);
TRACE("(%p)->(%p)\n",This,pHDC); TRACE("(%p)->(%p)\n",This,pHDC);
...@@ -1482,12 +1483,13 @@ HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) { ...@@ -1482,12 +1483,13 @@ HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) {
static HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode) { static HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode) {
BOOL colorkey_active = need_alpha_ck && (This->CKeyFlags & WINEDDSD_CKSRCBLT); BOOL colorkey_active = need_alpha_ck && (This->CKeyFlags & WINEDDSD_CKSRCBLT);
const PixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format); const GlPixelFormatDesc *glDesc;
getFormatDescEntry(This->resource.format, &glDesc);
/* Default values: From the surface */ /* Default values: From the surface */
*format = formatEntry->glFormat; *format = glDesc->glFormat;
*internal = srgb_mode?formatEntry->glGammaInternal:formatEntry->glInternal; *internal = srgb_mode?glDesc->glGammaInternal:glDesc->glInternal;
*type = formatEntry->glType; *type = glDesc->glType;
*convert = NO_CONVERSION; *convert = NO_CONVERSION;
*target_bpp = This->bytesPerPixel; *target_bpp = This->bytesPerPixel;
...@@ -2248,7 +2250,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3D ...@@ -2248,7 +2250,8 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetContainer(IWineD3DSurface *iface, IWineD3D
HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORMAT format) { HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORMAT format) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
const PixelFormatDesc *formatEntry = getFormatDescEntry(format); const GlPixelFormatDesc *glDesc;
const StaticPixelFormatDesc *formatEntry = getFormatDescEntry(format, &glDesc);
if (This->resource.format != WINED3DFMT_UNKNOWN) { if (This->resource.format != WINED3DFMT_UNKNOWN) {
FIXME("(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN\n", This); FIXME("(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN\n", This);
...@@ -2273,9 +2276,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORM ...@@ -2273,9 +2276,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, WINED3DFORM
/* Setup some glformat defaults */ /* Setup some glformat defaults */
This->glDescription.glFormat = formatEntry->glFormat; This->glDescription.glFormat = glDesc->glFormat;
This->glDescription.glFormatInternal = formatEntry->glInternal; This->glDescription.glFormatInternal = glDesc->glInternal;
This->glDescription.glType = formatEntry->glType; This->glDescription.glType = glDesc->glType;
if (format != WINED3DFMT_UNKNOWN) { if (format != WINED3DFMT_UNKNOWN) {
This->bytesPerPixel = formatEntry->bpp; This->bytesPerPixel = formatEntry->bpp;
......
...@@ -498,7 +498,7 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface, ...@@ -498,7 +498,7 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
WINED3DFORMAT dfmt = WINED3DFMT_UNKNOWN, sfmt = WINED3DFMT_UNKNOWN; WINED3DFORMAT dfmt = WINED3DFMT_UNKNOWN, sfmt = WINED3DFMT_UNKNOWN;
int bpp, srcheight, srcwidth, dstheight, dstwidth, width; int bpp, srcheight, srcwidth, dstheight, dstwidth, width;
int x, y; int x, y;
const PixelFormatDesc *sEntry, *dEntry; const StaticPixelFormatDesc *sEntry, *dEntry;
LPBYTE dbuf, sbuf; LPBYTE dbuf, sbuf;
TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, Src, SrcRect, Flags, DDBltFx); TRACE("(%p)->(%p,%p,%p,%x,%p)\n", This, DestRect, Src, SrcRect, Flags, DDBltFx);
...@@ -536,7 +536,7 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface, ...@@ -536,7 +536,7 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
dfmt = This->resource.format; dfmt = This->resource.format;
slock = dlock; slock = dlock;
sfmt = dfmt; sfmt = dfmt;
sEntry = getFormatDescEntry(sfmt); sEntry = getFormatDescEntry(sfmt, NULL);
dEntry = sEntry; dEntry = sEntry;
} }
else else
...@@ -546,9 +546,9 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface, ...@@ -546,9 +546,9 @@ IWineGDISurfaceImpl_Blt(IWineD3DSurface *iface,
IWineD3DSurface_LockRect(SrcSurface, &slock, NULL, WINED3DLOCK_READONLY); IWineD3DSurface_LockRect(SrcSurface, &slock, NULL, WINED3DLOCK_READONLY);
sfmt = Src->resource.format; sfmt = Src->resource.format;
} }
sEntry = getFormatDescEntry(sfmt); sEntry = getFormatDescEntry(sfmt, NULL);
dfmt = This->resource.format; dfmt = This->resource.format;
dEntry = getFormatDescEntry(dfmt); dEntry = getFormatDescEntry(dfmt, NULL);
IWineD3DSurface_LockRect(iface, &dlock,NULL,0); IWineD3DSurface_LockRect(iface, &dlock,NULL,0);
} }
...@@ -1135,7 +1135,7 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface, ...@@ -1135,7 +1135,7 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
RECT rsrc2; RECT rsrc2;
RECT lock_src, lock_dst, lock_union; RECT lock_src, lock_dst, lock_union;
BYTE *sbuf, *dbuf; BYTE *sbuf, *dbuf;
const PixelFormatDesc *sEntry, *dEntry; const StaticPixelFormatDesc *sEntry, *dEntry;
if (TRACE_ON(d3d_surface)) if (TRACE_ON(d3d_surface))
{ {
...@@ -1221,7 +1221,7 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface, ...@@ -1221,7 +1221,7 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
assert(This->resource.allocatedMemory != NULL); assert(This->resource.allocatedMemory != NULL);
sbuf = (BYTE *)This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp; sbuf = (BYTE *)This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
dbuf = (BYTE *)This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp; dbuf = (BYTE *)This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
sEntry = getFormatDescEntry(Src->resource.format); sEntry = getFormatDescEntry(Src->resource.format, NULL);
dEntry = sEntry; dEntry = sEntry;
} }
else else
...@@ -1235,8 +1235,8 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface, ...@@ -1235,8 +1235,8 @@ IWineGDISurfaceImpl_BltFast(IWineD3DSurface *iface,
dbuf = dlock.pBits; dbuf = dlock.pBits;
TRACE("Dst is at %p, Src is at %p\n", dbuf, sbuf); TRACE("Dst is at %p, Src is at %p\n", dbuf, sbuf);
sEntry = getFormatDescEntry(Src->resource.format); sEntry = getFormatDescEntry(Src->resource.format, NULL);
dEntry = getFormatDescEntry(This->resource.format); dEntry = getFormatDescEntry(This->resource.format, NULL);
} }
/* Handle first the FOURCC surfaces... */ /* Handle first the FOURCC surfaces... */
...@@ -1414,7 +1414,7 @@ const char* filename) ...@@ -1414,7 +1414,7 @@ const char* filename)
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
static char *output = NULL; static char *output = NULL;
static int size = 0; static int size = 0;
const PixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format); const StaticPixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format, NULL);
if (This->pow2Width > size) { if (This->pow2Width > size) {
output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pow2Width * 3); output = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pow2Width * 3);
......
...@@ -32,92 +32,172 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); ...@@ -32,92 +32,172 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
/***************************************************************************** /*****************************************************************************
* Pixel format array * Pixel format array
*/ */
static const PixelFormatDesc formats[] = { static const StaticPixelFormatDesc formats[] = {
/*{WINED3DFORMAT ,alphamask ,redmask ,greenmask ,bluemask ,bpp ,isFourcc ,internal ,srgbInternal ,format ,type }*/ /*{WINED3DFORMAT ,alphamask ,redmask ,greenmask ,bluemask ,bpp ,isFourcc*/
{WINED3DFMT_UNKNOWN ,0x0 ,0x0 ,0x0 ,0x0 ,1 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_UNKNOWN ,0x0 ,0x0 ,0x0 ,0x0 ,1 ,FALSE },
/* FourCC formats, kept here to have WINED3DFMT_R8G8B8(=20) at position 20 */ /* FourCC formats, kept here to have WINED3DFMT_R8G8B8(=20) at position 20 */
{WINED3DFMT_UYVY ,0x0 ,0x0 ,0x0 ,0x0 ,1/*?*/ ,TRUE ,0 ,0 ,0 ,0 }, {WINED3DFMT_UYVY ,0x0 ,0x0 ,0x0 ,0x0 ,1/*?*/ ,TRUE },
{WINED3DFMT_YUY2 ,0x0 ,0x0 ,0x0 ,0x0 ,1/*?*/ ,TRUE ,0 ,0 ,0 ,0 }, {WINED3DFMT_YUY2 ,0x0 ,0x0 ,0x0 ,0x0 ,1/*?*/ ,TRUE },
{WINED3DFMT_DXT1 ,0x0 ,0x0 ,0x0 ,0x0 ,1 ,TRUE ,GL_COMPR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,0x0 ,0x0 ,0x0 ,2 ,FALSE },
{WINED3DFMT_G16R16F ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_G16R16F ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE },
{WINED3DFMT_A16B16G16R16F,0x0 ,0x0 ,0x0 ,0x0 ,8 ,FALSE ,GL_RGBA16F_ARB ,GL_RGBA16F_ARB ,GL_RGBA ,GL_HALF_FLOAT_ARB }, {WINED3DFMT_A16B16G16R16F,0x0 ,0x0 ,0x0 ,0x0 ,8 ,FALSE },
/* Palettized formats */ /* Palettized formats */
{WINED3DFMT_A8P8 ,0x0000ff00 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_A8P8 ,0x0000ff00 ,0x0 ,0x0 ,0x0 ,2 ,FALSE },
{WINED3DFMT_P8 ,0x0 ,0x0 ,0x0 ,0x0 ,1 ,FALSE ,GL_COLOR_INDEX8_EXT ,GL_COLOR_INDEX8_EXT ,GL_COLOR_INDEX ,GL_UNSIGNED_BYTE }, {WINED3DFMT_P8 ,0x0 ,0x0 ,0x0 ,0x0 ,1 ,FALSE },
/* Standard ARGB formats. Keep WINED3DFMT_R8G8B8(=20) at position 20 */ /* Standard ARGB formats. Keep WINED3DFMT_R8G8B8(=20) at position 20 */
{WINED3DFMT_R8G8B8 ,0x0 ,0x00ff0000 ,0x0000ff00 ,0x000000ff ,3 ,FALSE ,GL_RGB8 ,GL_RGB8 ,GL_BGR ,GL_UNSIGNED_BYTE }, {WINED3DFMT_R8G8B8 ,0x0 ,0x00ff0000 ,0x0000ff00 ,0x000000ff ,3 ,FALSE },
{WINED3DFMT_A8R8G8B8 ,0xff000000 ,0x00ff0000 ,0x0000ff00 ,0x000000ff ,4 ,FALSE ,GL_RGBA8 ,GL_SRGB8_ALPHA8_EXT ,GL_BGRA ,GL_UNSIGNED_INT_8_8_8_8_REV }, {WINED3DFMT_A8R8G8B8 ,0xff000000 ,0x00ff0000 ,0x0000ff00 ,0x000000ff ,4 ,FALSE },
{WINED3DFMT_X8R8G8B8 ,0x0 ,0x00ff0000 ,0x0000ff00 ,0x000000ff ,4 ,FALSE ,GL_RGB8 ,GL_SRGB8_EXT ,GL_BGRA ,GL_UNSIGNED_INT_8_8_8_8_REV }, {WINED3DFMT_X8R8G8B8 ,0x0 ,0x00ff0000 ,0x0000ff00 ,0x000000ff ,4 ,FALSE },
{WINED3DFMT_R5G6B5 ,0x0 ,0x0000F800 ,0x000007e0 ,0x0000001f ,2 ,FALSE ,GL_RGB5 ,GL_RGB5 ,GL_RGB ,GL_UNSIGNED_SHORT_5_6_5 }, {WINED3DFMT_R5G6B5 ,0x0 ,0x0000F800 ,0x000007e0 ,0x0000001f ,2 ,FALSE },
{WINED3DFMT_X1R5G5B5 ,0x0 ,0x00007c00 ,0x000003e0 ,0x0000001f ,2 ,FALSE ,GL_RGB5_A1 ,GL_RGB5_A1 ,GL_BGRA ,GL_UNSIGNED_SHORT_1_5_5_5_REV }, {WINED3DFMT_X1R5G5B5 ,0x0 ,0x00007c00 ,0x000003e0 ,0x0000001f ,2 ,FALSE },
{WINED3DFMT_A1R5G5B5 ,0x00008000 ,0x00007c00 ,0x000003e0 ,0x0000001f ,2 ,FALSE ,GL_RGB5_A1 ,GL_RGB5_A1 ,GL_BGRA ,GL_UNSIGNED_SHORT_1_5_5_5_REV }, {WINED3DFMT_A1R5G5B5 ,0x00008000 ,0x00007c00 ,0x000003e0 ,0x0000001f ,2 ,FALSE },
{WINED3DFMT_A4R4G4B4 ,0x0000f000 ,0x00000f00 ,0x000000f0 ,0x0000000f ,2 ,FALSE ,GL_RGBA4 ,GL_SRGB8_ALPHA8_EXT ,GL_BGRA ,GL_UNSIGNED_SHORT_4_4_4_4_REV }, {WINED3DFMT_A4R4G4B4 ,0x0000f000 ,0x00000f00 ,0x000000f0 ,0x0000000f ,2 ,FALSE },
{WINED3DFMT_R3G3B2 ,0x0 ,0x000000e0 ,0x0000001c ,0x00000003 ,1 ,FALSE ,GL_R3_G3_B2 ,GL_R3_G3_B2 ,GL_RGB ,GL_UNSIGNED_BYTE_2_3_3_REV }, {WINED3DFMT_R3G3B2 ,0x0 ,0x000000e0 ,0x0000001c ,0x00000003 ,1 ,FALSE },
{WINED3DFMT_A8 ,0x000000ff ,0x0 ,0x0 ,0x0 ,1 ,FALSE ,GL_ALPHA8 ,GL_ALPHA8 ,GL_ALPHA ,GL_UNSIGNED_BYTE }, {WINED3DFMT_A8 ,0x000000ff ,0x0 ,0x0 ,0x0 ,1 ,FALSE },
{WINED3DFMT_A8R3G3B2 ,0x0000ff00 ,0x000000e0 ,0x0000001c ,0x00000003 ,2 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_A8R3G3B2 ,0x0000ff00 ,0x000000e0 ,0x0000001c ,0x00000003 ,2 ,FALSE },
{WINED3DFMT_X4R4G4B4 ,0x0 ,0x00000f00 ,0x000000f0 ,0x0000000f ,2 ,FALSE ,GL_RGB4 ,GL_RGB4 ,GL_BGRA ,GL_UNSIGNED_SHORT_4_4_4_4_REV }, {WINED3DFMT_X4R4G4B4 ,0x0 ,0x00000f00 ,0x000000f0 ,0x0000000f ,2 ,FALSE },
{WINED3DFMT_A2B10G10R10 ,0xb0000000 ,0x000003ff ,0x000ffc00 ,0x3ff00000 ,4 ,FALSE ,GL_RGB ,GL_RGB ,GL_RGBA ,GL_UNSIGNED_INT_2_10_10_10_REV }, {WINED3DFMT_A2B10G10R10 ,0xb0000000 ,0x000003ff ,0x000ffc00 ,0x3ff00000 ,4 ,FALSE },
{WINED3DFMT_A8B8G8R8 ,0xff000000 ,0x000000ff ,0x0000ff00 ,0x00ff0000 ,4 ,FALSE ,GL_RGBA8 ,GL_RGBA8 ,GL_RGBA ,GL_UNSIGNED_INT_8_8_8_8_REV }, {WINED3DFMT_A8B8G8R8 ,0xff000000 ,0x000000ff ,0x0000ff00 ,0x00ff0000 ,4 ,FALSE },
{WINED3DFMT_X8B8G8R8 ,0x0 ,0x000000ff ,0x0000ff00 ,0x00ff0000 ,4 ,FALSE ,GL_RGB8 ,GL_RGB8 ,GL_RGBA ,GL_UNSIGNED_INT_8_8_8_8_REV }, {WINED3DFMT_X8B8G8R8 ,0x0 ,0x000000ff ,0x0000ff00 ,0x00ff0000 ,4 ,FALSE },
{WINED3DFMT_G16R16 ,0x0 ,0x0000ffff ,0xffff0000 ,0x0 ,4 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_G16R16 ,0x0 ,0x0000ffff ,0xffff0000 ,0x0 ,4 ,FALSE },
{WINED3DFMT_A2R10G10B10 ,0xb0000000 ,0x3ff00000 ,0x000ffc00 ,0x000003ff ,4 ,FALSE ,GL_RGBA ,GL_RGBA ,GL_BGRA ,GL_UNSIGNED_INT_2_10_10_10_REV }, {WINED3DFMT_A2R10G10B10 ,0xb0000000 ,0x3ff00000 ,0x000ffc00 ,0x000003ff ,4 ,FALSE },
{WINED3DFMT_A16B16G16R16,0x0 ,0x0000ffff ,0xffff0000 ,0x0 ,8 ,FALSE ,GL_RGBA16_EXT ,GL_RGBA16_EXT ,GL_RGBA ,GL_UNSIGNED_SHORT }, {WINED3DFMT_A16B16G16R16,0x0 ,0x0000ffff ,0xffff0000 ,0x0 ,8 ,FALSE },
/* Luminance */ /* Luminance */
{WINED3DFMT_L8 ,0x0 ,0x0 ,0x0 ,0x0 ,1 ,FALSE ,GL_LUMINANCE8 ,GL_SLUMINANCE8_EXT ,GL_LUMINANCE ,GL_UNSIGNED_BYTE }, {WINED3DFMT_L8 ,0x0 ,0x0 ,0x0 ,0x0 ,1 ,FALSE },
{WINED3DFMT_A8L8 ,0x0000ff00 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,GL_LUMINANCE8_ALPHA8 ,GL_SLUMINANCE8_ALPHA8_EXT ,GL_LUMINANCE_ALPHA ,GL_UNSIGNED_BYTE }, {WINED3DFMT_A8L8 ,0x0000ff00 ,0x0 ,0x0 ,0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OAT }, {WINED3DFMT_D24FS8 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE },
/* Is this a vertex buffer? */ /* Is this a vertex buffer? */
{WINED3DFMT_VERTEXDATA ,0x0 ,0x0 ,0x0 ,0x0 ,0 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_VERTEXDATA ,0x0 ,0x0 ,0x0 ,0x0 ,0 ,FALSE },
{WINED3DFMT_INDEX16 ,0x0 ,0x0 ,0x0 ,0x0 ,2 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_INDEX16 ,0x0 ,0x0 ,0x0 ,0x0 ,2 ,FALSE },
{WINED3DFMT_INDEX32 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE ,0 ,0 ,0 ,0 }, {WINED3DFMT_INDEX32 ,0x0 ,0x0 ,0x0 ,0x0 ,4 ,FALSE },
{WINED3DFMT_Q16W16V16U16,0x0 ,0x0 ,0x0 ,0x0 ,8 ,FALSE ,GL_COLOR_INDEX ,GL_COLOR_INDEX ,GL_COLOR_INDEX ,GL_UNSIGNED_SHORT } {WINED3DFMT_Q16W16V16U16,0x0 ,0x0 ,0x0 ,0x0 ,8 ,FALSE },
}; };
const PixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt) /*****************************************************************************
* Pixel format array
*/
GlPixelFormatDesc gl_formats[] = {
/*{internal ,srgbInternal ,format ,type }*/
{0 ,0 ,0 ,0 },
/* FourCC formats, kept here to have WINED3DFMT_R8G8B8(=20) at position 20 */
{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },
{GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT ,GL_RGBA ,GL_UNSIGNED_BYTE },
{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT ,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT ,GL_RGBA ,GL_UNSIGNED_BYTE },
{GL_COMPRESSED_RGBA_S3TC_DXT3_EXT ,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT ,GL_RGBA ,GL_UNSIGNED_BYTE },
{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT ,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT ,GL_RGBA ,GL_UNSIGNED_BYTE },
{GL_COMPRESSED_RGBA_S3TC_DXT5_EXT ,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT ,GL_RGBA ,GL_UNSIGNED_BYTE },
{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },
/* IEEE formats */
{GL_RGB32F_ARB ,GL_RGB32F_ARB ,GL_RED ,GL_FLOAT },
{0 ,0 ,0 ,0 },
{GL_RGBA32F_ARB ,GL_RGBA32F_ARB ,GL_RGBA ,GL_FLOAT },
/* Hmm? */
{0 ,0 ,0 ,0 },
/* Float */
{GL_RGB16F_ARB ,GL_RGB16F_ARB ,GL_RED ,GL_HALF_FLOAT_ARB },
{0 ,0 ,0 ,0 },
{GL_RGBA16F_ARB ,GL_RGBA16F_ARB ,GL_RGBA ,GL_HALF_FLOAT_ARB },
/* Palettized formats */
{0 ,0 ,0 ,0 },
{GL_COLOR_INDEX8_EXT ,GL_COLOR_INDEX8_EXT ,GL_COLOR_INDEX ,GL_UNSIGNED_BYTE },
/* Standard ARGB formats. Keep WINED3DFMT_R8G8B8(=20) at position 20 */
{GL_RGB8 ,GL_RGB8 ,GL_BGR ,GL_UNSIGNED_BYTE },
{GL_RGBA8 ,GL_SRGB8_ALPHA8_EXT ,GL_BGRA ,GL_UNSIGNED_INT_8_8_8_8_REV },
{GL_RGB8 ,GL_SRGB8_EXT ,GL_BGRA ,GL_UNSIGNED_INT_8_8_8_8_REV },
{GL_RGB5 ,GL_RGB5 ,GL_RGB ,GL_UNSIGNED_SHORT_5_6_5 },
{GL_RGB5_A1 ,GL_RGB5_A1 ,GL_BGRA ,GL_UNSIGNED_SHORT_1_5_5_5_RE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_MAG8_INTENSITY8_NV ,GL_DSDT_MAG_INTENSITY_NV ,GL_BYTE },
{GL_SIGNED_RGBA8_NV ,GL_SIGNED_RGBA8_NV ,GL_RGBA ,GL_BYTE },
{GL_SIGNED_HILO16_NV ,GL_SIGNED_HILO16_NV ,GL_HILO_NV ,GL_SHORT },
{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },
/* Depth stencil formats */
{GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT ,GL_UNSIGNED_SHORT },
{GL_DEPTH_COMPONENT32_ARB ,GL_DEPTH_COMPONENT32_ARB ,GL_DEPTH_COMPONENT ,GL_UNSIGNED_INT },
{GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT ,GL_UNSIGNED_SHORT },
{GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT ,GL_UNSIGNED_INT },
{GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT,GL_UNSIGNED_INT },
{GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT,GL_UNSIGNED_INT },
{GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT,GL_UNSIGNED_SHORT },
{GL_LUMINANCE16_EXT ,GL_LUMINANCE16_EXT ,GL_LUMINANCE ,GL_UNSIGNED_SHORT },
{GL_DEPTH_COMPONENT32_ARB ,GL_DEPTH_COMPONENT32_ARB ,GL_DEPTH_COMPONENT ,GL_FLOAT },
{GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT24_ARB ,GL_DEPTH_COMPONENT ,GL_FLOAT },
/* Is this a vertex buffer? */
{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },
{0 ,0 ,0 ,0 },
{GL_COLOR_INDEX ,GL_COLOR_INDEX ,GL_COLOR_INDEX ,GL_UNSIGNED_SHORT }
};
const StaticPixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt, const GlPixelFormatDesc **glDesc)
{ {
/* First check if the format is at the position of its value. /* First check if the format is at the position of its value.
* This will catch the argb formats before the loop is entered * This will catch the argb formats before the loop is entered
*/ */
if(fmt < (sizeof(formats) / sizeof(formats[0])) && formats[fmt].format == fmt) { if(fmt < (sizeof(formats) / sizeof(formats[0])) && formats[fmt].format == fmt) {
if(glDesc) *glDesc = &gl_formats[fmt];
return &formats[fmt]; return &formats[fmt];
} else { } else {
unsigned int i; unsigned int i;
for(i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { for(i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) {
if(formats[i].format == fmt) { if(formats[i].format == fmt) {
if(glDesc) *glDesc = &gl_formats[i];
return &formats[i]; return &formats[i];
} }
} }
...@@ -128,7 +208,7 @@ const PixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt) ...@@ -128,7 +208,7 @@ const PixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt)
return NULL; return NULL;
} }
/* Get the caller a valid pointer */ /* Get the caller a valid pointer */
return getFormatDescEntry(WINED3DFMT_UNKNOWN); return getFormatDescEntry(WINED3DFMT_UNKNOWN, glDesc);
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -265,7 +265,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWi ...@@ -265,7 +265,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IWi
static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int gl_level, BOOL srgb_mode) { static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int gl_level, BOOL srgb_mode) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
WINED3DFORMAT format = This->resource.format; WINED3DFORMAT format = This->resource.format;
const PixelFormatDesc *formatEntry = getFormatDescEntry(format); const GlPixelFormatDesc *glDesc;
getFormatDescEntry(format, &glDesc);
TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(format), format); TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(format), format);
...@@ -273,23 +274,23 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int ...@@ -273,23 +274,23 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int
TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n", TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
GL_TEXTURE_3D, GL_TEXTURE_3D,
gl_level, gl_level,
formatEntry->glInternal, glDesc->glInternal,
This->currentDesc.Width, This->currentDesc.Width,
This->currentDesc.Height, This->currentDesc.Height,
This->currentDesc.Depth, This->currentDesc.Depth,
0, 0,
formatEntry->glFormat, glDesc->glFormat,
formatEntry->glType, glDesc->glType,
This->resource.allocatedMemory); This->resource.allocatedMemory);
GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D,
gl_level, gl_level,
formatEntry->glInternal, glDesc->glInternal,
This->currentDesc.Width, This->currentDesc.Width,
This->currentDesc.Height, This->currentDesc.Height,
This->currentDesc.Depth, This->currentDesc.Depth,
0, 0,
formatEntry->glFormat, glDesc->glFormat,
formatEntry->glType, glDesc->glType,
This->resource.allocatedMemory)); This->resource.allocatedMemory));
checkGLcall("glTexImage3D"); checkGLcall("glTexImage3D");
} else } else
......
...@@ -2038,10 +2038,15 @@ typedef struct { ...@@ -2038,10 +2038,15 @@ typedef struct {
DWORD alphaMask, redMask, greenMask, blueMask; DWORD alphaMask, redMask, greenMask, blueMask;
UINT bpp; UINT bpp;
BOOL isFourcc; BOOL isFourcc;
} StaticPixelFormatDesc;
typedef struct {
/* Array uses the same indices as the static pixelformat */
GLint glInternal, glGammaInternal, glFormat, glType; GLint glInternal, glGammaInternal, glFormat, glType;
} PixelFormatDesc; } GlPixelFormatDesc;
const PixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt); const StaticPixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt,
const GlPixelFormatDesc **glDesc);
static inline BOOL use_vs(IWineD3DDeviceImpl *device) { static inline BOOL use_vs(IWineD3DDeviceImpl *device) {
return (device->vs_selected_mode != SHADER_NONE return (device->vs_selected_mode != SHADER_NONE
......
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