jak-project/goal_src/engine/gfx/generic/generic-h.gc
2021-05-07 00:41:42 -04:00

260 lines
8.7 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: generic-h.gc
;; name in dgo: generic-h
;; dgos: GAME, ENGINE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GENERIC RENDERER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The generic renderer is the slow but general renderer.
;; gsf, what does it stand for?
(deftype gsf-vertex (structure)
((data uint32 8 :offset-assert 0)
(byte uint8 32 :offset 0)
(quad uint128 2 :offset 0)
(vt qword :inline :offset 0)
(pos vector3s :inline :offset 0)
(tex vector2uh :inline :offset 12)
(nrm vector3s :inline :offset 16)
(nc qword :inline :offset 16)
(clr vector4ub :inline :offset 28)
(dtex vector2uh :inline :offset 16)
(dclr vector4ub :inline :offset 20)
)
:pack-me
:method-count-assert 9
:size-assert #x20
:flag-assert #x900000020
)
;; dynamically sized array of gsf-verts
(deftype gsf-vertex-array (structure)
((vtx gsf-vertex :dynamic :offset-assert 0)
)
:method-count-assert 9
:size-assert #x0
:flag-assert #x900000000
)
(deftype gsf-fx-vertex (structure)
((clr vector4ub :inline :offset-assert 0)
(tex vector2uh :inline :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
)
(deftype gsf-fx-vertex-array (structure)
((data gsf-fx-vertex :dynamic :offset-assert 0)
)
:method-count-assert 9
:size-assert #x0
:flag-assert #x900000000
)
(deftype gsf-header (structure)
((num-strips uint8 :offset-assert 0)
(expanded uint8 :offset-assert 1)
(num-dps uint16 :offset-assert 2)
(num-vtxs uint16 :offset-assert 4)
(strip-table uint8 10 :offset-assert 6)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype gsf-ik (structure)
((index uint8 :offset-assert 0)
(no-kick uint8 :offset-assert 1)
)
:method-count-assert 9
:size-assert #x2
:flag-assert #x900000002
)
(deftype gsf-info (structure)
((ptr-iks uint32 :offset-assert 0)
(ptr-verts uint32 :offset-assert 4)
(ptr-fx uint32 :offset-assert 8)
(dummy2 uint32 :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype gsf-buffer (structure)
((data uint8 8192 :offset-assert 0)
(info gsf-info :inline :offset 0)
(header gsf-header :inline :offset 16)
(work-area uint8 :dynamic :offset 32)
)
:method-count-assert 9
:size-assert #x2000
:flag-assert #x900002000
)
(deftype generic-frag (structure)
((start-pos uint16 :offset-assert 0)
(end-pos uint16 :offset-assert 2)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
(deftype generic-strip (structure)
((pos uint16 :offset-assert 0)
(len uint16 :offset-assert 2)
)
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
(deftype generic-envmap-saves (structure)
((index-mask vector4w :inline :offset-assert 0)
(verts uint128 12 :offset-assert 16)
(kicks uint128 4 :offset-assert 208)
)
:method-count-assert 9
:size-assert #x110
:flag-assert #x900000110
)
(deftype generic-interp-job (structure)
((job-type uint16 :offset-assert 0)
(num uint16 :offset-assert 2)
(first uint16 :offset-assert 4)
(pad uint16 :offset-assert 6)
(ptr-data uint32 :offset-assert 8)
(morph-z uint16 :offset-assert 12)
(morph-w uint16 :offset-assert 14)
)
:pack-me
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype generic-saves (structure)
((ptr-dma uint32 :offset-assert 0)
(ptr-vtxs uint32 :offset-assert 4)
(ptr-clrs uint32 :offset-assert 8)
(ptr-texs uint32 :offset-assert 12)
(ptr-env-clrs uint32 :offset-assert 16)
(ptr-env-texs uint32 :offset-assert 20)
(cur-outbuf uint32 :offset-assert 24)
(ptr-fx-buf uint32 :offset-assert 28)
(xor-outbufs uint32 :offset-assert 32)
(num-dps uint32 :offset-assert 36)
(qwc uint32 :offset-assert 40)
(gsf-buf gsf-buffer :offset-assert 44)
(ptr-shaders uint32 :offset-assert 48)
(ptr-env-shader uint32 :offset-assert 52)
(is-envmap uint32 :offset-assert 56)
(basep uint32 :offset-assert 60)
(ptr-interp-job generic-interp-job :offset-assert 64)
(gifbuf-adr uint32 :offset-assert 68)
(inbuf-adr uint32 :offset-assert 72)
(fade-val uint32 :offset-assert 76)
(time-of-day-color uint32 :offset-assert 80)
(to-vu0-waits uint32 :offset-assert 84)
(to-spr-waits uint32 :offset-assert 88)
(from-spr-waits uint32 :offset-assert 92)
(envmap generic-envmap-saves :inline :offset-assert 96)
)
:method-count-assert 9
:size-assert #x170
:flag-assert #x900000170
)
(deftype generic-gif-tag (structure)
((data uint32 4 :offset-assert 0)
(qword qword :inline :offset 0)
(fan-prim uint32 :offset 0)
(str-prim uint32 :offset 4)
(regs uint32 :offset 8)
(num-strips uint32 :offset 12)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype ad-cmd (structure)
((word uint32 4 :offset-assert 0)
(quad uint128 :offset 0)
(data uint64 :offset 0)
(cmds uint64 :offset 8)
(cmd uint8 :offset 8)
(x uint32 :offset 0)
(y uint32 :offset 4)
(z uint32 :offset 8)
(w uint32 :offset 12)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
)
(deftype generic-envmap-consts (structure)
((consts vector :inline :offset-assert 0)
(strgif generic-gif-tag :inline :offset-assert 16)
(colors vector4w :inline :offset-assert 32)
(shader adgif-shader :inline :offset-assert 48)
)
:method-count-assert 9
:size-assert #x80
:flag-assert #x900000080
)
(deftype generic-consts (structure)
((dma-header dma-packet :inline :offset-assert 0)
(vif-header uint32 4 :offset-assert 16)
(dma-ref-vtxs dma-packet :inline :offset-assert 32)
(dma-cnt-call dma-packet :inline :offset-assert 48)
(matrix matrix :inline :offset-assert 64)
(base-strgif generic-gif-tag :inline :offset-assert 128)
(alpha-opaque ad-cmd :inline :offset-assert 144)
(alpha-translucent ad-cmd :inline :offset-assert 160)
(ztest-normal ad-cmd :inline :offset-assert 176)
(ztest-opaque ad-cmd :inline :offset-assert 192)
(adcmd-offsets uint8 16 :offset-assert 208)
(adcmds ad-cmd 4 :offset 144)
(stcycle-tag uint32 :offset-assert 224)
(unpack-vtx-tag uint32 :offset-assert 228)
(unpack-clr-tag uint32 :offset-assert 232)
(unpack-tex-tag uint32 :offset-assert 236)
(mscal-tag uint32 :offset-assert 240)
(flush-tag uint32 :offset-assert 244)
(reset-cycle-tag uint32 :offset-assert 248)
(dummy0 uint32 :offset-assert 252)
(dma-tag-cnt uint64 :offset-assert 256)
(envmap generic-envmap-consts :inline :offset-assert 272)
(light-consts vector :inline :offset-assert 400)
(texture-offset uint16 8 :offset-assert 416)
)
:method-count-assert 9
:size-assert #x1b0
:flag-assert #x9000001b0
)
(deftype generic-storage (structure)
((data uint128 16 :offset-assert 0)
)
:method-count-assert 9
:size-assert #x100
:flag-assert #x900000100
)
(define *gsf-buffer* (the gsf-buffer (kmalloc global #x2400 (kmalloc-flags align-64) "malloc")))