-
-
Notifications
You must be signed in to change notification settings - Fork 23
Add simple page shader #270
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| set cc [C] | ||
| $cc include <string.h> | ||
| $cc include <openssl/sha.h> | ||
| $cc proc sha1 {char* d} Jim_Obj* { | ||
| unsigned char md[20]; | ||
| SHA1((unsigned char *)d, strlen(d), md); | ||
| return Jim_NewStringObj(interp, (char *)md, 20); | ||
| } | ||
| $cc endcflags -lssl -lcrypto | ||
| set sha1Lib [$cc compile] | ||
|
|
||
|
|
||
| When /someone/ wishes /p/ draws shader /shaderCode/ { | ||
| binary scan [$sha1Lib sha1 $shaderCode] H* sha1 | ||
|
|
||
| Wish the GPU compiles pipeline $sha1 [list \ | ||
| {vec2 viewport mat3 surfaceToClip} { | ||
| vec2 vertices[6] = vec2[6]( | ||
| vec2(0.0, 0.0), vec2(1.0, 0.0), vec2(1.0, 1.0), | ||
| vec2(0.0, 0.0), vec2(1.0, 1.0), vec2(0.0, 1.0) | ||
| ); | ||
| vec3 v = surfaceToClip * vec3(vertices[gl_VertexIndex], 1.0); | ||
| return vec4(v.xy/v.z, 0.0, 1.0); | ||
| } $shaderCode] | ||
|
|
||
| When the GPU compiles pipeline $sha1 to /anything/ & \ | ||
| $p has canvas /id/ with /...wiOptions/ & \ | ||
| $p has canvas projection /surfaceToClip/ { | ||
| puts "the GPU compiled the pipeline" | ||
| set wiResolution [list [dict get $wiOptions width] [dict get $wiOptions height]] | ||
|
|
||
| Wish the GPU draws pipeline $sha1 onto canvas $id \ | ||
| with arguments [list $wiResolution $surfaceToClip ] | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The issue has the example "draws pixel shader." I like the specificity. We could also call it "fragment shader"