wined3d: Get rid of the WineD3D_PixelFormat typedef.

This commit is contained in:
Henri Verbeet 2011-05-05 20:56:10 +02:00 committed by Alexandre Julliard
parent 9f90225fa5
commit 0cbdd10c58
3 changed files with 19 additions and 17 deletions

View File

@ -1219,10 +1219,12 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc,
getDepthStencilBits(ds_format, &depthBits, &stencilBits); getDepthStencilBits(ds_format, &depthBits, &stencilBits);
for(matchtry = 0; matchtry < (sizeof(matches) / sizeof(matches[0])) && !iPixelFormat; matchtry++) { for (matchtry = 0; matchtry < (sizeof(matches) / sizeof(*matches)) && !iPixelFormat; ++matchtry)
for(i=0; i<nCfgs; i++) { {
for (i = 0; i < nCfgs; ++i)
{
const struct wined3d_pixel_format *cfg = &This->adapter->cfgs[i];
BOOL exactDepthMatch = TRUE; BOOL exactDepthMatch = TRUE;
WineD3D_PixelFormat *cfg = &This->adapter->cfgs[i];
/* For now only accept RGBA formats. Perhaps some day we will /* For now only accept RGBA formats. Perhaps some day we will
* allow floating point formats for pbuffers. */ * allow floating point formats for pbuffers. */

View File

@ -2932,7 +2932,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
} }
static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined3d_gl_info *gl_info, static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined3d_gl_info *gl_info,
const WineD3D_PixelFormat *cfg, const struct wined3d_format *format) const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
{ {
short redSize, greenSize, blueSize, alphaSize, colorBits; short redSize, greenSize, blueSize, alphaSize, colorBits;
@ -2969,7 +2969,7 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined
} }
static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3d_gl_info *gl_info, static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3d_gl_info *gl_info,
const WineD3D_PixelFormat *cfg, const struct wined3d_format *format) const struct wined3d_pixel_format *cfg, const struct wined3d_format *format)
{ {
short depthSize, stencilSize; short depthSize, stencilSize;
BOOL lockable = FALSE; BOOL lockable = FALSE;
@ -3033,7 +3033,7 @@ HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d,
} }
else else
{ {
const WineD3D_PixelFormat *cfgs; const struct wined3d_pixel_format *cfgs;
unsigned int cfg_count; unsigned int cfg_count;
unsigned int i; unsigned int i;
@ -3094,7 +3094,7 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
if (format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) if (format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))
{ {
const WineD3D_PixelFormat *cfgs; const struct wined3d_pixel_format *cfgs;
unsigned int i, cfg_count; unsigned int i, cfg_count;
cfgs = adapter->cfgs; cfgs = adapter->cfgs;
@ -3118,7 +3118,7 @@ HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3
else if (format->flags & WINED3DFMT_FLAG_RENDERTARGET) else if (format->flags & WINED3DFMT_FLAG_RENDERTARGET)
{ {
short redSize, greenSize, blueSize, alphaSize, colorBits; short redSize, greenSize, blueSize, alphaSize, colorBits;
const WineD3D_PixelFormat *cfgs; const struct wined3d_pixel_format *cfgs;
unsigned int i, cfg_count; unsigned int i, cfg_count;
if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits)) if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits))
@ -3187,7 +3187,7 @@ static BOOL CheckDepthStencilCapability(const struct wined3d_adapter *adapter,
/* Walk through all WGL pixel formats to find a match */ /* Walk through all WGL pixel formats to find a match */
for (it = 0; it < adapter->nCfgs; ++it) for (it = 0; it < adapter->nCfgs; ++it)
{ {
WineD3D_PixelFormat *cfg = &adapter->cfgs[it]; const struct wined3d_pixel_format *cfg = &adapter->cfgs[it];
if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, cfg, display_format)) if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, cfg, display_format))
{ {
if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, cfg, ds_format)) if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, cfg, ds_format))
@ -3217,10 +3217,10 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter,
if (!(check_format->flags & WINED3DFMT_FLAG_RENDERTARGET)) return FALSE; if (!(check_format->flags & WINED3DFMT_FLAG_RENDERTARGET)) return FALSE;
if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER)
{ {
WineD3D_PixelFormat *cfgs = adapter->cfgs;
int it;
short AdapterRed, AdapterGreen, AdapterBlue, AdapterAlpha, AdapterTotalSize; short AdapterRed, AdapterGreen, AdapterBlue, AdapterAlpha, AdapterTotalSize;
short CheckRed, CheckGreen, CheckBlue, CheckAlpha, CheckTotalSize; short CheckRed, CheckGreen, CheckBlue, CheckAlpha, CheckTotalSize;
const struct wined3d_pixel_format *cfgs = adapter->cfgs;
int it;
getColorBits(adapter_format, &AdapterRed, &AdapterGreen, &AdapterBlue, &AdapterAlpha, &AdapterTotalSize); getColorBits(adapter_format, &AdapterRed, &AdapterGreen, &AdapterBlue, &AdapterAlpha, &AdapterTotalSize);
getColorBits(check_format, &CheckRed, &CheckGreen, &CheckBlue, &CheckAlpha, &CheckTotalSize); getColorBits(check_format, &CheckRed, &CheckGreen, &CheckBlue, &CheckAlpha, &CheckTotalSize);
@ -5140,10 +5140,10 @@ static BOOL InitAdapters(struct wined3d *wined3d)
struct wined3d_adapter *adapter = &wined3d->adapters[0]; struct wined3d_adapter *adapter = &wined3d->adapters[0];
const struct wined3d_gl_info *gl_info = &adapter->gl_info; const struct wined3d_gl_info *gl_info = &adapter->gl_info;
struct wined3d_fake_gl_ctx fake_gl_ctx = {0}; struct wined3d_fake_gl_ctx fake_gl_ctx = {0};
struct wined3d_pixel_format *cfgs;
int iPixelFormat; int iPixelFormat;
int res; int res;
int i; int i;
WineD3D_PixelFormat *cfgs;
DISPLAY_DEVICEW DisplayDevice; DISPLAY_DEVICEW DisplayDevice;
HDC hdc; HDC hdc;
@ -5202,7 +5202,7 @@ static BOOL InitAdapters(struct wined3d *wined3d)
attribute = WGL_NUMBER_PIXEL_FORMATS_ARB; attribute = WGL_NUMBER_PIXEL_FORMATS_ARB;
GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, &attribute, &adapter->nCfgs)); GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, &attribute, &adapter->nCfgs));
adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->nCfgs *sizeof(WineD3D_PixelFormat)); adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->nCfgs * sizeof(*adapter->cfgs));
cfgs = adapter->cfgs; cfgs = adapter->cfgs;
attribs[nAttribs++] = WGL_RED_BITS_ARB; attribs[nAttribs++] = WGL_RED_BITS_ARB;
attribs[nAttribs++] = WGL_GREEN_BITS_ARB; attribs[nAttribs++] = WGL_GREEN_BITS_ARB;
@ -5262,7 +5262,7 @@ static BOOL InitAdapters(struct wined3d *wined3d)
else else
{ {
int nCfgs = DescribePixelFormat(hdc, 0, 0, 0); int nCfgs = DescribePixelFormat(hdc, 0, 0, 0);
adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nCfgs*sizeof(WineD3D_PixelFormat)); adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nCfgs * sizeof(*adapter->cfgs));
adapter->nCfgs = 0; /* We won't accept all formats e.g. software accelerated ones will be skipped */ adapter->nCfgs = 0; /* We won't accept all formats e.g. software accelerated ones will be skipped */
cfgs = adapter->cfgs; cfgs = adapter->cfgs;

View File

@ -1263,7 +1263,7 @@ struct wined3d_light_info
/* The default light parameters */ /* The default light parameters */
extern const WINED3DLIGHT WINED3D_default_light DECLSPEC_HIDDEN; extern const WINED3DLIGHT WINED3D_default_light DECLSPEC_HIDDEN;
typedef struct WineD3D_PixelFormat struct wined3d_pixel_format
{ {
int iPixelFormat; /* WGL pixel format */ int iPixelFormat; /* WGL pixel format */
int iPixelType; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */ int iPixelType; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */
@ -1273,7 +1273,7 @@ typedef struct WineD3D_PixelFormat
BOOL doubleBuffer; BOOL doubleBuffer;
int auxBuffers; int auxBuffers;
int numSamples; int numSamples;
} WineD3D_PixelFormat; } wined3d_pixel_format;
/* The driver names reflect the lowest GPU supported /* The driver names reflect the lowest GPU supported
* by a certain driver, so DRIVER_AMD_R300 supports * by a certain driver, so DRIVER_AMD_R300 supports
@ -1528,7 +1528,7 @@ struct wined3d_adapter
struct wined3d_driver_info driver_info; struct wined3d_driver_info driver_info;
WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */ WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */
int nCfgs; int nCfgs;
WineD3D_PixelFormat *cfgs; struct wined3d_pixel_format *cfgs;
BOOL brokenStencil; /* Set on cards which only offer mixed depth+stencil */ BOOL brokenStencil; /* Set on cards which only offer mixed depth+stencil */
unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */ unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */
unsigned int UsedTextureRam; unsigned int UsedTextureRam;