Commit b85a0705 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Support more formats for display mode enumeration.

ddraw/d3d8/d3d9 only support a limited number of formats, but those already limit the supported formats themselves.
parent b3defd4c
...@@ -2199,6 +2199,8 @@ static UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Ad ...@@ -2199,6 +2199,8 @@ static UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Ad
/* TODO: Store modes per adapter and read it from the adapter structure */ /* TODO: Store modes per adapter and read it from the adapter structure */
if (Adapter == 0) { /* Display */ if (Adapter == 0) { /* Display */
const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapters[Adapter].gl_info);
UINT format_bits = format_desc->byte_count * CHAR_BIT;
unsigned int i = 0; unsigned int i = 0;
unsigned int j = 0; unsigned int j = 0;
DEVMODEW mode; DEVMODEW mode;
...@@ -2209,28 +2211,15 @@ static UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Ad ...@@ -2209,28 +2211,15 @@ static UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Ad
while (EnumDisplaySettingsExW(NULL, j, &mode, 0)) while (EnumDisplaySettingsExW(NULL, j, &mode, 0))
{ {
++j; ++j;
switch (Format)
if (Format == WINED3DFMT_UNKNOWN)
{ {
case WINED3DFMT_UNKNOWN:
/* This is for D3D8, do not enumerate P8 here */ /* This is for D3D8, do not enumerate P8 here */
if (mode.dmBitsPerPel == 32 || mode.dmBitsPerPel == 16) ++i; if (mode.dmBitsPerPel == 32 || mode.dmBitsPerPel == 16) ++i;
break; }
else if (mode.dmBitsPerPel == format_bits)
case WINED3DFMT_B8G8R8X8_UNORM: {
if (mode.dmBitsPerPel == 32) ++i; ++i;
break;
case WINED3DFMT_B5G6R5_UNORM:
if (mode.dmBitsPerPel == 16) ++i;
break;
case WINED3DFMT_P8_UINT:
if (mode.dmBitsPerPel == 8) ++i;
break;
default:
/* Skip other modes as they do not match the requested format */
break;
} }
} }
...@@ -2257,6 +2246,8 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte ...@@ -2257,6 +2246,8 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte
/* TODO: Store modes per adapter and read it from the adapter structure */ /* TODO: Store modes per adapter and read it from the adapter structure */
if (Adapter == 0) if (Adapter == 0)
{ {
const struct GlPixelFormatDesc *format_desc = getFormatDescEntry(Format, &This->adapters[Adapter].gl_info);
UINT format_bits = format_desc->byte_count * CHAR_BIT;
DEVMODEW DevModeW; DEVMODEW DevModeW;
int ModeIdx = 0; int ModeIdx = 0;
UINT i = 0; UINT i = 0;
...@@ -2268,27 +2259,16 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte ...@@ -2268,27 +2259,16 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte
/* If we are filtering to a specific format (D3D9), then need to skip /* If we are filtering to a specific format (D3D9), then need to skip
all unrelated modes, but if mode is irrelevant (D3D8), then we can all unrelated modes, but if mode is irrelevant (D3D8), then we can
just count through the ones with valid bit depths */ just count through the ones with valid bit depths */
while ((i<=Mode) && EnumDisplaySettingsExW(NULL, j++, &DevModeW, 0)) { while ((i<=Mode) && EnumDisplaySettingsExW(NULL, j++, &DevModeW, 0))
switch (Format)
{ {
case WINED3DFMT_UNKNOWN: if (Format == WINED3DFMT_UNKNOWN)
/* This is D3D8. Do not enumerate P8 here */ {
if (DevModeW.dmBitsPerPel == 32 || /* This is for D3D8, do not enumerate P8 here */
DevModeW.dmBitsPerPel == 16) i++; if (DevModeW.dmBitsPerPel == 32 || DevModeW.dmBitsPerPel == 16) ++i;
break; }
case WINED3DFMT_B8G8R8X8_UNORM: else if (DevModeW.dmBitsPerPel == format_bits)
if (DevModeW.dmBitsPerPel == 32) i++; {
break; ++i;
case WINED3DFMT_B5G6R5_UNORM:
if (DevModeW.dmBitsPerPel == 16) i++;
break;
case WINED3DFMT_P8_UINT:
if (DevModeW.dmBitsPerPel == 8) i++;
break;
default:
/* Modes that don't match what we support can get an early-out */
TRACE_(d3d_caps)("Searching for %s, returning D3DERR_INVALIDCALL\n", debug_d3dformat(Format));
return WINED3DERR_INVALIDCALL;
} }
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <math.h> #include <math.h>
#include <limits.h>
#define NONAMELESSUNION #define NONAMELESSUNION
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#define COBJMACROS #define COBJMACROS
......
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