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

#include <combiner_tests.h>

Inheritance diagram for CombinerTests:
Collaboration diagram for CombinerTests:

Public Member Functions

 CombinerTests (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.
 
- 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.
 
virtual void TearDownTest ()
 Called after 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 behavior of NV097_SET_COMBINER_* and NV097_SET_SPECULAR_* final combiner operations.

Constructor & Destructor Documentation

◆ CombinerTests()

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

Initializes the test suite and creates test cases.

Remarks
ColorAlphaIndependence Demonstrates that setting color on a combiner register does not affect alpha.
SpecularR0SumFlags Tests behavior of specular_add_invert_r0, specular_add_invert_v1, and specular_clamp on final combiner sum (SRC_SPEC_R0_SUM). Each quad is split into tested (left) and expected reference (right) halves. Validates positive overflow clamping on sums exceeding 1.0, individual and simultaneous operand inversion (1 - R0, 1 - V1), and clamping behavior with negative/underflowing input registers.
InputMappings Tests behavior of each CombinerMapping input modifier (UNSIGNED_IDENTITY, UNSIGNED_INVERT, EXPAND_NORMAL, EXPAND_NEGATE, HALFBIAS_NORMAL, HALFBIAS_NEGATE, SIGNED_IDENTITY, SIGNED_NEGATE) across positive (+0.70) and negative (-0.40) input registers. Output is scaled and biased (0.5 * mapping(x) + 0.5) to keep all results within [0.0, 1.0]. Each quad is split into actual (left) and expected reference (right) halves.
Independence Demonstrates that setting a register's value in a combiner stage does not mutate the value until after it is assigned as an output. The test performs several draws where R0 is initialized to some color then both mutated and copied into R1, demonstrating that the original value of R0 is copied into R1 before being replaced with the new value.
Mux Tests behavior of the "MUX" combiner mode, in which R0.a is used to select between the AB and CD outputs.
UnboundTex Demonstrates that the alpha channel for unbound textures is set to 1.0.
AlphaFromBlue Demonstrates behavior of the "blue to alpha" flags.
CombinerOps Tests the various output operations.
SpecialInputs Tests the special input registers in the final combiner.
SignedCombinerOps Tests behavior of combiner output operations (OP_IDENTITY, OP_SHIFT_LEFT_1, OP_SHIFT_LEFT_2, OP_SHIFT_RIGHT_1, OP_BIAS) in conjunction with signed (negative) values. Verifies that negative values are properly scaled and clamped when added to a positive base value in subsequent stages.
SignedToUnsignedMapping Validates behavior when known signed (negative) values are mapped as MAP_UNSIGNED_IDENTITY versus MAP_SIGNED_IDENTITY across intermediate registers, pass-through texture coordinates, and a multi-stage pipeline. Verifies that MAP_UNSIGNED_IDENTITY properly clamps negative values to 0.0 (preserving base colors), while MAP_SIGNED_IDENTITY preserves negative values (allowing subtraction).
TextureDestination Demonstrates and validates behavior when general combiner stages write to texture registers (DST_TEX0, DST_TEX1). Tests cross-stage register forwarding, in-place read-modify-write, multi-stage pipeline flow, direct Final Combiner register reads, alpha channel destination writes, and unbound texture registers as general scratch registers.
ShiftClamping Validates clamping behavior combined with combiner output shift and bias operations (OP_IDENTITY, OP_SHIFT_RIGHT_1, OP_BIAS, OP_SHIFT_LEFT_1, OP_SHIFT_LEFT_1_BIAS, OP_SHIFT_LEFT_2). Each rectangular quad is split in half: the left half displays the actual tested combiner result, while the right half displays the forced exact expected reference value. Demonstrates post-shift/bias clamping on sums exceeding 1.0 (internal accumulator headroom is preserved before scale/bias) and verifies positive saturation.
SpecularR0Sum Validates final combiner SRC_SPEC_R0_SUM (R0 + Specular) across general combiner output operations (IDENTITY, OP_SHIFT_LEFT_1, OP_SHIFT_LEFT_2, OP_SHIFT_RIGHT_1, OP_BIAS, OP_SHIFT_LEFT_1_BIAS) with specular zeroed. Each quad is split into tested (left) and expected reference (right) halves, comparing direct SRC_R0 against SRC_SPEC_R0_SUM to isolate emulator discrepancies under bias operations.

Member Function Documentation

◆ Deinitialize()

void CombinerTests::Deinitialize ( )
overridevirtual

Called to tear down the test suite.

Reimplemented from TestSuite.

◆ Initialize()

void CombinerTests::Initialize ( )
overridevirtual

Called to initialize the test suite.

Reimplemented from TestSuite.


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