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
21class FogTests : public TestSuite {
22 public:
23 enum FogMode {
24 FOG_LINEAR = NV097_SET_FOG_MODE_V_LINEAR,
25 FOG_EXP = NV097_SET_FOG_MODE_V_EXP,
26 FOG_EXP2 = NV097_SET_FOG_MODE_V_EXP2,
27 FOG_EXP_ABS = NV097_SET_FOG_MODE_V_EXP_ABS,
28 FOG_EXP2_ABS = NV097_SET_FOG_MODE_V_EXP2_ABS,
29 FOG_LINEAR_ABS = NV097_SET_FOG_MODE_V_LINEAR_ABS,
30 };
31
32 enum FogGenMode {
33 FOG_GEN_SPEC_ALPHA = NV097_SET_FOG_GEN_MODE_V_SPEC_ALPHA,
34 FOG_GEN_RADIAL = NV097_SET_FOG_GEN_MODE_V_RADIAL,
35 FOG_GEN_PLANAR = NV097_SET_FOG_GEN_MODE_V_PLANAR,
36 FOG_GEN_ABS_PLANAR = NV097_SET_FOG_GEN_MODE_V_ABS_PLANAR,
37 FOG_GEN_FOG_X = NV097_SET_FOG_GEN_MODE_V_FOG_X,
38 };
39
40 public:
41 FogTests(TestHost& host, std::string output_dir, const Config& config, std::string suite_name = "Fog");
42 void Initialize() override;
43 void Deinitialize() override;
44
45 protected:
46 virtual void CreateGeometry();
47 void Test(FogMode fog_mode, FogGenMode gen_mode, uint32_t fog_alpha);
48
49 static std::string MakeTestName(FogMode fog_mode, FogGenMode gen_mode, uint32_t fog_alpha);
50
51 protected:
52 std::shared_ptr<VertexBuffer> vertex_buffer_;
53};
54
59 public:
60 FogCustomShaderTests(TestHost& host, std::string output_dir, const Config& config,
61 std::string suite_name = "Fog vsh");
62 void Initialize() override;
63};
64
69 public:
70 FogInfiniteFogCoordinateTests(TestHost& host, std::string output_dir, const Config& config);
71 void Initialize() override;
72};
73
79 public:
80 struct TestConfig {
81 const char* prefix;
82 const uint32_t* shader;
83 const uint32_t shader_size;
84 float fog[4];
85 };
86
87 public:
88 FogVec4CoordTests(TestHost& host, std::string output_dir, const Config& config);
89 void Initialize() override;
90
91 private:
92 // Verifies the behavior of setting individual components of the oFog register, showing that the last set value is
93 // taken as the value regardless of the destination mask.
94 // E.g., `mov oFog.w, 0.5` will effectively set oFog.x to 0.5, obliterating any previous value.
95 void Test(const TestConfig& config);
96
97 // Tests behavior when the fog register is used without being set.
98 void TestUnset();
99
100 void SetShader(const TestConfig& config) const;
101 static std::string MakeTestName(const TestConfig& config);
102};
103
113 public:
114 FogPlanarVertexShaderTests(TestHost& host, std::string output_dir, const Config& config);
115
116 protected:
117 void CreateGeometry() override;
118
119 private:
120 void TestPlanarZeroPlane(const std::string& name, bool rcp, float fog_value, uint32_t gen_mode);
121 void TestFogFactorSweep(const std::string& name, uint32_t gen_mode);
122};
123
124#endif // NXDK_PGRAPH_TESTS_FOG_TESTS_H
Definition fog_tests.h:58
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:274
Definition fog_tests.h:68
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:328
Definition fog_tests.h:112
Definition fog_tests.h:21
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:73
void Deinitialize() override
Called to tear down the test suite.
Definition fog_tests.cpp:89
Definition fog_tests.h:78
void Initialize() override
Called to initialize the test suite.
Definition fog_tests.cpp:606
Definition test_host.h:33
Definition test_suite.h:21
Definition fog_tests.h:80
Runtime configuration for TestSuites.
Definition test_suite.h:24