water111 2023-08-17 20:23:17 -04:00 committed by GitHub
parent b16daae310
commit eeb3292ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 7 deletions

View file

@ -283,8 +283,8 @@ void OpenGLRenderer::init_bucket_renderers_jak2() {
init_bucket_renderer<TextureUploadHandler>("tex-all-warp", BucketCategory::TEX,
BucketId::TEX_ALL_WARP, m_texture_animator);
init_bucket_renderer<Warp>("warp", BucketCategory::GENERIC, BucketId::GMERC_WARP, m_generic2);
init_bucket_renderer<DirectRenderer>("debug-no-zbuf1", BucketCategory::OTHER,
BucketId::DEBUG_NO_ZBUF1, 0x8000);
init_bucket_renderer<TextureUploadHandler>("debug-no-zbuf1", BucketCategory::OTHER,
BucketId::DEBUG_NO_ZBUF1, m_texture_animator, true);
init_bucket_renderer<TextureUploadHandler>("tex-all-map", BucketCategory::TEX,
BucketId::TEX_ALL_MAP, m_texture_animator, true);
// 320

View file

@ -841,6 +841,16 @@ void TextureAnimator::force_to_gpu(int tbp) {
break;
case VramEntry::Kind::GPU:
break; // already on the gpu.
case VramEntry::Kind::GENERIC_PSM32: {
int tw = entry.tex_width;
int th = entry.tex_height;
setup_vram_entry_for_gpu_texture(tw, th, tbp);
glBindTexture(GL_TEXTURE_2D, entry.tex.value().texture());
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV,
entry.data.data());
glBindTexture(GL_TEXTURE_2D, 0);
entry.kind = VramEntry::Kind::GPU;
} break;
case VramEntry::Kind::GENERIC_PSMT8: {
// we have data that was uploaded in PSMT8 format. Assume that it will also be read in this
// format. Convert to normal format.

View file

@ -114,13 +114,55 @@
)
)
;; hack
(defun draw-raw-image ((arg0 bucket-id) (arg1 art-group) (arg2 int) (arg3 int) (arg4 level) (arg5 int))
(format 0 "unimplemented draw-raw-image~%")
(none)
(defun pc-upload-raw-texture ((dma-buf dma-buffer) (image-data pointer) (width int) (height int) (tbp int))
"Added function in the PC port to create a 'raw' texture (no clut)"
(pc-texture-anim-flag start-anim-array dma-buf)
(pc-texture-anim-flag upload-generic-vram dma-buf :qwc 1)
(let ((upload-record (the texture-anim-pc-upload (-> dma-buf base))))
(set! (-> upload-record data) image-data)
(set! (-> upload-record width) width)
(set! (-> upload-record height) height)
(set! (-> upload-record dest) tbp)
(set! (-> upload-record format) (gs-psm ct32))
(set! (-> upload-record force-to-gpu) 1)
)
(&+! (-> dma-buf base) 16)
(pc-texture-anim-flag finish-anim-array dma-buf)
)
(defun draw-raw-image ((arg0 bucket-id) (arg1 art-group) (arg2 int) (arg3 int) (arg4 level) (arg5 int))
(local-vars (sv-16 blit-displays-work) (sv-32 int))
(set! sv-16 *blit-displays-work*)
(with-dma-buffer-add-bucket ((s0-0 (-> *display* frames (-> *display* on-screen) global-buf))
arg0
)
;; (upload-vram-data s0-0 0 (the-as pointer arg1) arg3 arg2)
(pc-upload-raw-texture s0-0 (the pointer arg1) arg2 arg3 0)
(set! sv-32 (+ (log2 (+ arg2 -1)) 1))
(let ((v1-8 (+ (log2 (+ arg3 -1)) 1)))
(dma-buffer-add-gs-set s0-0
(test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always)))
(alpha-1 (new 'static 'gs-alpha))
(tex0-1 (new 'static 'gs-tex0 :tcc #x1 :th v1-8 :tw sv-32 :tbw (/ arg2 64)))
(tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x1))
(clamp-1 (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)))
(texflush 0)
)
)
(let ((v1-19 (-> s0-0 base)))
(set! (-> (the-as (pointer uint128) v1-19)) (-> sv-16 sprite-slow-tmpl dma-vif quad))
(set! (-> (the-as (pointer uint128) v1-19) 1) (-> sv-16 sprite-slow-tmpl quad 1))
(set! (-> (the-as (pointer uint128) v1-19) 2) (-> sv-16 color quad))
(set-vector! (the-as vector4w (&+ v1-19 48)) 0 0 0 0)
(set-vector! (the-as vector4w (&+ v1-19 64)) #x7000 #x7300 0 0)
(set-vector! (the-as vector4w (&+ v1-19 80)) (* arg2 16) (* arg3 16) 0 0)
(set-vector! (the-as vector4w (&+ v1-19 96)) #x9000 #x8d00 0 0)
)
(&+! (-> s0-0 base) 112)
(set-dirty-mask! arg4 arg5 (* (* arg3 arg2) 4) 0)
)
(none)
)
;; not the real thing. just a temp hack.
(defun blit-displays ()