On Thu, 5 May 2022 at 15:23, Stefan Dösinger stefandoesinger@gmail.com wrote:
Am Montag, 2. Mai 2022, 18:36:25 EAT schrieb Henri Verbeet:
This patch always writes 4 uint32_t's in wined3d_format_convert_from_float(), but that could easily be avoided.
I made it write 16 bytes unconditionally on purpose - I don't like the idea of the caller magically knowing which format requires how many output bytes. I am not married to that though, since in practise the caller has to put the returned result somewhere anyhow.
In practise writing format->byte_count would do, as long as we don't add support for block based formats. I am not sure it would really make things nicer though.
Well, it allows using wined3d_format_convert_from_float() directly on the destination buffer, instead of always having to copy it from an intermediate variable. And of course the caller then still needs to know the size of the output to do that copy. I.e., "*((DWORD *)dest_ptr) = argb_color[0];" in the bit of code I was replying to only works because we know we have a 32-bit format.