summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2024-10-19 21:05:41 -0400
committerDavid Thompson <dthompson2@worcester.edu>2024-10-19 21:05:41 -0400
commitb5aa7cb9a857160e547718d184e89cb3221200a5 (patch)
tree140ee0e84811067fd9e7dfccfa6402a0a64f7e00 /chickadee.scm
parent76dc3f0af36775d2fdaab61134dd0f875ee48292 (diff)
WIP path stuffwip-graphics-backend
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm22
1 files changed, 16 insertions, 6 deletions
diff --git a/chickadee.scm b/chickadee.scm
index 0654ea3..f726691 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -162,6 +162,7 @@ not being pushed at all."
(define default-color-texture-view (make-parameter #f))
(define default-depth+stencil-texture-view (make-parameter #f))
+(define default-resolve-target (make-parameter #f))
(define* (make-window #:key (title "Chickadee") fullscreen? resizable?
(width 640) (height 480))
@@ -303,6 +304,7 @@ border is disabled, otherwise it is enabled.")
(vector
(make-color-attachment
#:view default-color-texture-view
+ #:resolve-target default-resolve-target
#:operation (make-color-operation
#:clear-color db32-viking)))
#:depth+stencil-attachment
@@ -417,7 +419,7 @@ border is disabled, otherwise it is enabled.")
(current-projection default-projection)
(current-pass default-render-pass))
(draw alpha))
- ((@@ (chickadee graphics) end-frame) (default-color-texture-view)))
+ ((@@ (chickadee graphics) end-frame) (default-resolve-target)))
(define (on-error e stack)
(error e stack)
;; Flush all input events that have occurred while in the error
@@ -426,9 +428,11 @@ border is disabled, otherwise it is enabled.")
(define (refresh-default-texture-views! width height)
(let* ((old-color (default-color-texture-view))
(old-depth+stencil (default-depth+stencil-texture-view))
+ (old-resolve-target (default-resolve-target))
(color-texture (make-texture #:name "Default color texture"
#:width width
- #:height height))
+ #:height height
+ #:samples 4))
(color-view (make-texture-view color-texture
#:name "Default color texture view"))
(depth+stencil-texture (make-texture #:name "Default depth/stencil texture"
@@ -436,11 +440,19 @@ border is disabled, otherwise it is enabled.")
#:height height
#:format 'depth24plus-stencil8))
(depth+stencil-view (make-texture-view depth+stencil-texture
- #:name "Default depth/stencil texture view")))
+ #:name "Default depth/stencil texture view"))
+ (resolve-target-texture (make-texture #:name "Default resolve target texture"
+ #:width width
+ #:height height))
+ (resolve-target (make-texture-view resolve-target-texture
+ #:name "Default resolve target texture view")))
+ ;; TODO: Destroy the underlying textures, too?
(when old-color (destroy-texture-view old-color))
(when old-depth+stencil (destroy-texture-view old-depth+stencil))
+ (when old-resolve-target (destroy-texture-view old-resolve-target))
(default-color-texture-view color-view)
- (default-depth+stencil-texture-view depth+stencil-view)))
+ (default-depth+stencil-texture-view depth+stencil-view)
+ (default-resolve-target resolve-target)))
(parameterize ((current-window window)
(gpu:current-gpu gpu))
(refresh-default-texture-views! window-width window-height)
@@ -452,8 +464,6 @@ border is disabled, otherwise it is enabled.")
(lambda args
(display "warning: could not enable vsync\n"
(current-error-port))))
- ;; Turn off multisampling by default.
- ;; (gl-disable (version-1-3 multisample))
;; Enable seamless cube maps.
;; (gl-enable (version-3-2 texture-cube-map-seamless))
(sdl2:load-game-controller-mappings!