nxdk_pgraph_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
ZMinMaxControlTests Class Reference
Inheritance diagram for ZMinMaxControlTests:
Collaboration diagram for ZMinMaxControlTests:

Public Types

enum  ZMinMaxDrawMode {
  M_Z_INC_W_ONE , M_Z_INC_W_INC , M_Z_NF_W_INC , M_Z_NF_W_NF ,
  M_Z_INC_W_TEN , M_Z_INC_W_FRAC , M_Z_INC_W_INV_Z
}
 
typedef enum ZMinMaxControlTests::ZMinMaxDrawMode ZMinMaxDrawMode
 

Public Member Functions

 ZMinMaxControlTests (TestHost &host, std::string output_dir, const Config &config)
 
void Initialize () override
 Called to initialize the test suite.
 
void TearDownTest () override
 Called after running an individual test within this suite.
 
- Public Member Functions inherited from TestSuite
 TestSuite (TestHost &host, std::string output_dir, std::string suite_name, const Config &config, bool interactive_only=false)
 
const std::string & Name () const
 
virtual void Deinitialize ()
 Called to tear down the test suite.
 
virtual void SetupTest ()
 Called before running an individual test within this suite.
 
void DisableTests (const std::set< std::string > &tests_to_skip)
 
std::vector< std::string > TestNames () const
 
bool HasEnabledTests () const
 
void Run (const std::string &test_name, uint32_t test_index=0, uint32_t total_tests=0)
 
void RunAll (bool include_interactive)
 
bool IsInteractiveOnly () const
 
void SetSavingAllowed (bool enable=true)
 

Additional Inherited Members

- Static Public Member Functions inherited from TestSuite
static void TagNV2ATrace (uint32_t num_nops)
 Inserts a pattern of NV097_NO_OPERATION's into the pushbuffer to allow identification when viewing nv2a traces.
 
- Protected Member Functions inherited from TestSuite
void SetDefaultTextureFormat () const
 
void FinishDraw (const std::string &name, bool save_zbuffer=false)
 
void FinishDrawNoSave (const std::string &name, bool save_zbuffer=false)
 
- Protected Attributes inherited from TestSuite
TestHost & host_
 
std::string output_dir_
 
std::string suite_name_
 
bool interactive_only_
 
bool allow_saving_ {true}
 
std::map< std::string, std::function< void()> > tests_ {}
 
std::set< std::string > interactive_only_tests_ {}
 
PGRAPHDiffToken pgraph_diff_
 
bool enable_progress_log_
 
bool enable_pgraph_region_diff_
 
uint32_t delay_milliseconds_between_tests_
 
std::shared_ptr< FTPLogger > ftp_logger_
 

Constructor & Destructor Documentation

◆ ZMinMaxControlTests()

ZMinMaxControlTests::ZMinMaxControlTests ( TestHost &  host,
std::string  output_dir,
const Config &  config 
)

Initializes the test suite and creates test cases.

Ctrl* and CtrlFixed* tests set NV097_SET_ZMIN_MAX_CONTROL to the mode encoded in the test name, set the depth clip range to 10-100 (in z, or in w for WBuf tests) and draw six blocks of small quads whose z (in depth buffer units, 0-150) and w values vary as labeled: top left: z increasing, w = 1; top middle: z increasing, w = 0.01 on the left edge of each quad and 0.0001 on the right; top right: z and w increasing; bottom left: z from 8 (left edge) to 120 (right edge) of each quad, w increasing; bottom middle: z and w from 8 to 120 across each quad; bottom right: z increasing, w = 10. Ctrl tests pass screen space coordinates through a passthrough vertex shader. CtrlFixed tests unproject the same screen space points and draw them with the fixed function pipeline using a D3D style orthographic projection with near/far planes at 10/100.

Name components: WBuf enables w-buffering; NEARFAR sets CULL_NEAR_FAR_EN_TRUE; ZCLAMP sets ZCLAMP_EN_CLAMP and ZCULL sets ZCLAMP_EN_CULL; IgnW sets CULL_IGNORE_W_TRUE. Quads (or portions of quads) whose depth falls outside the clip range are culled or clamped according to the mode.

Remarks
CtrlFixed_NEARFAR_ZCLAMP Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
CtrlFixed_NEARFAR_ZCLAMP_IgnW Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
CtrlFixed_NEARFAR_ZCULL Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
CtrlFixed_NEARFAR_ZCULL_IgnW Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
CtrlFixed_WBuf_NEARFAR_ZCLAMP Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
CtrlFixed_WBuf_NEARFAR_ZCLAMP_IgnW Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
CtrlFixed_WBuf_NEARFAR_ZCULL Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
CtrlFixed_WBuf_NEARFAR_ZCULL_IgnW Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
CtrlFixed_WBuf_ZCLAMP Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
CtrlFixed_WBuf_ZCLAMP_IgnW Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
CtrlFixed_WBuf_ZCULL Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
CtrlFixed_WBuf_ZCULL_IgnW Draws the quad blocks with the fixed function pipeline and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
CtrlFixed_ZCLAMP Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
CtrlFixed_ZCLAMP_IgnW Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
CtrlFixed_ZCULL Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
CtrlFixed_ZCULL_IgnW Draws the quad blocks with the fixed function pipeline; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
Ctrl_NEARFAR_ZCLAMP Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
Ctrl_NEARFAR_ZCLAMP_IgnW Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
Ctrl_NEARFAR_ZCULL Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
Ctrl_NEARFAR_ZCULL_IgnW Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
Ctrl_WBuf_NEARFAR_ZCLAMP Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
Ctrl_WBuf_NEARFAR_ZCLAMP_IgnW Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
Ctrl_WBuf_NEARFAR_ZCULL Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
Ctrl_WBuf_NEARFAR_ZCULL_IgnW Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_TRUE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
Ctrl_WBuf_ZCLAMP Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
Ctrl_WBuf_ZCLAMP_IgnW Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
Ctrl_WBuf_ZCULL Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
Ctrl_WBuf_ZCULL_IgnW Draws the quad blocks with the passthrough vertex shader and w-buffering enabled; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
Ctrl_ZCLAMP Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_FALSE.
Ctrl_ZCLAMP_IgnW Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CLAMP | CULL_IGNORE_W_TRUE.
Ctrl_ZCULL Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_FALSE.
Ctrl_ZCULL_IgnW Draws the quad blocks with the passthrough vertex shader; NV097_SET_ZMIN_MAX_CONTROL = CULL_NEAR_FAR_EN_FALSE | ZCLAMP_EN_CULL | CULL_IGNORE_W_TRUE.
NearPlaneBoundaryPassthrough Draws three quads through a passthrough vertex shader in screen space with w = 40 and screen z of -0.8, 0 and 0.8 from left to right, on a Z24S8 surface with the default NV097_SET_ZMIN_MAX_CONTROL (CULL_NEAR_FAR, ZCLAMP_CULL) and a clip range of 0-16777215. A z exactly equal to the clip minimum is inside the range, so only the left quad is culled. Together with the Vertex shader rounding tests OpRounding_* this shows that Rugby 2005's depth of field quad (xemu-project/xemu#2388) is culled on hardware because truncation in the vertex shader places it slightly behind the near plane, not because of how the clip boundary is handled.

Member Function Documentation

◆ Initialize()

void ZMinMaxControlTests::Initialize ( )
overridevirtual

Called to initialize the test suite.

Reimplemented from TestSuite.

◆ TearDownTest()

void ZMinMaxControlTests::TearDownTest ( )
overridevirtual

Called after running an individual test within this suite.

Reimplemented from TestSuite.


The documentation for this class was generated from the following files: