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