diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-29 23:29:36 +0000 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-29 23:29:36 +0000 |
commit | aecd4221f2e493a6cb5c76a383ec84f68f6383b7 (patch) | |
tree | 23395f1536083d679ce533a10d6f1efe8c40cda6 | |
parent | 89d3fc5a24d8fc9da0b5b24c29763e6a9b5ffafe (diff) |
hwtest/pgraph: Model Celsius PIPE ovtx state.
-rw-r--r-- | hwtest/pgraph_class_celsius.cc | 296 | ||||
-rw-r--r-- | hwtest/pgraph_class_emu_d3d56.cc | 152 | ||||
-rw-r--r-- | hwtest/pgraph_state.cc | 159 | ||||
-rw-r--r-- | hwtest/pgraph_state_tests.cc | 1 | ||||
-rw-r--r-- | include/nvhw/pgraph.h | 5 | ||||
-rw-r--r-- | nvhw/pgraph_celsius.c | 32 |
6 files changed, 317 insertions, 328 deletions
diff --git a/hwtest/pgraph_class_celsius.cc b/hwtest/pgraph_class_celsius.cc index cbf5b478..317ef9de 100644 --- a/hwtest/pgraph_class_celsius.cc +++ b/hwtest/pgraph_class_celsius.cc @@ -134,9 +134,7 @@ class MthdCelsiusTexOffset : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_offset[idx] = val; - exp.celsius_pipe_junk[0] = idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_offset[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, idx, val); } insrt(exp.valid[1], idx ? 22 : 14, 1, 1); } @@ -230,9 +228,7 @@ class MthdCelsiusTexFormat : public SingleMthdTest { insrt(rval, 12, 4, mips); if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_format[idx] = rval | (exp.celsius_tex_format[idx] & 8); - exp.celsius_pipe_junk[0] = 0x10 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_format[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 4 + idx, exp.celsius_tex_format[idx]); } insrt(exp.valid[1], idx ? 21 : 15, 1, 1); } @@ -256,9 +252,7 @@ class MthdCelsiusTexControl : public SingleMthdTest { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_control[idx] = val & 0x7fffffff; insrt(exp.celsius_xf_misc_b, idx ? 14 : 0, 1, extr(val, 30, 1)); - exp.celsius_pipe_junk[0] = 0x18 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_control[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 6 + idx, exp.celsius_tex_control[idx]); if (!extr(exp.debug[3], 28, 1)) { exp.celsius_pipe_junk[2] = exp.celsius_xf_misc_a; exp.celsius_pipe_junk[3] = exp.celsius_xf_misc_b; @@ -292,9 +286,7 @@ class MthdCelsiusTexPitch : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_pitch[idx] = val & 0xffff0000; - exp.celsius_pipe_junk[0] = 0x20 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_pitch[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 8 + idx, exp.celsius_tex_pitch[idx]); } } using SingleMthdTest::SingleMthdTest; @@ -309,9 +301,7 @@ class MthdCelsiusTexUnk238 : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_unk238[idx] = val; - exp.celsius_pipe_junk[0] = 0x28 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_unk238[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0xa + idx, exp.celsius_tex_unk238[idx]); } } using SingleMthdTest::SingleMthdTest; @@ -353,9 +343,7 @@ class MthdCelsiusTexRect : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_rect[idx] = val & 0x07ff07ff; - exp.celsius_pipe_junk[0] = 0x30 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_rect[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0xc + idx, exp.celsius_tex_rect[idx]); } } using SingleMthdTest::SingleMthdTest; @@ -393,9 +381,7 @@ class MthdCelsiusTexFilter : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_filter[idx] = val & 0x77001fff; - exp.celsius_pipe_junk[0] = 0x38 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_filter[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0xe + idx, exp.celsius_tex_filter[idx]); } insrt(exp.valid[1], idx ? 23 : 16, 1, 1); } @@ -423,9 +409,7 @@ class MthdCelsiusTexPalette : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_palette[idx] = val & 0xffffffc1; - exp.celsius_pipe_junk[0] = 8 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_palette[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 2 + idx, exp.celsius_tex_palette[idx]); } } using SingleMthdTest::SingleMthdTest; @@ -468,9 +452,7 @@ class MthdCelsiusRcInAlpha : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_in[0][idx] = val; - exp.celsius_pipe_junk[0] = 0x40 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_rc_in[0][idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x10 + idx, exp.celsius_rc_in[0][idx]); } } using SingleMthdTest::SingleMthdTest; @@ -513,9 +495,7 @@ class MthdCelsiusRcInColor : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_in[1][idx] = val; - exp.celsius_pipe_junk[0] = 0x48 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_rc_in[1][idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x12 + idx, exp.celsius_rc_in[1][idx]); } } using SingleMthdTest::SingleMthdTest; @@ -530,9 +510,7 @@ class MthdCelsiusRcFactor : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_factor[idx] = val; - exp.celsius_pipe_junk[0] = 0x50 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_rc_factor[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x14 + idx, exp.celsius_rc_factor[idx]); } } using SingleMthdTest::SingleMthdTest; @@ -588,9 +566,7 @@ class MthdCelsiusRcOutAlpha : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_out[0][idx] = val & 0x3cfff; - exp.celsius_pipe_junk[0] = 0x58 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_rc_out[0][idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x16 + idx, exp.celsius_rc_out[0][idx]); } } using SingleMthdTest::SingleMthdTest; @@ -660,9 +636,7 @@ class MthdCelsiusRcOutColor : public SingleMthdTest { } if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_out[1][idx] = rval; - exp.celsius_pipe_junk[0] = 0x60 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_rc_out[1][idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x18 + idx, exp.celsius_rc_out[1][idx]); } } using SingleMthdTest::SingleMthdTest; @@ -696,9 +670,7 @@ class MthdCelsiusRcFinal0 : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_final[0] = val & 0x3f3f3f3f; - exp.celsius_pipe_junk[0] = 0x68; - exp.celsius_pipe_junk[1] = exp.celsius_rc_final[0]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1a, exp.celsius_rc_final[0]); } } using SingleMthdTest::SingleMthdTest; @@ -732,9 +704,7 @@ class MthdCelsiusRcFinal1 : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_final[1] = val & 0x3f3f3fe0; - exp.celsius_pipe_junk[0] = 0x6c; - exp.celsius_pipe_junk[1] = exp.celsius_rc_final[1]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1b, exp.celsius_rc_final[1]); } } using SingleMthdTest::SingleMthdTest; @@ -774,10 +744,10 @@ class MthdCelsiusConfig : public SingleMthdTest { insrt(exp.celsius_config_b, 10, 4, extr(val, 8, 4)); if (nv04_pgraph_is_nv17p(&chipset)) insrt(exp.celsius_config_b, 14, 2, extr(val, 28, 2)); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); insrt(exp.celsius_raster, 29, 1, extr(val, 12, 1)); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } using SingleMthdTest::SingleMthdTest; @@ -971,10 +941,8 @@ class MthdCelsiusFogEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_b, 8, 1, val); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); insrt(exp.celsius_xf_misc_b, 31, 1, val); - exp.celsius_pipe_junk[0] = 0x7c; - exp.celsius_pipe_junk[1] = exp.celsius_config_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); if (!extr(exp.debug[3], 28, 1)) { exp.celsius_pipe_junk[2] = exp.celsius_xf_misc_a; exp.celsius_pipe_junk[3] = exp.celsius_xf_misc_b; @@ -1005,9 +973,7 @@ class MthdCelsiusFogColor : public SingleMthdTest { insrt(exp.celsius_fog_color, 8, 8, extr(val, 8, 8)); insrt(exp.celsius_fog_color, 16, 8, extr(val, 0, 8)); insrt(exp.celsius_fog_color, 24, 8, extr(val, 24, 8)); - exp.celsius_pipe_junk[0] = 0x8c; - exp.celsius_pipe_junk[1] = exp.celsius_fog_color; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x23, exp.celsius_fog_color); } } insrt(exp.valid[1], 13, 1, 1); @@ -1032,9 +998,7 @@ class MthdCelsiusTexColorKey : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_color_key[idx] = val; - exp.celsius_pipe_junk[0] = 0xa0 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_color_key[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x28 + idx, exp.celsius_tex_color_key[idx]); } } if (idx == 0) @@ -1158,9 +1122,7 @@ class MthdCelsiusAlphaFuncEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 12, 1, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -1201,9 +1163,7 @@ class MthdCelsiusBlendFuncEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_blend, 3, 1, val); - exp.celsius_pipe_junk[0] = 0x80; - exp.celsius_pipe_junk[1] = exp.celsius_blend; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x20, exp.celsius_blend); } } } @@ -1244,9 +1204,7 @@ class MthdCelsiusCullFaceEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 28, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -1287,9 +1245,7 @@ class MthdCelsiusDepthTestEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 14, 1, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -1330,9 +1286,7 @@ class MthdCelsiusDitherEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 22, 1, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -1414,10 +1368,8 @@ class MthdCelsiusPointParamsEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_b, 9, 1, val); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); insrt(exp.celsius_xf_misc_a, 25, 1, val); - exp.celsius_pipe_junk[0] = 0x7c; - exp.celsius_pipe_junk[1] = exp.celsius_config_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); if (!extr(exp.debug[3], 28, 1)) { exp.celsius_pipe_junk[2] = exp.celsius_xf_misc_a; exp.celsius_pipe_junk[3] = exp.celsius_xf_misc_b; @@ -1462,9 +1414,7 @@ class MthdCelsiusPointSmoothEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 9, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -1505,9 +1455,7 @@ class MthdCelsiusLineSmoothEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 10, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -1548,9 +1496,7 @@ class MthdCelsiusPolygonSmoothEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 11, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -1632,9 +1578,7 @@ class MthdCelsiusStencilEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_stencil_func, 0, 1, val); - exp.celsius_pipe_junk[0] = 0x74; - exp.celsius_pipe_junk[1] = exp.celsius_stencil_func; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1d, exp.celsius_stencil_func); } } } @@ -1675,9 +1619,7 @@ class MthdCelsiusPolygonOffsetPointEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 6, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -1718,9 +1660,7 @@ class MthdCelsiusPolygonOffsetLineEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 7, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -1761,9 +1701,7 @@ class MthdCelsiusPolygonOffsetFillEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 8, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -1809,9 +1747,7 @@ class MthdCelsiusAlphaFuncFunc : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 8, 4, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -1852,9 +1788,7 @@ class MthdCelsiusAlphaFuncRef : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 0, 8, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -1948,9 +1882,7 @@ class MthdCelsiusBlendFunc : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_blend, 4 + which * 4, 4, rv); - exp.celsius_pipe_junk[0] = 0x80; - exp.celsius_pipe_junk[1] = exp.celsius_blend; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x20, exp.celsius_blend); } } } @@ -1976,9 +1908,7 @@ class MthdCelsiusBlendColor : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { exp.celsius_blend_color = val; - exp.celsius_pipe_junk[0] = 0x84; - exp.celsius_pipe_junk[1] = exp.celsius_blend_color; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x21, exp.celsius_blend_color); } } } @@ -2041,9 +1971,7 @@ class MthdCelsiusBlendEquation : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_blend, 0, 3, rv); - exp.celsius_pipe_junk[0] = 0x80; - exp.celsius_pipe_junk[1] = exp.celsius_blend; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x20, exp.celsius_blend); } } } @@ -2089,9 +2017,7 @@ class MthdCelsiusDepthFunc : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 16, 4, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -2132,9 +2058,7 @@ class MthdCelsiusColorMask : public SingleMthdTest { insrt(exp.celsius_config_a, 28, 1, extr(val, 8, 1)); insrt(exp.celsius_config_a, 27, 1, extr(val, 16, 1)); insrt(exp.celsius_config_a, 26, 1, extr(val, 24, 1)); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -2175,9 +2099,7 @@ class MthdCelsiusDepthWriteEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 24, 1, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } } @@ -2219,9 +2141,7 @@ class MthdCelsiusStencilVal : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_stencil_func, 8 + 8 * which, 8, val); - exp.celsius_pipe_junk[0] = 0x74; - exp.celsius_pipe_junk[1] = exp.celsius_stencil_func; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1d, exp.celsius_stencil_func); } } } @@ -2269,9 +2189,7 @@ class MthdCelsiusStencilFunc : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_stencil_func, 4, 4, val); - exp.celsius_pipe_junk[0] = 0x74; - exp.celsius_pipe_junk[1] = exp.celsius_stencil_func; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1d, exp.celsius_stencil_func); } } } @@ -2347,9 +2265,7 @@ class MthdCelsiusStencilOp : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_stencil_op, 4 * which, 4, rv); - exp.celsius_pipe_junk[0] = 0x78; - exp.celsius_pipe_junk[1] = exp.celsius_stencil_op; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1e, exp.celsius_stencil_op); } } } @@ -2405,9 +2321,7 @@ class MthdCelsiusShadeMode : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_b, 7, 1, val); - exp.celsius_pipe_junk[0] = 0x7c; - exp.celsius_pipe_junk[1] = exp.celsius_config_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); } } } @@ -2440,9 +2354,7 @@ class MthdCelsiusLineWidth : public SingleMthdTest { if (chipset.chipset == 0x10) rv &= 0xff; insrt(exp.celsius_raster, 12, 9, rv); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -2469,9 +2381,7 @@ class MthdCelsiusPolygonOffsetFactor : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { exp.celsius_polygon_offset_factor = val; - exp.celsius_pipe_junk[0] = 0x90; - exp.celsius_pipe_junk[1] = exp.celsius_polygon_offset_factor; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x24, exp.celsius_polygon_offset_factor); } } } @@ -2498,9 +2408,7 @@ class MthdCelsiusPolygonOffsetUnits : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { exp.celsius_polygon_offset_units = val; - exp.celsius_pipe_junk[0] = 0x94; - exp.celsius_pipe_junk[1] = exp.celsius_polygon_offset_units; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x25, exp.celsius_polygon_offset_units); } } } @@ -2561,9 +2469,7 @@ class MthdCelsiusPolygonMode : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, which * 2, 2, rv); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -2592,9 +2498,7 @@ class MthdCelsiusDepthRangeNear : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { exp.celsius_depth_range_near = val; - exp.celsius_pipe_junk[0] = 0x98; - exp.celsius_pipe_junk[1] = exp.celsius_depth_range_near; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x26, exp.celsius_depth_range_near); } } } @@ -2621,9 +2525,7 @@ class MthdCelsiusDepthRangeFar : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { exp.celsius_depth_range_far = val; - exp.celsius_pipe_junk[0] = 0x9c; - exp.celsius_pipe_junk[1] = exp.celsius_depth_range_far; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x27, exp.celsius_depth_range_far); } } } @@ -2683,9 +2585,7 @@ class MthdCelsiusCullFace : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 21, 2, rv); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -2739,9 +2639,7 @@ class MthdCelsiusFrontFace : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 23, 1, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -2823,9 +2721,7 @@ class MthdCelsiusSpecularEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_b, 5, 1, val); - exp.celsius_pipe_junk[0] = 0x7c; - exp.celsius_pipe_junk[1] = exp.celsius_config_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); } } } @@ -3068,9 +2964,7 @@ class MthdCelsiusPointSize : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { exp.celsius_point_size = val & 0x1ff; - exp.celsius_pipe_junk[0] = 0xa8; - exp.celsius_pipe_junk[1] = exp.celsius_point_size; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x2a, exp.celsius_point_size); } } } @@ -3109,9 +3003,7 @@ class MthdCelsiusUnk3f0 : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 26, 2, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -3150,9 +3042,7 @@ class MthdCelsiusUnk3f4 : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_b, 0, 1, val); - exp.celsius_pipe_junk[0] = 0x7c; - exp.celsius_pipe_junk[1] = exp.celsius_config_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); } } } @@ -3659,9 +3549,7 @@ class MthdCelsiusOldUnk3f8 : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_raster, 30, 2, val); - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); } } } @@ -3699,9 +3587,7 @@ class MthdCelsiusColorLogicOpEnable : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_blend, 16, 1, val); - exp.celsius_pipe_junk[0] = 0x80; - exp.celsius_pipe_junk[1] = exp.celsius_blend; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x20, exp.celsius_blend); } } } @@ -3747,9 +3633,7 @@ class MthdCelsiusColorLogicOpOp : public SingleMthdTest { } else { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_blend, 12, 4, val); - exp.celsius_pipe_junk[0] = 0x80; - exp.celsius_pipe_junk[1] = exp.celsius_blend; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x20, exp.celsius_blend); } } } @@ -3770,9 +3654,8 @@ class MthdDmaClipid : public SingleMthdTest { uint32_t dcls = extr(pobj[0], 0, 12); exp.celsius_surf_limit_clipid = (limit & offset_mask) | (dcls != 0x30) << 31; exp.celsius_surf_base_clipid = base & offset_mask; - exp.celsius_pipe_junk[0] = 0xc8; - exp.celsius_pipe_junk[1] = exp.celsius_surf_limit_clipid; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x31, exp.celsius_surf_base_clipid); + pgraph_celsius_icmd(&exp, 0x32, exp.celsius_surf_limit_clipid); bool bad = true; if (dcls == 0x30 || dcls == 0x3d) bad = false; @@ -3809,9 +3692,8 @@ class MthdDmaZcull : public SingleMthdTest { uint32_t dcls = extr(pobj[0], 0, 12); exp.celsius_surf_limit_zcull = (limit & offset_mask) | (dcls != 0x30) << 31; exp.celsius_surf_base_zcull = base & offset_mask; - exp.celsius_pipe_junk[0] = 0xb8; - exp.celsius_pipe_junk[1] = exp.celsius_surf_limit_zcull; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x2d, exp.celsius_surf_base_zcull); + pgraph_celsius_icmd(&exp, 0x2e, exp.celsius_surf_limit_zcull); bool bad = true; if (dcls == 0x30 || dcls == 0x3d) bad = false; @@ -3853,9 +3735,7 @@ class MthdSurfPitchClipid : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_surf_pitch_clipid = val & 0xffff; - exp.celsius_pipe_junk[0] = 0xd0; - exp.celsius_pipe_junk[1] = exp.celsius_surf_pitch_clipid; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x34, exp.celsius_surf_pitch_clipid); } } using SingleMthdTest::SingleMthdTest; @@ -3880,9 +3760,7 @@ class MthdSurfOffsetClipid : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_surf_offset_clipid = val & 0x07ffffff; - exp.celsius_pipe_junk[0] = 0xcc; - exp.celsius_pipe_junk[1] = exp.celsius_surf_offset_clipid; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x33, exp.celsius_surf_offset_clipid); } } using SingleMthdTest::SingleMthdTest; @@ -3907,9 +3785,7 @@ class MthdSurfPitchZcull : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_surf_pitch_zcull = val & 0xffff; - exp.celsius_pipe_junk[0] = 0xc0; - exp.celsius_pipe_junk[1] = exp.celsius_surf_pitch_zcull; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x30, exp.celsius_surf_pitch_zcull); } } using SingleMthdTest::SingleMthdTest; @@ -3934,9 +3810,7 @@ class MthdSurfOffsetZcull : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_surf_offset_zcull = val & 0x3fffffff; - exp.celsius_pipe_junk[0] = 0xbc; - exp.celsius_pipe_junk[1] = exp.celsius_surf_offset_zcull; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x2f, exp.celsius_surf_offset_zcull); } } using SingleMthdTest::SingleMthdTest; @@ -3986,9 +3860,7 @@ class MthdClearZeta : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_clear_zeta = val; - exp.celsius_pipe_junk[0] = 0xdc; - exp.celsius_pipe_junk[1] = exp.celsius_clear_zeta; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x37, exp.celsius_clear_zeta); } } using SingleMthdTest::SingleMthdTest; @@ -4011,9 +3883,7 @@ class MthdClipidEnable : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_d, 6, 1, val); - exp.celsius_pipe_junk[0] = 0xd8; - exp.celsius_pipe_junk[1] = exp.celsius_config_d; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x36, exp.celsius_config_d); } } using SingleMthdTest::SingleMthdTest; @@ -4036,9 +3906,7 @@ class MthdClipidId : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_clipid_id = val & 0xf; - exp.celsius_pipe_junk[0] = 0xd4; - exp.celsius_pipe_junk[1] = exp.celsius_clipid_id; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x35, exp.celsius_clipid_id); } } using SingleMthdTest::SingleMthdTest; @@ -4067,9 +3935,7 @@ class MthdClearHv : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_clear_hv[which] = val & 0x0fff0fff; - exp.celsius_pipe_junk[0] = 0xac + which * 4; - exp.celsius_pipe_junk[1] = exp.celsius_clear_hv[which]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x2b + which, exp.celsius_clear_hv[which]); } } public: @@ -4095,9 +3961,7 @@ class MthdCelsiusUnkd84 : public SingleMthdTest { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_d, 1, 2, val); insrt(exp.celsius_config_d, 31, 1, extr(val, 31, 1)); - exp.celsius_pipe_junk[0] = 0xd8; - exp.celsius_pipe_junk[1] = exp.celsius_config_d; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x36, exp.celsius_config_d); } } using SingleMthdTest::SingleMthdTest; @@ -4120,9 +3984,7 @@ class MthdCelsiusTexUnk258 : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_tex_format[idx], 3, 1, val); - exp.celsius_pipe_junk[0] = 0x10 + idx * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_format[idx]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 4 + idx, exp.celsius_tex_format[idx]); } } using SingleMthdTest::SingleMthdTest; @@ -4187,9 +4049,7 @@ class MthdCelsiusUnk3f8 : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_config_a, 31, 1, val); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } } using SingleMthdTest::SingleMthdTest; @@ -4204,9 +4064,7 @@ class MthdCelsiusUnk3fc : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_mthd_unk3fc = val; - exp.celsius_pipe_junk[0] = 0xe0; - exp.celsius_pipe_junk[1] = exp.celsius_mthd_unk3fc; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x38, exp.celsius_mthd_unk3fc); } } using SingleMthdTest::SingleMthdTest; diff --git a/hwtest/pgraph_class_emu_d3d56.cc b/hwtest/pgraph_class_emu_d3d56.cc index 67f20a1e..7406799f 100644 --- a/hwtest/pgraph_class_emu_d3d56.cc +++ b/hwtest/pgraph_class_emu_d3d56.cc @@ -39,9 +39,7 @@ class MthdEmuD3D56TexColorKey : public SingleMthdTest { void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_color_key[0] = val; - exp.celsius_pipe_junk[0] = 0xa0; - exp.celsius_pipe_junk[1] = val; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x28, val); } insrt(exp.valid[1], 12, 1, 1); } @@ -67,9 +65,7 @@ class MthdEmuD3D56TexOffset : public SingleMthdTest { if (which & (1 << j)) { if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_offset[j] = val; - exp.celsius_pipe_junk[0] = j * 4; - exp.celsius_pipe_junk[1] = val; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, j, val); } insrt(exp.valid[1], j ? 22 : 14, 1, 1); } @@ -184,9 +180,6 @@ class MthdEmuD3D56TexFormat : public SingleMthdTest { for (int i = 0; i < 2; i++) { if (which & 1 << i) { exp.celsius_tex_format[i] = rval | (exp.celsius_tex_format[i] & 8); - exp.celsius_pipe_junk[0] = 0x10 + i * 4; - exp.celsius_pipe_junk[1] = exp.celsius_tex_format[i]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); } } if (cls == 0x94 || cls == 0x54) { @@ -196,15 +189,16 @@ class MthdEmuD3D56TexFormat : public SingleMthdTest { extr(exp.celsius_config_b, 6, 1) && !extr(rval, 27, 1) && !extr(rval, 31, 1)); insrt(exp.celsius_xf_misc_b, 16, 1, 0); - exp.celsius_pipe_junk[0] = 0x1c; - exp.celsius_pipe_junk[1] = exp.celsius_tex_control[1]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 4, exp.celsius_tex_format[0]); + pgraph_celsius_icmd(&exp, 6, exp.celsius_tex_control[0]); + pgraph_celsius_icmd(&exp, 7, exp.celsius_tex_control[1]); } else { if (which == 2) { insrt(exp.celsius_xf_misc_b, 16, 1, extr(exp.celsius_config_b, 6, 1) && !extr(rval, 27, 1) && !extr(rval, 31, 1)); } + pgraph_celsius_icmd(&exp, 4 + which - 1, exp.celsius_tex_format[which - 1]); } if (which & 1) { insrt(exp.celsius_xf_misc_b, 2, 1, @@ -259,9 +253,7 @@ class MthdEmuD3D56TexFilter : public SingleMthdTest { insrt(rval, 5, 8, extr(val, 16, 8)); if (!extr(exp.nsource, 1, 1)) { exp.celsius_tex_filter[which == 2] = rval; - exp.celsius_pipe_junk[0] = 0x38 + (which == 2) * 4; - exp.celsius_pipe_junk[1] = rval; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0xe + (which == 2), rval); } insrt(exp.valid[1], which == 2 ? 23 : 16, 1, 1); } @@ -373,28 +365,31 @@ class MthdEmuD3D6CombineControl : public SingleMthdTest { insrt(rc_out, 15, 3, op); insrt(exp.valid[1], 28 - which * 2 - ac, 1, 1); if (!extr(exp.nsource, 1, 1)) { - exp.celsius_rc_in[ac][which] = rc_in; - insrt(exp.celsius_rc_out[ac][which], 0, 18, rc_out); - exp.celsius_tex_control[1] = 0x4003ffc0; if (which == 0) { insrt(exp.celsius_config_c, 16 + ac, 1, !t1); } else { bool bypass = (val & 0x1f1f1f1f) == 0x04040510; insrt(exp.celsius_config_c, 18 + ac, 1, bypass); - insrt(exp.celsius_rc_out[1][1], 28, 2, extr(exp.celsius_config_c, 18, 2) == 3 ? 1 : 2); - if (ac == 1) - exp.celsius_tex_control[0] = 0x4003ffc0; } insrt(exp.celsius_config_c, 20 + ac + which * 2, 1, comp); - exp.celsius_pipe_junk[0] = 0x6c; - uint32_t jval = exp.celsius_rc_final[1]; - uint32_t cc = exp.celsius_config_c; - if (extr(cc, 23, 1) || (extr(cc, 19, 1) && extr(cc, 21, 1))) - insrt(jval, 5, 1, 1); - if (extr(cc, 22, 1) || (extr(cc, 18, 1) && extr(cc, 20, 1))) - insrt(jval, 13, 1, 1); - exp.celsius_pipe_junk[1] = jval; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + if (which == 1 && ac == 1) { + exp.celsius_tex_control[0] = 0x4003ffc0; + pgraph_celsius_icmd(&exp, 6, exp.celsius_tex_control[0]); + } + exp.celsius_tex_control[1] = 0x4003ffc0; + pgraph_celsius_icmd(&exp, 7, exp.celsius_tex_control[1]); + exp.celsius_rc_in[ac][which] = rc_in; + pgraph_celsius_icmd(&exp, 0x10 + ac * 2 + which, rc_in); + if (which == 0) + pgraph_celsius_icmd(&exp, 0x11 + ac * 2, exp.celsius_rc_in[ac][1]); + insrt(exp.celsius_rc_out[ac][which], 0, 18, rc_out); + if (which == 1) { + insrt(exp.celsius_rc_out[1][1], 28, 2, extr(exp.celsius_config_c, 18, 2) == 3 ? 1 : 2); + } + pgraph_celsius_icmd(&exp, 0x16 + ac * 2 + which, exp.celsius_rc_out[ac][which]); + if (which == 1 && !ac) + pgraph_celsius_icmd(&exp, 0x19, exp.celsius_rc_out[1][1]); + pgraph_celsius_icmd(&exp, 0x1b, exp.celsius_rc_final[1]); } } public: @@ -412,9 +407,8 @@ class MthdEmuD3D6CombineFactor : public SingleMthdTest { if (!extr(exp.nsource, 1, 1)) { exp.celsius_rc_factor[0] = val; exp.celsius_rc_factor[1] = val; - exp.celsius_pipe_junk[0] = 0x54; - exp.celsius_pipe_junk[1] = val; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x14, val); + pgraph_celsius_icmd(&exp, 0x15, val); } insrt(exp.valid[1], 24, 1, 1); } @@ -536,11 +530,19 @@ class MthdEmuD3D56Blend : public SingleMthdTest { exp.celsius_rc_out[0][0] = 0x00c00; exp.celsius_rc_out[1][0] = 0x00c00; } - exp.celsius_pipe_junk[0] = 0x80; - exp.celsius_pipe_junk[1] = exp.celsius_blend; + if (cls == 0x54 || cls == 0x94) { + pgraph_celsius_icmd(&exp, 0x10, exp.celsius_rc_in[0][0]); + pgraph_celsius_icmd(&exp, 0x12, exp.celsius_rc_in[1][0]); + pgraph_celsius_icmd(&exp, 0x16, exp.celsius_rc_out[0][0]); + pgraph_celsius_icmd(&exp, 0x18, exp.celsius_rc_out[1][0]); + } + pgraph_celsius_icmd(&exp, 0x19, exp.celsius_rc_out[1][1]); + pgraph_celsius_icmd(&exp, 0x1a, exp.celsius_rc_final[0]); + pgraph_celsius_icmd(&exp, 0x1b, exp.celsius_rc_final[1]); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); + pgraph_celsius_icmd(&exp, 0x20, exp.celsius_blend); exp.celsius_pipe_junk[2] = exp.celsius_xf_misc_a; exp.celsius_pipe_junk[3] = exp.celsius_xf_misc_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); } insrt(exp.valid[1], 19, 1, 1); } @@ -588,6 +590,7 @@ class MthdEmuD3D56Config : public SingleMthdTest { insrt(rval, 25, 5, 0x1e); int scull = extr(val, 20, 2); insrt(exp.celsius_config_a, 0, 30, rval); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); insrt(exp.celsius_raster, 0, 21, 0); insrt(exp.celsius_raster, 21, 2, scull == 2 ? 1 : 2); insrt(exp.celsius_raster, 23, 5, 8); @@ -599,12 +602,11 @@ class MthdEmuD3D56Config : public SingleMthdTest { insrt(exp.celsius_xf_misc_b, 14, 1, 0); if (!is_d3d6) { exp.celsius_stencil_func = 0x70; + pgraph_celsius_icmd(&exp, 0x1d, exp.celsius_stencil_func); } - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); exp.celsius_pipe_junk[2] = exp.celsius_xf_misc_a; exp.celsius_pipe_junk[3] = exp.celsius_xf_misc_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); } insrt(exp.valid[1], 17, 1, 1); if (!is_d3d6) @@ -634,9 +636,7 @@ class MthdEmuD3D6StencilFunc : public SingleMthdTest { uint32_t rval = val & 0xfffffff1; insrt(rval, 4, 4, extr(val, 4, 4) - 1); exp.celsius_stencil_func = rval; - exp.celsius_pipe_junk[0] = 0x74; - exp.celsius_pipe_junk[1] = exp.celsius_stencil_func; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1d, exp.celsius_stencil_func); } } using SingleMthdTest::SingleMthdTest; @@ -672,9 +672,7 @@ class MthdEmuD3D6StencilOp : public SingleMthdTest { insrt(exp.valid[1], 20, 1, 1); if (!extr(exp.nsource, 1, 1)) { exp.celsius_stencil_op = val & 0xfff; - exp.celsius_pipe_junk[0] = 0x78; - exp.celsius_pipe_junk[1] = exp.celsius_stencil_op; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1e, exp.celsius_stencil_op); } } using SingleMthdTest::SingleMthdTest; @@ -690,9 +688,7 @@ class MthdEmuD3D56FogColor : public SingleMthdTest { insrt(exp.valid[1], 13, 1, 1); if (!extr(exp.nsource, 1, 1)) { exp.celsius_fog_color = val; - exp.celsius_pipe_junk[0] = 0x8c; - exp.celsius_pipe_junk[1] = val; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x23, val); } } using SingleMthdTest::SingleMthdTest; @@ -742,12 +738,12 @@ class MthdEmuEmuD3D0TexFormat : public SingleMthdTest { insrt(exp.celsius_tex_format[i], 12, 4, max_l - min_l + 1); insrt(exp.celsius_tex_format[i], 16, 4, max_l); insrt(exp.celsius_tex_format[i], 20, 4, max_l); + pgraph_celsius_icmd(&exp, 4 + i, exp.celsius_tex_format[i]); } exp.celsius_tex_control[0] = 0x4003ffc0 | extr(val, 16, 2); exp.celsius_tex_control[1] = 0x3ffc0 | extr(val, 16, 2); - exp.celsius_pipe_junk[0] = 0x1c; - exp.celsius_pipe_junk[1] = exp.celsius_tex_control[1]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 6, exp.celsius_tex_control[0]); + pgraph_celsius_icmd(&exp, 7, exp.celsius_tex_control[1]); } } using SingleMthdTest::SingleMthdTest; @@ -758,9 +754,8 @@ class MthdEmuEmuD3D0TexFilter : public SingleMthdTest { if (!extr(exp.nsource, 1, 1)) { insrt(exp.celsius_tex_filter[0], 0, 13, extrs(val, 16, 8) << 4); insrt(exp.celsius_tex_filter[1], 0, 13, extrs(val, 16, 8) << 4); - exp.celsius_pipe_junk[0] = 0x3c; - exp.celsius_pipe_junk[1] = exp.celsius_tex_filter[1]; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0xe, exp.celsius_tex_filter[0]); + pgraph_celsius_icmd(&exp, 0xf, exp.celsius_tex_filter[1]); } insrt(exp.valid[1], 23, 1, 1); insrt(exp.valid[1], 16, 1, 1); @@ -843,9 +838,31 @@ class MthdEmuEmuD3D0Config : public SingleMthdTest { insrt(exp.celsius_tex_format[i], 4, 1, origin); insrt(exp.celsius_tex_format[i], 24, 4, wrapu); insrt(exp.celsius_tex_format[i], 28, 4, wrapv); + pgraph_celsius_icmd(&exp, 4 + i, exp.celsius_tex_format[i]); + } + for (int i = 0; i < 2; i++) { insrt(exp.celsius_tex_filter[i], 24, 3, filt); insrt(exp.celsius_tex_filter[i], 28, 3, filt); + pgraph_celsius_icmd(&exp, 0xe + i, exp.celsius_tex_filter[i]); } + exp.celsius_rc_in[0][0] = rc_in_alpha_a << 24 | rc_in_alpha_b << 16; + pgraph_celsius_icmd(&exp, 0x10, exp.celsius_rc_in[0][0]); + exp.celsius_rc_in[1][0] = 0x08040000; + pgraph_celsius_icmd(&exp, 0x12, exp.celsius_rc_in[1][0]); + exp.celsius_rc_factor[0] = val; + pgraph_celsius_icmd(&exp, 0x14, exp.celsius_rc_factor[0]); + exp.celsius_rc_factor[1] = val; + pgraph_celsius_icmd(&exp, 0x15, exp.celsius_rc_factor[1]); + exp.celsius_rc_out[0][0] = 0xc00; + pgraph_celsius_icmd(&exp, 0x16, exp.celsius_rc_out[0][0]); + exp.celsius_rc_out[1][0] = 0xc00; + pgraph_celsius_icmd(&exp, 0x18, exp.celsius_rc_out[1][0]); + insrt(exp.celsius_rc_out[1][1], 27, 3, 2); + pgraph_celsius_icmd(&exp, 0x19, exp.celsius_rc_out[1][1]); + exp.celsius_rc_final[0] = 0xc; + pgraph_celsius_icmd(&exp, 0x1a, exp.celsius_rc_final[0]); + exp.celsius_rc_final[1] = rc_final_1; + pgraph_celsius_icmd(&exp, 0x1b, exp.celsius_rc_final[1]); insrt(exp.celsius_config_a, 14, 1, !!extr(val, 20, 3)); insrt(exp.celsius_config_a, 16, 4, extr(val, 16, 4) - 1); insrt(exp.celsius_config_a, 22, 1, 1); @@ -854,28 +871,22 @@ class MthdEmuEmuD3D0Config : public SingleMthdTest { insrt(exp.celsius_config_a, 25, 1, 0); insrt(exp.celsius_config_a, 26, 1, 0); insrt(exp.celsius_config_a, 27, 3, extr(val, 24, 3) ? 0x7 : 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); exp.celsius_stencil_func = 0x70; + pgraph_celsius_icmd(&exp, 0x1d, exp.celsius_stencil_func); exp.celsius_stencil_op = 0x222; + pgraph_celsius_icmd(&exp, 0x1e, exp.celsius_stencil_op); insrt(exp.celsius_config_b, 0, 9, 0x1c0); + pgraph_celsius_icmd(&exp, 0x1f, exp.celsius_config_b); exp.celsius_blend = 0xa | sblend << 4 | dblend << 8; + pgraph_celsius_icmd(&exp, 0x20, exp.celsius_blend); insrt(exp.celsius_raster, 0, 21, 0); insrt(exp.celsius_raster, 21, 2, scull == 3 ? 1 : 2); insrt(exp.celsius_raster, 23, 5, 8); insrt(exp.celsius_raster, 28, 2, scull != 1); - exp.celsius_rc_factor[0] = val; - exp.celsius_rc_factor[1] = val; - exp.celsius_rc_in[0][0] = rc_in_alpha_a << 24 | rc_in_alpha_b << 16; - exp.celsius_rc_in[1][0] = 0x08040000; - exp.celsius_rc_out[0][0] = 0xc00; - exp.celsius_rc_out[1][0] = 0xc00; - insrt(exp.celsius_rc_out[1][1], 27, 3, 2); - exp.celsius_rc_final[0] = 0xc; - exp.celsius_rc_final[1] = rc_final_1; - exp.celsius_pipe_junk[0] = 0x88; - exp.celsius_pipe_junk[1] = exp.celsius_raster; + pgraph_celsius_icmd(&exp, 0x22, exp.celsius_raster); exp.celsius_pipe_junk[2] = exp.celsius_xf_misc_a; exp.celsius_pipe_junk[3] = exp.celsius_xf_misc_b; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); } insrt(exp.valid[1], 17, 1, 1); insrt(exp.valid[1], 24, 1, 1); @@ -909,9 +920,7 @@ class MthdEmuEmuD3D0Alpha : public SingleMthdTest { insrt(exp.celsius_config_a, 0, 8, val); insrt(exp.celsius_config_a, 8, 4, extr(val, 8, 4) - 1); insrt(exp.celsius_config_a, 12, 1, 1); - exp.celsius_pipe_junk[0] = 0x70; - exp.celsius_pipe_junk[1] = exp.celsius_config_a; - insrt(exp.celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(&exp, 0x1c, exp.celsius_config_a); } insrt(exp.valid[1], 18, 1, 1); } @@ -1100,6 +1109,11 @@ class MthdEmuD3D56TlvUv : public SingleMthdTest { } return true; } + void emulate_mthd_pre() override { + if (cls == 0x48 && fin) { + exp.misc24[1] = exp.misc24[2]; + } + } void emulate_mthd() override { if (!extr(exp.nsource, 1, 1)) { if (chipset.chipset != 0x10) diff --git a/hwtest/pgraph_state.cc b/hwtest/pgraph_state.cc index 4d27a21b..60de3e7a 100644 --- a/hwtest/pgraph_state.cc +++ b/hwtest/pgraph_state.cc @@ -415,22 +415,7 @@ std::vector<std::unique_ptr<Register>> pgraph_d3d56_regs(const chipset_info &chi class CelsiusRegister : public MmioRegister { void sim_write(struct pgraph_state *state, uint32_t val) override { MmioRegister::sim_write(state, val); - uint32_t cls = extr(state->ctx_switch[0], 0, 8); - uint32_t rval = ref(state); - uint32_t cc = state->celsius_config_c; - if (cls == 0x55 || cls == 0x95) { - if (addr == 0x400e44 || addr == 0x400e4c) { - bool color = addr == 0x400e4c; - if (extr(cc, 20 + color, 1) && !extr(cc, 18 + color, 1)) { - for (int i = 0; i < 4; i++) - if (extr(rval, i * 8, 4) == 0xc) - rval ^= 1 << (i * 8 + 5); - } - } - } - state->celsius_pipe_junk[0] = addr & 0xfc; - state->celsius_pipe_junk[1] = rval; - insrt(state->celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(state, extr(addr, 2, 6), ref(state)); } using MmioRegister::MmioRegister; }; @@ -438,9 +423,7 @@ class CelsiusRegister : public MmioRegister { class SimpleCelsiusRegister : public SimpleMmioRegister { void sim_write(struct pgraph_state *state, uint32_t val) override { MmioRegister::sim_write(state, val); - state->celsius_pipe_junk[0] = addr & 0xfc; - state->celsius_pipe_junk[1] = ref(state); - insrt(state->celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(state, extr(addr, 2, 6), ref(state)); } using SimpleMmioRegister::SimpleMmioRegister; }; @@ -449,23 +432,9 @@ template<int n> class IndexedCelsiusRegister : public IndexedMmioRegister<n> { void sim_write(struct pgraph_state *state, uint32_t val) override { MmioRegister::sim_write(state, val); - uint32_t cls = extr(state->ctx_switch[0], 0, 8); uint32_t rval = IndexedMmioRegister<n>::ref(state); uint32_t ad = IndexedMmioRegister<n>::addr; - uint32_t cc = state->celsius_config_c; - if (cls == 0x55 || cls == 0x95) { - if (ad == 0x400e1c) - insrt(rval, 30, 1, extr(cc, 16, 4) != 0xf); - if (ad == 0x400e6c) { - if (extr(cc, 23, 1) || (extr(cc, 19, 1) && extr(cc, 21, 1))) - insrt(rval, 5, 1, 1); - if (extr(cc, 22, 1) || (extr(cc, 18, 1) && extr(cc, 20, 1))) - insrt(rval, 13, 1, 1); - } - } - state->celsius_pipe_junk[0] = ad & 0xfc; - state->celsius_pipe_junk[1] = rval; - insrt(state->celsius_pipe_vtx_state, 28, 3, 0); + pgraph_celsius_icmd(state, extr(ad, 2, 6), rval); } using IndexedMmioRegister<n>::IndexedMmioRegister; }; @@ -862,6 +831,13 @@ static uint32_t canonical_light_sx_float(uint32_t v) { return v & 0xfffffc00; } +static uint32_t canonical_ovtx_fog(uint32_t v) { + uint32_t res = v & 0xfffff800; + if (res & 0x800) + res |= 0x400; + return res; +} + void pgraph_gen_state_celsius(int cnum, std::mt19937 &rnd, struct pgraph_state *state) { for (auto ® : pgraph_celsius_regs(state->chipset)) { reg->ref(state) = (rnd() & reg->mask) | reg->fixed; @@ -901,6 +877,38 @@ void pgraph_gen_state_celsius(int cnum, std::mt19937 &rnd, struct pgraph_state * state->celsius_pipe_light_v[47][0] = 0; state->celsius_pipe_light_v[47][1] = 0; state->celsius_pipe_light_v[47][2] = 0; + state->celsius_pipe_broke_ovtx = rnd() & 1; + } else { + state->celsius_pipe_broke_ovtx = false; + } + // XXX unfix this + if (nv04_pgraph_is_nv17p(&state->chipset)) + state->celsius_pipe_ovtx_pos = 9; + else + state->celsius_pipe_ovtx_pos = 11; + for (int i = 0; i < 3; i++) + for (int j = 0; j < 0x10; j++) { + state->celsius_pipe_xvtx[i][j] = rnd(); + } + for (int i = 0; i < 0x10; i++) { + // XXX clean this. + state->celsius_pipe_ovtx[i][0] = rnd() & 0xbfffffff; + state->celsius_pipe_ovtx[i][1] = rnd() & 0xbfffffff; + state->celsius_pipe_ovtx[i][2] = 0; + state->celsius_pipe_ovtx[i][3] = rnd() & 0xbfffffff; + state->celsius_pipe_ovtx[i][4] = rnd() & 0xbfffffff; + state->celsius_pipe_ovtx[i][5] = rnd() & 0xbfffffff; + state->celsius_pipe_ovtx[i][6] = rnd() & 0xbfffffff; + state->celsius_pipe_ovtx[i][7] = rnd() & 0xbfffffff; + state->celsius_pipe_ovtx[i][8] = rnd(); + state->celsius_pipe_ovtx[i][9] = canonical_light_sx_float(canonical_ovtx_fog(rnd())); + state->celsius_pipe_ovtx[i][10] = rnd(); + state->celsius_pipe_ovtx[i][11] = rnd() & 0xffffff01; + state->celsius_pipe_ovtx[i][12] = 0; + state->celsius_pipe_ovtx[i][13] = 0; + state->celsius_pipe_ovtx[i][14] = 0; + state->celsius_pipe_ovtx[i][15] = 0x3f800000; + insrt(state->celsius_pipe_ovtx[i][2], 31, 1, extr(state->celsius_pipe_ovtx[i][11], 0, 1)); } } } @@ -1094,6 +1102,38 @@ void pgraph_load_celsius(int cnum, struct pgraph_state *state) { for (auto ® : pgraph_celsius_regs(state->chipset)) { reg->write(cnum, reg->ref(state)); } + nva_wr32(cnum, 0x400084, 0xffffffff); + nva_wr32(cnum, 0x400088, 0xffffffff); + nva_wr32(cnum, 0x40008c, 0xffffffff); + nva_wr32(cnum, 0x400090, 0xffffffff); + uint32_t cargo_a[8] = { + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0x3f800000, + 0x00000000, + 0x00000000, + 0x00000000, + 0x00000000, + }; + uint32_t cargo_b[3] = { + 0x3f800000, + 0x3f800000, + 0x3f800000, + }; + uint32_t cargo_c[3] = { 0, 0, 0 }; + nva_wr32(cnum, 0x40014c, 0x00000056); + pgraph_load_pipe(cnum, 0x64c0, cargo_a, 8); + pgraph_load_pipe(cnum, 0x6ab0, cargo_b, 3); + pgraph_load_pipe(cnum, 0x6a80, cargo_c, 3); + nva_wr32(cnum, 0x400f40, 0x10000000); + nva_wr32(cnum, 0x400f44, 0x00000000); + uint32_t mode = 0xf; + pgraph_load_pipe(cnum, 0x0040, &mode, 1); + for (int i = 0; i < 3; i++) + pgraph_load_pipe(cnum, 0x0200 + i * 0x40, state->celsius_pipe_xvtx[i], 0x10); + for (int i = 0; i < 0x10; i++) + pgraph_load_pipe(cnum, 0x0800 + i * 0x40, state->celsius_pipe_ovtx[i], 0x10); uint32_t vtx[4]; vtx[0] = state->celsius_pipe_begin_end; vtx[1] = state->celsius_pipe_edge_flag; @@ -1119,7 +1159,9 @@ void pgraph_load_celsius(int cnum, struct pgraph_state *state) { for (int i = 0; i < 12; i++) { pgraph_load_pipe(cnum, 0x7800 + i * 0x10, state->celsius_pipe_light_sd + i, 1); } - pgraph_load_pipe(cnum, 0x7bf0, state->celsius_pipe_junk, 0x4); + nva_wr32(cnum, 0x400f40, state->celsius_xf_misc_a); + nva_wr32(cnum, 0x400f44, state->celsius_xf_misc_b); + pgraph_load_pipe(cnum, 0x4470, state->celsius_pipe_junk, 0x4); } void pgraph_load_fifo(int cnum, struct pgraph_state *state) { @@ -1174,7 +1216,10 @@ void pgraph_load_state(int cnum, struct pgraph_state *state) { } } else { nva_wr32(cnum, 0x400720, 0); - nva_wr32(cnum, 0x400160, 0); + if (state->chipset.card_type < 0x10) + nva_wr32(cnum, 0x400160, 0); + else + nva_wr32(cnum, 0x40014c, 0); } pgraph_load_vtx(cnum, state); @@ -1392,8 +1437,15 @@ void pgraph_dump_celsius(int cnum, struct pgraph_state *state) { } void pgraph_dump_celsius_pipe(int cnum, struct pgraph_state *state) { + if (state->celsius_pipe_broke_ovtx) + pgraph_dump_pipe(cnum, 0x4470, state->celsius_pipe_junk, 4); + for (int i = 0; i < 0x10; i++) + pgraph_dump_pipe(cnum, 0x0800 + i * 0x40, state->celsius_pipe_ovtx[i], 0x10); pgraph_dump_pipe(cnum, 0x4400, state->celsius_pipe_vtx, 0x1c); - pgraph_dump_pipe(cnum, 0x4470, state->celsius_pipe_junk, 4); + if (!state->celsius_pipe_broke_ovtx) + pgraph_dump_pipe(cnum, 0x4470, state->celsius_pipe_junk, 4); + for (int i = 0; i < 3; i++) + pgraph_dump_pipe(cnum, 0x0200 + i * 0x40, state->celsius_pipe_xvtx[i], 0x10); for (int i = 0; i < 0x3c; i++) { pgraph_dump_pipe(cnum, 0x6400 + i * 0x10, state->celsius_pipe_xfrm[i], 4); } @@ -1723,10 +1775,13 @@ restart: CMP(celsius_pipe_edge_flag, "CELSIUS_PIPE_EDGE_FLAG") CMP(celsius_pipe_unk48, "CELSIUS_PIPE_UNK48") CMP(celsius_pipe_vtx_state, "CELSIUS_PIPE_VTX_STATE") - for (int i = 0; i < 0x1c; i++) + for (int i = 0; i < 0x1c; i++) { CMP(celsius_pipe_vtx[i], "CELSIUS_PIPE_VTX[%d]", i) - for (int i = 0; i < 4; i++) - CMP(celsius_pipe_junk[i], "CELSIUS_PIPE_JUNK[%d]", i) + } + if (real->celsius_pipe_broke_ovtx || real->chipset.chipset != 0x10) { + for (int i = 0; i < 4; i++) + 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_xfrm[i][j], "CELSIUS_PIPE_XFRM[%d][%d]", i, j) @@ -1747,6 +1802,30 @@ restart: for (int i = 0; i < 12; i++) { CMP(celsius_pipe_light_sd[i], "CELSIUS_PIPE_LIGHT_SD[%d]", i) } +#if 0 + for (int i = 0; i < 0x3; i++) { + for (int j = 0; j < 0x10; j++) + CMP(celsius_pipe_xvtx[i][j], "CELSIUS_PIPE_XVTX[%d][%d]", i, j) + } +#endif + for (int i = 0; i < 0x10; i++) { + CMP(celsius_pipe_ovtx[i][0], "CELSIUS_PIPE_OVTX[%d].TXC1.S", i) + CMP(celsius_pipe_ovtx[i][1], "CELSIUS_PIPE_OVTX[%d].TXC1.T", i) + CMP(celsius_pipe_ovtx[i][2], "CELSIUS_PIPE_OVTX[%d].PTSZ", i) + CMP(celsius_pipe_ovtx[i][3], "CELSIUS_PIPE_OVTX[%d].TXC1.Q", i) + if (!real->celsius_pipe_broke_ovtx || i != 0) { + CMP(celsius_pipe_ovtx[i][4], "CELSIUS_PIPE_OVTX[%d].TXC0.S", i) + CMP(celsius_pipe_ovtx[i][5], "CELSIUS_PIPE_OVTX[%d].TXC0.T", i) + CMP(celsius_pipe_ovtx[i][7], "CELSIUS_PIPE_OVTX[%d].TXC0.Q", i) + } + CMP(celsius_pipe_ovtx[i][9], "CELSIUS_PIPE_OVTX[%d].FOG", i) + CMP(celsius_pipe_ovtx[i][10], "CELSIUS_PIPE_OVTX[%d].COL0", i) + CMP(celsius_pipe_ovtx[i][11], "CELSIUS_PIPE_OVTX[%d].COL1E", i) + CMP(celsius_pipe_ovtx[i][12], "CELSIUS_PIPE_OVTX[%d].POS.X", i) + CMP(celsius_pipe_ovtx[i][13], "CELSIUS_PIPE_OVTX[%d].POS.Y", i) + CMP(celsius_pipe_ovtx[i][14], "CELSIUS_PIPE_OVTX[%d].POS.Z", i) + CMP(celsius_pipe_ovtx[i][15], "CELSIUS_PIPE_OVTX[%d].POS.W", i) + } } // DMA diff --git a/hwtest/pgraph_state_tests.cc b/hwtest/pgraph_state_tests.cc index 9afd18e9..5f9906f3 100644 --- a/hwtest/pgraph_state_tests.cc +++ b/hwtest/pgraph_state_tests.cc @@ -35,6 +35,7 @@ int StateTest::run_once() { pgraph_load_state(cnum, &orig); exp = orig; mutate(); + real.celsius_pipe_broke_ovtx = orig.celsius_pipe_broke_ovtx; pgraph_dump_state(cnum, &real); bool fail = other_fail(); if (skip) diff --git a/include/nvhw/pgraph.h b/include/nvhw/pgraph.h index 03618aef..913f52b5 100644 --- a/include/nvhw/pgraph.h +++ b/include/nvhw/pgraph.h @@ -231,6 +231,10 @@ struct pgraph_state { uint32_t celsius_pipe_edge_flag; uint32_t celsius_pipe_unk48; uint32_t celsius_pipe_vtx_state; + uint32_t celsius_pipe_xvtx[3][0x10]; + uint32_t celsius_pipe_ovtx[0x10][0x10]; + uint32_t celsius_pipe_ovtx_pos; + bool celsius_pipe_broke_ovtx; }; enum { @@ -330,6 +334,7 @@ uint32_t pgraph_celsius_convert_light_sx(uint32_t val); uint32_t pgraph_celsius_ub_to_float(uint8_t val); uint32_t pgraph_celsius_short_to_float(struct pgraph_state *state, int16_t val); uint32_t pgraph_celsius_nshort_to_float(int16_t val); +void pgraph_celsius_icmd(struct pgraph_state *state, int cmd, uint32_t val); static inline uint32_t pgraph_class(struct pgraph_state *state) { diff --git a/nvhw/pgraph_celsius.c b/nvhw/pgraph_celsius.c index 2b35640a..4b877e50 100644 --- a/nvhw/pgraph_celsius.c +++ b/nvhw/pgraph_celsius.c @@ -88,3 +88,35 @@ uint32_t pgraph_celsius_nshort_to_float(int16_t val) { insrt(res, 31, 1, sign); return res; } + +void pgraph_celsius_icmd(struct pgraph_state *state, int cmd, uint32_t val) { + uint32_t cls = extr(state->ctx_switch[0], 0, 8); + uint32_t cc = state->celsius_config_c; + if (cls == 0x55 || cls == 0x95) { + if (cmd == 0x11 || cmd == 0x13) { + bool color = cmd == 0x13; + if (extr(cc, 20 + color, 1) && !extr(cc, 18 + color, 1)) { + for (int i = 0; i < 4; i++) + if (extr(val, i * 8, 4) == 0xc) + val ^= 1 << (i * 8 + 5); + } + } + if (cmd == 7) + insrt(val, 30, 1, extr(cc, 16, 4) != 0xf); + if (cmd == 0x1b) { + if (extr(cc, 23, 1) || (extr(cc, 19, 1) && extr(cc, 21, 1))) + insrt(val, 5, 1, 1); + if (extr(cc, 22, 1) || (extr(cc, 18, 1) && extr(cc, 20, 1))) + insrt(val, 13, 1, 1); + } + } + state->celsius_pipe_junk[0] = cmd << 2; + state->celsius_pipe_junk[1] = val; + insrt(state->celsius_pipe_vtx_state, 28, 3, 0); + int ctr = state->celsius_pipe_ovtx_pos; + state->celsius_pipe_ovtx[ctr][2] = val; + insrt(state->celsius_pipe_ovtx[ctr][9], 0, 6, cmd); + insrt(state->celsius_pipe_ovtx[ctr][11], 0, 1, extr(val, 31, 1)); + state->celsius_pipe_ovtx_pos++; + state->celsius_pipe_ovtx_pos &= 0xf; +} |