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

Mesh-Program attribute matching on bind #37

Merged
merged 2 commits into from
Jun 30, 2014
Merged

Conversation

kvark
Copy link
Member

@kvark kvark commented Jun 30, 2014

This PR implements actual shader-mesh binding by matching names. This can be cached (as the next step) with a simple HashMap that holds the sequence of attribute indices, but I'd rather have all other matching functionality done first (shader parameters is the major one, and there is also a need to match shader outputs).

I had to put a simple handle management in place, to be replaced by a proper one with #22.

…e shader loading to error instead of failing on attribute or uniform mismatch.
@brendanzab
Copy link
Contributor

How far are we off being able to have an example for this?

@brendanzab
Copy link
Contributor

Looks good! Thoughts @csherratt?

@kvark
Copy link
Member Author

kvark commented Jun 30, 2014

@bjz an example? Sorry if I'm stating the obvious but this code is active already. It's matching mesh data vs shader inputs on every draw call, including the one we do for the triangle. That sample has only one attribute used, so it is a slightly redundant case... but still a case ;)

If you just want a bigger example, then the terrain one will suffice. I think we need #19 badly before implementing it.

@ghost
Copy link

ghost commented Jun 30, 2014

The change as a whole looks good, I think it is ok to merge.

@brendanzab
Copy link
Contributor

@kvark Awesome, sounds good

brendanzab added a commit that referenced this pull request Jun 30, 2014
Mesh-Program attribute matching on bind
@brendanzab brendanzab merged commit 1a784fe into gfx-rs:master Jun 30, 2014
@kvark
Copy link
Member Author

kvark commented Jun 30, 2014

@csherratt I'm not sure what would be the best way to deal with unrecognized attributes or uniforms.

On the one hand, it's not fatal to the execution. We can either ignore binding the attribute/uniform (possibly by simply not registering it on our side), or mark the whole shader program as invalid (preventing all the draw calls with it). Either an error!, or some real error passed back by the async channel would tell the user what went wrong.

On the other hand, I struggle to see the use case where this error happens on a non-developer machine. And the developer (of the shader) should fix it right away.

@kvark kvark deleted the shade branch June 30, 2014 17:33
kvark pushed a commit to kvark/gfx that referenced this pull request Jun 14, 2015
adamnemecek pushed a commit to adamnemecek/gfx that referenced this pull request Apr 1, 2021
52: Gfx examples framework r=grovesNL a=kvark

Fixes gfx-rs#37 
It's not functional yet, I think it needs a proper resize event handler. We can do this incrementally.

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
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

Successfully merging this pull request may close these issues.

None yet

2 participants