On 1/14/22 11:11, Henri Verbeet wrote:
On Tue, 11 Jan 2022 at 19:17, Zebediah Figura zfigura@codeweavers.com wrote:
+struct texture +{
- unsigned int slot;
- DXGI_FORMAT format;
- enum texture_data_type data_type;
- unsigned int texel_size;
- unsigned int width, height;
- uint8_t *data;
- size_t data_size, data_capacity;
- void *private;
+};
We've used private pointers like that in the past in some cases, and we've generally moved away from them because void pointers just aren't great to work with. I'd much prefer a scheme like the following:
struct texture { ... }; struct d3d11_texture { struct texture t; ... }; struct d3d12_texture { struct texture t; ... };
and then using CONTAINING_RECORD to get e.g. a struct d3d12_texture pointer from a struct texture pointer, much like we do in various other places.
I guess we'd need an extra callback to allocate resource/sampler pointers in that case. That's a bit more work, but I guess not terrible...