nxdk_pgraph_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
fog_tests.h
1#ifndef NXDK_PGRAPH_TESTS_FOG_TESTS_H
2#define NXDK_PGRAPH_TESTS_FOG_TESTS_H
3
4#include <memory>
5#include <vector>
6
7#include "test_host.h"
8#include "test_suite.h"
9#include "vertex_buffer.h"
10
11class TestHost;
12namespace PBKitPlusPlus {
13class VertexBuffer;
14}
15
16using namespace PBKitPlusPlus;
17
18// Tests behavior of the Fog code.
19class FogTests : public TestSuite {
20 public:
21 enum FogMode {
22 FOG_LINEAR = NV097_SET_FOG_MODE_V_LINEAR,
23 FOG_EXP = NV097_SET_FOG_MODE_V_EXP,
24 FOG_EXP2 = NV097_SET_FOG_MODE_V_EXP2,
25 FOG_EXP_ABS = NV097_SET_FOG_MODE_V_EXP_ABS,
26 FOG_EXP2_ABS = NV097_SET_FOG_MODE_V_EXP2_ABS,
27 FOG_LINEAR_ABS = NV097_SET_FOG_MODE_V_LINEAR_ABS,
28 };
29
30 enum FogGenMode {
31 FOG_GEN_SPEC_ALPHA = NV097_SET_FOG_GEN_MODE_V_SPEC_ALPHA,
32 FOG_GEN_RADIAL = NV097_SET_FOG_GEN_MODE_V_RADIAL,
33 FOG_GEN_PLANAR = NV097_SET_FOG_GEN_MODE_V_PLANAR,
34 FOG_GEN_ABS_PLANAR = NV097_SET_FOG_GEN_MODE_V_ABS_PLANAR,
35 FOG_GEN_FOG_X = NV097_SET_FOG_GEN_MODE_V_FOG_X,
36 };
37
38 public:
39 FogTests(TestHost& host, std::string output_dir, const Config& config, std::string suite_name = "Fog");
40 void Initialize() override;
41 void Deinitialize() override;
42
43 protected:
44 virtual void CreateGeometry();
45 void Test(FogMode fog_mode, FogGenMode gen_mode, uint32_t fog_alpha);
46
47 static std::string MakeTestName(FogMode fog_mode, FogGenMode gen_mode, uint32_t fog_alpha);
48
49 protected:
50 std::shared_ptr<VertexBuffer> vertex_buffer_;
51};
52
54 public:
55 FogCustomShaderTests(TestHost& host, std::string output_dir, const Config& config,
56 std::string suite_name = "Fog vsh");
57 void Initialize() override;
58};
59
61 public:
62 FogInfiniteFogCoordinateTests(TestHost& host, std::string output_dir, const Config& config);
63 void Initialize() override;
64};
65
67 public:
68 struct TestConfig {
69 const char* prefix;
70 const uint32_t* shader;
71 const uint32_t shader_size;
72 float fog[4];
73 };
74
75 public:
76 FogVec4CoordTests(TestHost& host, std::string output_dir, const Config& config);
77 void Initialize() override;
78
79 private:
80 // Verifies the behavior of setting individual components of the oFog register, showing that the last set value is
81 // taken as the value regardless of the destination mask.
82 // E.g., `mov oFog.w, 0.5` will effectively set oFog.x to 0.5, obliterating any previous value.
83 void Test(const TestConfig& config);
84
85 // Tests behavior when the fog register is used without being set.
86 void TestUnset();
87
88 void SetShader(const TestConfig& config) const;
89 static std::string MakeTestName(const TestConfig& config);
90};
91
92#endif // NXDK_PGRAPH_TESTS_FOG_TESTS_H
Definition fog_tests.h:53
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:221
Definition fog_tests.h:60
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:248
Definition fog_tests.h:19
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:48
void Deinitialize() override
Called to tear down the test suite.
Definition fog_tests.cpp:64
Definition fog_tests.h:66
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:399
Definition test_host.h:33
Definition test_suite.h:20
Definition fog_tests.h:68
Runtime configuration for TestSuites.
Definition test_suite.h:23