diff options
-rw-r--r-- | chickadee/render/shader.scm | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/chickadee/render/shader.scm b/chickadee/render/shader.scm index 5442097..0b0e631 100644 --- a/chickadee/render/shader.scm +++ b/chickadee/render/shader.scm @@ -45,10 +45,11 @@ float-vec4 mat4 sampler-2d + local-field + define-shader-type uniform-namespace? uniform-namespace-ref uniform-namespace-for-each - define-shader-type make-shader shader? null-shader @@ -238,6 +239,8 @@ (format port "#<shader-struct ~a>" (shader-struct-fields vt))))) +(define local-field (gensym "local-shader-field-")) + (define (shader-struct? struct) (eq? (struct-vtable (struct-vtable struct)) <shader-struct>)) @@ -258,6 +261,8 @@ (shader-data-type-validate type value)) (error "invalid type for shader struct field" field value))) (cond + ((eq? type local-field) + #t) ((= size 1) (validate value)) ((and (vector? value) @@ -306,7 +311,11 @@ (() #f) (((name index type size) . rest) (format port " ~a[~d ~a]: ~a" - name size (shader-data-type-name type) (struct-ref obj index)) + name size + (if (eq? type local-field) + 'local + (shader-data-type-name type)) + (struct-ref obj index)) (loop rest)))) (display ">" port))) |