[4/9] wined3d: replace vendor specific callbacks with generic code that uses vendor specific renderer string tables
Henri Verbeet
hverbeet at gmail.com
Mon Jul 7 06:16:45 CDT 2014
On 4 July 2014 00:40, Andrei Slăvoiu <andrei.slavoiu at gmail.com> wrote:
> +/* See http://developer.amd.com/drivers/pc_vendor_id/Pages/default.aspx
> + *·
Trailing space.
> +cards_vmware[]= {
Space between ']' and '=', '{' placement.
> static const struct gl_vendor_selection
> {
> enum wined3d_gl_vendor gl_vendor;
> const char *description; /* Description of the card selector i.e. Apple OS/X Intel */
> - enum wined3d_pci_device (*select_card)(const char *gl_renderer);
> + const struct
> + {
> + const char *renderer;
> + enum wined3d_pci_device id;
> + } *cards; /* To be used as cards[], pointer to the first member in an array */
This doesn't work:
directx.c:2124:5: warning: initialization from incompatible pointer
type [enabled by default]
directx.c:2124:5: warning: (near initialization for
‘amd_gl_vendor_table[0].cards’) [enabled by default]
etc.
> + size_t nr_cards; /* Number of entries in the array above */
We'd generally name that "card_count", or perhaps "cards_size".
> + {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", cards_amd_binary, sizeof(cards_amd_binary) / sizeof(*cards_amd_binary)},
> + {GL_VENDOR_FGLRX, "AMD/ATI binary driver", cards_amd_binary, sizeof(cards_amd_binary) / sizeof(*cards_amd_binary)},
> + {GL_VENDOR_MESA, "Mesa AMD/ATI driver", cards_amd_mesa, sizeof(cards_amd_mesa) / sizeof(*cards_amd_mesa)},
Those lines are a bit long. Generally speaking, in wined3d, 100
characters is safe, 120 is the limit.
Note that as a potential follow-up patch it wouldn't be very hard to
merge these tables with card_vendor_table[].
> + for (j = 0; j < table[i].nr_cards; ++j)
> + {
> + if (strstr(gl_renderer, table[i].cards[j].renderer))
> + return table[i].cards[j].id;
> + }
Four space indentation, please.
More information about the wine-devel
mailing list