[5/5] WineD3D: Merge buffer creation methods

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

2009/4/4 Stefan Dösinger <stefan at codeweavers.com>:
> -    hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, &wined3d_desc,
> -            data ? data->pSysMem : NULL, (IUnknown *)object, &object->wined3d_buffer);
> +    hr = IWineD3DDevice_CreateBuffer(This->wined3d_device, 0 /* fvf */,
> +            WINED3DFMT_VERTEXDATA, WINED3DPOOL_DEFAULT, &wined3d_desc,
> +            data ? data->pSysMem : NULL, (IUnknown *)object, 0 /* SharedHandle */, &object->wined3d_buffer);

Please don't introduce things like "SharedHandle" into CreateBuffer().
We should get rid of that for the other wined3d methods as well
actually, it's never used anywhere, and it will probably be quite a
while before we will, if ever. (DXGI and D3D9 in Vista actually allow
this to be used, but I don't think it's very useful to have this at
the moment).

> +    memset(&wined3d_desc, 0, sizeof(wined3d_desc));
> +    wined3d_desc.byte_width = Size;
> +    wined3d_desc.usage = Usage & WINED3DUSAGE_MASK;
That's not what the "usage" field was meant for. I don't think you
should involve the d3d10 style CreateBuffer() in this at this point.
However, if you do, it should be a separate patch for merging
CreateVertexBuffer() and CreateIndexBuffer(), and *after* you've
removed the format and FVF parameters. In that case you should use
wined3d_buffer_desc properly, ie. pay attention to cpu_access_flags,
etc. and using bind_flags instead of buffer_type_hint.

More information about the wine-devel mailing list