[3/10] WineD3D: Merge indexbuffer and buffer implementations

Henri Verbeet hverbeet at gmail.com
Sun Apr 5 17:29:12 CDT 2009

Personally I would've eliminated the implementation differences first
(the main difference is when the data is copied, unmap vs. preload),
and then just killed IWineD3DIndexBufferImpl once they were the same
from an implementation point of view. Eg., you can ignore the
conversion if you can prove it never happens for index buffers.

> -    desc->FVF = This->fvf;
> +
> +    /* Temporary hack */
> +    if(This->buffer_type_hint == GL_ARRAY_BUFFER_ARB) {
> +        desc->FVF = This->fvf;
> +    }
This is extremely ugly.

> +    /* No conversion is needed on index buffers for now */
> +    if (This->resource.format_desc->format != WINED3DFMT_VERTEXDATA) return FALSE;
> +
This is redundant, buffer_find_decl() will never be called for index buffers.

Related to that, the bind_count field now has an ambiguous name, it
only refers to how often the buffer is bound as vertex data, not index
data, or any other type of potential binding (eg. stream output in the

> +    if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) {
I realise wined3d is pretty much unsalvageable in terms of style
consistency, but buffer.c is fairly consistent at the moment. I don't
care too much about style differences, but I figured I'd mention it.

More information about the wine-devel mailing list