diff options
Diffstat (limited to 'chickadee/graphics/pass.scm')
-rw-r--r-- | chickadee/graphics/pass.scm | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/chickadee/graphics/pass.scm b/chickadee/graphics/pass.scm new file mode 100644 index 0000000..889d28d --- /dev/null +++ b/chickadee/graphics/pass.scm @@ -0,0 +1,85 @@ +;;; Chickadee Game Toolkit +;;; Copyright © 2023 David Thompson <dthompson2@worcester.edu> +;;; +;;; Licensed under the Apache License, Version 2.0 (the "License"); +;;; you may not use this file except in compliance with the License. +;;; You may obtain a copy of the License at +;;; +;;; http://www.apache.org/licenses/LICENSE-2.0 +;;; +;;; Unless required by applicable law or agreed to in writing, software +;;; distributed under the License is distributed on an "AS IS" BASIS, +;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +;;; See the License for the specific language governing permissions and +;;; limitations under the License. + +;;; Commentary: +;; +;; GPU render passes. +;; +;;; Code: + +(define-module (chickadee graphics pass) + #:use-module (chickadee graphics color) + #:use-module (chickadee graphics depth-stencil) + #:use-module (srfi srfi-9) + #:export (<color-attachment> + make-color-attachment + color-attachment? + color-attachment-view + color-attachment-resolve-target + color-attachment-clear-color + color-attachment-load-op + color-attachment-store-op + + <depth+stencil-attachment> + make-depth+stencil-attachment + depth+stencil-attachment? + depth+stencil-attachment-view + depth+stencil-attachment-depth-clear-value + depth+stencil-attachment-depth-load-op + depth+stencil-attachment-depth-store-op + depth+stencil-attachment-depth-read-only? + depth+stencil-attachment-stencil-clear-value + depth+stencil-attachment-stencil-load-op + depth+stencil-attachment-stencil-store-op + depth+stencil-attachment-stencil-read-only? + + <render-pass> + make-render-pass + render-pass? + render-pass-color-attachments + render-pass-depth+stencil-attachment)) + +(define-record-type <color-attachment> + (%make-color-attachment view resolve-target operation) + color-attachment? + (view color-attachment-view) + (resolve-target color-attachment-resolve-target) + (operation color-attachment-operation)) + +(define* (make-color-attachment #:key view resolve-target + (operation (make-color-operation))) + (%make-color-attachment view resolve-target operation)) + +(define-record-type <depth+stencil-attachment> + (%make-depth+stencil-attachment view depth-operation stencil-operation) + depth+stencil-attachment? + (view depth+stencil-attachment-view) + (depth-operation depth+stencil-attachment-depth-operation) + (stencil-operation depth+stencil-attachment-stencil-operation)) + +(define* (make-depth+stencil-attachment #:key view + (depth-operation (make-depth-operation)) + (stencil-operation (make-stencil-operation))) + (%make-depth+stencil-attachment view depth-operation stencil-operation)) + +(define-record-type <render-pass> + (%make-render-pass color-attachments depth+stencil-attachment) + render-pass? + (color-attachments render-pass-color-attachments) + (depth+stencil-attachment render-pass-depth+stencil-attachment)) + +(define* (make-render-pass #:key (color-attachments #()) + depth+stencil-attachment) + (%make-render-pass color-attachments depth+stencil-attachment)) |