summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Koƛcielnicki <koriakin@0x04.net>2016-12-28 21:13:52 +0000
committerMarcin Koƛcielnicki <koriakin@0x04.net>2016-12-28 21:13:52 +0000
commit7b6eeaf220f515dfd8d22cb58e2d4cf4f42cb53b (patch)
treecd4c7a758cccd80965c0e8f1d47640b404291600
parent3f53d5e6c164b9e13fcfeacda69bc4e9e671e03e (diff)
hwtest/pgraph: Mostly test EmuD3D56 and EmuEmuD3D0 tlv_[uv] methods.
-rw-r--r--hwtest/pgraph_class_celsius.cc8
-rw-r--r--hwtest/pgraph_class_emu_d3d56.cc92
-rw-r--r--hwtest/pgraph_state.cc16
-rw-r--r--include/nvhw/pgraph.h2
4 files changed, 95 insertions, 23 deletions
diff --git a/hwtest/pgraph_class_celsius.cc b/hwtest/pgraph_class_celsius.cc
index 8fad85b6..a56cee51 100644
--- a/hwtest/pgraph_class_celsius.cc
+++ b/hwtest/pgraph_class_celsius.cc
@@ -2949,7 +2949,7 @@ class MthdCelsiusMatrix : public SingleMthdTest {
exp.celsius_pipe_junk[idx & 3] = val;
if ((idx & 3) == 3) {
for (int i = 0; i < 4; i++)
- exp.celsius_pipe_xfer[which * 4 + (idx >> 2)][i] = exp.celsius_pipe_junk[i];
+ exp.celsius_pipe_xfrm[which * 4 + (idx >> 2)][i] = exp.celsius_pipe_junk[i];
}
}
}
@@ -2979,7 +2979,7 @@ class MthdCelsiusXfrm : public SingleMthdTest {
exp.celsius_pipe_junk[idx] = val;
if (idx == 3) {
for (int i = 0; i < 4; i++)
- exp.celsius_pipe_xfer[which][i] = exp.celsius_pipe_junk[i];
+ exp.celsius_pipe_xfrm[which][i] = exp.celsius_pipe_junk[i];
}
}
}
@@ -3009,7 +3009,7 @@ class MthdCelsiusXfrm3 : public SingleMthdTest {
exp.celsius_pipe_junk[idx] = val;
if (idx == 2) {
for (int i = 0; i < 4; i++)
- exp.celsius_pipe_xfer[which][i] = exp.celsius_pipe_junk[i];
+ exp.celsius_pipe_xfrm[which][i] = exp.celsius_pipe_junk[i];
}
}
}
@@ -3030,7 +3030,7 @@ class MthdCelsiusXfrmFree : public SingleMthdTest {
exp.celsius_pipe_junk[idx] = val;
if (idx == 3) {
for (int i = 0; i < 4; i++)
- exp.celsius_pipe_xfer[which][i] = exp.celsius_pipe_junk[i];
+ exp.celsius_pipe_xfrm[which][i] = exp.celsius_pipe_junk[i];
}
}
}
diff --git a/hwtest/pgraph_class_emu_d3d56.cc b/hwtest/pgraph_class_emu_d3d56.cc
index 845d8c10..b1f63c15 100644
--- a/hwtest/pgraph_class_emu_d3d56.cc
+++ b/hwtest/pgraph_class_emu_d3d56.cc
@@ -1017,6 +1017,78 @@ class MthdEmuD3D56TlvW : public SingleMthdTest {
using SingleMthdTest::SingleMthdTest;
};
+class MthdEmuD3D56TlvUv : public SingleMthdTest {
+ int which_uv, which_vtx;
+ bool fin;
+ void adjust_orig_mthd() override {
+ if (fin)
+ insrt(orig.notify, 0, 1, 0);
+ if (cls == 0x48 && fin) {
+ // XXX: test me
+ exp.valid[0] = 0;
+ exp.valid[1] = 0;
+ }
+ if (rnd() & 1) {
+ insrt(val, 0, 23, 0);
+ val ^= 1 << (rnd() & 0x1f);
+ }
+ }
+ bool is_valid_val() override {
+ if (cls == 0x48) {
+ int e = extr(val, 23, 8);
+ if (e > 0x7f + 10)
+ return false;
+ }
+ return true;
+ }
+ void emulate_mthd() override {
+ if (!extr(exp.nsource, 1, 1)) {
+ if (chipset.chipset != 0x10)
+ exp.celsius_pipe_vtx[(3 + which_vtx) * 4 + 1] = 0;
+ exp.celsius_pipe_vtx[(3 + which_vtx) * 4 + 2] = 0;
+ exp.celsius_pipe_vtx[(3 + which_vtx) * 4 + 3] = 0x3f800000;
+ exp.celsius_pipe_vtx[(3 + which_vtx) * 4 + which_uv] = val;
+ }
+ int vidx = (cls == 0x48 ? extr(exp.misc24[2], 0, 4) : idx);
+ if (!which_uv || !which_vtx)
+ insrt(exp.valid[1], 6 + which_vtx * 2 + which_uv, 1, 1);
+ if (fin) {
+ // XXX: test this thing
+ skip = true;
+ uint32_t msk = (cls == 0x55 || cls == 0x95 ? 0x1ff : 0x7f);
+ int ovidx = extr(exp.valid[0], 16, 4);
+ if ((exp.valid[1] & msk) == msk) {
+ insrt(exp.valid[0], vidx, 1, 1);
+ if (cls != 0x48)
+ insrt(exp.valid[0], 16, 4, vidx);
+ exp.valid[1] &= ~msk;
+ } else if (!extr(exp.valid[0], ovidx, 1)) {
+ nv04_pgraph_blowup(&exp, 0x4000);
+ }
+ // sounds buggy...
+ if (extr(exp.debug[3], 5, 1) && cls != 0x48)
+ vidx = extr(exp.valid[0], 16, 4);
+ if (cls == 0x55) {
+ vidx &= 7;
+ // ...
+ } else {
+ // ...
+ }
+ if (cls == 0x48) {
+ // XXX
+ skip = true;
+ }
+ if (!extr(exp.surf_format, 8, 4) && extr(exp.debug[3], 22, 1))
+ nv04_pgraph_blowup(&exp, 0x0200);
+ } else {
+ insrt(exp.valid[0], vidx, 1, 0);
+ }
+ }
+public:
+ MthdEmuD3D56TlvUv(hwtest::TestOptions &opt, uint32_t seed, const std::string &name, int trapbit, uint32_t cls, uint32_t mthd, uint32_t num, uint32_t stride, int which_vtx, int which_uv, bool fin)
+ : SingleMthdTest(opt, seed, name, trapbit, cls, mthd, num, stride), which_uv(which_uv), which_vtx(which_vtx), fin(fin) {}
+};
+
std::vector<SingleMthdTest *> EmuEmuD3D0::mthds() {
return {
new MthdNop(opt, rnd(), "nop", -1, cls, 0x100),
@@ -1040,8 +1112,8 @@ std::vector<SingleMthdTest *> EmuEmuD3D0::mthds() {
new MthdEmuD3D56TlvY(opt, rnd(), "tlv_y", 15, cls, 0x100c, 0x80, 0x20),
new MthdEmuD3D56TlvZ(opt, rnd(), "tlv_z", 16, cls, 0x1010, 0x80, 0x20),
new MthdEmuD3D56TlvW(opt, rnd(), "tlv_rhw", 17, cls, 0x1014, 0x80, 0x20),
- new UntestedMthd(opt, rnd(), "tlv_u", -1, cls, 0x1018, 0x80, 0x20),
- new UntestedMthd(opt, rnd(), "tlv_v", -1, cls, 0x101c, 0x80, 0x20),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_u", 18, cls, 0x1018, 0x80, 0x20, 0, 0, false),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_v", 19, cls, 0x101c, 0x80, 0x20, 0, 1, true),
};
}
@@ -1067,9 +1139,9 @@ std::vector<SingleMthdTest *> EmuD3D5::mthds() {
new MthdEmuD3D56TlvW(opt, rnd(), "tlv_rhw", 15, cls, 0x40c, 0x10, 0x20),
new MthdEmuD3D56TlvColor(opt, rnd(), "tlv_color", 16, cls, 0x410, 0x10, 0x20),
new MthdEmuD3D56TlvFogCol1(opt, rnd(), "tlv_fog_col1", 17, cls, 0x414, 0x10, 0x20),
- new UntestedMthd(opt, rnd(), "unk", -1, cls, 0x418, 0x10, 0x20),
- new UntestedMthd(opt, rnd(), "unk", -1, cls, 0x41c, 0x10, 0x20),
- new UntestedMthd(opt, rnd(), "draw", -1, cls, 0x600, 0x40),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_u", 18, cls, 0x418, 0x10, 0x20, 0, 0, false),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_v", 19, cls, 0x41c, 0x10, 0x20, 0, 1, true),
+ new UntestedMthd(opt, rnd(), "draw", 20, cls, 0x600, 0x40),
};
}
@@ -1104,11 +1176,11 @@ std::vector<SingleMthdTest *> EmuD3D6::mthds() {
new MthdEmuD3D56TlvW(opt, rnd(), "tlv_rhw", 24, cls, 0x40c, 8, 0x28),
new MthdEmuD3D56TlvColor(opt, rnd(), "tlv_color", 25, cls, 0x410, 8, 0x28),
new MthdEmuD3D56TlvFogCol1(opt, rnd(), "tlv_fog_col1", 26, cls, 0x414, 8, 0x28),
- new UntestedMthd(opt, rnd(), "unk", -1, cls, 0x418, 8, 0x28),
- new UntestedMthd(opt, rnd(), "unk", -1, cls, 0x41c, 8, 0x28),
- new UntestedMthd(opt, rnd(), "unk", -1, cls, 0x420, 8, 0x28),
- new UntestedMthd(opt, rnd(), "unk", -1, cls, 0x424, 8, 0x28),
- new UntestedMthd(opt, rnd(), "draw", -1, cls, 0x540, 0x30),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_u_0", 27, cls, 0x418, 8, 0x28, 0, 0, false),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_v_0", 28, cls, 0x41c, 8, 0x28, 0, 1, false),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_u_1", 29, cls, 0x420, 8, 0x28, 1, 0, false),
+ new MthdEmuD3D56TlvUv(opt, rnd(), "tlv_v_1", 30, cls, 0x424, 8, 0x28, 1, 1, true),
+ new UntestedMthd(opt, rnd(), "draw", 31, cls, 0x540, 0x30),
};
}
diff --git a/hwtest/pgraph_state.cc b/hwtest/pgraph_state.cc
index 52d79f4c..b69856ef 100644
--- a/hwtest/pgraph_state.cc
+++ b/hwtest/pgraph_state.cc
@@ -868,7 +868,7 @@ void pgraph_gen_state_celsius(int cnum, std::mt19937 &rnd, struct pgraph_state *
state->celsius_pipe_junk[i] = rnd();
for (int i = 0; i < 0x3c; i++)
for (int j = 0; j < 4; j++) {
- state->celsius_pipe_xfer[i][j] = rnd();
+ state->celsius_pipe_xfrm[i][j] = rnd();
}
for (int i = 0; i < 0x30; i++)
for (int j = 0; j < 3; j++) {
@@ -887,10 +887,10 @@ void pgraph_gen_state_celsius(int cnum, std::mt19937 &rnd, struct pgraph_state *
state->celsius_pipe_light_sc[0] = 0x3f800000;
state->celsius_pipe_light_sd[0] = 0;
if (state->chipset.chipset == 0x10) {
- state->celsius_pipe_xfer[59][0] = 0;
- state->celsius_pipe_xfer[59][1] = 0;
- state->celsius_pipe_xfer[59][2] = 0;
- state->celsius_pipe_xfer[59][3] = 0;
+ state->celsius_pipe_xfrm[59][0] = 0;
+ state->celsius_pipe_xfrm[59][1] = 0;
+ state->celsius_pipe_xfrm[59][2] = 0;
+ state->celsius_pipe_xfrm[59][3] = 0;
state->celsius_pipe_light_v[47][0] = 0;
state->celsius_pipe_light_v[47][1] = 0;
state->celsius_pipe_light_v[47][2] = 0;
@@ -1089,7 +1089,7 @@ void pgraph_load_celsius(int cnum, struct pgraph_state *state) {
}
pgraph_load_pipe(cnum, 0x4400, state->celsius_pipe_vtx, 0x1c);
for (int i = 0; i < 0x3c; i++) {
- pgraph_load_pipe(cnum, 0x6400 + i * 0x10, state->celsius_pipe_xfer[i], 4);
+ pgraph_load_pipe(cnum, 0x6400 + i * 0x10, state->celsius_pipe_xfrm[i], 4);
}
for (int i = 0; i < 0x30; i++) {
pgraph_load_pipe(cnum, 0x6800 + i * 0x10, state->celsius_pipe_light_v[i], 3);
@@ -1382,7 +1382,7 @@ void pgraph_dump_celsius_pipe(int cnum, struct pgraph_state *state) {
pgraph_dump_pipe(cnum, 0x4400, state->celsius_pipe_vtx, 0x1c);
pgraph_dump_pipe(cnum, 0x4470, state->celsius_pipe_junk, 4);
for (int i = 0; i < 0x3c; i++) {
- pgraph_dump_pipe(cnum, 0x6400 + i * 0x10, state->celsius_pipe_xfer[i], 4);
+ pgraph_dump_pipe(cnum, 0x6400 + i * 0x10, state->celsius_pipe_xfrm[i], 4);
}
for (int i = 0; i < 0x30; i++) {
pgraph_dump_pipe(cnum, 0x6800 + i * 0x10, state->celsius_pipe_light_v[i], 3);
@@ -1706,7 +1706,7 @@ restart:
CMP(celsius_pipe_junk[i], "CELSIUS_PIPE_JUNK[%d]", i)
for (int i = 0; i < 0x3c; i++) {
for (int j = 0; j < 4; j++)
- CMP(celsius_pipe_xfer[i][j], "CELSIUS_PIPE_XFER[%d][%d]", i, j)
+ CMP(celsius_pipe_xfrm[i][j], "CELSIUS_PIPE_XFRM[%d][%d]", i, j)
}
for (int i = 0; i < 0x30; i++) {
for (int j = 0; j < 3; j++)
diff --git a/include/nvhw/pgraph.h b/include/nvhw/pgraph.h
index 932fef8f..4938869f 100644
--- a/include/nvhw/pgraph.h
+++ b/include/nvhw/pgraph.h
@@ -220,7 +220,7 @@ struct pgraph_state {
uint32_t celsius_config_c;
uint32_t celsius_dma;
uint32_t celsius_pipe_vtx[0x1c];
- uint32_t celsius_pipe_xfer[0x3c][4];
+ uint32_t celsius_pipe_xfrm[0x3c][4];
uint32_t celsius_pipe_light_v[0x30][3];
uint32_t celsius_pipe_light_sa[3];
uint32_t celsius_pipe_light_sb[19];