On Tue Jun 14 22:50:11 2022 +0000, Matteo Bruni wrote:
load_texture_data() / load_resource_data()? We might consider introducing of our own structure for storing texture data, like e.g.:
struct texture_data { unsigned int row_pitch, slice_pitch; BYTE *data; };
instead of sort-of abusing D3D10_SUBRESOURCE_DATA by attaching the data at the end. Otherwise, probably a comment explaining that this function is returning an "object" combining a D3D10_SUBRESOURCE_DATA header with the actual texture data would be nice.
The helper will return array of structures in future (it's needed to e.g. support MipLevels). That's why I would prefer to do it in one of following ways. Return array of D3D10_SUBRESOURCE_DATA structures with data following the structures: - can be freed with single free - it would be possible to sometimes pass loaded data directly without creating a copy (I was not planning to do that) - it's harder to create Return array of D3D10_SUBRESOURCE_DATA structures with each pSysMem fields allocated separately.
Do you have any preference?