Files
jak-project/goal_src/jak2/engine/gfx/texture/texture.gc
T
water111 b5d21be9c5 W/misc fixes (#1838)
* temp

* temp

* before cleaning up

* cleanup merge

* fix warnings

* merge fix

* clang format
2022-09-05 20:29:12 -04:00

66 lines
2.5 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: texture.gc
;; name in dgo: texture
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
(defun adgif-shader<-texture! ((arg0 adgif-shader) (arg1 texture))
(set! (-> arg0 tex1 mxl) (+ (-> arg1 num-mips) -1))
(set! (-> arg0 tex1 l) (-> arg1 mip-shift))
(set! (-> arg0 tex1 mmag) (logand (-> arg1 tex1-control) 1))
(set! (-> arg0 tex1 mmin) (shr (-> arg1 tex1-control) 1))
(set! (-> arg0 tex0) (new 'static 'gs-tex0
:tcc #x1
:cld #x1
:cpsm (-> arg1 clutpsm)
:cbp (-> arg1 clutdest)
:tfx (-> arg0 tex0 tfx)
:th (log2 (-> arg1 h))
:tw (log2 (-> arg1 w))
:tbw (-> arg1 width 0)
:tbp0 (-> arg1 dest 0)
:psm (the-as int (-> arg1 psm))
)
)
(set! (-> arg0 miptbp1) (new 'static 'gs-miptbp
:tbp1 (-> arg1 dest 1)
:tbw1 (-> arg1 width 1)
:tbp2 (-> arg1 dest 2)
:tbw2 (-> arg1 width 2)
:tbp3 (-> arg1 dest 3)
:tbw3 (-> arg1 width 3)
)
)
(when (< (the-as uint 4) (-> arg1 num-mips))
(set! (-> arg0 alpha-as-miptb2) (new 'static 'gs-miptbp
:tbp1 (-> arg1 dest 4)
:tbw1 (-> arg1 width 4)
:tbp2 (-> arg1 dest 5)
:tbw2 (-> arg1 width 5)
:tbp3 (-> arg1 dest 6)
:tbw3 (-> arg1 width 6)
)
)
(set! (-> (&-> arg0 reg-4-u32) 0) (gs-reg32 miptbp2-1))
)
arg0
)
(defun adgif-shader<-texture-simple! ((arg0 adgif-shader) (arg1 texture))
(set! (-> arg0 tex1) (new 'static 'gs-tex1 :mmag #x1 :mmin #x1))
(set! (-> arg0 tex0 tfx) 0)
(if arg1
(adgif-shader<-texture! arg0 arg1)
)
(set! (-> arg0 clamp) (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)))
(set! (-> arg0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
(set! (-> arg0 prims 1) (gs-reg64 tex0-1))
(set! (-> arg0 prims 3) (gs-reg64 tex1-1))
(set! (-> arg0 prims 5) (gs-reg64 miptbp1-1))
(set! (-> arg0 clamp-reg) (gs-reg64 clamp-1))
(set! (-> arg0 prims 9) (gs-reg64 alpha-1))
arg0
)