Navigate to the top level

Color_key

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.
Suite class def

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.

Image with alpha
Test result for Color_key::FixedTex_Alpha
Image as seen on display
No alpha test result for Color_key::FixedTex_Alpha

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.

Image with alpha
Test result for Color_key::FixedTex_AlphaColor
Image as seen on display
No alpha test result for Color_key::FixedTex_AlphaColor

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.

Image with alpha
Test result for Color_key::FixedTex_Color
Image as seen on display
No alpha test result for Color_key::FixedTex_Color

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.

Image with alpha
Test result for Color_key::FixedTex_Disabled
Image as seen on display
No alpha test result for Color_key::FixedTex_Disabled

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_FixedTex_Alpha
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_FixedTex_Alpha

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_FixedTex_AlphaColor
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_FixedTex_AlphaColor

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_FixedTex_Color
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_FixedTex_Color

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_FixedTex_Disabled
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_FixedTex_Disabled

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_ProgTex_Alpha
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_ProgTex_Alpha

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_ProgTex_AlphaColor
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_ProgTex_AlphaColor

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_ProgTex_Color
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_ProgTex_Color

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.

Image with alpha
Test result for Color_key::IgnAlphaCh_ProgTex_Disabled
Image as seen on display
No alpha test result for Color_key::IgnAlphaCh_ProgTex_Disabled

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.

Image with alpha
Test result for Color_key::ProgTex_Alpha
Image as seen on display
No alpha test result for Color_key::ProgTex_Alpha

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.

Image with alpha
Test result for Color_key::ProgTex_AlphaColor
Image as seen on display
No alpha test result for Color_key::ProgTex_AlphaColor

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.

Image with alpha
Test result for Color_key::ProgTex_Color
Image as seen on display
No alpha test result for Color_key::ProgTex_Color

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.

Image with alpha
Test result for Color_key::ProgTex_Disabled
Image as seen on display
No alpha test result for Color_key::ProgTex_Disabled

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.

Image with alpha
Test result for Color_key::UnsampledTex
Image as seen on display
No alpha test result for Color_key::UnsampledTex