nxdk_pgraph_tests
A collection of tests for the Xbox nv2a graphics processor
 
Loading...
Searching...
No Matches
SurfaceAsVertexArrayTests Class Reference

#include <surface_as_vertex_array_tests.h>

Inheritance diagram for SurfaceAsVertexArrayTests:
Collaboration diagram for SurfaceAsVertexArrayTests:

Public Member Functions

 SurfaceAsVertexArrayTests (TestHost &host, std::string output_dir, const Config &config)
 
void Initialize () override
 Called to initialize the test suite.
 
void Deinitialize () override
 Called to tear down 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 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_
 

Detailed Description

Tests rendering to GPU surfaces (render targets) and subsequently binding the rendered surface memory as a vertex attribute array (vertex stream).

This pattern takes advantage of Xbox UMA (Unified Memory Architecture) to perform GPU-driven vertex generation or displacement mapping without hardware vertex texture fetch.

Constructor & Destructor Documentation

◆ SurfaceAsVertexArrayTests()

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

Initializes the test suite and creates test cases.

Remarks
LinearDiffuseArray Renders four solid color strips (Red, Green, Blue, Yellow) into the first row of a linear A8R8G8B8 surface. The surface memory is then bound as NV2A_VERTEX_ATTR_DIFFUSE with TYPE_UB_D3D format and drawn via DRAW_ARRAYS. Expect to see four quads on a dark background: top-left Red, top-right Green, bottom-left Blue, bottom-right Yellow.
SwizzledDiffuseArray Renders four 2x2 color blocks into a swizzled A8R8G8B8 surface (paired with matching 32-bit depth buffer). Due to Morton order swizzling, the 2x2 blocks occupy contiguous 4-pixel chunks in memory. The surface is then bound as NV2A_VERTEX_ATTR_DIFFUSE. Expect to see four quads on a dark background: top-left Red, top-right Green, bottom-left Blue, bottom-right Yellow.
MultiStream Tests multiple simultaneous surface vertex streams. Surface A is rendered with Cyan and Black pixels and bound to NV2A_VERTEX_ATTR_DIFFUSE; Surface B is rendered with Black and Magenta pixels and bound to NV2A_VERTEX_ATTR_SPECULAR. A register combiner adds Diffuse and Specular colors. Expect to see two wide quads on a dark background: left Cyan (Cyan + Black) and right Magenta (Black + Magenta).
DynamicUpdateLoop Sequentially renders a single color into a surface and immediately draws the corresponding quad in four successive passes within a single frame to verify surface update synchronization between draw passes. Expect to see four quads on a dark background: top-left Red, top-right Green, bottom-left Blue, bottom-right Yellow.
RenderScalePattern Renders carrier triangle vertex indices and barycentric weights across swizzled surfaces A and B. The surfaces are bound as Diffuse and Specular vertex streams with a vertex shader that blends three carrier positions via address-register palette lookups (arl a0.x / c[A0+112]) to reconstruct a 3D mesh. Expect to see a clean, contiguous 3D mesh at 1x render scale. When emulator render scale > 1.0 downsamples/filters the surface with interpolation errors across diagonal seams, shifts in index values cause address-register lookups to select incorrect palette slots, visibly tearing the mesh into spikes (reproducing the behavior in the XDK DisplacementMap sample and xemu PR #2984).

Member Function Documentation

◆ Deinitialize()

void SurfaceAsVertexArrayTests::Deinitialize ( )
overridevirtual

Called to tear down the test suite.

Reimplemented from TestSuite.

◆ Initialize()

void SurfaceAsVertexArrayTests::Initialize ( )
overridevirtual

Called to initialize the test suite.

Reimplemented from TestSuite.

◆ TearDownTest()

void SurfaceAsVertexArrayTests::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: