Skip to content
Browse files

Fix texspec format joining a bit.

  • Loading branch information...
Shinmera committed Aug 19, 2019
1 parent 9785dc6 commit 80627c6facd7a514686624c13f8e2e060ec208da
Showing with 25 additions and 16 deletions.
  1. +25 −13 resources/texture.lisp
  2. +0 −3 shader-pass.lisp
@@ -298,26 +298,38 @@

(defun join-texture-format-typespec (a b)
(flet ((same (a b)
(cond ((eql a b) (values a T)) ((null a) (values b T)) ((null b) (values a T))))
(max* (a b)
(cond ((and a b) (max a b)) (a a) (b b))))
(cond ((and a b)
(when (and (nth-value 1 (same (second a) (second b)))
(nth-value 1 (same (third a) (third b))))
(list (max* (first a) (first b))
(same (second a) (second b))
(same (third a) (third b)))))
(a a)
(b b))))
(flet ((max* (a b)
(cond ((and a b) (max a b))
(a a)
(b b))))
(cond ((null b) (values a T))
((null a) (values b T))
((equal a b) (values a T))
(destructuring-bind (a-b a-t a-s) a
(destructuring-bind (b-b b-t b-s) b
(cond ((and (member a-t '(:float NIL))
(member b-t '(:float NIL)))
(values (list (max* a-b b-b)
(or a-t b-t)
(or a-s b-s))
((and (eq a-t b-t) (eq a-s b-s))
(values (list (max* a-b b-b)

(defun join-texture-format (a b)
(let ((a (destructure-texture-format a))
(b (destructure-texture-format b)))
(flet ((same (field)
(equal (getf a field) (getf b field)))
(join-texture-format-typespec* (f)
(join-texture-format-typespec (getf a f) (getf b f))))
(multiple-value-bind (spec joinable) (join-texture-format-typespec (getf a f) (getf b f))
(if joinable
(return-from join-texture-format NIL)))))
(when (and (same :features)
(same :shared))
(cond ((and (getf a :depth) (getf b :depth))
@@ -43,9 +43,6 @@
(defclass image-out (image-port flow:out-port flow:n-port)
((access :initform :write-only)))

(defclass image-in-out (image-port flow:n-port)
((access :initform :read-write)))

;; FIXME: check for duplicate inputs/outputs.
(defclass uniform-port (flow:port)
((uniform-name :initarg :uniform :initform NIL :accessor uniform-name)))

0 comments on commit 80627c6

Please sign in to comment.
You can’t perform that action at this time.