Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions core/internals.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@
(let ((type (or (varjo.internals::try-type-spec->type array-type nil)
(error 'bad-type-for-buffer-stream-data :type array-type))))
(if (and (varjo:core-typep type) (not (varjo:v-typep type 'v-sampler)))
(let ((slot-layout (cepl.types::expand-slot-to-layout
nil type normalized))
(stride 0))
(let* ((slot-layout (cepl.types::expand-slot-to-layout
nil type normalized))
(stride (reduce (lambda (accum attr)
(incf accum (* (first attr)
(gl-type-size (second attr)))))
slot-layout
:initial-value 0)))
(loop :for attr :in slot-layout
:for i :from 0
:with offset = 0
Expand Down
13 changes: 9 additions & 4 deletions core/types/structs.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@

(defun+ make-varjo-struct-def (name slots)
(let ((hidden-name (symb-package (symbol-package name)
'v_ name )))
'v_ name)))
`(v-defstruct
(,name :shadowing ,hidden-name)
()
Expand Down Expand Up @@ -465,11 +465,16 @@

(defun+ make-struct-attrib-assigner (type-name slots)
(when (every #'buffer-stream-compatible-typep slots)
(let* ((stride (if (> (length slots) 1)
(let* ((def-sets (mapcat #'expand-slot-to-layout slots))
(stride (if (> (length slots) 1)
`(cepl.internals:gl-type-size ',type-name)
0))
(reduce (lambda (accum attr)
(incf accum (* (first attr)
(cepl.internals:gl-type-size
(second attr)))))
def-sets
:initial-value 0)))
(stride-sym (gensym "stride"))
(def-sets (mapcat #'expand-slot-to-layout slots))
(definitions
(loop :for (len cffi-type normalized gl-type)
:in def-sets
Expand Down