Commit 2c9c968a authored by Andrei Slăvoiu's avatar Andrei Slăvoiu Committed by Alexandre Julliard

wined3d: Replace vendor specific callbacks with generic code that uses vendor specific arrays.

parent d3387cf7
......@@ -88,6 +88,7 @@ enum wined3d_d3d_level
WINED3D_D3D_LEVEL_9_SM3,
WINED3D_D3D_LEVEL_10,
WINED3D_D3D_LEVEL_11,
WINED3D_D3D_LEVEL_COUNT
};
/* The d3d device ID */
......@@ -2190,45 +2191,43 @@ intel_gl_vendor_table[] =
{GL_VENDOR_MESA, "Mesa Intel driver", cards_intel, ARRAY_SIZE(cards_intel)},
};
static enum wined3d_pci_device select_card_fallback_nvidia(const struct wined3d_gl_info *gl_info)
static const enum wined3d_pci_device
card_fallback_nvidia[] =
{
enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info);
if (d3d_level >= WINED3D_D3D_LEVEL_10)
return CARD_NVIDIA_GEFORCE_8800GTX;
if (d3d_level >= WINED3D_D3D_LEVEL_9_SM3)
return CARD_NVIDIA_GEFORCE_6800;
if (d3d_level >= WINED3D_D3D_LEVEL_9_SM2)
return CARD_NVIDIA_GEFORCEFX_5800;
if (d3d_level >= WINED3D_D3D_LEVEL_8)
return CARD_NVIDIA_GEFORCE3;
if (d3d_level >= WINED3D_D3D_LEVEL_7)
return CARD_NVIDIA_GEFORCE;
if (d3d_level >= WINED3D_D3D_LEVEL_6)
return CARD_NVIDIA_RIVA_TNT;
return CARD_NVIDIA_RIVA_128;
}
static enum wined3d_pci_device select_card_fallback_amd(const struct wined3d_gl_info *gl_info)
CARD_NVIDIA_RIVA_128, /* D3D5 */
CARD_NVIDIA_RIVA_TNT, /* D3D6 */
CARD_NVIDIA_GEFORCE, /* D3D7 */
CARD_NVIDIA_GEFORCE3, /* D3D8 */
CARD_NVIDIA_GEFORCEFX_5800, /* D3D9_SM2 */
CARD_NVIDIA_GEFORCE_6800, /* D3D9_SM3 */
CARD_NVIDIA_GEFORCE_8800GTX, /* D3D10 */
CARD_NVIDIA_GEFORCE_GTX470, /* D3D11 */
},
card_fallback_amd[] =
{
enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info);
if (d3d_level >= WINED3D_D3D_LEVEL_10)
return CARD_AMD_RADEON_HD2900;
if (d3d_level >= WINED3D_D3D_LEVEL_9_SM2)
return CARD_AMD_RADEON_9500;
if (d3d_level >= WINED3D_D3D_LEVEL_8)
return CARD_AMD_RADEON_8500;
if (d3d_level >= WINED3D_D3D_LEVEL_7)
return CARD_AMD_RADEON_7200;
return CARD_AMD_RAGE_128PRO;
}
static enum wined3d_pci_device select_card_fallback_intel(const struct wined3d_gl_info *gl_info)
CARD_AMD_RAGE_128PRO, /* D3D5 */
CARD_AMD_RAGE_128PRO, /* D3D6 */
CARD_AMD_RADEON_7200, /* D3D7 */
CARD_AMD_RADEON_8500, /* D3D8 */
CARD_AMD_RADEON_9500, /* D3D9_SM2 */
CARD_AMD_RADEON_X1600, /* D3D9_SM3 */
CARD_AMD_RADEON_HD2900, /* D3D10 */
CARD_AMD_RADEON_HD5600, /* D3D11 */
},
card_fallback_intel[] =
{
enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info);
if (d3d_level >= WINED3D_D3D_LEVEL_10)
return CARD_INTEL_G45;
return CARD_INTEL_915G;
}
CARD_INTEL_915G, /* D3D5 */
CARD_INTEL_915G, /* D3D6 */
CARD_INTEL_915G, /* D3D7 */
CARD_INTEL_915G, /* D3D8 */
CARD_INTEL_915G, /* D3D9_SM2 */
CARD_INTEL_915G, /* D3D9_SM3 */
CARD_INTEL_G45, /* D3D10 */
CARD_INTEL_IVBD, /* D3D11 */
};
C_ASSERT(ARRAY_SIZE(card_fallback_nvidia) == WINED3D_D3D_LEVEL_COUNT);
C_ASSERT(ARRAY_SIZE(card_fallback_amd) == WINED3D_D3D_LEVEL_COUNT);
C_ASSERT(ARRAY_SIZE(card_fallback_intel) == WINED3D_D3D_LEVEL_COUNT);
static enum wined3d_pci_device select_card_handler(const struct gl_vendor_selection *table,
unsigned int table_size, enum wined3d_gl_vendor gl_vendor, const char *gl_renderer)
......@@ -2261,22 +2260,22 @@ static const struct
const char *description; /* Description of the card selector i.e. Apple OS/X Intel */
const struct gl_vendor_selection *gl_vendor_selection;
unsigned int gl_vendor_count;
enum wined3d_pci_device (*select_card_fallback)(const struct wined3d_gl_info *gl_info);
const enum wined3d_pci_device *card_fallback; /* An array with D3D_LEVEL_COUNT elements */
}
card_vendor_table[] =
{
{HW_VENDOR_AMD, "AMD", amd_gl_vendor_table,
sizeof(amd_gl_vendor_table) / sizeof(*amd_gl_vendor_table),
select_card_fallback_amd},
card_fallback_amd},
{HW_VENDOR_NVIDIA, "Nvidia", nvidia_gl_vendor_table,
sizeof(nvidia_gl_vendor_table) / sizeof(*nvidia_gl_vendor_table),
select_card_fallback_nvidia},
card_fallback_nvidia},
{HW_VENDOR_VMWARE, "VMware", vmware_gl_vendor_table,
sizeof(vmware_gl_vendor_table) / sizeof(*vmware_gl_vendor_table),
select_card_fallback_amd},
card_fallback_amd},
{HW_VENDOR_INTEL, "Intel", intel_gl_vendor_table,
sizeof(intel_gl_vendor_table) / sizeof(*intel_gl_vendor_table),
select_card_fallback_intel},
card_fallback_intel},
};
......@@ -2334,6 +2333,7 @@ static enum wined3d_pci_device wined3d_guess_card(const struct wined3d_gl_info *
* memory can be overruled using a registry setting. */
unsigned int i;
enum wined3d_d3d_level d3d_level = d3d_level_from_gl_info(gl_info);
enum wined3d_pci_device device;
for (i = 0; i < (sizeof(card_vendor_table) / sizeof(*card_vendor_table)); ++i)
......@@ -2348,7 +2348,7 @@ static enum wined3d_pci_device wined3d_guess_card(const struct wined3d_gl_info *
return device;
TRACE("Unrecognized renderer %s, falling back to default.\n", debugstr_a(gl_renderer));
return card_vendor_table[i].select_card_fallback(gl_info);
return card_vendor_table[i].card_fallback[d3d_level];
}
FIXME("No card selector available for card vendor %04x (using GL_RENDERER %s).\n",
......@@ -2356,7 +2356,7 @@ static enum wined3d_pci_device wined3d_guess_card(const struct wined3d_gl_info *
/* Default to generic Nvidia hardware based on the supported OpenGL extensions. */
*card_vendor = HW_VENDOR_NVIDIA;
return select_card_fallback_nvidia(gl_info);
return card_fallback_nvidia[d3d_level];
}
static const struct wined3d_vertex_pipe_ops *select_vertex_implementation(const struct wined3d_gl_info *gl_info,
......
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