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

please remove prototypes #61

Closed
dk opened this issue Jun 26, 2017 · 8 comments
Closed

please remove prototypes #61

dk opened this issue Jun 26, 2017 · 8 comments

Comments

@dk
Copy link
Contributor

dk commented Jun 26, 2017

There's another issue that bothers me somewhat - the prototypes of API functions. Consider f.x. the use case for glProgramUniform3f($$$$$) - it's rather useful to call it with glProgramUniform3f($x,$y,@vec), but that's not allowed. I think that the forced syntax of glProgramUniform3f($x,$y,$vec[0],$vec[1],$vec[2]) is somewhat frustrating

@devel-chm
Copy link
Collaborator

devel-chm commented Jun 26, 2017 via email

@devel-chm
Copy link
Collaborator

I could also see supporting a glProgramUniform with no types, arg counts, or v suffix doing what you mean. There would be an unavoidable and possibly objectionable performance penalty for the generality.

@wchristian
Copy link
Collaborator

I agree with @dk here. Having to manually unpack arrays like that leads to Perl code that is crap. And at the end of the day we're writing Perl here, not C. Additionally the glProgramUniform3f functions supported arrays as arguments in OpenGL.pm, so this is a porting hurdle as well.

Making one's own wrapper for that in Perl just leads to lower performance.

As for the v variants: Undefined subroutine &OpenGL::Modern::glUniform2fv There's a _c version, but that's not exactly useful when one wants to pass in a perl array.

Personally i think the pure uniform functions should have a freely accepting prototype, and the prototyped ones be accessible under something like _fast if that actually gives an improvement. But if that's not easy to do with the code generation, then there should at least be legacy forms of the functions available.

@devel-chm
Copy link
Collaborator

devel-chm commented Jun 26, 2017 via email

@dk
Copy link
Contributor Author

dk commented Jun 27, 2017

If you know someone who has
experience in XS and is interested in helping out for the code generation,
please put them in contact with me.

Chris,

I can volunteer, I need though detailed requirements from you -- what is the input, what you need as the output. I wouldn't be able to help without that, because I don't have the same vision of the module you have

/dk

@dk
Copy link
Contributor Author

dk commented Jun 27, 2017

I could also see supporting a glProgramUniform with no types, arg counts, or v suffix doing what you mean. There would be an unavoidable and possibly objectionable performance penalty for the generality.

I'd say "easy things easy, hard things possible" - whoever wants speed, won't use it.

@devel-chm
Copy link
Collaborator

BTW, I'm fine with the _p variants having the variable number of args input.

@devel-chm
Copy link
Collaborator

I'll collect my thoughts and write something up for the mailing list and/or wiki. The start is with the topic branch I referred to earlier.

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

3 participants