From 73fb0bfcf7d78cb1fd49b0f75fc773fa88845c44 Mon Sep 17 00:00:00 2001 From: Yukari Hafner Date: Wed, 18 Sep 2024 14:25:48 +0200 Subject: [PATCH] Make sure to rebind buffer to program when setting slot. --- shader-entity.lisp | 4 ++++ shader-pass.lisp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/shader-entity.lisp b/shader-entity.lisp index 8a174f00..53a8809e 100644 --- a/shader-entity.lisp +++ b/shader-entity.lisp @@ -469,6 +469,10 @@ void main(){ (unless (slot-boundp entity 'shader-program) (setf (shader-program entity) (make-shader-program entity)))) +(defmethod (setf c2mop:slot-value-using-class) :after (value (class shader-entity-class) (entity standalone-shader-entity) (slotd buffer-slot-definition)) + (when (and (slot-boundp entity 'shader-program) (allocated-p (shader-program entity))) + (bind value (shader-program entity)))) + (defmethod stage :after ((entity standalone-shader-entity) (area staging-area)) (stage (shader-program entity) area)) diff --git a/shader-pass.lisp b/shader-pass.lisp index 22472f7f..8c91618a 100644 --- a/shader-pass.lisp +++ b/shader-pass.lisp @@ -470,6 +470,10 @@ (setf (shaders (shader-program pass)) (shaders (make-shader-program pass))))) +(defmethod (setf c2mop:slot-value-using-class) :after (value (class shader-pass-class) (entity single-shader-pass) (slotd buffer-slot-definition)) + (when (and (slot-boundp entity 'shader-program) (allocated-p (shader-program entity))) + (bind value (shader-program entity)))) + (defmethod stage ((pass single-shader-pass) (area staging-area)) (unless (slot-boundp pass 'shader-program) (setf (shader-program pass) (make-shader-program pass)))