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

#include <color_key_tests.h>

Inheritance diagram for ColorKeyTests:
Collaboration diagram for ColorKeyTests:

Public Member Functions

 ColorKeyTests (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)
 
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)
 
void RunAll ()
 
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
 
- Protected Attributes inherited from TestSuite
TestHosthost_
 
std::string output_dir_
 
std::string suite_name_
 
bool allow_saving_ {true}
 
std::map< std::string, std::function< void()> > tests_ {}
 
PGRAPHDiffToken pgraph_diff_
 
bool enable_progress_log_
 
bool enable_pgraph_region_diff_
 
uint32_t delay_milliseconds_between_tests_
 
std::shared_ptr< FTPLoggerftp_logger_
 

Detailed Description

Tests NV097_SET_COLOR_KEY_COLOR (0x0AE0) and the NV097_SET_TEXTURE_CONTROL0_COLOR_KEY_MODE color key functions.

NV097_SET_TEXTURE_CONTROL0_COLOR_KEY_MODE is used to instruct the hardware what to do when a texel's value matches a color key. See ColorKeyMode for the supported modes.

NV097_SET_COLOR_KEY_COLOR is used to instruct the hardware which texels should have the color key mode applied.

Each test renders a series of quads, with each quad being divided into four subcomponents (NW = northwest/top left, etc...):

NW: Checkerboard alternating a color-keyed color and a light grey. NE: Checkerboard alternating a dark grey and an alpha-keyed color. SW: Checkerboard alternating the color-keyed color with alpha from the alpha key and the color keyed color with 0xFF alpha that matches none of the keys. SE: Checkerboard alternating a non-keyed color with alpha from the color key and a non-keyed color with alpha from the alpha key.

Constructor & Destructor Documentation

◆ ColorKeyTests()

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

Initializes the test suite and creates test cases.

Remarks
FixedTex_Alpha With the fixed function pipeline, zero out just the alpha channel for all places where the colorkey matches the value of a texel. RGB channels are unaffected. This should omit all texels that match the color key.
FixedTex_AlphaColor With the fixed function pipeline, kill the texel completely for wherever the color key matches the value of a texel. This completely masks the texel rather than simply zero-ing out values. See IgnAlphaCh_FixedTex_AlphaColor. This should omit all texels that match the color key.
FixedTex_Color With the fixed function pipeline, zero out the color and alpha channels for all places where the color key matches the value of a texel. Note that the Alpha channel is also set to zero. This should omit all texels that match the color key.
FixedTex_Disabled With the fixed function pipeline, make no changes to any texel whose value matches the color key. This should render all texels as fully opaque with their original colors.
IgnAlphaCh_FixedTex_Alpha With the fixed function pipeline, set the color key mode to clear just the alpha channel for matching texels. When rendering, set the final combiner to use an alpha value of 0xFF for all texels, forcing pixels to be rendered opaque despite matching the color key. This should render all texels fully opaque with their original colors, since the texel alpha is ignored during texturing.
IgnAlphaCh_FixedTex_AlphaColor With the fixed function pipeline, kill the texel completely for wherever the color key matches the value of a texel. This completely masks the texel rather than simply zero-ing out values. When rendering, set the final combiner to use an alpha value of 0xFF for all texels. This omits killed texels even though the combiner sets them to fully opaque during texturing.
IgnAlphaCh_FixedTex_Color With the fixed function pipeline, zero out the color and alpha channels for all places where the color key matches the value of a texel. When rendering, set the final combiner to use an alpha value of 0xFF for all texels, forcing pixels to be rendered opaque despite matching the color key. This should render matching texels as fully black, since their RGB values were zeroed out and the zeroed alpha channel is ignored.
IgnAlphaCh_FixedTex_Disabled With the fixed function pipeline, make no changes to any texel whose value matches the color key. When rendering, set the final combiner to use an alpha value of 0xFF for all texels. This should render all texels as fully opaque with their original colors.
IgnAlphaCh_ProgTex_Alpha With a programmable shader, set the color key mode to clear just the alpha channel for matching texels. When rendering, set the final combiner to use an alpha value of 0xFF for all texels, forcing pixels to be rendered opaque despite matching the color key. This should render all texels fully opaque with their original colors, since the texel alpha is ignored during texturing.
IgnAlphaCh_ProgTex_AlphaColor With a programmable shader, kill the texel completely for wherever the color key matches the value of a texel. This completely masks the texel rather than simply zero-ing out values. When rendering, set the final combiner to use an alpha value of 0xFF for all texels. This omits killed texels even though the combiner sets them to fully opaque during texturing.
IgnAlphaCh_ProgTex_Color With a programmable shader, zero out the color and alpha channels for all places where the color key matches the value of a texel. When rendering, set the final combiner to use an alpha value of 0xFF for all texels, forcing pixels to be rendered opaque despite matching the color key. This should render matching texels as fully black, since their RGB values were zeroed out and the zeroed alpha channel is ignored.
IgnAlphaCh_ProgTex_Disabled With a programmable shader, make no changes to any texel whose value matches the color key. When rendering, set the final combiner to use an alpha value of 0xFF for all texels. This should render all texels as fully opaque with their original colors.
ProgTex_Alpha With a programmable shader, zero out just the alpha channel for all places where the colorkey matches the value of a texel. RGB channels are unaffected. This should omit all texels that match the color key.
ProgTex_AlphaColor With a programmable shader, kill the texel completely for wherever the color key matches the value of a texel. This completely masks the texel rather than simply zero-ing out values. See IgnAlphaCh_FixedTex_AlphaColor. This should omit all texels that match the color key.
ProgTex_Color With a programmable shader, zero out the color and alpha channels for all places where the color key matches the value of a texel. Note that the Alpha channel is also set to zero. This should omit all texels that match the color key.
ProgTex_Disabled With a programmable shader, make no changes to any texel whose value matches the color key. This should render all texels as fully opaque with their original colors.
UnsampledTex Demonstrates that the color keys are independent of whether the associated texture stage is used in the final composition or not. With a programable shader, draw two quads with the color key mode set to kill matching texels. In both cases, the final color combiner only samples from texture 0. The left quad renders with the blue color key as key 0. The right quad enables the second texture stage, keeps key 0, and adds the magenta color key with an alpha value forced to 0xFF as key 1. The left image should have the blue color in the NW checkerboard killed. The right image should have the blue color in the NW checkerboard killed, but also the secondary blue color in the SW checkerboard killed. This is because the unsampled magenta texture's SW secondary color matches the magenta + 0xFF alpha enabled as a color key in the second operation.

Member Function Documentation

◆ Initialize()

void ColorKeyTests::Initialize ( )
overridevirtual

Called to initialize the test suite.

Reimplemented from TestSuite.

◆ TearDownTest()

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