mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-27 08:20:47 +00:00
[graphics] tie generic (#1341)
* [gtie] tie inst and proto functions * first chain input to generic ee looks good * m * works * ugh * add tie generic * rm debug print * rm generic ties from fr3
This commit is contained in:
parent
08d701bb26
commit
a51536de8d
@ -50,7 +50,7 @@ enum MemoryUsageCategory {
|
||||
NUM_CATEGORIES
|
||||
};
|
||||
|
||||
constexpr int TFRAG3_VERSION = 15;
|
||||
constexpr int TFRAG3_VERSION = 16;
|
||||
|
||||
// These vertices should be uploaded to the GPU at load time and don't change
|
||||
struct PreloadedVertex {
|
||||
|
@ -69,6 +69,11 @@ inline void emulate_dma(const void* source_base, void* dest_base, u32 tadr, u32
|
||||
dest_offset += (1 + tag.qwc) * 16;
|
||||
tadr += 16 + tag.qwc * 16;
|
||||
break;
|
||||
case DmaTag::Kind::NEXT:
|
||||
memcpy(dst + dest_offset, src + tadr, (1 + tag.qwc) * 16);
|
||||
dest_offset += (1 + tag.qwc) * 16;
|
||||
tadr = tag.addr;
|
||||
break;
|
||||
case DmaTag::Kind::REF: {
|
||||
// tte
|
||||
memcpy(dst + dest_offset, src + tadr, 16);
|
||||
|
@ -1058,6 +1058,7 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output,
|
||||
case InstructionKind::DSLLV:
|
||||
case InstructionKind::PAND:
|
||||
case InstructionKind::PCEQB:
|
||||
case InstructionKind::PPACW:
|
||||
return handle_generic_op3(i0, instr_str, {});
|
||||
case InstructionKind::MULS:
|
||||
return handle_generic_op3(i0, instr_str, "muls");
|
||||
|
@ -6827,7 +6827,7 @@
|
||||
(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)
|
||||
(time-of-day-color rgba :offset-assert 80)
|
||||
(to-vu0-waits uint32 :offset-assert 84)
|
||||
(to-spr-waits uint32 :offset-assert 88)
|
||||
(from-spr-waits uint32 :offset-assert 92)
|
||||
@ -16886,11 +16886,11 @@
|
||||
;; - Functions
|
||||
|
||||
(define-extern generic-work-init (function generic-dma-foreground-sink none))
|
||||
(define-extern generic-upload-vu0 function)
|
||||
(define-extern generic-upload-vu0 (function none))
|
||||
(define-extern upload-vu0-program (function vu-function pointer none))
|
||||
(define-extern generic-initialize-without-sink (function matrix vu-lights none))
|
||||
(define-extern generic-initialize function)
|
||||
(define-extern generic-wrapup function)
|
||||
(define-extern generic-initialize (function generic-dma-foreground-sink matrix vu-lights none))
|
||||
(define-extern generic-wrapup (function generic-dma-foreground-sink none))
|
||||
(define-extern generic-dma-from-spr function)
|
||||
(define-extern generic-light-proc function)
|
||||
(define-extern generic-envmap-proc function)
|
||||
@ -16967,11 +16967,11 @@
|
||||
;; - Functions
|
||||
|
||||
(define-extern generic-tie-dma-to-spad function)
|
||||
(define-extern generic-tie-dma-to-spad-sync function)
|
||||
(define-extern generic-tie-dma-to-spad-sync (function object object none))
|
||||
(define-extern generic-tie-decompress function)
|
||||
(define-extern generic-tie-upload-next function)
|
||||
(define-extern generic-tie-convert-proc function)
|
||||
(define-extern generic-tie-convert function)
|
||||
(define-extern generic-tie-convert (function none))
|
||||
(define-extern generic-tie-display-stats function)
|
||||
(define-extern generic-tie-debug function)
|
||||
(define-extern generic-tie-execute (function generic-dma-foreground-sink dma-buffer basic none))
|
||||
@ -17416,7 +17416,7 @@
|
||||
(define-extern tie-debug-between (function uint uint uint))
|
||||
(define-extern tie-debug-one (function uint uint uint))
|
||||
(define-extern walk-tie-generic-prototypes (function none))
|
||||
(define-extern draw-inline-array-instance-tie (function pointer drawable int dma-buffer none))
|
||||
(define-extern draw-inline-array-instance-tie (function pointer (inline-array instance-tie) int dma-buffer none))
|
||||
(define-extern draw-inline-array-prototype-tie-generic-asm (function dma-buffer int prototype-array-tie none))
|
||||
(define-extern draw-inline-array-prototype-tie-asm (function dma-buffer int prototype-array-tie none))
|
||||
(define-extern draw-inline-array-prototype-tie-near-asm (function dma-buffer int prototype-array-tie none))
|
||||
|
@ -141,11 +141,8 @@
|
||||
"generic-envmap-only-proc",
|
||||
"generic-no-light",
|
||||
"generic-no-light+envmap",
|
||||
"generic-no-light-dproc",
|
||||
"generic-no-light-dproc-only",
|
||||
"generic-no-light-proc",
|
||||
"generic-interp-dproc",
|
||||
"generic-envmap-dproc",
|
||||
"generic-prepare-dma-single",
|
||||
"generic-prepare-dma-double",
|
||||
"generic-envmap-proc",
|
||||
@ -163,11 +160,9 @@
|
||||
"generic-merc-init-asm",
|
||||
|
||||
// generic-tie
|
||||
"generic-tie-convert",
|
||||
"generic-tie-convert-proc",
|
||||
"generic-tie-upload-next",
|
||||
"generic-tie-decompress",
|
||||
"generic-tie-dma-to-spad-sync",
|
||||
|
||||
// shadow-cpu
|
||||
"shadow-add-double-edges",
|
||||
@ -200,8 +195,6 @@
|
||||
// tie-methods
|
||||
"draw-inline-array-prototype-tie-near-asm",
|
||||
"draw-inline-array-prototype-tie-asm",
|
||||
"draw-inline-array-prototype-tie-generic-asm",
|
||||
"draw-inline-array-instance-tie",
|
||||
|
||||
// sparticle-launcher
|
||||
"sp-init-fields!",
|
||||
@ -613,7 +606,18 @@
|
||||
"shadow-scissor-top",
|
||||
"shadow-scissor-edges",
|
||||
"shadow-calc-dual-verts",
|
||||
"shadow-xform-verts"
|
||||
"shadow-xform-verts",
|
||||
|
||||
// generic tie
|
||||
"draw-inline-array-instance-tie",
|
||||
"generic-tie-dma-to-spad-sync",
|
||||
"draw-inline-array-prototype-tie-generic-asm",
|
||||
"generic-interp-dproc",
|
||||
"generic-no-light-dproc",
|
||||
"generic-envmap-dproc",
|
||||
"generic-tie-convert"
|
||||
|
||||
|
||||
],
|
||||
|
||||
"mips2c_jump_table_functions": {
|
||||
|
@ -7778,5 +7778,10 @@
|
||||
],
|
||||
|
||||
"(method 12 effect-control)": [["_stack_", 112, "res-tag"]],
|
||||
|
||||
"generic-tie-execute": [
|
||||
[118, "v1", "terrain-context"],
|
||||
[124, "v1", "terrain-context"]
|
||||
],
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
@ -2034,6 +2034,10 @@ void add_vertices_and_static_draw(tfrag3::TieTree& tree,
|
||||
|
||||
// loop over all prototypes
|
||||
for (auto& proto : protos) {
|
||||
if (proto.uses_generic) {
|
||||
// generic ties go through generic
|
||||
continue;
|
||||
}
|
||||
// bool using_wind = true; // hack, for testing
|
||||
bool using_wind = proto.stiffness != 0.f;
|
||||
|
||||
|
@ -46,7 +46,9 @@ set(RUNTIME_SOURCE
|
||||
mips2c/functions/collide_probe.cpp
|
||||
mips2c/functions/draw_string.cpp
|
||||
mips2c/functions/generic_effect.cpp
|
||||
mips2c/functions/generic_effect2.cpp
|
||||
mips2c/functions/generic_merc.cpp
|
||||
mips2c/functions/generic_tie.cpp
|
||||
mips2c/functions/joint.cpp
|
||||
mips2c/functions/merc_blend_shape.cpp
|
||||
mips2c/functions/ocean.cpp
|
||||
@ -59,6 +61,7 @@ set(RUNTIME_SOURCE
|
||||
mips2c/functions/test_func.cpp
|
||||
mips2c/functions/texture.cpp
|
||||
mips2c/functions/tfrag.cpp
|
||||
mips2c/functions/tie_methods.cpp
|
||||
mips2c/functions/time_of_day.cpp
|
||||
overlord/dma.cpp
|
||||
overlord/fake_iso.cpp
|
||||
@ -128,19 +131,19 @@ set(RUNTIME_SOURCE
|
||||
find_package(Git)
|
||||
|
||||
function(write_svnrev_h)
|
||||
set(GIT_SHORT_SHA "")
|
||||
if (GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_SHORT_SHA
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
set(GIT_SHORT_SHA "")
|
||||
if (GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_SHORT_SHA
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else()
|
||||
set(GIT_SHORT_SHA "unk. rev.")
|
||||
endif()
|
||||
if(NOT GIT_SHORT_SHA)
|
||||
set(GIT_SHORT_SHA "unk. rev.")
|
||||
set(GIT_SHORT_SHA "unk. rev.")
|
||||
endif()
|
||||
if(NOT GIT_SHORT_SHA)
|
||||
set(GIT_SHORT_SHA "unk. rev.")
|
||||
else()
|
||||
string(SUBSTRING ${GIT_SHORT_SHA} 0 6 GIT_SHORT_SHA)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/kernel/svnrev.h "#define GIT_SHORT_SHA \"rev. ${GIT_SHORT_SHA}\"\n")
|
||||
endfunction()
|
||||
|
@ -528,6 +528,14 @@ struct alignas(16) Accumulator {
|
||||
}
|
||||
}
|
||||
|
||||
void msuba(Mask mask, const Vf& a, float b) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((u64)mask & (1 << i)) {
|
||||
data[i] -= a[i] * b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u16 madd_flag(Mask mask, Vf& dest, const Vf& a, float b) {
|
||||
u16 result = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -108,16 +108,25 @@ void Generic2::determine_draw_modes() {
|
||||
|
||||
u64 bonus_adgif_data[4];
|
||||
memcpy(bonus_adgif_data, frag.header + (5 * 16), 4 * sizeof(u64));
|
||||
// ADGIF 5
|
||||
ASSERT((u8)bonus_adgif_data[1] == (u8)(GsRegisterAddress::TEST_1));
|
||||
u64 final_test = bonus_adgif_data[0];
|
||||
|
||||
// ADGIF 6
|
||||
if ((u8)bonus_adgif_data[3] == (u8)(GsRegisterAddress::ALPHA_1)) {
|
||||
final_alpha = bonus_adgif_data[2];
|
||||
} else {
|
||||
u64 final_test;
|
||||
if ((u8)bonus_adgif_data[1] == (u8)(GsRegisterAddress::ALPHA_1)) {
|
||||
ASSERT((u8)bonus_adgif_data[1] == (u8)(GsRegisterAddress::ALPHA_1));
|
||||
final_alpha = bonus_adgif_data[0];
|
||||
ASSERT((u8)bonus_adgif_data[3] == (u8)(GsRegisterAddress::TEST_1));
|
||||
final_test = bonus_adgif_data[2];
|
||||
} else {
|
||||
// ADGIF 5
|
||||
ASSERT((u8)bonus_adgif_data[1] == (u8)(GsRegisterAddress::TEST_1));
|
||||
final_test = bonus_adgif_data[0];
|
||||
|
||||
// ADGIF 6
|
||||
if ((u8)bonus_adgif_data[3] == (u8)(GsRegisterAddress::ALPHA_1)) {
|
||||
final_alpha = bonus_adgif_data[2];
|
||||
} else {
|
||||
ASSERT((u8)bonus_adgif_data[3] == (u8)(GsRegisterAddress::TEST_1));
|
||||
final_test = bonus_adgif_data[2];
|
||||
}
|
||||
}
|
||||
|
||||
if (final_alpha) {
|
||||
|
@ -58,7 +58,7 @@ void main() {
|
||||
|
||||
// color
|
||||
if (mode == 0) {
|
||||
fragment_color = vec4(0.4, 0.5, 0.5, 1);
|
||||
fragment_color = vec4((normal_in + 1)*.5, 1);
|
||||
fragment_color.xyz *= (pow(cam_dot, 3) + 0.3);
|
||||
} else {
|
||||
fragment_color = vec4(0.0, 0.3, 0.3, 1);
|
||||
|
@ -368,8 +368,9 @@ void load_and_link_dgo_from_c(const char* name,
|
||||
|
||||
char objName[64];
|
||||
strcpy(objName, (dgoObj + 4).cast<char>().c()); // name from dgo object header
|
||||
lg::debug("[link and exec] {:18s} {} {:6d} heap-use {:8d} {:8d}", objName, lastObjectLoaded,
|
||||
objSize, kheapused(kglobalheap), kdebugheap.offset ? kheapused(kdebugheap) : 0);
|
||||
lg::debug("[link and exec] {:18s} {} {:6d} heap-use {:8d} {:8d}: 0x{:x}", objName,
|
||||
lastObjectLoaded, objSize, kheapused(kglobalheap),
|
||||
kdebugheap.offset ? kheapused(kdebugheap) : 0, kglobalheap->current.offset);
|
||||
link_and_exec(obj, objName, objSize, heap, linkFlag, jump_from_c_to_goal); // link now!
|
||||
|
||||
// inform IOP we are done
|
||||
|
1016
game/mips2c/functions/generic_effect2.cpp
Normal file
1016
game/mips2c/functions/generic_effect2.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2201
game/mips2c/functions/generic_tie.cpp
Normal file
2201
game/mips2c/functions/generic_tie.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1963
game/mips2c/functions/tie_methods.cpp
Normal file
1963
game/mips2c/functions/tie_methods.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -475,6 +475,15 @@ struct ExecutionContext {
|
||||
}
|
||||
}
|
||||
|
||||
void ppacw(int rd, int rs, int rt) {
|
||||
auto s = gpr_src(rs);
|
||||
auto t = gpr_src(rt);
|
||||
gprs[rd].du32[0] = t.du32[0];
|
||||
gprs[rd].du32[1] = t.du32[2];
|
||||
gprs[rd].du32[2] = s.du32[0];
|
||||
gprs[rd].du32[3] = s.du32[2];
|
||||
}
|
||||
|
||||
void ppach(int rd, int rs, int rt) {
|
||||
auto s = gpr_src(rs);
|
||||
auto t = gpr_src(rt);
|
||||
@ -713,6 +722,20 @@ struct ExecutionContext {
|
||||
gprs[dest].du16[7] = hi.du16[6];
|
||||
}
|
||||
|
||||
void pmfhl_uw(int dest) {
|
||||
gprs[dest].du32[0] = lo.du32[1];
|
||||
gprs[dest].du32[1] = hi.du32[1];
|
||||
gprs[dest].du32[2] = lo.du32[3];
|
||||
gprs[dest].du32[3] = hi.du32[3];
|
||||
}
|
||||
|
||||
void pmfhl_lw(int dest) {
|
||||
gprs[dest].du32[0] = lo.du32[0];
|
||||
gprs[dest].du32[1] = hi.du32[0];
|
||||
gprs[dest].du32[2] = lo.du32[2];
|
||||
gprs[dest].du32[3] = hi.du32[2];
|
||||
}
|
||||
|
||||
void vsub_bc(DEST mask, BC bc, int dest, int src0, int src1) {
|
||||
auto s0 = vf_src(src0);
|
||||
auto s1 = vf_src(src1);
|
||||
@ -801,6 +824,17 @@ struct ExecutionContext {
|
||||
}
|
||||
}
|
||||
|
||||
void vmula(DEST mask, int src0, int src1) {
|
||||
auto s0 = vf_src(src0);
|
||||
auto s1 = vf_src(src1);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((u64)mask & (1 << i)) {
|
||||
acc.f[i] = s0.f[i] * s1.f[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vadda_bc(DEST mask, BC bc, int src0, int src1) {
|
||||
auto s0 = vf_src(src0);
|
||||
auto s1 = vf_src(src1);
|
||||
@ -878,6 +912,27 @@ struct ExecutionContext {
|
||||
}
|
||||
}
|
||||
|
||||
void vmsub(DEST mask, int dst, int src0, int src1) {
|
||||
auto s0 = vf_src(src0);
|
||||
auto s1 = vf_src(src1);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((u64)mask & (1 << i)) {
|
||||
vfs[dst].f[i] = acc.f[i] - s0.f[i] * s1.f[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vmsubq(DEST mask, int dst, int src0) {
|
||||
auto s0 = vf_src(src0);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((u64)mask & (1 << i)) {
|
||||
vfs[dst].f[i] = acc.f[i] - s0.f[i] * Q;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vdiv(int src0, BC bc0, int src1, BC bc1) {
|
||||
Q = vf_src(src0).f[(int)bc0] / vf_src(src1).f[(int)bc1];
|
||||
}
|
||||
|
@ -320,6 +320,29 @@ extern void link();
|
||||
namespace shadow_xform_verts {
|
||||
extern void link();
|
||||
}
|
||||
namespace draw_inline_array_instance_tie {
|
||||
extern void link();
|
||||
}
|
||||
namespace draw_inline_array_prototype_tie_generic_asm {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace generic_tie_dma_to_spad_sync {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_envmap_dproc {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_interp_dproc {
|
||||
extern void link();
|
||||
}
|
||||
namespace generic_no_light_dproc {
|
||||
extern void link();
|
||||
}
|
||||
|
||||
namespace generic_tie_convert {
|
||||
extern void link();
|
||||
}
|
||||
LinkedFunctionTable gLinkedFunctionTable;
|
||||
Rng gRng;
|
||||
std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks = {
|
||||
@ -361,7 +384,8 @@ std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks =
|
||||
high_speed_reject::link}},
|
||||
{"generic-effect",
|
||||
{generic_prepare_dma_double::link, generic_light_proc::link, generic_envmap_proc::link,
|
||||
generic_prepare_dma_single::link}},
|
||||
generic_prepare_dma_single::link, generic_envmap_dproc::link, generic_interp_dproc::link,
|
||||
generic_no_light_dproc::link}},
|
||||
{"ripple",
|
||||
{ripple_execute_init::link, ripple_create_wave_table::link, ripple_apply_wave_table::link,
|
||||
ripple_matrix_scale::link}},
|
||||
@ -373,7 +397,10 @@ std::unordered_map<std::string, std::vector<void (*)()>> gMips2CLinkCallbacks =
|
||||
shadow_find_double_edges::link, shadow_find_facing_double_tris::link,
|
||||
shadow_find_single_edges::link, shadow_find_facing_single_tris::link, shadow_init_vars::link,
|
||||
shadow_scissor_top::link, shadow_scissor_edges::link, shadow_calc_dual_verts::link,
|
||||
shadow_xform_verts::link}}};
|
||||
shadow_xform_verts::link}},
|
||||
{"tie-methods",
|
||||
{draw_inline_array_instance_tie::link, draw_inline_array_prototype_tie_generic_asm::link}},
|
||||
{"generic-tie", {generic_tie_dma_to_spad_sync::link, generic_tie_convert::link}}};
|
||||
|
||||
void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) {
|
||||
const auto& it = m_executes.insert({name, {exec, Ptr<u8>()}});
|
||||
|
@ -507,7 +507,7 @@
|
||||
(new 'static 'rgba :r #x80 :g #x20 :b #x60 :a #x80)
|
||||
)
|
||||
)
|
||||
#|
|
||||
|
||||
;; TIE Generic
|
||||
(dotimes (gp-2 (-> *background-work* tie-tree-count))
|
||||
(when (nonzero? (-> *background-work* tie-generic gp-2))
|
||||
@ -533,7 +533,6 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|#
|
||||
)
|
||||
|
||||
)
|
||||
|
@ -104,6 +104,14 @@
|
||||
)
|
||||
|
||||
(defun upload-vu0-program ((func vu-function) (wait-ptr pointer))
|
||||
"Upload and block until done.
|
||||
Generating the DMA is highly optimized."
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun generic-upload-vu0 ()
|
||||
"Start upload, but don't sync yet.
|
||||
Generating the DMA chain is not as optimized."
|
||||
(none)
|
||||
)
|
||||
|
||||
@ -137,11 +145,35 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun generic-initialize ((arg0 generic-dma-foreground-sink) (arg1 matrix) (arg2 vu-lights))
|
||||
(generic-work-init arg0)
|
||||
(generic-upload-vu0)
|
||||
;;(let ((a2-1 (+ #x2e20 (the-as int #x70000000)))
|
||||
(let ((a2-1 (-> (scratchpad-object terrain-context) work foreground generic-work fx-buf work consts matrix))
|
||||
(v1-1 (-> arg1 vector 0 quad))
|
||||
(a0-2 (-> arg1 vector 1 quad))
|
||||
(a1-1 (-> arg1 vector 2 quad))
|
||||
(a3-0 (-> arg1 vector 3 quad))
|
||||
)
|
||||
(set! (-> a2-1 vector 0 quad) v1-1)
|
||||
(set! (-> a2-1 vector 1 quad) a0-2)
|
||||
(set! (-> a2-1 vector 2 quad) a1-1)
|
||||
(set! (-> a2-1 vector 3 quad) a3-0)
|
||||
)
|
||||
(if arg2
|
||||
(quad-copy! (the-as pointer (-> (scratchpad-object terrain-context) work foreground generic-work fx-buf work lights)) (the-as pointer arg2) 7)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun generic-wrapup ((arg0 generic-dma-foreground-sink))
|
||||
(set! (-> arg0 state gifbuf-adr) (-> (scratchpad-object terrain-context) work foreground generic-work saves gifbuf-adr))
|
||||
(set! (-> arg0 state inbuf-adr) (-> (scratchpad-object terrain-context) work foreground generic-work saves inbuf-adr))
|
||||
(none)
|
||||
)
|
||||
|
||||
(def-mips2c generic-prepare-dma-single function)
|
||||
|
||||
|
||||
(def-mips2c generic-prepare-dma-double function)
|
||||
|
||||
(def-mips2c generic-light-proc function)
|
||||
|
||||
(def-mips2c generic-envmap-proc function)
|
@ -166,7 +166,7 @@
|
||||
(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)
|
||||
(time-of-day-color rgba :offset-assert 80)
|
||||
(to-vu0-waits uint32 :offset-assert 84)
|
||||
(to-spr-waits uint32 :offset-assert 88)
|
||||
(from-spr-waits uint32 :offset-assert 92)
|
||||
|
@ -5,3 +5,109 @@
|
||||
;; name in dgo: generic-tie
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(define *generic-tie* #t)
|
||||
|
||||
(def-mips2c generic-tie-dma-to-spad-sync (function object object none))
|
||||
(def-mips2c generic-envmap-dproc function)
|
||||
(def-mips2c generic-interp-dproc function)
|
||||
(def-mips2c generic-no-light-dproc function)
|
||||
(def-mips2c generic-tie-convert (function none))
|
||||
|
||||
|
||||
(defun generic-tie-execute ((arg0 generic-dma-foreground-sink) (arg1 dma-buffer) (arg2 basic))
|
||||
;; (local-vars (v1-28 uint128) (v1-29 uint128) (v1-30 uint128) (a0-33 int) (a0-35 int))
|
||||
;; (rlet ((vf1 :class vf))
|
||||
(when (logtest? *vu1-enable-user* (vu1-renderer-mask generic))
|
||||
(when *generic-tie*
|
||||
(if *debug-segment*
|
||||
(add-frame
|
||||
(-> *display* frames (-> *display* on-screen) frame profile-bar 0)
|
||||
'draw
|
||||
(new 'static 'rgba :r #x40 :b #x40 :a #x80)
|
||||
)
|
||||
)
|
||||
(reset! (-> *perf-stats* data 2))
|
||||
|
||||
(when (nonzero? arg2)
|
||||
(let ((s4-0 (-> arg1 base)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves basep) (the-as uint (-> arg1 base)))
|
||||
(generic-initialize arg0 (-> *math-camera* perspective) *default-lights*)
|
||||
(generic-tie-dma-to-spad-sync arg2 (-> (scratchpad-object terrain-context) work foreground generic-work in-buf tie input-a))
|
||||
; (let ((v1-24 (+ 716 (the-as int #x70000000))))
|
||||
|
||||
;; set up tie memory layout.
|
||||
(let ((v1-24 (-> (scratchpad-object terrain-context) work foreground generic-work in-buf tie shadow)))
|
||||
(set! (-> v1-24 end-of-chain) (the-as uint 0))
|
||||
(set! (-> v1-24 tie-type) 0)
|
||||
(set! (-> v1-24 out-buf) *gsf-buffer*)
|
||||
(set! (-> v1-24 ptr-buf) (the-as uint (+ 768 (scratchpad-object int))))
|
||||
(set! (-> v1-24 ptr-inst) (the-as uint (+ 3648 (scratchpad-object int))))
|
||||
(set! (-> v1-24 inst-xor) 4640)
|
||||
(set! (-> v1-24 write-limit) (the-as uint (&+ (-> arg1 end) -65536)))
|
||||
)
|
||||
;;(let ((v1-26 (+ 748 (the-as int #x70000000))))
|
||||
(let ((v1-26 (-> (scratchpad-object terrain-context) work foreground generic-work in-buf tie shadow calls)))
|
||||
(set! (-> v1-26 generic-prepare-dma-double) generic-prepare-dma-double)
|
||||
(set! (-> v1-26 generic-envmap-dproc) generic-envmap-dproc) ;; todo
|
||||
(set! (-> v1-26 generic-interp-dproc) generic-interp-dproc) ;; todo
|
||||
(set! (-> v1-26 generic-no-light-dproc) generic-no-light-dproc) ;; todo
|
||||
)
|
||||
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color r)
|
||||
(the int (-> *time-of-day-context* current-sun env-color x)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color g)
|
||||
(the int (-> *time-of-day-context* current-sun env-color y)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color b)
|
||||
(the int (-> *time-of-day-context* current-sun env-color z)))
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work saves time-of-day-color a)
|
||||
(the int (-> *time-of-day-context* current-sun env-color w)))
|
||||
|
||||
; (let ((v1-27 *time-of-day-context*))
|
||||
; (let ((a0-26 (+ 16 (the-as int #x70000000))))
|
||||
; (.lvf vf1 (&-> v1-27 current-sun env-color quad))
|
||||
; (.ftoi.vf vf1 vf1)
|
||||
; (.mov v1-28 vf1)
|
||||
; (.ppach v1-29 (the-as uint128 0) v1-28)
|
||||
; (.ppacb v1-30 r0 (the-as int v1-29))
|
||||
; (set! (-> a0-26 foreground generic-work saves time-of-day-color) (the-as uint v1-30))
|
||||
; )
|
||||
; )
|
||||
(generic-tie-convert)
|
||||
(set! (-> arg1 base)
|
||||
(the-as pointer (-> (scratchpad-object terrain-context) work foreground generic-work saves basep))
|
||||
)
|
||||
(generic-wrapup arg0)
|
||||
(set! (-> (scratchpad-object terrain-context) work foreground generic-work fx-buf work consts mscal-tag)
|
||||
(logior (logand (-> (scratchpad-object terrain-context) work foreground generic-work fx-buf work consts mscal-tag)
|
||||
-65536
|
||||
)
|
||||
6
|
||||
)
|
||||
)
|
||||
; (dma-sync (the-as pointer #x1000d000) 0 0)
|
||||
(let ((v1-37 *dma-mem-usage*))
|
||||
(when (nonzero? v1-37)
|
||||
(set! (-> v1-37 length) (max 18 (-> v1-37 length)))
|
||||
(set! (-> v1-37 data 17 name) "tie-generic")
|
||||
(+! (-> v1-37 data 17 count) 1)
|
||||
(+! (-> v1-37 data 17 used) (&- (-> arg1 base) (the-as uint s4-0)))
|
||||
(set! (-> v1-37 data 17 total) (-> v1-37 data 17 used))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(read! (-> *perf-stats* data 2))
|
||||
(if *debug-segment*
|
||||
(add-frame
|
||||
(-> *display* frames (-> *display* on-screen) frame profile-bar 0)
|
||||
'draw
|
||||
(new 'static 'rgba :r #xd2 :g #xd2 :b #x50 :a #x80)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
0
|
||||
(none)
|
||||
;)
|
||||
)
|
@ -5,6 +5,9 @@
|
||||
;; name in dgo: tie-methods
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(def-mips2c draw-inline-array-instance-tie (function pointer (inline-array instance-tie) int dma-buffer none))
|
||||
(def-mips2c draw-inline-array-prototype-tie-generic-asm (function dma-buffer int prototype-array-tie none))
|
||||
|
||||
(defun tie-init-buffers ((arg0 dma-buffer))
|
||||
"Initialize the TIE buckets.
|
||||
Note: the buffer passed in here is _not_ used.
|
||||
@ -296,7 +299,11 @@
|
||||
;;
|
||||
(let ((s4-0 (+ (-> arg0 length) -1))) ;; number of arrays of draw-nodes (depth of the BVH tree, not counting instance leaves)
|
||||
|
||||
;; perform draw node culling. TODO
|
||||
;; perform draw node culling.
|
||||
;; Note: It's okay to skip this. The visible list right now will just be the occlusion string
|
||||
;; The PC renderer won't see this (and has its own version of culling that's plenty fast)
|
||||
;; The instance drawing will end up looking at too many instances, but this is fine - it
|
||||
;; should reject those, and it plenty fast.
|
||||
#|
|
||||
(when (nonzero? s4-0)
|
||||
(dotimes (s3-0 s4-0)
|
||||
@ -363,7 +370,10 @@
|
||||
(reset! (-> *perf-stats* data 9))
|
||||
|
||||
;; DRAW!
|
||||
;;(draw-inline-array-instance-tie s0-0 s1-0 sv-16 s3-1)
|
||||
;; note: this is a bit wasteful because we only care about generic ties.
|
||||
;; non-generics are drawn fully in C++, but we're computing unused stuff here.
|
||||
;; This ends up being so fast it's probably not worth worrying about yet.
|
||||
(with-profiler "tie-instance" (draw-inline-array-instance-tie s0-0 s1-0 sv-16 s3-1))
|
||||
;; finish perf stats
|
||||
(read! (-> *perf-stats* data 9))
|
||||
(update-wait-stats (-> *perf-stats* data 9) (the-as uint 0)
|
||||
@ -398,8 +408,10 @@
|
||||
(set! (-> *prototype-tie-work* generic-wait-from-spr) (the-as uint 0))
|
||||
(set! (-> *instance-tie-work* first-generic-prototype) (the-as uint (-> s3-1 base)))
|
||||
|
||||
;; hack, I expect this to overwrite this.
|
||||
(set! (-> (the (pointer uint64) (-> s3-1 base))) #xdeadbeefdeadbeef)
|
||||
(reset! (-> *perf-stats* data 10))
|
||||
;;(draw-inline-array-prototype-tie-generic-asm s3-1 s5-1 s4-1)
|
||||
(with-profiler "tie-generic-protos" (draw-inline-array-prototype-tie-generic-asm s3-1 s5-1 s4-1))
|
||||
(read! (-> *perf-stats* data 10))
|
||||
(update-wait-stats (-> *perf-stats* data 10) (the-as uint 0)
|
||||
(-> *prototype-tie-work* generic-wait-to-spr)
|
||||
|
@ -755,6 +755,16 @@
|
||||
(when (< current-login-pos (-> s1-2 length))
|
||||
(set! sv-16 (-> s1-2 array-data (the-as uint current-login-pos)))
|
||||
(set! sv-32 0)
|
||||
(when (!= (-> sv-16 envmap-fade-far) 0.0)
|
||||
(format 0 "proto: ~A: ~f ~f~%" (-> sv-16 name) (-> sv-16 envmap-rfade) (-> sv-16 envmap-fade-far))
|
||||
(format 0 " d: ~`vector`P~%" (-> sv-16 dists))
|
||||
(format 0 " d: ~`vector`P~%" (-> sv-16 rdists))
|
||||
;(set! (-> sv-16 dists x) 1.)
|
||||
;(set! (-> sv-16 dists y) 100000000.)
|
||||
(*! (-> sv-16 envmap-fade-far) 10000.)
|
||||
|
||||
)
|
||||
|
||||
(while (< sv-32 4)
|
||||
(let ((a0-28 (-> sv-16 geometry sv-32)))
|
||||
;;(load-dbg " login geom: ~A~%" a0-28)
|
||||
|
@ -121,9 +121,9 @@
|
||||
(PC_PORT
|
||||
|
||||
;; make sure the scratchpad is 16kb aligned, and make it 32 kB so we can big stacks on it.
|
||||
(let* ((mem (new 'global 'array 'uint8 (* (+ 16 32) 1024)))
|
||||
(let* ((mem (new 'global 'array 'uint8 (* 128 1024)))
|
||||
)
|
||||
(define *fake-scratchpad-data* (the pointer (align-n mem (* 16 1024))))
|
||||
(define *fake-scratchpad-data* (the pointer (align-n mem (* 64 1024))))
|
||||
)
|
||||
|
||||
;; We will move stacks on the scratchpad to here.
|
||||
|
2
test/decompiler/reference/engine/gfx/generic/generic-h_REF.gc
generated
vendored
2
test/decompiler/reference/engine/gfx/generic/generic-h_REF.gc
generated
vendored
@ -281,7 +281,7 @@
|
||||
(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)
|
||||
(time-of-day-color rgba :offset-assert 80)
|
||||
(to-vu0-waits uint32 :offset-assert 84)
|
||||
(to-spr-waits uint32 :offset-assert 88)
|
||||
(from-spr-waits uint32 :offset-assert 92)
|
||||
|
2
test/decompiler/reference/engine/gfx/tie/tie-methods_REF.gc
generated
vendored
2
test/decompiler/reference/engine/gfx/tie/tie-methods_REF.gc
generated
vendored
@ -391,7 +391,7 @@
|
||||
(let ((t9-2 draw-inline-array-instance-tie)
|
||||
(a3-1 s3-1)
|
||||
)
|
||||
(t9-2 s0-0 (the-as drawable s1-0) sv-16 a3-1)
|
||||
(t9-2 s0-0 s1-0 sv-16 a3-1)
|
||||
)
|
||||
(let ((v1-35 (-> *perf-stats* data 9)))
|
||||
(b! (zero? (-> v1-35 ctrl)) cfg-14 :delay (nop!))
|
||||
|
Loading…
Reference in New Issue
Block a user