Open kg opened 7 months ago
I might be misremembering but I thought this worked like SetData where byte[] was okay... are we just missing some math checks that exist in SetData?
I might be misremembering but I thought this worked like SetData where byte[] was okay... are we just missing some math checks that exist in SetData?
The
int elementSizeInBytes = MarshalHelper.SizeOf<T>();
ValidateGetDataFormat(Format, elementSizeInBytes);
should reject an attempt to download a Color surface into a byte[], I think. IIRC the last time I tried it, it didn't work.
Alternate proposal: Don't do this, instead we add GetDataPointerAsyncEXT/SetDataPointerAsyncEXT, which only work on the SDL_GPU backend. If we had those I'd use them instead
Without this, it's not possible to cleanly queue up texture readback operations to execute later, since GetData checks the size of T against the texture format, instead of checking the size of the buffer - so you can't read a Color texture into a byte[] even if it's big enough.