Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Texture2D.GetDataPointerEXT #486

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add Texture2D.GetDataPointerEXT #486

wants to merge 1 commit into from

Conversation

kg
Copy link
Contributor

@kg kg commented Apr 13, 2024

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.

@flibitijibibo
Copy link
Member

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?

@kg
Copy link
Contributor Author

kg commented Apr 13, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants