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

CMP_Feedback_Proc is useless without user data pointer(s) #243

Open
carlschissler opened this issue Apr 6, 2023 · 0 comments
Open

CMP_Feedback_Proc is useless without user data pointer(s) #243

carlschissler opened this issue Apr 6, 2023 · 0 comments

Comments

@carlschissler
Copy link

Various functions in the API take a pointer to a CMP_Feedback_Proc function in order to receive progress notifications from the encoder and to potentially cancel the encoding. This is a useful feature.

This function pointer type is defined to have two CMP_DWORD_PTR user data parameters which are passed into the function by the encoder as it makes progress. These user data parameters are important for the function to know how to respond to the callback. Without them, it is necessary to resort to global hacks that will not be thread safe (or will be slow and serial with locks), in order to access the local state of the calling function, such as to update a progress window GUI.

However, none of these functions defined in compressonator.h that take a CMP_Feedback_Proc provide any mechanism to actually pass these pointers into the functions. As a result, the CMP_Feedback_Proc is mostly useless because it can't be used without introducing bad software design (globals).

This is perplexing because I was able to add the parameters to the functions myself and pass them internally into the codec with just a few lines of code modification. Surely you could add new functions to the API with slightly different names that provide a way to pass in the user data pointers? Such as CMP_ConvertTextureWithFeedback(), for example.

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

No branches or pull requests

1 participant