diff options
author | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-28 07:04:12 +0000 |
---|---|---|
committer | Marcin KoĆcielnicki <koriakin@0x04.net> | 2016-12-28 07:04:12 +0000 |
commit | 72ad4b84f7cbeff36cf64e053b422fa59fcb471c (patch) | |
tree | 2d03346a677c30b4f5ad76d7e19fcfdfa7155369 | |
parent | 44d106cacae5a6f1287df268c6bcf3fcd85f3883 (diff) |
hwtest/pgraph: Nailed down Celsius methods affecting PIPE light_s[cd] areas.
-rw-r--r-- | hwtest/pgraph_class_celsius.cc | 154 |
1 files changed, 136 insertions, 18 deletions
diff --git a/hwtest/pgraph_class_celsius.cc b/hwtest/pgraph_class_celsius.cc index f247c507..3c1cd69a 100644 --- a/hwtest/pgraph_class_celsius.cc +++ b/hwtest/pgraph_class_celsius.cc @@ -3182,6 +3182,118 @@ public: : SingleMthdTest(opt, seed, name, trapbit, cls, mthd), which(which) {} }; +class MthdCelsiusLightSC : public SingleMthdTest { + int which; + void adjust_orig_mthd() override { + if (rnd() & 1) { + insrt(val, 23, 8, rnd() & 1 ? 0 : 0xff); + if (rnd() & 1) { + val &= 0xfff0000f; + } + val ^= 1 << (rnd() & 0x1f); + } + if (rnd() & 1) + insrt(orig.notify, 28, 3, 0); + } + bool can_warn() override { + return true; + } + void emulate_mthd() override { + uint32_t err = 0; + if (extr(exp.celsius_config_c, 8, 1)) + err |= 4; + if (err) { + warn(err); + } else { + if (!extr(exp.nsource, 1, 1)) { + exp.celsius_pipe_junk[0] = val; + exp.celsius_pipe_light_sc[which] = pgraph_celsius_convert_light_sx(val); + } + } + } +public: + MthdCelsiusLightSC(hwtest::TestOptions &opt, uint32_t seed, const std::string &name, int trapbit, uint32_t cls, uint32_t mthd, int which) + : SingleMthdTest(opt, seed, name, trapbit, cls, mthd), which(which) {} +}; + +class MthdCelsiusLightSCFree : public SingleMthdTest { + int which; + void adjust_orig_mthd() override { + if (rnd() & 1) { + insrt(val, 23, 8, rnd() & 1 ? 0 : 0xff); + if (rnd() & 1) { + val &= 0xfff0000f; + } + val ^= 1 << (rnd() & 0x1f); + } + } + void emulate_mthd() override { + if (!extr(exp.nsource, 1, 1)) { + exp.celsius_pipe_junk[0] = val; + exp.celsius_pipe_light_sc[which] = pgraph_celsius_convert_light_sx(val); + } + } +public: + MthdCelsiusLightSCFree(hwtest::TestOptions &opt, uint32_t seed, const std::string &name, int trapbit, uint32_t cls, uint32_t mthd, int which) + : SingleMthdTest(opt, seed, name, trapbit, cls, mthd), which(which) {} +}; + +class MthdCelsiusLightSD : public SingleMthdTest { + int which; + void adjust_orig_mthd() override { + if (rnd() & 1) { + insrt(val, 23, 8, rnd() & 1 ? 0 : 0xff); + if (rnd() & 1) { + val &= 0xfff0000f; + } + val ^= 1 << (rnd() & 0x1f); + } + if (rnd() & 1) + insrt(orig.notify, 28, 3, 0); + } + bool can_warn() override { + return true; + } + void emulate_mthd() override { + uint32_t err = 0; + if (extr(exp.celsius_config_c, 8, 1)) + err |= 4; + if (err) { + warn(err); + } else { + if (!extr(exp.nsource, 1, 1)) { + exp.celsius_pipe_junk[0] = val; + exp.celsius_pipe_light_sd[which] = pgraph_celsius_convert_light_sx(val); + } + } + } +public: + MthdCelsiusLightSD(hwtest::TestOptions &opt, uint32_t seed, const std::string &name, int trapbit, uint32_t cls, uint32_t mthd, int which) + : SingleMthdTest(opt, seed, name, trapbit, cls, mthd), which(which) {} +}; + +class MthdCelsiusLightSDFree : public SingleMthdTest { + int which; + void adjust_orig_mthd() override { + if (rnd() & 1) { + insrt(val, 23, 8, rnd() & 1 ? 0 : 0xff); + if (rnd() & 1) { + val &= 0xfff0000f; + } + val ^= 1 << (rnd() & 0x1f); + } + } + void emulate_mthd() override { + if (!extr(exp.nsource, 1, 1)) { + exp.celsius_pipe_junk[0] = val; + exp.celsius_pipe_light_sd[which] = pgraph_celsius_convert_light_sx(val); + } + } +public: + MthdCelsiusLightSDFree(hwtest::TestOptions &opt, uint32_t seed, const std::string &name, int trapbit, uint32_t cls, uint32_t mthd, int which) + : SingleMthdTest(opt, seed, name, trapbit, cls, mthd), which(which) {} +}; + class MthdCelsiusOldUnk3f8 : public SingleMthdTest { void adjust_orig_mthd() override { if (rnd() & 1) { @@ -3776,7 +3888,7 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusCullFace(opt, rnd(), "cull_face", -1, cls, 0x39c), new MthdCelsiusFrontFace(opt, rnd(), "front_face", -1, cls, 0x3a0), new MthdCelsiusNormalizeEnable(opt, rnd(), "normalize_enable", -1, cls, 0x3a4), - new UntestedMthd(opt, rnd(), "material_factor_a", -1, cls, 0x3b4), // XXX + new MthdCelsiusLightSDFree(opt, rnd(), "material_factor_a", -1, cls, 0x3b4, 11), new MthdCelsiusSpecularEnable(opt, rnd(), "specular_enable", -1, cls, 0x3b8), new MthdCelsiusLightEnable(opt, rnd(), "light_enable", -1, cls, 0x3bc), new MthdCelsiusTexGenMode(opt, rnd(), "tex_gen_mode_s", -1, cls, 0x3c0, 2, 0x10, 0), @@ -3806,19 +3918,18 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "fog_coeff", -1, cls, 0x680, 3, 4, 43), new MthdCelsiusXfrmFree(opt, rnd(), "fog_plane", -1, cls, 0x68c, 4, 4, 56), new MthdCelsiusLightSBFree(opt, rnd(), "material_shininess_0", -1, cls, 0x6a0, 1), - new UntestedMthd(opt, rnd(), "material_shininess_1", -1, cls, 0x6a4), // XXX - new UntestedMthd(opt, rnd(), "material_shininess_2", -1, cls, 0x6a8), // XXX + new MthdCelsiusLightSCFree(opt, rnd(), "material_shininess_1", -1, cls, 0x6a4, 1), + new MthdCelsiusLightSDFree(opt, rnd(), "material_shininess_2", -1, cls, 0x6a8, 2), new MthdCelsiusLightSAFree(opt, rnd(), "material_shininess_3", -1, cls, 0x6ac, 2), - new UntestedMthd(opt, rnd(), "material_shininess_4", -1, cls, 0x6b0), // XXX - new UntestedMthd(opt, rnd(), "material_shininess_5", -1, cls, 0x6b4), // XXX + new MthdCelsiusLightSCFree(opt, rnd(), "material_shininess_4", -1, cls, 0x6b0, 2), + new MthdCelsiusLightSCFree(opt, rnd(), "material_shininess_5", -1, cls, 0x6b4, 3), new MthdCelsiusLightVFree(opt, rnd(), "light_model_ambient_color", -1, cls, 0x6c4, 3, 4, 41), new MthdCelsiusXfrm(opt, rnd(), "viewport_translate", -1, cls, 0x6e8, 4, 4, 57), new MthdCelsiusLightV(opt, rnd(), "point_params_012", -1, cls, 0x6f8, 3, 4, 45), new MthdCelsiusLightV(opt, rnd(), "point_params_345", -1, cls, 0x704, 3, 4, 46), new MthdCelsiusLightSB(opt, rnd(), "point_params_6", -1, cls, 0x710, 2), - new UntestedMthd(opt, rnd(), "point_params_7", -1, cls, 0x714), // XXX + new MthdCelsiusLightSD(opt, rnd(), "point_params_7", -1, cls, 0x714, 1), new MthdCelsiusXfrm(opt, rnd(), "light_eye_position", -1, cls, 0x718, 4, 4, 52), - new UntestedMthd(opt, rnd(), "meh", -1, cls, 0x728, 0x8), // XXX new MthdCelsiusLightVFree(opt, rnd(), "light_0_ambient_color", -1, cls, 0x800, 3, 4, 0), new MthdCelsiusLightVFree(opt, rnd(), "light_0_diffuse_color", -1, cls, 0x80c, 3, 4, 1), new MthdCelsiusLightVFree(opt, rnd(), "light_0_specular_color", -1, cls, 0x818, 3, 4, 2), @@ -3826,8 +3937,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_0_half_vector", -1, cls, 0x828, 3, 4, 3), new MthdCelsiusLightV(opt, rnd(), "light_0_direction", -1, cls, 0x834, 3, 4, 4), new MthdCelsiusLightSB(opt, rnd(), "light_0_spot_cutoff_0", -1, cls, 0x840, 11), - new UntestedMthd(opt, rnd(), "light_0_spot_cutoff_1", -1, cls, 0x844, 8, 0x80), // XXX - new UntestedMthd(opt, rnd(), "light_0_spot_cutoff_2", -1, cls, 0x848, 8, 0x80), // XXX + new MthdCelsiusLightSC(opt, rnd(), "light_0_spot_cutoff_1", -1, cls, 0x844, 4), + new MthdCelsiusLightSD(opt, rnd(), "light_0_spot_cutoff_2", -1, cls, 0x848, 3), new MthdCelsiusXfrm(opt, rnd(), "light_0_spot_direction", -1, cls, 0x84c, 4, 4, 44), new MthdCelsiusXfrm3(opt, rnd(), "light_0_position", -1, cls, 0x85c, 3, 4, 36), new MthdCelsiusLightV(opt, rnd(), "light_0_attenuation", -1, cls, 0x868, 3, 4, 3), @@ -3838,7 +3949,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_1_half_vector", -1, cls, 0x8a8, 3, 4, 8), new MthdCelsiusLightV(opt, rnd(), "light_1_direction", -1, cls, 0x8b4, 3, 4, 9), new MthdCelsiusLightSB(opt, rnd(), "light_1_spot_cutoff_0", -1, cls, 0x8c0, 12), - + new MthdCelsiusLightSC(opt, rnd(), "light_1_spot_cutoff_1", -1, cls, 0x8c4, 5), + new MthdCelsiusLightSD(opt, rnd(), "light_1_spot_cutoff_2", -1, cls, 0x8c8, 4), new MthdCelsiusXfrm(opt, rnd(), "light_1_spot_direction", -1, cls, 0x8cc, 4, 4, 45), new MthdCelsiusXfrm3(opt, rnd(), "light_1_position", -1, cls, 0x8dc, 3, 4, 37), new MthdCelsiusLightV(opt, rnd(), "light_1_attenuation", -1, cls, 0x8e8, 3, 4, 8), @@ -3849,7 +3961,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_2_half_vector", -1, cls, 0x928, 3, 4, 13), new MthdCelsiusLightV(opt, rnd(), "light_2_direction", -1, cls, 0x934, 3, 4, 14), new MthdCelsiusLightSB(opt, rnd(), "light_2_spot_cutoff_0", -1, cls, 0x940, 13), - + new MthdCelsiusLightSC(opt, rnd(), "light_2_spot_cutoff_1", -1, cls, 0x944, 6), + new MthdCelsiusLightSD(opt, rnd(), "light_2_spot_cutoff_2", -1, cls, 0x948, 5), new MthdCelsiusXfrm(opt, rnd(), "light_2_spot_direction", -1, cls, 0x94c, 4, 4, 46), new MthdCelsiusXfrm3(opt, rnd(), "light_2_position", -1, cls, 0x95c, 3, 4, 38), new MthdCelsiusLightV(opt, rnd(), "light_2_attenuation", -1, cls, 0x968, 3, 4, 13), @@ -3860,7 +3973,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_3_half_vector", -1, cls, 0x9a8, 3, 4, 18), new MthdCelsiusLightV(opt, rnd(), "light_3_direction", -1, cls, 0x9b4, 3, 4, 19), new MthdCelsiusLightSB(opt, rnd(), "light_3_spot_cutoff_0", -1, cls, 0x9c0, 14), - + new MthdCelsiusLightSC(opt, rnd(), "light_3_spot_cutoff_1", -1, cls, 0x9c4, 7), + new MthdCelsiusLightSD(opt, rnd(), "light_3_spot_cutoff_2", -1, cls, 0x9c8, 6), new MthdCelsiusXfrm(opt, rnd(), "light_3_spot_direction", -1, cls, 0x9cc, 4, 4, 47), new MthdCelsiusXfrm3(opt, rnd(), "light_3_position", -1, cls, 0x9dc, 3, 4, 39), new MthdCelsiusLightV(opt, rnd(), "light_3_attenuation", -1, cls, 0x9e8, 3, 4, 18), @@ -3871,7 +3985,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_4_half_vector", -1, cls, 0xa28, 3, 4, 23), new MthdCelsiusLightV(opt, rnd(), "light_4_direction", -1, cls, 0xa34, 3, 4, 24), new MthdCelsiusLightSB(opt, rnd(), "light_4_spot_cutoff_0", -1, cls, 0xa40, 15), - + new MthdCelsiusLightSC(opt, rnd(), "light_4_spot_cutoff_1", -1, cls, 0xa44, 8), + new MthdCelsiusLightSD(opt, rnd(), "light_4_spot_cutoff_2", -1, cls, 0xa48, 7), new MthdCelsiusXfrm(opt, rnd(), "light_4_spot_direction", -1, cls, 0xa4c, 4, 4, 48), new MthdCelsiusXfrm3(opt, rnd(), "light_4_position", -1, cls, 0xa5c, 3, 4, 40), new MthdCelsiusLightV(opt, rnd(), "light_4_attenuation", -1, cls, 0xa68, 3, 4, 23), @@ -3882,7 +3997,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_5_half_vector", -1, cls, 0xaa8, 3, 4, 28), new MthdCelsiusLightV(opt, rnd(), "light_5_direction", -1, cls, 0xab4, 3, 4, 29), new MthdCelsiusLightSB(opt, rnd(), "light_5_spot_cutoff_0", -1, cls, 0xac0, 16), - + new MthdCelsiusLightSC(opt, rnd(), "light_5_spot_cutoff_1", -1, cls, 0xac4, 9), + new MthdCelsiusLightSD(opt, rnd(), "light_5_spot_cutoff_2", -1, cls, 0xac8, 8), new MthdCelsiusXfrm(opt, rnd(), "light_5_spot_direction", -1, cls, 0xacc, 4, 4, 49), new MthdCelsiusXfrm3(opt, rnd(), "light_5_position", -1, cls, 0xadc, 3, 4, 41), new MthdCelsiusLightV(opt, rnd(), "light_5_attenuation", -1, cls, 0xae8, 3, 4, 28), @@ -3893,7 +4009,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_6_half_vector", -1, cls, 0xb28, 3, 4, 33), new MthdCelsiusLightV(opt, rnd(), "light_6_direction", -1, cls, 0xb34, 3, 4, 34), new MthdCelsiusLightSB(opt, rnd(), "light_6_spot_cutoff_0", -1, cls, 0xb40, 17), - + new MthdCelsiusLightSC(opt, rnd(), "light_6_spot_cutoff_1", -1, cls, 0xb44, 10), + new MthdCelsiusLightSD(opt, rnd(), "light_6_spot_cutoff_2", -1, cls, 0xb48, 9), new MthdCelsiusXfrm(opt, rnd(), "light_6_spot_direction", -1, cls, 0xb4c, 4, 4, 50), new MthdCelsiusXfrm3(opt, rnd(), "light_6_position", -1, cls, 0xb5c, 3, 4, 42), new MthdCelsiusLightV(opt, rnd(), "light_6_attenuation", -1, cls, 0xb68, 3, 4, 33), @@ -3904,7 +4021,8 @@ std::vector<SingleMthdTest *> Celsius::mthds() { new MthdCelsiusLightV(opt, rnd(), "light_7_half_vector", -1, cls, 0xba8, 3, 4, 38), new MthdCelsiusLightV(opt, rnd(), "light_7_direction", -1, cls, 0xbb4, 3, 4, 39), new MthdCelsiusLightSB(opt, rnd(), "light_7_spot_cutoff_0", -1, cls, 0xbc0, 18), - + new MthdCelsiusLightSC(opt, rnd(), "light_7_spot_cutoff_1", -1, cls, 0xbc4, 11), + new MthdCelsiusLightSD(opt, rnd(), "light_7_spot_cutoff_2", -1, cls, 0xbc8, 10), new MthdCelsiusXfrm(opt, rnd(), "light_7_spot_direction", -1, cls, 0xbcc, 4, 4, 51), new MthdCelsiusXfrm3(opt, rnd(), "light_7_position", -1, cls, 0xbdc, 3, 4, 43), new MthdCelsiusLightV(opt, rnd(), "light_7_attenuation", -1, cls, 0xbe8, 3, 4, 38), @@ -3932,12 +4050,12 @@ std::vector<SingleMthdTest *> Celsius::mthds() { } else { res.insert(res.end(), { new MthdCelsiusLightVFree(opt, rnd(), "material_factor_rgb", -1, cls, 0x3a8, 3, 4, 42), - new UntestedMthd(opt, rnd(), "meh", -1, cls, 0x114), // XXX + new UntestedMthd(opt, rnd(), "unk114", -1, cls, 0x114), // XXX new MthdFlipSet(opt, rnd(), "flip_write", -1, cls, 0x120, 1, 1), new MthdFlipSet(opt, rnd(), "flip_read", -1, cls, 0x124, 1, 0), new MthdFlipSet(opt, rnd(), "flip_modulo", -1, cls, 0x128, 1, 2), new MthdFlipBumpWrite(opt, rnd(), "flip_bump_write", -1, cls, 0x12c, 1), - new UntestedMthd(opt, rnd(), "flip", -1, cls, 0x130), + new UntestedMthd(opt, rnd(), "flip_unk130", -1, cls, 0x130), new MthdCelsiusColorLogicOpEnable(opt, rnd(), "color_logic_op_enable", -1, cls, 0xd40), new MthdCelsiusColorLogicOpOp(opt, rnd(), "color_logic_op_op", -1, cls, 0xd44), }); |