Created
April 22, 2018 22:45
-
-
Save psilord/e9f223b802ac871281583d4ecfcbb509 to your computer and use it in GitHub Desktop.
This file contains 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
;; Most of the full API to deal with uniform/buffer blocks. | |
;; Some of this code is in or should be in shadow, and other parts are | |
;; in or should be in FL. | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; Naming an interface block in a specific shader | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; New function. | |
(XXX:create-shader-storage-block-alias snazzy-alias-eql-name | |
shader-program-symbol | |
block-name-symbol) | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; buffer creation on the GPU | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; A) the way we can do it now in shadow | |
(XXX:create-buffer target snazzy-buffer-eql-name | |
shader-program-symbol block-name-symbol) | |
;; B) Additionally using an alias name for the shader-program-symbol and | |
;; block-name-symbol pair | |
(XXX:create-buffer target snazzy-buffer-eql-name | |
snazzy-alias-eql-name) | |
;; Corollary: multiple buffer creation and naming suitable for | |
;; the same storage-block: | |
(XXX:create-buffer :ssbo :foo snazzy-alias-eql-name) | |
(XXX:create-buffer :ssbo :bar snazzy-alias-eql-name) | |
(XXX:create-buffer :ssbo :qux snazzy-alias-eql-name) | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; binding a buffer to a shader block | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; A) this is what shadow does: | |
(XXX:bind-shader-storage-block shader-program-name block-name-symbol | |
binding-point-integer) | |
;; B) another name for the same thing, specify the binding-point-integer | |
(XXX:bind-shader-storage-alias snazzy-alias-eql-name | |
binding-point-integer) | |
;; C) bind the alias automatically to a new binding-point integer | |
;; This will choose an unused binding point and store the | |
;; snazzy-alias-eql-name -> binding-point | |
;; association. | |
(XXX:bind-shader-storage-alias snazzy-alias-eql-name) | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; binding a buffer to a binding point | |
;; ;;;;;;;;;;;;;;;;;;;;;;; | |
;; A) what shadow does now | |
(XXX:bind-buffer snazzy-buffer-name binding-point-integer) | |
;; B) doing the same thing, but with an alias: | |
;; If snazzy-alias-eql-name is already associated with a binding-point, | |
;; then use it. | |
;; If snazzy-alias-eql-name is not already associated with a binding-point, | |
;; then assign a free one and use it. | |
(XX:bind-buffer snazzy-buffer-name snazzy-alias-eql-name) | |
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Then, we have stuff to delete stuff, break bindings, etc, etc | |
;; Delete the buffer. | |
;; This will search the automaticl binding-point association list and | |
;; if :foo exists in it, breaks the bindings, then deletes foo. | |
(XXX:delete-buffer :ssbo :foo) | |
;; Delete an alias | |
;; supply :break-binding t to also break all bindings with this alias. | |
(XXX:delete-shader-storage-block-alias snazzy-alias-eql-name &key break-binding) | |
;; unbinding a buffer, break all binding to any shader storage block to this | |
;; buffer. | |
(XXX:unbind-buffer snazzy-buffer-eql-name) | |
;; Probably some more to fill out the API. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment