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

Uniform locations of array needs to be fetched for each #415

Open
okuoku opened this issue Jan 18, 2023 · 2 comments
Open

Uniform locations of array needs to be fetched for each #415

okuoku opened this issue Jan 18, 2023 · 2 comments

Comments

@okuoku
Copy link
Contributor

okuoku commented Jan 18, 2023

at: f5dda93
found by: (internal validation tool)

Strictly speaking, glGetUniformLocation needs to be called for each element of an array. GL spec says:

Locations for sequential array indices are not required to be sequential. The location for "a[1]" may or may not be equal to the location for "a[0]" + 1. ... Applications that wish to set individual array elements should query the locations of each element separately.

In fill_program function, it just id++ for each elements as it assume locations for sequential array indices are sequential. The function could be patched like okuoku@328e404 and there might be other functions need to be fixed.

@Mathias-Boulay
Copy link
Contributor

Out of curiosity @okuoku how does the error manifests itself when it is unpatched ?

@okuoku
Copy link
Contributor Author

okuoku commented Feb 20, 2023

As far as i know, it won't be issue on existing OpenGLES2 hardware implementations on the market and ANGLE. So no error will be detected on these. It was detected with my own GLES call validator and my implementation of GLES to WebGL wrapper.

Although the spec allows to optimize-out specific array element during shader compilation by allowing non-contiguous uniform locations, I never experienced such optimization..

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

2 participants