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

libktx: update ktxTexture2_setImageFromStream to allow setting the entire level's data in one call #794

Merged
merged 1 commit into from
Nov 5, 2023

Conversation

AlexRouSg
Copy link
Contributor

This change updates ktxTexture2_setImageFromStream to allow setting faceSlice to -1,
This allows setting the entire level's data in one call rather having to do a loop and setting each slice individually.

Fixes: #792

@CLAassistant
Copy link

CLAassistant commented Nov 2, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@MarkCallow MarkCallow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. See my small comments.

lib/writer2.c Outdated Show resolved Hide resolved
lib/writer2.c Outdated
return result;

imageByteLength = ktxTexture_GetImageSize(ktxTexture(This), level);
if (faceSlice == (ktx_uint32_t)(-1)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this does not change the type of the faceSlice parameter, which I agree with, let's document this as specify UINT_MAX (i.e. the value of -1 cast to uint32_t) instead of -1 to set the entire level. Consider making a define to be used, e.g. KTX_ENTIRE_LEVEL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, I did it that way to avoid including limits.h

@MarkCallow MarkCallow merged commit 88fc7a6 into KhronosGroup:main Nov 5, 2023
14 checks passed
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 21, 2024
…tire level's data in one call (KhronosGroup#794)

This change updates `ktxTexture2_setImageFromStream` to allow setting
`faceSlice` to `KTX_FACESLICE_WHOLE_LEVEL`. This allows setting
the entire level's data in one call rather having to do a loop setting each
slice individually.

Fixes: KhronosGroup#792
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
…tire level's data in one call (KhronosGroup#794)

This change updates `ktxTexture2_setImageFromStream` to allow setting
`faceSlice` to `KTX_FACESLICE_WHOLE_LEVEL`. This allows setting
the entire level's data in one call rather having to do a loop setting each
slice individually.

Fixes: KhronosGroup#792
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
…tire level's data in one call (KhronosGroup#794)

This change updates `ktxTexture2_setImageFromStream` to allow setting
`faceSlice` to `KTX_FACESLICE_WHOLE_LEVEL`. This allows setting
the entire level's data in one call rather having to do a loop setting each
slice individually.

Fixes: KhronosGroup#792
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
…tire level's data in one call (KhronosGroup#794)

This change updates `ktxTexture2_setImageFromStream` to allow setting
`faceSlice` to `KTX_FACESLICE_WHOLE_LEVEL`. This allows setting
the entire level's data in one call rather having to do a loop setting each
slice individually.

Fixes: KhronosGroup#792
KaperD pushed a commit to KaperD/KTX-Software that referenced this pull request Feb 22, 2024
…tire level's data in one call (KhronosGroup#794)

This change updates `ktxTexture2_setImageFromStream` to allow setting
`faceSlice` to `KTX_FACESLICE_WHOLE_LEVEL`. This allows setting
the entire level's data in one call rather having to do a loop setting each
slice individually.

Fixes: KhronosGroup#792
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.

ktxTexture_GetImageSize doesn't handle 3D textures
3 participants