-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Show only 1 once the message "Parameter not found" #566
Conversation
Would you mind describing the problem? If I get it right, you insert the -1 value into the cache so that the next time, it will be recognized, and no further error message is emitted? Have you made sure that this doesn't break the semantics elsewhere? |
I've used a similar technique before. In order for a nonexistent (and in some implementations, unused) uniform to become available, the shader source would have to change; SFML already clears the parameter cache when that happens (in |
All this PR does is make sure that the shader only has to look up a name->location mapping once per compiled program. The mappings are specific to a compiled & linked program and thus they are already deleted in the current implementation when doing something that causes the program to be recompiled. This doesn't solve the issue of preventing warning messages when deliberately trying to set a parameter that doesn't exist in the shader, but at least it limits the warning to just the first attempt to set the parameter. This should be enough for the developer to fix unintended behaviour adequately. In the future there should be a way to optionally set parameters of a shader if the developer knows that their shaders all specify different uniforms. It isn't even enough just specifying them and leaving them unused. If the shader compiler notices that after compiling/optimizing, a uniform isn't used anywhere, it won't show up in the location registry of the shader and you will get spammed with warnings by SFML. I'd say just apply this PR for now. A more flexible parameter system will come some time in the future. |
Note: this PR is not in sync with master and has to milestone set. |
I'd like to see this being merged, too! |
If I remember correctly, there are a few other places where a lot of error messages are emitted (mostly invalid GL calls). It could be worthwhile to have a look at them too. |
@ZerpHmm Would you mind updating your version to the latest master? Otherwise I'll create a new branch later on. |
Merged in bugfix/shader_uniform. |
Unless someone reviews this negatively, I'm going to merge into master. |
Looks good to me. |
Has anybody tested the code yet? |
Yep, it does work flawlessly. Tested on Linux (behavior shouldn't be any different on other platforms). |
I'd say go ahead and merge it. |
Merged. Thanks @ZerpHmm |
No description provided.