-
Notifications
You must be signed in to change notification settings - Fork 245
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
Add example to evaluate sky shader on CPU #141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is super cool, and impressively simple!
later when we start introducing GPU & SPIRV specific intrinsics (#81), this approach won't work
It should work, I plan on implementing it in a way where it should work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love that we can do this :-)
Ah some cargo-deny stuff to fix with the minifb dependency |
@Mergifyio rebase |
Like the other types, for now.
Command
|
647f712
to
560eccb
Compare
Adds a new example that shows how to compile and evaluate a simple fragment shader (our sky shader) directly on the CPU.
For this specific shader as it doesn't use any resources it is very easy as one can just call the fragment shader function manually, later for standard shaders with resource bindings this will be much harder, but maybe still useful to test parts of shaders or reuse some functionality.
Right now it also just works for the current temp math functions that use
core
intrinsic, as all of those are available obviously on the CPU also, later when we start introducing GPU & SPIRV specific intrinsics (#81), this approach won't work, and then we will want to use a higher-level math layer in the shaders for the math instructions (glam: #134) so they can be mapped to the right available target intrinsic.To make the example very simple, slim and cross-platform, this example uses the
minifb
crate to drive the Window. Could switch to something else later though but it is very basic.