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

Show only 1 once the message "Parameter not found" #566

Closed
wants to merge 1 commit into from

Conversation

ZerpHmm
Copy link
Contributor

@ZerpHmm ZerpHmm commented Apr 6, 2014

No description provided.

@Bromeon
Copy link
Member

Bromeon commented Apr 6, 2014

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?

@criptych
Copy link

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 compile), so the location will have to be looked up again anyway.

@binary1248
Copy link
Member

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.

@mantognini
Copy link
Member

Note: this PR is not in sync with master and has to milestone set.

@Foaly
Copy link
Contributor

Foaly commented Jun 1, 2014

I'd like to see this being merged, too!
It has annoyed me quiet a few times. Especially the case that @binary1248 has discribed, when something in the shader code is wrong and the variable gets optimized out. Any other (meaningful) warning/error message gets lost in the flooded console.

@Bromeon
Copy link
Member

Bromeon commented Jun 1, 2014

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.

@eXpl0it3r
Copy link
Member

@ZerpHmm Would you mind updating your version to the latest master? Otherwise I'll create a new branch later on.

@TankOs TankOs added this to the 2.2 milestone Jun 9, 2014
@TankOs TankOs self-assigned this Jun 9, 2014
@TankOs
Copy link
Member

TankOs commented Jun 9, 2014

Merged in bugfix/shader_uniform.

@TankOs
Copy link
Member

TankOs commented Jun 10, 2014

Unless someone reviews this negatively, I'm going to merge into master.

@zsbzsb
Copy link
Member

zsbzsb commented Jun 10, 2014

Looks good to me.

@Bromeon
Copy link
Member

Bromeon commented Jun 10, 2014

Has anybody tested the code yet?

@TankOs
Copy link
Member

TankOs commented Jun 11, 2014

Yep, it does work flawlessly. Tested on Linux (behavior shouldn't be any different on other platforms).

@eXpl0it3r
Copy link
Member

I'd say go ahead and merge it.

@TankOs
Copy link
Member

TankOs commented Jun 11, 2014

Merged. Thanks @ZerpHmm

@TankOs TankOs closed this Jun 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants