mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 14:13:45 -04:00
[graphics] ocean near (#1234)
* dma for ocean near * add first attempt at ocean near
This commit is contained in:
@@ -221,6 +221,7 @@ VuDisassembler::VuDisassembler(VuKind kind) : m_kind(kind) {
|
||||
add_op(VuInstrK::SQRT, "sqrt").fsf_zero().ftf_0().vis_zero().dst_q().src_vft();
|
||||
add_op(VuInstrK::SQD, "sqd").dst_mask().src_vfs().src_vit();
|
||||
add_op(VuInstrK::ERLENG, "erleng").dst_mask().vft_zero().src_vfs().dst_p();
|
||||
add_op(VuInstrK::ELENG, "eleng").dst_mask().vft_zero().src_vfs().dst_p();
|
||||
add_op(VuInstrK::MFP, "mfp").dst_mask().dst_vft().src_p();
|
||||
}
|
||||
|
||||
@@ -289,6 +290,8 @@ VuInstrK VuDisassembler::lower_kind(u32 in) {
|
||||
return VuInstrK::XTOP;
|
||||
case 0b11011'1111'00:
|
||||
return VuInstrK::XGKICK;
|
||||
case 0b11100'1111'10:
|
||||
return VuInstrK::ELENG;
|
||||
case 0b11100'1111'11:
|
||||
return VuInstrK::ERLENG;
|
||||
case 0b11110'1111'11:
|
||||
@@ -830,7 +833,6 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma
|
||||
vi_src(instr.src.at(1).to_string(m_label_names), mips2c_format));
|
||||
case VuInstrK::IOR:
|
||||
if (instr.src.at(1).is_int_reg(0)) {
|
||||
fmt::print("instr: {}\n", to_string(instr));
|
||||
if (instr.src.at(0).is_int_reg(0) && instr.src.at(1).is_int_reg(0)) {
|
||||
return fmt::format("vu.{} = 0;", instr.dst->to_string(m_label_names));
|
||||
} else {
|
||||
@@ -873,6 +875,8 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma
|
||||
|
||||
case VuInstrK::ERLENG:
|
||||
return fmt::format("vu.P = erleng(vu.{});", instr.src.at(0).to_string(m_label_names));
|
||||
case VuInstrK::ELENG:
|
||||
return fmt::format("vu.P = eleng(vu.{});", instr.src.at(0).to_string(m_label_names));
|
||||
case VuInstrK::RSQRT:
|
||||
return fmt::format(
|
||||
"c->Q = c->vf_src({}).vf.{}() / std::sqrt(c->vf_src({}).vf.{}());",
|
||||
@@ -976,6 +980,14 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma
|
||||
mask_to_string(*instr.mask), instr.dst->to_string(m_label_names),
|
||||
instr.src.at(0).to_string(m_label_names), instr.src.at(1).to_string(m_label_names),
|
||||
bc_to_part(*instr.bc));
|
||||
case VuInstrK::MSUBbc:
|
||||
return fmt::format(
|
||||
mips2c_format
|
||||
? "c->acc.vf.msub(Mask::{}, c->vfs[{}].vf, c->vf_src({}).vf, c->vf_src({}).vf.{}());"
|
||||
: "vu.acc.msub(Mask::{}, vu.{}, vu.{}, vu.{}.{}());",
|
||||
mask_to_string(*instr.mask), instr.dst->to_string(m_label_names),
|
||||
instr.src.at(0).to_string(m_label_names), instr.src.at(1).to_string(m_label_names),
|
||||
bc_to_part(*instr.bc));
|
||||
case VuInstrK::MULA:
|
||||
return fmt::format("vu.acc.mula(Mask::{}, vu.{}, vu.{});", mask_to_string(*instr.mask),
|
||||
instr.src.at(0).to_string(m_label_names),
|
||||
|
||||
@@ -127,7 +127,7 @@ enum class VuInstrK {
|
||||
WAITP,
|
||||
// ESADD,
|
||||
// ERSADD,
|
||||
// ELENG,
|
||||
ELENG,
|
||||
ERLENG,
|
||||
// EATANxy,
|
||||
// EATANxz,
|
||||
|
||||
@@ -7307,23 +7307,23 @@
|
||||
(constants2 vector :inline :offset-assert 80)
|
||||
(constants3 vector :inline :offset-assert 96)
|
||||
(constants4 vector :inline :offset-assert 112)
|
||||
(drw-fan qword :inline :offset-assert 128)
|
||||
(drw2-fan qword :inline :offset-assert 144)
|
||||
(env-fan qword :inline :offset-assert 160)
|
||||
(drw-adgif qword :inline :offset-assert 176)
|
||||
(drw-fan gs-gif-tag :inline :offset-assert 128) ;; was qword
|
||||
(drw2-fan gs-gif-tag :inline :offset-assert 144) ;; was qword
|
||||
(env-fan gs-gif-tag :inline :offset-assert 160) ;; was qword
|
||||
(drw-adgif gs-gif-tag :inline :offset-assert 176) ;; was qword
|
||||
(drw-texture adgif-shader :inline :offset-assert 192)
|
||||
(drw-strip qword :inline :offset-assert 272)
|
||||
(env-adgif qword :inline :offset-assert 288)
|
||||
(env-texture adgif-shader :inline :offset-assert 304)
|
||||
(env-strip qword :inline :offset-assert 384)
|
||||
(drw-strip gs-gif-tag :inline :offset-assert 272) ;; was qword
|
||||
(env-adgif gs-gif-tag :inline :offset-assert 288) ;; was qword
|
||||
(env-texture adgif-shader :inline :offset-assert 304) ;; was qword
|
||||
(env-strip gs-gif-tag :inline :offset-assert 384)
|
||||
(env-color vector :inline :offset-assert 400)
|
||||
(drw2-adgif qword :inline :offset-assert 416)
|
||||
(drw2-adgif gs-gif-tag :inline :offset-assert 416)
|
||||
(drw2-tex0 qword :inline :offset-assert 432)
|
||||
(drw2-frame qword :inline :offset-assert 448)
|
||||
(drw2-strip qword :inline :offset-assert 464)
|
||||
(drw3-adgif qword :inline :offset-assert 480)
|
||||
(drw2-strip gs-gif-tag :inline :offset-assert 464)
|
||||
(drw3-adgif gs-gif-tag :inline :offset-assert 480)
|
||||
(drw3-frame qword :inline :offset-assert 496)
|
||||
(index-table uint128 4 :offset-assert 512)
|
||||
(index-table vector4w 4 :inline :offset-assert 512)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x240
|
||||
@@ -21708,7 +21708,7 @@
|
||||
(define-extern draw-ocean-far (function dma-buffer profile-frame))
|
||||
(define-extern draw-ocean-mid (function dma-buffer none)) ; not confirmed
|
||||
(define-extern ocean-end-buffer (function dma-buffer pointer))
|
||||
(define-extern draw-ocean-near (function dma-buffer none)) ; not confirmed
|
||||
(define-extern draw-ocean-near (function dma-buffer none))
|
||||
(define-extern init-ocean-far-regs (function none))
|
||||
(define-extern render-ocean-far (function dma-buffer int none))
|
||||
(define-extern render-ocean-quad (function (inline-array ocean-vertex) dma-buffer symbol))
|
||||
@@ -21822,11 +21822,11 @@
|
||||
;; - Functions
|
||||
|
||||
(define-extern ocean-near-add-constants (function dma-buffer none))
|
||||
(define-extern ocean-near-add-heights (function dma-buffer ocean-wave-info))
|
||||
(define-extern ocean-near-add-heights (function dma-buffer none))
|
||||
(define-extern ocean-near-add-call (function dma-buffer int none))
|
||||
(define-extern ocean-near-add-upload (function dma-buffer uint uint ocean-near-upload))
|
||||
(define-extern ocean-near-add-matrices (function dma-buffer matrix none))
|
||||
(define-extern ocean-near-setup-constants (function (inline-array vector) vector))
|
||||
(define-extern ocean-near-add-upload (function dma-buffer uint uint none))
|
||||
(define-extern ocean-near-add-matrices (function dma-buffer vector none))
|
||||
(define-extern ocean-near-setup-constants (function ocean-near-constants none))
|
||||
(define-extern ocean-near-add-call-flush (function dma-buffer int none))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
@@ -5470,7 +5470,7 @@
|
||||
[48, "eye"]
|
||||
],
|
||||
|
||||
"ocean-near-add-matrices": [[16, "matrix"]],
|
||||
"ocean-near-add-matrices": [[16, "vector"]],
|
||||
|
||||
"ocean-near-add-upload": [
|
||||
[16, "vector"]
|
||||
|
||||
@@ -7272,11 +7272,12 @@
|
||||
[20, "a0", "vector"],
|
||||
[22, "s4", "matrix"],
|
||||
[23, "s4", "matrix"],
|
||||
[47, "v1", "matrix"]
|
||||
[47, "v1", "matrix"],
|
||||
[[40, 46], "s3", "vector"]
|
||||
],
|
||||
|
||||
"ocean-near-add-constants": [
|
||||
[3, "a0", "dma-packet"]
|
||||
[[8, 16], "a0", "dma-packet"]
|
||||
],
|
||||
|
||||
"draw-ocean-near": [
|
||||
@@ -7600,5 +7601,11 @@
|
||||
[[8, 16], "a0", "dma-packet"]
|
||||
],
|
||||
|
||||
"ocean-near-add-heights" : [
|
||||
[26, "a1", "int"],
|
||||
[[11, 19], "a3", "dma-packet"],
|
||||
[[30, 38], "a2", "dma-packet"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
||||
@@ -87,6 +87,8 @@ set(RUNTIME_SOURCE
|
||||
graphics/opengl_renderer/ocean/OceanMid.cpp
|
||||
graphics/opengl_renderer/ocean/OceanMid_PS2.cpp
|
||||
graphics/opengl_renderer/ocean/OceanMidAndFar.cpp
|
||||
graphics/opengl_renderer/ocean/OceanNear.cpp
|
||||
graphics/opengl_renderer/ocean/OceanNear_PS2.cpp
|
||||
graphics/opengl_renderer/ocean/OceanTexture.cpp
|
||||
graphics/opengl_renderer/ocean/OceanTexture_PC.cpp
|
||||
graphics/opengl_renderer/ocean/OceanTexture_PS2.cpp
|
||||
|
||||
@@ -113,6 +113,7 @@ void DirectRenderer::reset_state() {
|
||||
}
|
||||
|
||||
void DirectRenderer::draw_debug_window() {
|
||||
ImGui::SliderFloat("debug", &m_debug_tune, 0., 1.);
|
||||
ImGui::Checkbox("Wireframe", &m_debug_state.wireframe);
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("No-texture", &m_debug_state.disable_texture);
|
||||
@@ -265,6 +266,9 @@ void DirectRenderer::update_gl_prim(SharedRenderState* render_state) {
|
||||
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].id(),
|
||||
"color_mult"),
|
||||
m_ogl.color_mult);
|
||||
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].id(),
|
||||
"alpha_mult"),
|
||||
m_ogl.alpha_mult);
|
||||
glUniform4f(glGetUniformLocation(render_state->shaders[ShaderId::DIRECT_BASIC_TEXTURED].id(),
|
||||
"fog_color"),
|
||||
render_state->fog_color[0], render_state->fog_color[1], render_state->fog_color[2],
|
||||
@@ -344,12 +348,14 @@ void DirectRenderer::update_gl_texture(SharedRenderState* render_state, int unit
|
||||
void DirectRenderer::update_gl_blend() {
|
||||
const auto& state = m_blend_state;
|
||||
m_ogl.color_mult = 1.f;
|
||||
m_ogl.alpha_mult = 1.f;
|
||||
m_prim_gl_state_needs_gl_update = true;
|
||||
if (!state.alpha_blend_enable) {
|
||||
glDisable(GL_BLEND);
|
||||
} else {
|
||||
glEnable(GL_BLEND);
|
||||
glBlendColor(1, 1, 1, 1);
|
||||
|
||||
if (state.a == GsAlpha::BlendMode::SOURCE && state.b == GsAlpha::BlendMode::DEST &&
|
||||
state.c == GsAlpha::BlendMode::SOURCE && state.d == GsAlpha::BlendMode::DEST) {
|
||||
// (Cs - Cd) * As + Cd
|
||||
@@ -401,6 +407,24 @@ void DirectRenderer::update_gl_blend() {
|
||||
// ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_my_id == BucketId::OCEAN_NEAR) {
|
||||
if (state.a == GsAlpha::BlendMode::SOURCE && state.b == GsAlpha::BlendMode::DEST &&
|
||||
state.c == GsAlpha::BlendMode::SOURCE && state.d == GsAlpha::BlendMode::DEST) {
|
||||
if (m_prim_gl_state.fogging_enable) {
|
||||
// first draw.
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
m_ogl.alpha_mult = .5f;
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
} else {
|
||||
// second draw.
|
||||
m_ogl.alpha_mult = 2.f;
|
||||
glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_ALPHA, GL_ZERO);
|
||||
glBlendEquation(GL_FUNC_ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DirectRenderer::update_gl_test() {
|
||||
@@ -674,6 +698,8 @@ void DirectRenderer::handle_ad(const u8* data,
|
||||
break;
|
||||
case GsRegisterAddress::TEXFLUSH:
|
||||
break;
|
||||
case GsRegisterAddress::FRAME_1:
|
||||
break;
|
||||
default:
|
||||
fmt::print("Address {} is not supported\n", register_address_name(addr));
|
||||
ASSERT(false);
|
||||
|
||||
@@ -153,6 +153,7 @@ class DirectRenderer : public BucketRenderer {
|
||||
|
||||
static constexpr int TEXTURE_STATE_COUNT = 1;
|
||||
|
||||
float m_debug_tune = 1;
|
||||
struct TextureState {
|
||||
GsTex0 current_register;
|
||||
u32 texture_base_ptr = 0;
|
||||
@@ -243,6 +244,7 @@ class DirectRenderer : public BucketRenderer {
|
||||
u32 vertex_buffer_bytes = 0;
|
||||
u32 vertex_buffer_max_verts = 0;
|
||||
float color_mult = 1.0;
|
||||
float alpha_mult = 1.0;
|
||||
} m_ogl;
|
||||
|
||||
struct {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "game/graphics/opengl_renderer/EyeRenderer.h"
|
||||
#include "game/graphics/opengl_renderer/GenericRenderer.h"
|
||||
#include "game/graphics/opengl_renderer/ocean/OceanMidAndFar.h"
|
||||
#include "game/graphics/opengl_renderer/ocean/OceanNear.h"
|
||||
|
||||
// for the vif callback
|
||||
#include "game/kernel/kmachine.h"
|
||||
@@ -233,7 +234,7 @@ void OpenGLRenderer::init_bucket_renderers() {
|
||||
init_bucket_renderer<GenericRenderer>("l1-water-generic", BucketCategory::GENERIC_MERC,
|
||||
BucketId::GENERIC_WATER_LEVEL1); // 62
|
||||
|
||||
// 63?
|
||||
init_bucket_renderer<OceanNear>("ocean-near", BucketCategory::OCEAN, BucketId::OCEAN_NEAR); // 63
|
||||
// 64?
|
||||
|
||||
//-----------------------
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
OceanMidAndFar::OceanMidAndFar(const std::string& name, BucketId my_id)
|
||||
: BucketRenderer(name, my_id), m_direct(name, my_id, 4096) {}
|
||||
: BucketRenderer(name, my_id), m_direct(name, my_id, 4096), m_texture_renderer(true) {}
|
||||
|
||||
void OceanMidAndFar::draw_debug_window() {
|
||||
m_texture_renderer.draw_debug_window();
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
#include "OceanNear.h"
|
||||
|
||||
OceanNear::OceanNear(const std::string& name, BucketId my_id)
|
||||
: BucketRenderer(name, my_id), m_texture_renderer(false), m_direct(name, my_id, 0x4000) {
|
||||
for (auto& a : m_vu_data) {
|
||||
a.fill(0);
|
||||
}
|
||||
}
|
||||
|
||||
void OceanNear::draw_debug_window() {
|
||||
m_direct.draw_debug_window();
|
||||
}
|
||||
|
||||
void OceanNear::init_textures(TexturePool& pool) {
|
||||
m_texture_renderer.init_textures(pool);
|
||||
}
|
||||
|
||||
static bool is_end_tag(const DmaTag& tag, const VifCode& v0, const VifCode& v1) {
|
||||
return tag.qwc == 2 && tag.kind == DmaTag::Kind::CNT && v0.kind == VifCode::Kind::NOP &&
|
||||
v1.kind == VifCode::Kind::DIRECT;
|
||||
}
|
||||
|
||||
void OceanNear::render(DmaFollower& dma,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof) {
|
||||
// skip if disabled
|
||||
if (!m_enabled) {
|
||||
while (dma.current_tag_offset() != render_state->next_bucket) {
|
||||
dma.read_and_advance();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// jump to bucket
|
||||
auto data0 = dma.read_and_advance();
|
||||
ASSERT(data0.vif1() == 0);
|
||||
ASSERT(data0.vif0() == 0);
|
||||
ASSERT(data0.size_bytes == 0);
|
||||
|
||||
// see if bucket is empty or not
|
||||
if (dma.current_tag().kind == DmaTag::Kind::CALL) {
|
||||
// renderer didn't run, let's just get out of here.
|
||||
for (int i = 0; i < 4; i++) {
|
||||
dma.read_and_advance();
|
||||
}
|
||||
ASSERT(dma.current_tag_offset() == render_state->next_bucket);
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
auto p = prof.make_scoped_child("texture");
|
||||
// TODO: this looks the same as the previous ocean renderer to me... why do it again?
|
||||
m_texture_renderer.handle_ocean_texture(dma, render_state, p);
|
||||
}
|
||||
|
||||
if (dma.current_tag().qwc != 2) {
|
||||
fmt::print("abort!\n");
|
||||
while (dma.current_tag_offset() != render_state->next_bucket) {
|
||||
dma.read_and_advance();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// direct setup
|
||||
m_direct.reset_state();
|
||||
{
|
||||
auto setup = dma.read_and_advance();
|
||||
ASSERT(setup.vifcode0().kind == VifCode::Kind::NOP);
|
||||
ASSERT(setup.vifcode1().kind == VifCode::Kind::DIRECT);
|
||||
ASSERT(setup.size_bytes == 32);
|
||||
m_direct.render_gif(setup.data, 32, render_state, prof);
|
||||
}
|
||||
|
||||
// oofset and base
|
||||
{
|
||||
auto ob = dma.read_and_advance();
|
||||
ASSERT(ob.size_bytes == 0);
|
||||
auto base = ob.vifcode0();
|
||||
auto off = ob.vifcode1();
|
||||
ASSERT(base.kind == VifCode::Kind::BASE);
|
||||
ASSERT(off.kind == VifCode::Kind::OFFSET);
|
||||
ASSERT(base.immediate == VU1_INPUT_BUFFER_BASE);
|
||||
ASSERT(off.immediate == VU1_INPUT_BUFFER_OFFSET);
|
||||
}
|
||||
|
||||
while (!is_end_tag(dma.current_tag(), dma.current_tag_vif0(), dma.current_tag_vif1())) {
|
||||
auto data = dma.read_and_advance();
|
||||
auto v0 = data.vifcode0();
|
||||
auto v1 = data.vifcode1();
|
||||
|
||||
if (v0.kind == VifCode::Kind::STCYCL && v1.kind == VifCode::Kind::UNPACK_V4_32) {
|
||||
ASSERT(v0.immediate == 0x404);
|
||||
auto up = VifCodeUnpack(v1);
|
||||
u16 addr = up.addr_qw + (up.use_tops_flag ? get_upload_buffer() : 0);
|
||||
ASSERT(addr + v1.num <= 1024);
|
||||
memcpy(m_vu_data + addr, data.data, 16 * v1.num);
|
||||
} else if (v0.kind == VifCode::Kind::MSCALF && v1.kind == VifCode::Kind::STMOD) {
|
||||
ASSERT(v1.immediate == 0);
|
||||
switch (v0.immediate) {
|
||||
case 0:
|
||||
run_call0_vu2c();
|
||||
break;
|
||||
case 39:
|
||||
run_call39_vu2c(render_state, prof);
|
||||
break;
|
||||
default:
|
||||
fmt::print("unknown ocean near call: {}\n", v0.immediate);
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (dma.current_tag_offset() != render_state->next_bucket) {
|
||||
dma.read_and_advance();
|
||||
}
|
||||
m_direct.flush_pending(render_state, prof);
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
#pragma once
|
||||
|
||||
#include "game/graphics/opengl_renderer/BucketRenderer.h"
|
||||
#include "game/graphics/opengl_renderer/ocean/OceanTexture.h"
|
||||
#include "game/common/vu.h"
|
||||
|
||||
class OceanNear : public BucketRenderer {
|
||||
public:
|
||||
OceanNear(const std::string& name, BucketId my_id);
|
||||
void render(DmaFollower& dma, SharedRenderState* render_state, ScopedProfilerNode& prof) override;
|
||||
void draw_debug_window() override;
|
||||
void init_textures(TexturePool& pool) override;
|
||||
|
||||
private:
|
||||
void run_call0_vu2c();
|
||||
void run_call39_vu2c(SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
void run_L15_vu2c();
|
||||
void run_L21_vu2c();
|
||||
void run_L23_vu2c();
|
||||
void run_L25_vu2c(SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
void run_L30_vu2c();
|
||||
void run_L32_vu2c();
|
||||
|
||||
OceanTexture m_texture_renderer;
|
||||
DirectRenderer m_direct;
|
||||
|
||||
bool m_buffer_toggle = false;
|
||||
static constexpr int VU1_INPUT_BUFFER_BASE = 0;
|
||||
static constexpr int VU1_INPUT_BUFFER_OFFSET = 0x10;
|
||||
|
||||
void xgkick(u16 addr, SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
|
||||
u16 xtop() {
|
||||
m_buffer_toggle = !m_buffer_toggle;
|
||||
return get_vu_buffer();
|
||||
}
|
||||
|
||||
u16 get_upload_buffer() {
|
||||
if (m_buffer_toggle) {
|
||||
return VU1_INPUT_BUFFER_OFFSET;
|
||||
} else {
|
||||
return VU1_INPUT_BUFFER_BASE;
|
||||
}
|
||||
}
|
||||
|
||||
u16 get_vu_buffer() {
|
||||
if (!m_buffer_toggle) {
|
||||
return VU1_INPUT_BUFFER_OFFSET;
|
||||
} else {
|
||||
return VU1_INPUT_BUFFER_BASE;
|
||||
}
|
||||
}
|
||||
|
||||
void lq_buffer(Mask mask, Vf& dest, u16 addr) {
|
||||
ASSERT(addr < 1024);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((u64)mask & (1 << i)) {
|
||||
dest[i] = m_vu_data[addr].data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sq_buffer(Mask mask, const Vf& val, u16 addr) {
|
||||
ASSERT(addr < 1024);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if ((u64)mask & (1 << i)) {
|
||||
m_vu_data[addr].data[i] = val[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ilw_buffer(Mask mask, u16& dest, u16 addr) {
|
||||
ASSERT(addr < 1024);
|
||||
switch (mask) {
|
||||
case Mask::x:
|
||||
dest = m_vu_data[addr].x_as_u16();
|
||||
break;
|
||||
case Mask::y:
|
||||
dest = m_vu_data[addr].y_as_u16();
|
||||
break;
|
||||
case Mask::z:
|
||||
dest = m_vu_data[addr].z_as_u16();
|
||||
break;
|
||||
case Mask::w:
|
||||
dest = m_vu_data[addr].w_as_u16();
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
void isw_buffer(Mask mask, u16 src, u16 addr) {
|
||||
ASSERT(addr < 1024);
|
||||
u32 val32 = src;
|
||||
switch (mask) {
|
||||
case Mask::x:
|
||||
memcpy(&m_vu_data[addr].data[0], &val32, 4);
|
||||
break;
|
||||
case Mask::y:
|
||||
memcpy(&m_vu_data[addr].data[1], &val32, 4);
|
||||
break;
|
||||
case Mask::z:
|
||||
memcpy(&m_vu_data[addr].data[2], &val32, 4);
|
||||
break;
|
||||
case Mask::w:
|
||||
memcpy(&m_vu_data[addr].data[3], &val32, 4);
|
||||
break;
|
||||
default:
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
Vf m_vu_data[1024];
|
||||
|
||||
struct Vu {
|
||||
const Vf vf00;
|
||||
|
||||
Accumulator acc;
|
||||
Vf vf01, vf02, vf03, vf04, vf05, vf06, vf07, vf08, vf09, vf10, vf11, vf12, vf13, vf14, vf15,
|
||||
vf16, vf17, vf18, vf19, vf20, vf21, vf22, vf23, vf24, vf25, vf26, vf27, vf28, vf29, vf30,
|
||||
vf31;
|
||||
u16 vi01, vi02, vi03, vi04, vi05, vi06, vi07, vi08, vi09, vi10, vi11, vi12, vi13, vi14;
|
||||
|
||||
float P, Q;
|
||||
Vu() : vf00(0, 0, 0, 1) {}
|
||||
|
||||
} vu;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,14 @@
|
||||
#include "third-party/imgui/imgui.h"
|
||||
|
||||
constexpr int OCEAN_TEX_TBP = 8160; // todo
|
||||
OceanTexture::OceanTexture()
|
||||
: m_result_texture(TEX0_SIZE, TEX0_SIZE, GL_UNSIGNED_INT_8_8_8_8_REV, 8),
|
||||
OceanTexture::OceanTexture(bool generate_mipmaps)
|
||||
: m_generate_mipmaps(generate_mipmaps),
|
||||
m_result_texture(TEX0_SIZE,
|
||||
TEX0_SIZE,
|
||||
GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
m_generate_mipmaps ? NUM_MIPS : 1),
|
||||
m_temp_texture(TEX0_SIZE, TEX0_SIZE, GL_UNSIGNED_INT_8_8_8_8_REV),
|
||||
m_hack_renderer("burp", BucketId::BUCKET0, 0x8000) {
|
||||
m_hack_renderer("ocean-tex-unoptimized", BucketId::BUCKET0, 0x8000) {
|
||||
m_dbuf_x = m_dbuf_a;
|
||||
m_dbuf_y = m_dbuf_b;
|
||||
|
||||
@@ -54,7 +58,7 @@ void OceanTexture::init_textures(TexturePool& pool) {
|
||||
in.w = TEX0_SIZE;
|
||||
in.h = TEX0_SIZE;
|
||||
in.page_name = "PC-OCEAN";
|
||||
in.name = "pc-ocean";
|
||||
in.name = fmt::format("pc-ocean-mip-{}", m_generate_mipmaps);
|
||||
m_tex0_gpu = pool.give_texture_and_load_to_vram(in, OCEAN_TEX_TBP);
|
||||
}
|
||||
|
||||
@@ -101,7 +105,9 @@ void OceanTexture::handle_tex_call_rest(SharedRenderState* render_state, ScopedP
|
||||
void OceanTexture::handle_ocean_texture(DmaFollower& dma,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof) {
|
||||
FramebufferTexturePairContext ctxt(m_temp_texture);
|
||||
// if we're doing mipmaps, render to temp.
|
||||
// otherwise, render directly to target.
|
||||
FramebufferTexturePairContext ctxt(m_generate_mipmaps ? m_temp_texture : m_result_texture);
|
||||
// render to the first texture
|
||||
{
|
||||
// (set-display-gs-state arg0 ocean-tex-page-0 128 128 0 0)
|
||||
@@ -262,7 +268,14 @@ void OceanTexture::handle_ocean_texture(DmaFollower& dma,
|
||||
}
|
||||
|
||||
flush(render_state, prof);
|
||||
make_mipmaps(render_state, prof);
|
||||
if (m_generate_mipmaps) {
|
||||
// if we did mipmaps, the above code rendered to temp, and now we need to generate mipmaps
|
||||
// in the real output
|
||||
make_texture_with_mipmaps(render_state, prof);
|
||||
}
|
||||
|
||||
// give to gpu!
|
||||
render_state->texture_pool->move_existing_to_vram(m_tex0_gpu, OCEAN_TEX_TBP);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -270,7 +283,8 @@ void OceanTexture::handle_ocean_texture(DmaFollower& dma,
|
||||
* There's a trick here - we reduce the intensity of alpha on the lower lods. This lets texture
|
||||
* filtering slowly fade the alpha value out to 0 with distance.
|
||||
*/
|
||||
void OceanTexture::make_mipmaps(SharedRenderState* render_state, ScopedProfilerNode& prof) {
|
||||
void OceanTexture::make_texture_with_mipmaps(SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof) {
|
||||
glBindVertexArray(m_mipmap.vao);
|
||||
render_state->shaders[ShaderId::OCEAN_TEXTURE_MIPMAP].activate();
|
||||
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_TEXTURE_MIPMAP].id(),
|
||||
@@ -287,11 +301,11 @@ void OceanTexture::make_mipmaps(SharedRenderState* render_state, ScopedProfilerN
|
||||
0);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, m_mipmap.vtx_buffer);
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int i = 0; i < NUM_MIPS; i++) {
|
||||
FramebufferTexturePairContext ctxt(m_result_texture, i);
|
||||
glUniform1f(glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_TEXTURE_MIPMAP].id(),
|
||||
"alpha_intensity"),
|
||||
std::max(0.f, 1.f - 0.5f * i));
|
||||
std::max(0.f, 1.f - 0.4f * i));
|
||||
glUniform1f(
|
||||
glGetUniformLocation(render_state->shaders[ShaderId::OCEAN_TEXTURE_MIPMAP].id(), "scale"),
|
||||
1.f / (1 << i));
|
||||
@@ -299,6 +313,5 @@ void OceanTexture::make_mipmaps(SharedRenderState* render_state, ScopedProfilerN
|
||||
prof.add_draw_call();
|
||||
prof.add_tri(2);
|
||||
}
|
||||
render_state->texture_pool->move_existing_to_vram(m_tex0_gpu, OCEAN_TEX_TBP);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
class OceanTexture {
|
||||
public:
|
||||
OceanTexture();
|
||||
OceanTexture(bool generate_mipmaps);
|
||||
void handle_ocean_texture(DmaFollower& dma,
|
||||
SharedRenderState* render_state,
|
||||
ScopedProfilerNode& prof);
|
||||
@@ -39,11 +39,13 @@ class OceanTexture {
|
||||
void init_pc();
|
||||
void destroy_pc();
|
||||
|
||||
void make_mipmaps(SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
void make_texture_with_mipmaps(SharedRenderState* render_state, ScopedProfilerNode& prof);
|
||||
|
||||
bool m_use_ocean_specific = true;
|
||||
bool m_generate_mipmaps;
|
||||
|
||||
static constexpr int TEX0_SIZE = 128;
|
||||
static constexpr int NUM_MIPS = 8;
|
||||
FramebufferTexturePair m_result_texture;
|
||||
FramebufferTexturePair m_temp_texture;
|
||||
GpuTexture* m_tex0_gpu = nullptr;
|
||||
|
||||
@@ -6,6 +6,9 @@ in vec4 fragment_color;
|
||||
in vec3 tex_coord;
|
||||
uniform float alpha_reject;
|
||||
uniform float color_mult;
|
||||
uniform float alpha_mult;
|
||||
uniform float alpha_sub;
|
||||
|
||||
uniform vec4 fog_color;
|
||||
|
||||
in flat uvec4 tex_info;
|
||||
@@ -65,10 +68,12 @@ void main() {
|
||||
}
|
||||
color *= 2;
|
||||
color.xyz *= color_mult;
|
||||
color.w *= alpha_mult;
|
||||
if (color.a < alpha_reject) {
|
||||
discard;
|
||||
}
|
||||
if (tex_info.w == 1) {
|
||||
color.xyz = mix(color.xyz, fog_color.xyz / 255., clamp(fog_color.w * (1 - fog), 0, 1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
(define-extern draw-ocean-texture (function dma-buffer (inline-array vector) symbol none))
|
||||
(define-extern draw-ocean-transition (function dma-buffer none))
|
||||
(define-extern draw-ocean-mid (function dma-buffer none))
|
||||
(define-extern draw-ocean-near (function dma-buffer none))
|
||||
|
||||
|
||||
;; The "ocean" renderer is used to render the infinite water.
|
||||
;; It doesn't draw the rivers in FJ or the water near the farmer.
|
||||
@@ -365,23 +367,23 @@
|
||||
(constants2 vector :inline :offset-assert 80)
|
||||
(constants3 vector :inline :offset-assert 96)
|
||||
(constants4 vector :inline :offset-assert 112)
|
||||
(drw-fan qword :inline :offset-assert 128)
|
||||
(drw2-fan qword :inline :offset-assert 144)
|
||||
(env-fan qword :inline :offset-assert 160)
|
||||
(drw-adgif qword :inline :offset-assert 176)
|
||||
(drw-fan gs-gif-tag :inline :offset-assert 128) ;; was qword
|
||||
(drw2-fan gs-gif-tag :inline :offset-assert 144) ;; was qword
|
||||
(env-fan gs-gif-tag :inline :offset-assert 160) ;; was qword
|
||||
(drw-adgif gs-gif-tag :inline :offset-assert 176) ;; was qword
|
||||
(drw-texture adgif-shader :inline :offset-assert 192)
|
||||
(drw-strip qword :inline :offset-assert 272)
|
||||
(env-adgif qword :inline :offset-assert 288)
|
||||
(env-texture adgif-shader :inline :offset-assert 304)
|
||||
(env-strip qword :inline :offset-assert 384)
|
||||
(drw-strip gs-gif-tag :inline :offset-assert 272) ;; was qword
|
||||
(env-adgif gs-gif-tag :inline :offset-assert 288) ;; was qword
|
||||
(env-texture adgif-shader :inline :offset-assert 304) ;; was qword
|
||||
(env-strip gs-gif-tag :inline :offset-assert 384)
|
||||
(env-color vector :inline :offset-assert 400)
|
||||
(drw2-adgif qword :inline :offset-assert 416)
|
||||
(drw2-adgif gs-gif-tag :inline :offset-assert 416)
|
||||
(drw2-tex0 qword :inline :offset-assert 432)
|
||||
(drw2-frame qword :inline :offset-assert 448)
|
||||
(drw2-strip qword :inline :offset-assert 464)
|
||||
(drw3-adgif qword :inline :offset-assert 480)
|
||||
(drw2-strip gs-gif-tag :inline :offset-assert 464)
|
||||
(drw3-adgif gs-gif-tag :inline :offset-assert 480)
|
||||
(drw3-frame qword :inline :offset-assert 496)
|
||||
(index-table uint128 4 :offset-assert 512)
|
||||
(index-table vector4w 4 :inline :offset-assert 512)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x240
|
||||
|
||||
@@ -5,3 +5,715 @@
|
||||
;; name in dgo: ocean-near
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
(define ocean-near-block (new 'static 'vu-function #|:length #x3dc :qlength #x1ee|#))
|
||||
|
||||
(defun ocean-near-add-call ((arg0 dma-buffer) (arg1 int))
|
||||
(let* ((v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm arg1))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
|
||||
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun ocean-near-add-call-flush ((arg0 dma-buffer) (arg1 int))
|
||||
(let* ((v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm arg1))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
|
||||
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun ocean-near-setup-constants ((arg0 ocean-near-constants))
|
||||
(let ((v1-0 *math-camera*))
|
||||
(set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad))
|
||||
(set! (-> arg0 inv-hmge-scale quad) (-> v1-0 inv-hmge-scale quad))
|
||||
(set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad))
|
||||
(set-vector! (-> arg0 fog) (-> v1-0 pfog0) (-> v1-0 fog-min) (-> v1-0 fog-max) 3072.0)
|
||||
)
|
||||
(set-vector! (-> arg0 constants) 0.5 0.5 0.0 0.000010172526)
|
||||
(set-vector! (-> arg0 constants2) 0.5 0.5 1.0 128.0)
|
||||
(set-vector! (-> arg0 constants3) 12288.0 0.125 2.0 0.03125)
|
||||
(set-vector! (-> arg0 constants4) 2.0 255.0 3.0 0.0078125)
|
||||
(let ((v1-5 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-5)
|
||||
(set! (-> arg0 drw-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-5 1)
|
||||
(set! (-> arg0 drw-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-5 2)
|
||||
(set! (-> arg0 drw-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw-fan regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(let ((v1-14 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-14)
|
||||
(set! (-> arg0 drw2-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-14 1)
|
||||
(set! (-> arg0 drw2-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-14 2)
|
||||
(set! (-> arg0 drw2-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw2-fan regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(let ((v1-23 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-23)
|
||||
(set! (-> arg0 env-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-23 1)
|
||||
(set! (-> arg0 env-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-23 2)
|
||||
(set! (-> arg0 env-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 env-fan regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 drw-adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> arg0 drw-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(let* ((v1-34 *ocean-base-page*)
|
||||
(s4-0 *ocean-base-block*)
|
||||
(s2-0 (* (+ v1-34 8) 32))
|
||||
(s3-0 (* (+ v1-34 10) 32))
|
||||
(a0-18 (-> *display* on-screen))
|
||||
(s5-0 (-> *display* frames a0-18 draw frame1 fbp))
|
||||
)
|
||||
(set! (-> arg0 drw-texture tex0) (new 'static 'gs-tex0 :tbw #x2 :th (log2 128) :tw (log2 128) :tbp0 s4-0))
|
||||
(set! (-> arg0 drw-texture prims 1) (gs-reg64 tex0-1))
|
||||
(set! (-> arg0 drw-texture tex1) (new 'static 'gs-tex1 :mxl #x1 :mmag #x1 :mmin #x5 :l #x1 :k #xeed))
|
||||
(set! (-> arg0 drw-texture prims 3) (gs-reg64 tex1-1))
|
||||
(set! (-> arg0 drw-texture miptbp1)
|
||||
(new 'static 'gs-miptbp :tbw1 #x1 :tbw2 #x1 :tbw3 #x1 :tbp3 (+ s3-0 16) :tbp2 s3-0 :tbp1 s2-0)
|
||||
)
|
||||
(set! (-> arg0 drw-texture prims 5) (gs-reg64 miptbp1-1))
|
||||
(set! (-> arg0 drw-texture clamp) (new 'static 'gs-clamp))
|
||||
(set! (-> arg0 drw-texture clamp-reg) (gs-reg64 clamp-1))
|
||||
(set! (-> arg0 drw-texture alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
(set! (-> arg0 drw-texture prims 9) (gs-reg64 alpha-1))
|
||||
(let ((v1-60 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-60)
|
||||
(set! (-> arg0 drw-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-60 1)
|
||||
(set! (-> arg0 drw-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-60 2)
|
||||
(set! (-> arg0 drw-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw-strip regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 env-adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> arg0 env-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(let ((s3-1 (-> arg0 env-texture)))
|
||||
(adgif-shader<-texture-simple! s3-1 (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #x100)))
|
||||
(set! (-> s3-1 alpha) (new 'static 'gs-alpha :b #x2 :c #x1 :d #x1))
|
||||
)
|
||||
(let ((v1-72 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-72)
|
||||
(set! (-> arg0 env-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-72 1)
|
||||
(set! (-> arg0 env-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-72 2)
|
||||
(set! (-> arg0 env-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 env-strip regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 env-color quad) (-> *time-of-day-context* current-sun env-color quad))
|
||||
(set! (-> arg0 drw2-adgif tag) (new 'static 'gif-tag64 :nloop #x2 :eop #x1 :nreg #x1))
|
||||
(set! (-> arg0 drw2-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> arg0 drw2-tex0 dword 0)
|
||||
(logior (logior (logior (the-as uint #x400008000) (shr (shl s4-0 50) 50)) (shr (shl (log2 128) 60) 34))
|
||||
(shr (shl (log2 128) 60) 30)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw2-tex0 dword 1) (the-as uint 6))
|
||||
(set! (-> arg0 drw2-frame dword 0) (logior (the-as uint #xffffff00080000) (shr (shl s5-0 55) 55)))
|
||||
(set! (-> arg0 drw2-frame dword 1) (the-as uint 76))
|
||||
(let ((v1-94 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-94)
|
||||
(set! (-> arg0 drw2-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-94 1)
|
||||
(set! (-> arg0 drw2-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-94 2)
|
||||
(set! (-> arg0 drw2-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw2-strip regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 drw3-adgif tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
|
||||
(set! (-> arg0 drw3-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> arg0 drw3-frame dword 0) (logior #x80000 (shr (shl s5-0 55) 55)))
|
||||
)
|
||||
(set! (-> arg0 drw3-frame dword 1) (the-as uint 76))
|
||||
(set-vector! (-> arg0 index-table 0) 81 189 0 0)
|
||||
(set-vector! (-> arg0 index-table 1) 54 162 0 0)
|
||||
(set-vector! (-> arg0 index-table 2) 27 135 0 0)
|
||||
(set-vector! (-> arg0 index-table 3) 0 108 0 0)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun ocean-near-add-constants ((arg0 dma-buffer))
|
||||
(let* ((a1-0 36)
|
||||
(v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-0))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1)
|
||||
(new 'static 'vif-tag :imm #x3b7 :cmd (vif-cmd unpack-v4-32) :num a1-0)
|
||||
)
|
||||
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
||||
)
|
||||
(ocean-near-setup-constants (the-as ocean-near-constants (-> arg0 base)))
|
||||
(&+! (-> arg0 base) 576)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun ocean-near-add-heights ((arg0 dma-buffer))
|
||||
(let ((v1-0 128)
|
||||
(a1-0 (the-as object *ocean-heights*))
|
||||
)
|
||||
(let* ((a2-0 arg0)
|
||||
(a3-0 (the-as object (-> a2-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a3-0) dma)
|
||||
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int a1-0) :qwc v1-0)
|
||||
)
|
||||
(set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a3-0) vif1)
|
||||
(new 'static 'vif-tag :imm #x20 :cmd (vif-cmd unpack-v4-32) :num v1-0)
|
||||
)
|
||||
(set! (-> a2-0 base) (&+ (the-as pointer a3-0) 16))
|
||||
)
|
||||
(let ((a2-1 (the-as object (-> arg0 base))))
|
||||
(set! (-> (the-as dma-packet a2-1) dma)
|
||||
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (+ (the-as int a1-0) 2048) :qwc v1-0)
|
||||
)
|
||||
(set! (-> (the-as dma-packet a2-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a2-1) vif1)
|
||||
(new 'static 'vif-tag :imm #xa0 :cmd (vif-cmd unpack-v4-32) :num v1-0)
|
||||
)
|
||||
(set! (-> arg0 base) (&+ (the-as pointer a2-1) 16))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun ocean-near-add-matrices ((arg0 dma-buffer) (arg1 vector))
|
||||
(let ((s5-0 (new-stack-vector0)))
|
||||
(-> *math-camera* camera-rot)
|
||||
(let* ((a2-0 8)
|
||||
(v1-2 arg0)
|
||||
(a0-1 (the-as object (-> v1-2 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1)
|
||||
(new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num a2-0)
|
||||
)
|
||||
(set! (-> v1-2 base) (the-as pointer (&+ (the-as vector a0-1) 16)))
|
||||
)
|
||||
(let ((s4-0 (the-as object (-> arg0 base))))
|
||||
(let* ((v1-3 (the-as matrix s4-0))
|
||||
(t0-2 (-> *math-camera* camera-rot))
|
||||
(a0-4 (-> t0-2 vector 0 quad))
|
||||
(a2-4 (-> t0-2 vector 1 quad))
|
||||
(a3-4 (-> t0-2 vector 2 quad))
|
||||
(t0-3 (-> t0-2 vector 3 quad))
|
||||
)
|
||||
(set! (-> v1-3 vector 0 quad) a0-4)
|
||||
(set! (-> v1-3 vector 1 quad) a2-4)
|
||||
(set! (-> v1-3 vector 2 quad) a3-4)
|
||||
(set! (-> v1-3 vector 3 quad) t0-3)
|
||||
)
|
||||
(let ((s3-0 (the-as object (&+ (the-as pointer s4-0) 48))))
|
||||
(vector-matrix*! s5-0 arg1 (-> *math-camera* camera-rot))
|
||||
(set! (-> (the-as vector s3-0) x) (-> s5-0 x))
|
||||
(set! (-> (the-as vector s3-0) y) (-> s5-0 y))
|
||||
(set! (-> (the-as vector s3-0) z) (-> s5-0 z))
|
||||
)
|
||||
(let ((a0-6 (&+ (-> arg0 base) 64)))
|
||||
(ocean-matrix*! (the-as matrix a0-6) (the-as matrix s4-0) (-> *math-camera* perspective))
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! (-> arg0 base) 128)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun ocean-near-add-upload ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
||||
(local-vars
|
||||
(r0-0 int)
|
||||
(r0-1 int)
|
||||
(r0-2 int)
|
||||
(r0-3 int)
|
||||
(r0-4 int)
|
||||
(v1-17 uint128)
|
||||
(v1-18 uint128)
|
||||
(v1-19 float)
|
||||
(a0-18 uint128)
|
||||
(a0-19 uint128)
|
||||
(a0-20 uint128)
|
||||
(a2-23 float)
|
||||
(a2-30 uint128)
|
||||
(a2-31 uint128)
|
||||
(a3-27 uint128)
|
||||
(f31-0 none)
|
||||
)
|
||||
(rlet ((acc :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
(vf12 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(let ((s2-0 (-> *ocean-work* mid-minx))
|
||||
(s3-0 (-> *ocean-work* mid-minz))
|
||||
)
|
||||
(let ((a1-1 (new-stack-vector0)))
|
||||
(let ((v1-3 (-> *ocean-map* start-corner)))
|
||||
(set! (-> a1-1 x) (+ (-> v1-3 x) (* 98304.0 (the float arg2))))
|
||||
(set! (-> a1-1 y) (-> v1-3 y))
|
||||
(set! (-> a1-1 z) (+ (-> v1-3 z) (* 98304.0 (the float arg1))))
|
||||
)
|
||||
(set! (-> a1-1 w) 1.0)
|
||||
(ocean-near-add-matrices arg0 a1-1)
|
||||
)
|
||||
(let* ((a1-2 8)
|
||||
(v1-5 arg0)
|
||||
(a0-2 (the-as object (-> v1-5 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-2))
|
||||
(set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a0-2) vif1)
|
||||
(new 'static 'vif-tag :imm #x8008 :cmd (vif-cmd unpack-v4-32) :num a1-2)
|
||||
)
|
||||
(set! (-> v1-5 base) (&+ (the-as pointer a0-2) 16))
|
||||
)
|
||||
(let* ((v1-6 (-> arg0 base))
|
||||
(a0-5 (- arg2 (* s2-0 4)))
|
||||
(a1-7 (- arg1 (* s3-0 4)))
|
||||
(a2-5 (shr a0-5 2))
|
||||
(a3-2 (shr a1-7 2))
|
||||
(a0-6 (logand a0-5 3))
|
||||
(a1-8 (logand a1-7 3))
|
||||
(a2-9 (-> (the-as (pointer int16) (+ (* (+ (* a3-2 4) a2-5) 2) (the-as uint *ocean-work*))) 1550))
|
||||
(a3-8 (-> *ocean-map* ocean-near-indices data a2-9))
|
||||
(a0-12
|
||||
(-> *ocean-map*
|
||||
ocean-mid-masks
|
||||
data
|
||||
(-> (the-as (pointer int16) (+ (* (+ (* a1-8 4) a0-6) 2) (the-as uint a3-8))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set-vector!
|
||||
(the-as vector4w (&+ v1-6 0))
|
||||
(the-as int (-> a0-12 mask 0))
|
||||
(the-as int (-> a0-12 mask 1))
|
||||
(the-as int (-> a0-12 mask 2))
|
||||
(the-as int (-> a0-12 mask 3))
|
||||
)
|
||||
(set-vector!
|
||||
(the-as vector4w (&+ v1-6 16))
|
||||
(the-as int (-> a0-12 mask 4))
|
||||
(the-as int (-> a0-12 mask 5))
|
||||
(the-as int (-> a0-12 mask 6))
|
||||
(the-as int (-> a0-12 mask 7))
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! (-> arg0 base) 32)
|
||||
(let ((a0-14 (/ (the-as int arg2) 4))
|
||||
(v1-10 (/ (the-as int arg1) 4))
|
||||
(a2-18 (logand arg2 3))
|
||||
(a3-9 (logand arg1 3))
|
||||
)
|
||||
(let ((t0-0 (-> arg0 base))
|
||||
(a1-15 (logand (+ arg2 1) 3))
|
||||
(t1-1 (logand (+ arg1 1) 3))
|
||||
)
|
||||
(set-vector!
|
||||
(the-as vector4w (&+ t0-0 0))
|
||||
(the-as int (+ (* a3-9 64) (* a2-18 2)))
|
||||
(the-as int (+ (* a3-9 64) (* a1-15 2)))
|
||||
(the-as int (+ (* t1-1 64) (* a2-18 2)))
|
||||
(the-as int (+ (* t1-1 64) (* a1-15 2)))
|
||||
)
|
||||
)
|
||||
(&+! (-> arg0 base) 16)
|
||||
(set-vector!
|
||||
(the-as vector (&+ (-> arg0 base) 0))
|
||||
(* 0.25 (the float a2-18))
|
||||
(* 0.25 (the float a3-9))
|
||||
1.0
|
||||
0.0
|
||||
)
|
||||
(&+! (-> arg0 base) 16)
|
||||
(let ((a1-24 (the-as object (-> arg0 base))))
|
||||
(let ((a2-19 (+ (* 5 (the-as int a3-9)) a2-18)))
|
||||
(.lvf vf5 (&-> (&-> *ocean-trans-corner-table* 0 quad a2-19) 0))
|
||||
(.lvf vf6 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ a2-19 1)) 0))
|
||||
(.lvf vf7 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ a2-19 5)) 0))
|
||||
(.lvf vf8 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ a2-19 6)) 0))
|
||||
)
|
||||
(.mov a2-23 vf8)
|
||||
(let ((a2-29 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 v1-10) a0-14))))
|
||||
(a3-26 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ a0-14 1 (* 52 v1-10)))))
|
||||
(t0-15 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (+ v1-10 1)) a0-14))))
|
||||
(v1-16 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ a0-14 1 (* 52 (+ v1-10 1))))))
|
||||
)
|
||||
(.pextlb a0-18 0 a2-29)
|
||||
(.mov r0-0 f31-0)
|
||||
(.pextlb a2-30 0 a3-26)
|
||||
(.mov r0-1 f31-0)
|
||||
(.pextlb a3-27 0 t0-15)
|
||||
(.mov r0-2 f31-0)
|
||||
(.pextlb v1-17 0 v1-16)
|
||||
)
|
||||
(.mov r0-3 f31-0)
|
||||
(.pextlh a0-19 0 a0-18)
|
||||
(.mov r0-4 f31-0)
|
||||
(.pextlh a2-31 0 a2-30)
|
||||
(.mov vf1 a0-19)
|
||||
(.pextlh a0-20 0 a3-27)
|
||||
(.mov vf2 a2-31)
|
||||
(.pextlh v1-18 0 v1-17)
|
||||
(.mov vf3 a0-20)
|
||||
(nop!)
|
||||
(.mov vf4 v1-18)
|
||||
(.itof.vf vf1 vf1)
|
||||
(nop!)
|
||||
(.itof.vf vf2 vf2)
|
||||
(nop!)
|
||||
(.itof.vf vf3 vf3)
|
||||
(nop!)
|
||||
(.itof.vf vf4 vf4)
|
||||
(nop!)
|
||||
(.mul.x.vf acc vf1 vf5)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf5 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf5 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf9 vf4 vf5 acc)
|
||||
(nop!)
|
||||
(.mul.x.vf acc vf1 vf6)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf6 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf6 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf10 vf4 vf6 acc)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 0 quad) vf9)
|
||||
(.mul.x.vf acc vf1 vf7)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf7 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf7 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf11 vf4 vf7 acc)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 1 quad) vf10)
|
||||
(.mul.x.vf acc vf1 vf8)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf8 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf8 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf12 vf4 vf8 acc)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 2 quad) vf11)
|
||||
(nop!)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 3 quad) vf12)
|
||||
)
|
||||
)
|
||||
(.mov v1-19 vf12)
|
||||
(&+! (-> arg0 base) 64)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
(defun draw-ocean-near ((arg0 dma-buffer))
|
||||
(let* ((v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1))
|
||||
(set! (-> v1-0 base) (the-as pointer (&+ (the-as dma-packet a0-1) 16)))
|
||||
)
|
||||
(let* ((v1-1 arg0)
|
||||
(a0-3 (the-as object (-> v1-1 base)))
|
||||
)
|
||||
(set! (-> (the-as gs-gif-tag a0-3) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
|
||||
(set! (-> (the-as gs-gif-tag a0-3) regs)
|
||||
(new 'static 'gif-tag-regs
|
||||
:regs0 (gif-reg-id a+d)
|
||||
:regs1 (gif-reg-id a+d)
|
||||
:regs2 (gif-reg-id a+d)
|
||||
:regs3 (gif-reg-id a+d)
|
||||
:regs4 (gif-reg-id a+d)
|
||||
:regs5 (gif-reg-id a+d)
|
||||
:regs6 (gif-reg-id a+d)
|
||||
:regs7 (gif-reg-id a+d)
|
||||
:regs8 (gif-reg-id a+d)
|
||||
:regs9 (gif-reg-id a+d)
|
||||
:regs10 (gif-reg-id a+d)
|
||||
:regs11 (gif-reg-id a+d)
|
||||
:regs12 (gif-reg-id a+d)
|
||||
:regs13 (gif-reg-id a+d)
|
||||
:regs14 (gif-reg-id a+d)
|
||||
:regs15 (gif-reg-id a+d)
|
||||
)
|
||||
)
|
||||
(set! (-> v1-1 base) (the-as pointer (the-as dma-packet (&+ (the-as pointer a0-3) 16))))
|
||||
)
|
||||
(let* ((v1-2 arg0)
|
||||
(a0-5 (the-as object (-> v1-2 base)))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-test) a0-5) 0)
|
||||
(new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-reg64) a0-5) 1) (gs-reg64 test-1))
|
||||
(set! (-> v1-2 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-5) 16))))
|
||||
)
|
||||
(dma-buffer-add-vu-function arg0 ocean-near-block 1)
|
||||
(let* ((v1-3 arg0)
|
||||
(a0-8 (the-as object (-> v1-3 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-8) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-8) vif0) (new 'static 'vif-tag :cmd (vif-cmd base)))
|
||||
(set! (-> (the-as dma-packet a0-8) vif1) (new 'static 'vif-tag :imm #x10 :cmd (vif-cmd offset)))
|
||||
(set! (-> v1-3 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-8) 16))))
|
||||
)
|
||||
(ocean-near-add-constants arg0)
|
||||
(ocean-near-add-heights arg0)
|
||||
(ocean-near-add-call arg0 0)
|
||||
(let ((s5-0 (-> *ocean-work* near-minx))
|
||||
(s4-0 (-> *ocean-work* near-maxx))
|
||||
(s3-0 (-> *ocean-work* near-minz))
|
||||
(s2-0 (-> *ocean-work* near-maxz))
|
||||
)
|
||||
(when (and (< s5-0 s4-0) (< s3-0 s2-0))
|
||||
(while (>= s2-0 s3-0)
|
||||
(let ((s1-0 s5-0)
|
||||
(s0-0 s4-0)
|
||||
)
|
||||
(while (>= s0-0 s1-0)
|
||||
(when (ocean-trans-camera-masks-bit? s3-0 s1-0)
|
||||
(let* ((a1-13 (- (shr s1-0 2) (-> *ocean-work* mid-minx)))
|
||||
(a2-1 (- (shr s3-0 2) (-> *ocean-work* mid-minz)))
|
||||
(v1-13 (logand s1-0 3))
|
||||
(a0-19 (logand s3-0 3))
|
||||
(a1-17 (-> (the-as (pointer int16) (+ (* (+ (* a2-1 4) a1-13) 2) (the-as uint *ocean-work*))) 1550))
|
||||
)
|
||||
(when (>= a1-17 0)
|
||||
(let ((a1-19 (-> *ocean-map* ocean-near-indices data a1-17)))
|
||||
(when (>= (-> (the-as (pointer int16) (+ (* (+ (* a0-19 4) v1-13) 2) (the-as uint a1-19)))) 0)
|
||||
(ocean-near-add-upload arg0 s3-0 s1-0)
|
||||
(ocean-near-add-call arg0 39)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! s1-0 1)
|
||||
)
|
||||
)
|
||||
(+! s3-0 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -668,28 +668,27 @@
|
||||
)
|
||||
)
|
||||
(when (not (or *ocean-near-off* (or *ocean-mid-off* (< 196608.0 (fabs (-> *math-camera* trans y))))))
|
||||
; (format *stdcon* "draw near~%")
|
||||
; (let* ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
|
||||
; (gp-2 (-> s5-1 base))
|
||||
; )
|
||||
; (draw-ocean-texture s5-1 *ocean-verts* #f)
|
||||
; (draw-ocean-near s5-1)
|
||||
; (ocean-end-buffer s5-1)
|
||||
; (let ((a3-1 (-> s5-1 base)))
|
||||
; (let ((v1-46 (the-as object (-> s5-1 base))))
|
||||
; (set! (-> (the-as dma-packet v1-46) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
|
||||
; (set! (-> (the-as dma-packet v1-46) vif0) (new 'static 'vif-tag))
|
||||
; (set! (-> (the-as dma-packet v1-46) vif1) (new 'static 'vif-tag))
|
||||
; (set! (-> s5-1 base) (&+ (the-as pointer v1-46) 16))
|
||||
; )
|
||||
; (dma-bucket-insert-tag
|
||||
; (-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
; (bucket-id bucket-63)
|
||||
; gp-2
|
||||
; (the-as (pointer dma-tag) a3-1)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
(let* ((s5-1 (-> *display* frames (-> *display* on-screen) frame global-buf))
|
||||
(gp-2 (-> s5-1 base))
|
||||
)
|
||||
(draw-ocean-texture s5-1 *ocean-verts* #f)
|
||||
(draw-ocean-near s5-1)
|
||||
(ocean-end-buffer s5-1)
|
||||
(let ((a3-1 (-> s5-1 base)))
|
||||
(let ((v1-46 (the-as object (-> s5-1 base))))
|
||||
(set! (-> (the-as dma-packet v1-46) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
|
||||
(set! (-> (the-as dma-packet v1-46) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet v1-46) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> s5-1 base) (&+ (the-as pointer v1-46) 16))
|
||||
)
|
||||
(dma-bucket-insert-tag
|
||||
(-> *display* frames (-> *display* on-screen) frame bucket-group)
|
||||
(bucket-id bucket-63)
|
||||
gp-2
|
||||
(the-as (pointer dma-tag) a3-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
+25
-25
@@ -684,31 +684,31 @@
|
||||
|
||||
;; definition of type ocean-near-constants
|
||||
(deftype ocean-near-constants (structure)
|
||||
((hmge-scale vector :inline :offset-assert 0)
|
||||
(inv-hmge-scale vector :inline :offset-assert 16)
|
||||
(hvdf-offset vector :inline :offset-assert 32)
|
||||
(fog vector :inline :offset-assert 48)
|
||||
(constants vector :inline :offset-assert 64)
|
||||
(constants2 vector :inline :offset-assert 80)
|
||||
(constants3 vector :inline :offset-assert 96)
|
||||
(constants4 vector :inline :offset-assert 112)
|
||||
(drw-fan qword :inline :offset-assert 128)
|
||||
(drw2-fan qword :inline :offset-assert 144)
|
||||
(env-fan qword :inline :offset-assert 160)
|
||||
(drw-adgif qword :inline :offset-assert 176)
|
||||
(drw-texture adgif-shader :inline :offset-assert 192)
|
||||
(drw-strip qword :inline :offset-assert 272)
|
||||
(env-adgif qword :inline :offset-assert 288)
|
||||
(env-texture adgif-shader :inline :offset-assert 304)
|
||||
(env-strip qword :inline :offset-assert 384)
|
||||
(env-color vector :inline :offset-assert 400)
|
||||
(drw2-adgif qword :inline :offset-assert 416)
|
||||
(drw2-tex0 qword :inline :offset-assert 432)
|
||||
(drw2-frame qword :inline :offset-assert 448)
|
||||
(drw2-strip qword :inline :offset-assert 464)
|
||||
(drw3-adgif qword :inline :offset-assert 480)
|
||||
(drw3-frame qword :inline :offset-assert 496)
|
||||
(index-table uint128 4 :offset-assert 512)
|
||||
((hmge-scale vector :inline :offset-assert 0)
|
||||
(inv-hmge-scale vector :inline :offset-assert 16)
|
||||
(hvdf-offset vector :inline :offset-assert 32)
|
||||
(fog vector :inline :offset-assert 48)
|
||||
(constants vector :inline :offset-assert 64)
|
||||
(constants2 vector :inline :offset-assert 80)
|
||||
(constants3 vector :inline :offset-assert 96)
|
||||
(constants4 vector :inline :offset-assert 112)
|
||||
(drw-fan gs-gif-tag :inline :offset-assert 128)
|
||||
(drw2-fan gs-gif-tag :inline :offset-assert 144)
|
||||
(env-fan gs-gif-tag :inline :offset-assert 160)
|
||||
(drw-adgif gs-gif-tag :inline :offset-assert 176)
|
||||
(drw-texture adgif-shader :inline :offset-assert 192)
|
||||
(drw-strip gs-gif-tag :inline :offset-assert 272)
|
||||
(env-adgif gs-gif-tag :inline :offset-assert 288)
|
||||
(env-texture adgif-shader :inline :offset-assert 304)
|
||||
(env-strip gs-gif-tag :inline :offset-assert 384)
|
||||
(env-color vector :inline :offset-assert 400)
|
||||
(drw2-adgif gs-gif-tag :inline :offset-assert 416)
|
||||
(drw2-tex0 qword :inline :offset-assert 432)
|
||||
(drw2-frame qword :inline :offset-assert 448)
|
||||
(drw2-strip gs-gif-tag :inline :offset-assert 464)
|
||||
(drw3-adgif gs-gif-tag :inline :offset-assert 480)
|
||||
(drw3-frame qword :inline :offset-assert 496)
|
||||
(index-table vector4w 4 :inline :offset-assert 512)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x240
|
||||
|
||||
+736
@@ -0,0 +1,736 @@
|
||||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for symbol ocean-near-block, type vu-function
|
||||
(define ocean-near-block (new 'static 'vu-function :length #x3dc :qlength #x1ee))
|
||||
|
||||
;; definition for function ocean-near-add-call
|
||||
;; INFO: Return type mismatch pointer vs none.
|
||||
(defun ocean-near-add-call ((arg0 dma-buffer) (arg1 int))
|
||||
(let* ((v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm arg1))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
|
||||
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ocean-near-add-call-flush
|
||||
;; INFO: Return type mismatch pointer vs none.
|
||||
(defun ocean-near-add-call-flush ((arg0 dma-buffer) (arg1 int))
|
||||
(let* ((v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :cmd (vif-cmd mscalf) :msk #x1 :imm arg1))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :cmd (vif-cmd flusha) :msk #x1))
|
||||
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ocean-near-setup-constants
|
||||
;; INFO: Return type mismatch vector4w vs none.
|
||||
;; Used lq/sq
|
||||
(defun ocean-near-setup-constants ((arg0 ocean-near-constants))
|
||||
(let ((v1-0 *math-camera*))
|
||||
(set! (-> arg0 hmge-scale quad) (-> v1-0 hmge-scale quad))
|
||||
(set! (-> arg0 inv-hmge-scale quad) (-> v1-0 inv-hmge-scale quad))
|
||||
(set! (-> arg0 hvdf-offset quad) (-> v1-0 hvdf-off quad))
|
||||
(set-vector! (-> arg0 fog) (-> v1-0 pfog0) (-> v1-0 fog-min) (-> v1-0 fog-max) 3072.0)
|
||||
)
|
||||
(set-vector! (-> arg0 constants) 0.5 0.5 0.0 0.000010172526)
|
||||
(set-vector! (-> arg0 constants2) 0.5 0.5 1.0 128.0)
|
||||
(set-vector! (-> arg0 constants3) 12288.0 0.125 2.0 0.03125)
|
||||
(set-vector! (-> arg0 constants4) 2.0 255.0 3.0 0.0078125)
|
||||
(let ((v1-5 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-5)
|
||||
(set! (-> arg0 drw-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-5 1)
|
||||
(set! (-> arg0 drw-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-5 2)
|
||||
(set! (-> arg0 drw-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw-fan regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(let ((v1-14 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-14)
|
||||
(set! (-> arg0 drw2-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-14 1)
|
||||
(set! (-> arg0 drw2-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-14 2)
|
||||
(set! (-> arg0 drw2-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw2-fan regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(let ((v1-23 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-23)
|
||||
(set! (-> arg0 env-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-23 1)
|
||||
(set! (-> arg0 env-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-23 2)
|
||||
(set! (-> arg0 env-fan tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x4
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-fan) :iip #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 env-fan regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 drw-adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> arg0 drw-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(let* ((v1-34 *ocean-base-page*)
|
||||
(s4-0 *ocean-base-block*)
|
||||
(s2-0 (* (+ v1-34 8) 32))
|
||||
(s3-0 (* (+ v1-34 10) 32))
|
||||
(a0-18 (-> *display* on-screen))
|
||||
(s5-0 (-> *display* frames a0-18 draw frame1 fbp))
|
||||
)
|
||||
(set! (-> arg0 drw-texture tex0) (new 'static 'gs-tex0 :tbw #x2 :th (log2 128) :tw (log2 128) :tbp0 s4-0))
|
||||
(set! (-> arg0 drw-texture prims 1) (gs-reg64 tex0-1))
|
||||
(set! (-> arg0 drw-texture tex1) (new 'static 'gs-tex1 :mxl #x1 :mmag #x1 :mmin #x5 :l #x1 :k #xeed))
|
||||
(set! (-> arg0 drw-texture prims 3) (gs-reg64 tex1-1))
|
||||
(set! (-> arg0 drw-texture miptbp1)
|
||||
(new 'static 'gs-miptbp :tbw1 #x1 :tbw2 #x1 :tbw3 #x1 :tbp3 (+ s3-0 16) :tbp2 s3-0 :tbp1 s2-0)
|
||||
)
|
||||
(set! (-> arg0 drw-texture prims 5) (gs-reg64 miptbp1-1))
|
||||
(set! (-> arg0 drw-texture clamp) (new 'static 'gs-clamp))
|
||||
(set! (-> arg0 drw-texture clamp-reg) (gs-reg64 clamp-1))
|
||||
(set! (-> arg0 drw-texture alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
(set! (-> arg0 drw-texture prims 9) (gs-reg64 alpha-1))
|
||||
(let ((v1-60 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-60)
|
||||
(set! (-> arg0 drw-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-60 1)
|
||||
(set! (-> arg0 drw-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-60 2)
|
||||
(set! (-> arg0 drw-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw-strip regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 env-adgif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> arg0 env-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(let ((s3-1 (-> arg0 env-texture)))
|
||||
(adgif-shader<-texture-simple! s3-1 (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #x100)))
|
||||
(set! (-> s3-1 alpha) (new 'static 'gs-alpha :b #x2 :c #x1 :d #x1))
|
||||
)
|
||||
(let ((v1-72 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-72)
|
||||
(set! (-> arg0 env-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-72 1)
|
||||
(set! (-> arg0 env-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-72 2)
|
||||
(set! (-> arg0 env-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 env-strip regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 env-color quad) (-> *time-of-day-context* current-sun env-color quad))
|
||||
(set! (-> arg0 drw2-adgif tag) (new 'static 'gif-tag64 :nloop #x2 :eop #x1 :nreg #x1))
|
||||
(set! (-> arg0 drw2-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> arg0 drw2-tex0 dword 0)
|
||||
(logior (logior (logior (the-as uint #x400008000) (shr (shl s4-0 50) 50)) (shr (shl (log2 128) 60) 34))
|
||||
(shr (shl (log2 128) 60) 30)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw2-tex0 dword 1) (the-as uint 6))
|
||||
(set! (-> arg0 drw2-frame dword 0) (logior (the-as uint #xffffff00080000) (shr (shl s5-0 55) 55)))
|
||||
(set! (-> arg0 drw2-frame dword 1) (the-as uint 76))
|
||||
(let ((v1-94 *ocean-subdivide-draw-mode*))
|
||||
(cond
|
||||
((zero? v1-94)
|
||||
(set! (-> arg0 drw2-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-94 1)
|
||||
(set! (-> arg0 drw2-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
((= v1-94 2)
|
||||
(set! (-> arg0 drw2-strip tag)
|
||||
(new 'static 'gif-tag64
|
||||
:nloop #x12
|
||||
:eop #x1
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :abe #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 drw2-strip regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> arg0 drw3-adgif tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
|
||||
(set! (-> arg0 drw3-adgif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> arg0 drw3-frame dword 0) (logior #x80000 (shr (shl s5-0 55) 55)))
|
||||
)
|
||||
(set! (-> arg0 drw3-frame dword 1) (the-as uint 76))
|
||||
(set-vector! (-> arg0 index-table 0) 81 189 0 0)
|
||||
(set-vector! (-> arg0 index-table 1) 54 162 0 0)
|
||||
(set-vector! (-> arg0 index-table 2) 27 135 0 0)
|
||||
(set-vector! (-> arg0 index-table 3) 0 108 0 0)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ocean-near-add-constants
|
||||
;; INFO: Return type mismatch pointer vs none.
|
||||
(defun ocean-near-add-constants ((arg0 dma-buffer))
|
||||
(let* ((a1-0 36)
|
||||
(v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-0))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1)
|
||||
(new 'static 'vif-tag :imm #x3b7 :cmd (vif-cmd unpack-v4-32) :num a1-0)
|
||||
)
|
||||
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16))
|
||||
)
|
||||
(ocean-near-setup-constants (the-as ocean-near-constants (-> arg0 base)))
|
||||
(&+! (-> arg0 base) 576)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ocean-near-add-heights
|
||||
;; INFO: Return type mismatch pointer vs none.
|
||||
(defun ocean-near-add-heights ((arg0 dma-buffer))
|
||||
(let ((v1-0 128)
|
||||
(a1-0 (the-as object *ocean-heights*))
|
||||
)
|
||||
(let* ((a2-0 arg0)
|
||||
(a3-0 (the-as object (-> a2-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a3-0) dma)
|
||||
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (the-as int a1-0) :qwc v1-0)
|
||||
)
|
||||
(set! (-> (the-as dma-packet a3-0) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a3-0) vif1)
|
||||
(new 'static 'vif-tag :imm #x20 :cmd (vif-cmd unpack-v4-32) :num v1-0)
|
||||
)
|
||||
(set! (-> a2-0 base) (&+ (the-as pointer a3-0) 16))
|
||||
)
|
||||
(let ((a2-1 (the-as object (-> arg0 base))))
|
||||
(set! (-> (the-as dma-packet a2-1) dma)
|
||||
(new 'static 'dma-tag :id (dma-tag-id ref) :addr (+ (the-as int a1-0) 2048) :qwc v1-0)
|
||||
)
|
||||
(set! (-> (the-as dma-packet a2-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a2-1) vif1)
|
||||
(new 'static 'vif-tag :imm #xa0 :cmd (vif-cmd unpack-v4-32) :num v1-0)
|
||||
)
|
||||
(set! (-> arg0 base) (&+ (the-as pointer a2-1) 16))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ocean-near-add-matrices
|
||||
;; INFO: Return type mismatch pointer vs none.
|
||||
;; Used lq/sq
|
||||
(defun ocean-near-add-matrices ((arg0 dma-buffer) (arg1 vector))
|
||||
(let ((s5-0 (new-stack-vector0)))
|
||||
(-> *math-camera* camera-rot)
|
||||
(let* ((a2-0 8)
|
||||
(v1-2 arg0)
|
||||
(a0-1 (the-as object (-> v1-2 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a2-0))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1)
|
||||
(new 'static 'vif-tag :imm #x8000 :cmd (vif-cmd unpack-v4-32) :num a2-0)
|
||||
)
|
||||
(set! (-> v1-2 base) (the-as pointer (&+ (the-as vector a0-1) 16)))
|
||||
)
|
||||
(let ((s4-0 (the-as object (-> arg0 base))))
|
||||
(let* ((v1-3 (the-as matrix s4-0))
|
||||
(t0-2 (-> *math-camera* camera-rot))
|
||||
(a0-4 (-> t0-2 vector 0 quad))
|
||||
(a2-4 (-> t0-2 vector 1 quad))
|
||||
(a3-4 (-> t0-2 vector 2 quad))
|
||||
(t0-3 (-> t0-2 vector 3 quad))
|
||||
)
|
||||
(set! (-> v1-3 vector 0 quad) a0-4)
|
||||
(set! (-> v1-3 vector 1 quad) a2-4)
|
||||
(set! (-> v1-3 vector 2 quad) a3-4)
|
||||
(set! (-> v1-3 vector 3 quad) t0-3)
|
||||
)
|
||||
(let ((s3-0 (the-as object (&+ (the-as pointer s4-0) 48))))
|
||||
(vector-matrix*! s5-0 arg1 (-> *math-camera* camera-rot))
|
||||
(set! (-> (the-as vector s3-0) x) (-> s5-0 x))
|
||||
(set! (-> (the-as vector s3-0) y) (-> s5-0 y))
|
||||
(set! (-> (the-as vector s3-0) z) (-> s5-0 z))
|
||||
)
|
||||
(let ((a0-6 (&+ (-> arg0 base) 64)))
|
||||
(ocean-matrix*! (the-as matrix a0-6) (the-as matrix s4-0) (-> *math-camera* perspective))
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! (-> arg0 base) 128)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function ocean-near-add-upload
|
||||
;; INFO: Return type mismatch pointer vs none.
|
||||
;; WARN: Function may read a register that is not set: f31
|
||||
;; Used lq/sq
|
||||
(defun ocean-near-add-upload ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
|
||||
(local-vars
|
||||
(r0-0 int)
|
||||
(r0-1 int)
|
||||
(r0-2 int)
|
||||
(r0-3 int)
|
||||
(r0-4 int)
|
||||
(v1-17 uint128)
|
||||
(v1-18 uint128)
|
||||
(v1-19 float)
|
||||
(a0-18 uint128)
|
||||
(a0-19 uint128)
|
||||
(a0-20 uint128)
|
||||
(a2-23 float)
|
||||
(a2-30 uint128)
|
||||
(a2-31 uint128)
|
||||
(a3-27 uint128)
|
||||
(f31-0 none)
|
||||
)
|
||||
(rlet ((acc :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf10 :class vf)
|
||||
(vf11 :class vf)
|
||||
(vf12 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
(vf7 :class vf)
|
||||
(vf8 :class vf)
|
||||
(vf9 :class vf)
|
||||
)
|
||||
(let ((s2-0 (-> *ocean-work* mid-minx))
|
||||
(s3-0 (-> *ocean-work* mid-minz))
|
||||
)
|
||||
(let ((a1-1 (new-stack-vector0)))
|
||||
(let ((v1-3 (-> *ocean-map* start-corner)))
|
||||
(set! (-> a1-1 x) (+ (-> v1-3 x) (* 98304.0 (the float arg2))))
|
||||
(set! (-> a1-1 y) (-> v1-3 y))
|
||||
(set! (-> a1-1 z) (+ (-> v1-3 z) (* 98304.0 (the float arg1))))
|
||||
)
|
||||
(set! (-> a1-1 w) 1.0)
|
||||
(ocean-near-add-matrices arg0 a1-1)
|
||||
)
|
||||
(let* ((a1-2 8)
|
||||
(v1-5 arg0)
|
||||
(a0-2 (the-as object (-> v1-5 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc a1-2))
|
||||
(set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-packet a0-2) vif1)
|
||||
(new 'static 'vif-tag :imm #x8008 :cmd (vif-cmd unpack-v4-32) :num a1-2)
|
||||
)
|
||||
(set! (-> v1-5 base) (&+ (the-as pointer a0-2) 16))
|
||||
)
|
||||
(let* ((v1-6 (-> arg0 base))
|
||||
(a0-5 (- arg2 (* s2-0 4)))
|
||||
(a1-7 (- arg1 (* s3-0 4)))
|
||||
(a2-5 (shr a0-5 2))
|
||||
(a3-2 (shr a1-7 2))
|
||||
(a0-6 (logand a0-5 3))
|
||||
(a1-8 (logand a1-7 3))
|
||||
(a2-9 (-> (the-as (pointer int16) (+ (* (+ (* a3-2 4) a2-5) 2) (the-as uint *ocean-work*))) 1550))
|
||||
(a3-8 (-> *ocean-map* ocean-near-indices data a2-9))
|
||||
(a0-12
|
||||
(-> *ocean-map*
|
||||
ocean-mid-masks
|
||||
data
|
||||
(-> (the-as (pointer int16) (+ (* (+ (* a1-8 4) a0-6) 2) (the-as uint a3-8))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set-vector!
|
||||
(the-as vector4w (&+ v1-6 0))
|
||||
(the-as int (-> a0-12 mask 0))
|
||||
(the-as int (-> a0-12 mask 1))
|
||||
(the-as int (-> a0-12 mask 2))
|
||||
(the-as int (-> a0-12 mask 3))
|
||||
)
|
||||
(set-vector!
|
||||
(the-as vector4w (&+ v1-6 16))
|
||||
(the-as int (-> a0-12 mask 4))
|
||||
(the-as int (-> a0-12 mask 5))
|
||||
(the-as int (-> a0-12 mask 6))
|
||||
(the-as int (-> a0-12 mask 7))
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! (-> arg0 base) 32)
|
||||
(let ((a0-14 (/ (the-as int arg2) 4))
|
||||
(v1-10 (/ (the-as int arg1) 4))
|
||||
(a2-18 (logand arg2 3))
|
||||
(a3-9 (logand arg1 3))
|
||||
)
|
||||
(let ((t0-0 (-> arg0 base))
|
||||
(a1-15 (logand (+ arg2 1) 3))
|
||||
(t1-1 (logand (+ arg1 1) 3))
|
||||
)
|
||||
(set-vector!
|
||||
(the-as vector4w (&+ t0-0 0))
|
||||
(the-as int (+ (* a3-9 64) (* a2-18 2)))
|
||||
(the-as int (+ (* a3-9 64) (* a1-15 2)))
|
||||
(the-as int (+ (* t1-1 64) (* a2-18 2)))
|
||||
(the-as int (+ (* t1-1 64) (* a1-15 2)))
|
||||
)
|
||||
)
|
||||
(&+! (-> arg0 base) 16)
|
||||
(set-vector!
|
||||
(the-as vector (&+ (-> arg0 base) 0))
|
||||
(* 0.25 (the float a2-18))
|
||||
(* 0.25 (the float a3-9))
|
||||
1.0
|
||||
0.0
|
||||
)
|
||||
(&+! (-> arg0 base) 16)
|
||||
(let ((a1-24 (the-as object (-> arg0 base))))
|
||||
(let ((a2-19 (+ (* 5 (the-as int a3-9)) a2-18)))
|
||||
(.lvf vf5 (&-> (&-> *ocean-trans-corner-table* 0 quad a2-19) 0))
|
||||
(.lvf vf6 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ a2-19 1)) 0))
|
||||
(.lvf vf7 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ a2-19 5)) 0))
|
||||
(.lvf vf8 (&-> (&-> *ocean-trans-corner-table* 0 quad (+ a2-19 6)) 0))
|
||||
)
|
||||
(.mov a2-23 vf8)
|
||||
(let ((a2-29 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 v1-10) a0-14))))
|
||||
(a3-26 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ a0-14 1 (* 52 v1-10)))))
|
||||
(t0-15 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (+ v1-10 1)) a0-14))))
|
||||
(v1-16 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ a0-14 1 (* 52 (+ v1-10 1))))))
|
||||
)
|
||||
(.pextlb a0-18 0 a2-29)
|
||||
(.mov r0-0 f31-0)
|
||||
(.pextlb a2-30 0 a3-26)
|
||||
(.mov r0-1 f31-0)
|
||||
(.pextlb a3-27 0 t0-15)
|
||||
(.mov r0-2 f31-0)
|
||||
(.pextlb v1-17 0 v1-16)
|
||||
)
|
||||
(.mov r0-3 f31-0)
|
||||
(.pextlh a0-19 0 a0-18)
|
||||
(.mov r0-4 f31-0)
|
||||
(.pextlh a2-31 0 a2-30)
|
||||
(.mov vf1 a0-19)
|
||||
(.pextlh a0-20 0 a3-27)
|
||||
(.mov vf2 a2-31)
|
||||
(.pextlh v1-18 0 v1-17)
|
||||
(.mov vf3 a0-20)
|
||||
(nop!)
|
||||
(.mov vf4 v1-18)
|
||||
(.itof.vf vf1 vf1)
|
||||
(nop!)
|
||||
(.itof.vf vf2 vf2)
|
||||
(nop!)
|
||||
(.itof.vf vf3 vf3)
|
||||
(nop!)
|
||||
(.itof.vf vf4 vf4)
|
||||
(nop!)
|
||||
(.mul.x.vf acc vf1 vf5)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf5 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf5 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf9 vf4 vf5 acc)
|
||||
(nop!)
|
||||
(.mul.x.vf acc vf1 vf6)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf6 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf6 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf10 vf4 vf6 acc)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 0 quad) vf9)
|
||||
(.mul.x.vf acc vf1 vf7)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf7 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf7 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf11 vf4 vf7 acc)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 1 quad) vf10)
|
||||
(.mul.x.vf acc vf1 vf8)
|
||||
(nop!)
|
||||
(.add.mul.y.vf acc vf2 vf8 acc)
|
||||
(nop!)
|
||||
(.add.mul.z.vf acc vf3 vf8 acc)
|
||||
(nop!)
|
||||
(.add.mul.w.vf vf12 vf4 vf8 acc)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 2 quad) vf11)
|
||||
(nop!)
|
||||
(.svf (&-> (the-as (inline-array vector) a1-24) 3 quad) vf12)
|
||||
)
|
||||
)
|
||||
(.mov v1-19 vf12)
|
||||
(&+! (-> arg0 base) 64)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function draw-ocean-near
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defun draw-ocean-near ((arg0 dma-buffer))
|
||||
(let* ((v1-0 arg0)
|
||||
(a0-1 (the-as object (-> v1-0 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-1) dma) (new 'static 'dma-tag :qwc #x2 :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-1) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet a0-1) vif1) (new 'static 'vif-tag :imm #x2 :cmd (vif-cmd direct) :msk #x1))
|
||||
(set! (-> v1-0 base) (the-as pointer (&+ (the-as dma-packet a0-1) 16)))
|
||||
)
|
||||
(let* ((v1-1 arg0)
|
||||
(a0-3 (the-as object (-> v1-1 base)))
|
||||
)
|
||||
(set! (-> (the-as gs-gif-tag a0-3) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x1))
|
||||
(set! (-> (the-as gs-gif-tag a0-3) regs)
|
||||
(new 'static 'gif-tag-regs
|
||||
:regs0 (gif-reg-id a+d)
|
||||
:regs1 (gif-reg-id a+d)
|
||||
:regs2 (gif-reg-id a+d)
|
||||
:regs3 (gif-reg-id a+d)
|
||||
:regs4 (gif-reg-id a+d)
|
||||
:regs5 (gif-reg-id a+d)
|
||||
:regs6 (gif-reg-id a+d)
|
||||
:regs7 (gif-reg-id a+d)
|
||||
:regs8 (gif-reg-id a+d)
|
||||
:regs9 (gif-reg-id a+d)
|
||||
:regs10 (gif-reg-id a+d)
|
||||
:regs11 (gif-reg-id a+d)
|
||||
:regs12 (gif-reg-id a+d)
|
||||
:regs13 (gif-reg-id a+d)
|
||||
:regs14 (gif-reg-id a+d)
|
||||
:regs15 (gif-reg-id a+d)
|
||||
)
|
||||
)
|
||||
(set! (-> v1-1 base) (the-as pointer (the-as dma-packet (&+ (the-as pointer a0-3) 16))))
|
||||
)
|
||||
(let* ((v1-2 arg0)
|
||||
(a0-5 (the-as object (-> v1-2 base)))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-test) a0-5) 0)
|
||||
(new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal))
|
||||
)
|
||||
(set! (-> (the-as (pointer gs-reg64) a0-5) 1) (gs-reg64 test-1))
|
||||
(set! (-> v1-2 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-5) 16))))
|
||||
)
|
||||
(dma-buffer-add-vu-function arg0 ocean-near-block 1)
|
||||
(let* ((v1-3 arg0)
|
||||
(a0-8 (the-as object (-> v1-3 base)))
|
||||
)
|
||||
(set! (-> (the-as dma-packet a0-8) dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-packet a0-8) vif0) (new 'static 'vif-tag :cmd (vif-cmd base)))
|
||||
(set! (-> (the-as dma-packet a0-8) vif1) (new 'static 'vif-tag :imm #x10 :cmd (vif-cmd offset)))
|
||||
(set! (-> v1-3 base) (the-as pointer (the-as dma-packet (&+ (the-as dma-packet a0-8) 16))))
|
||||
)
|
||||
(ocean-near-add-constants arg0)
|
||||
(ocean-near-add-heights arg0)
|
||||
(ocean-near-add-call arg0 0)
|
||||
(let ((s5-0 (-> *ocean-work* near-minx))
|
||||
(s4-0 (-> *ocean-work* near-maxx))
|
||||
(s3-0 (-> *ocean-work* near-minz))
|
||||
(s2-0 (-> *ocean-work* near-maxz))
|
||||
)
|
||||
(when (and (< s5-0 s4-0) (< s3-0 s2-0))
|
||||
(while (>= s2-0 s3-0)
|
||||
(let ((s1-0 s5-0)
|
||||
(s0-0 s4-0)
|
||||
)
|
||||
(while (>= s0-0 s1-0)
|
||||
(when (ocean-trans-camera-masks-bit? s3-0 s1-0)
|
||||
(let* ((a1-13 (- (shr s1-0 2) (-> *ocean-work* mid-minx)))
|
||||
(a2-1 (- (shr s3-0 2) (-> *ocean-work* mid-minz)))
|
||||
(v1-13 (logand s1-0 3))
|
||||
(a0-19 (logand s3-0 3))
|
||||
(a1-17 (-> (the-as (pointer int16) (+ (* (+ (* a2-1 4) a1-13) 2) (the-as uint *ocean-work*))) 1550))
|
||||
)
|
||||
(when (>= a1-17 0)
|
||||
(let ((a1-19 (-> *ocean-map* ocean-near-indices data a1-17)))
|
||||
(when (>= (-> (the-as (pointer int16) (+ (* (+ (* a0-19 4) v1-13) 2) (the-as uint a1-19)))) 0)
|
||||
(ocean-near-add-upload arg0 s3-0 s1-0)
|
||||
(ocean-near-add-call arg0 39)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(+! s1-0 1)
|
||||
)
|
||||
)
|
||||
(+! s3-0 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -108,17 +108,27 @@ TEST(VuDisasm, OceanTexture) {
|
||||
TEST(VuDisasm, OceanMid) {
|
||||
auto data = get_test_data("ocean-mid");
|
||||
VuDisassembler disasm(VuDisassembler::VuKind::VU1);
|
||||
/*
|
||||
disasm.add_label_with_name(41, "JUMP_41");
|
||||
disasm.add_label_with_name(43, "JUMP_43");
|
||||
disasm.add_label_with_name(46, "JUMP_46");
|
||||
disasm.add_label_with_name(73, "JUMP_73");
|
||||
disasm.add_label_with_name(107, "JUMP_107");
|
||||
disasm.add_label_with_name(275, "JUMP_275");
|
||||
*/
|
||||
|
||||
auto prog = disasm.disassemble(data.data(), data.size() * 4, false);
|
||||
EXPECT_EQ(disasm.to_string(prog), get_expected("ocean-mid"));
|
||||
}
|
||||
|
||||
// TEST(VuDisasm, OceanNear) {
|
||||
// auto data = get_test_data("ocean-near");
|
||||
// VuDisassembler disasm(VuDisassembler::VuKind::VU1);
|
||||
// auto prog = disasm.disassemble(data.data(), data.size() * 4, false);
|
||||
// fmt::print("{}\n", disasm.to_string(prog));
|
||||
// // EXPECT_EQ(disasm.to_string(prog), get_expected("ocean-mid"));
|
||||
// }
|
||||
TEST(VuDisasm, OceanNear) {
|
||||
auto data = get_test_data("ocean-near");
|
||||
VuDisassembler disasm(VuDisassembler::VuKind::VU1);
|
||||
// disasm.add_label_with_name(39, "JUMP_39");
|
||||
auto prog = disasm.disassemble(data.data(), data.size() * 4, false);
|
||||
// fmt::print("{}\n", disasm.to_string_with_cpp(prog, false));
|
||||
EXPECT_EQ(disasm.to_string(prog), get_expected("ocean-near"));
|
||||
}
|
||||
|
||||
TEST(VuDisasm, Sky) {
|
||||
auto data = get_test_data("sky");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user