[D3D12] Emulate reversed Z in shaders because it's unsupported on Nvidia

This commit is contained in:
Triang3l 2018-09-26 20:46:24 +03:00
parent 55f96c0f83
commit ea7d9e9060
8 changed files with 215 additions and 152 deletions

View File

@ -1275,6 +1275,11 @@ void D3D12CommandProcessor::UpdateFixedFunctionState(
viewport.Height = viewport_scale_y * 2.0f * float(ssaa_scale_y);
viewport.MinDepth = viewport_offset_z;
viewport.MaxDepth = viewport_offset_z + viewport_scale_z;
if (viewport_scale_z < 0.0f) {
// MinDepth > MaxDepth doesn't work on Nvidia, emulating it in vertex
// shaders and when applying polygon offset.
std::swap(viewport.MinDepth, viewport.MaxDepth);
}
ff_viewport_update_needed_ |= ff_viewport_.TopLeftX != viewport.TopLeftX;
ff_viewport_update_needed_ |= ff_viewport_.TopLeftY != viewport.TopLeftY;
ff_viewport_update_needed_ |= ff_viewport_.Width != viewport.Width;
@ -1378,21 +1383,20 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
// W0 division control.
// http://www.x.org/docs/AMD/old/evergreen_3D_registers_v2.pdf
// VTX_XY_FMT = true: the incoming XY have already been multiplied by 1/W0.
// 8: VTX_XY_FMT = true: the incoming XY have already been multiplied by 1/W0.
// = false: multiply the X, Y coordinates by 1/W0.
// VTX_Z_FMT = true: the incoming Z has already been multiplied by 1/W0.
// 9: VTX_Z_FMT = true: the incoming Z has already been multiplied by 1/W0.
// = false: multiply the Z coordinate by 1/W0.
// VTX_W0_FMT = true: the incoming W0 is not 1/W0. Perform the reciprocal to
// get 1/W0.
uint32_t vtx_xy_fmt = (pa_cl_vte_cntl >> 8) & 1;
uint32_t vtx_z_fmt = (pa_cl_vte_cntl >> 9) & 1;
uint32_t vtx_w0_fmt = (pa_cl_vte_cntl >> 10) & 1;
dirty |= system_constants_.vertex_w_format[0] != vtx_xy_fmt;
dirty |= system_constants_.vertex_w_format[1] != vtx_z_fmt;
dirty |= system_constants_.vertex_w_format[2] != vtx_w0_fmt;
system_constants_.vertex_w_format[0] = vtx_xy_fmt;
system_constants_.vertex_w_format[1] = vtx_z_fmt;
system_constants_.vertex_w_format[2] = vtx_w0_fmt;
// 10: VTX_W0_FMT = true: the incoming W0 is not 1/W0. Perform the reciprocal
// to get 1/W0.
uint32_t ndc_control = (pa_cl_vte_cntl >> 8) & 0x7;
// Reversed depth.
if ((pa_cl_vte_cntl & (1 << 4)) &&
regs[XE_GPU_REG_PA_CL_VPORT_ZSCALE].f32 < 0.0f) {
ndc_control |= 1 << 3;
}
dirty |= system_constants_.ndc_control != ndc_control;
system_constants_.ndc_control = ndc_control;
// Conversion to Direct3D 12 normalized device coordinates.
// See viewport configuration in UpdateFixedFunctionState for explanations.

View File

@ -540,6 +540,13 @@ PipelineCache::UpdateStatus PipelineCache::UpdateRasterizerState(
register_file_->values[XE_GPU_REG_PA_SU_POLY_OFFSET_BACK_SCALE].f32;
}
}
// Reversed depth is emulated in vertex shaders because MinDepth > MaxDepth
// in viewports doesn't seem to work on Nvidia.
if ((register_file_->values[XE_GPU_REG_PA_CL_VTE_CNTL].u32 & (1 << 4)) &&
register_file_->values[XE_GPU_REG_PA_CL_VPORT_ZSCALE].f32 < 0.0f) {
poly_offset = -poly_offset;
poly_offset_scale = -poly_offset_scale;
}
if (((pa_su_sc_mode_cntl >> 3) & 0x3) == 0) {
// Fill mode is disabled.
fill_mode_wireframe = false;

View File

@ -1,14 +1,14 @@
// generated from `xb buildhlsl`
// source: primitive_point_list.gs.hlsl
const uint8_t primitive_point_list_gs[] = {
0x44, 0x58, 0x42, 0x43, 0xD0, 0x65, 0x5F, 0x92, 0x74, 0x64, 0x5F, 0xE4,
0xFD, 0x96, 0xA6, 0x25, 0x25, 0xC2, 0x9C, 0x39, 0x01, 0x00, 0x00, 0x00,
0x10, 0x15, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0x4C, 0x05, 0x00, 0x00, 0x24, 0x07, 0x00, 0x00, 0x44, 0x09, 0x00, 0x00,
0x74, 0x14, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x10, 0x05, 0x00, 0x00,
0x44, 0x58, 0x42, 0x43, 0x41, 0xB7, 0xED, 0xDB, 0x44, 0x45, 0x04, 0xC7,
0xAF, 0x03, 0xB7, 0xFE, 0x1E, 0xB6, 0x28, 0xF8, 0x01, 0x00, 0x00, 0x00,
0xE0, 0x14, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
0x1C, 0x05, 0x00, 0x00, 0xF4, 0x06, 0x00, 0x00, 0x14, 0x09, 0x00, 0x00,
0x44, 0x14, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xE0, 0x04, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x3C, 0x00, 0x00, 0x00, 0x01, 0x05, 0x53, 0x47, 0x00, 0x05, 0x00, 0x00,
0xE8, 0x04, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00,
0xB8, 0x04, 0x00, 0x00, 0x13, 0x13, 0x44, 0x25, 0x3C, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x24, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@ -18,99 +18,95 @@ const uint8_t primitive_point_list_gs[] = {
0x6D, 0x5F, 0x63, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x00, 0xAB, 0xAB,
0x64, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00,
0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x98, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xB4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x98, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xB8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0xD8, 0x02, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF4, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xDC, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB8, 0x02, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x18, 0x03, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x2C, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xF1, 0x02, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xB8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x50, 0x03, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xB8, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x67, 0x03, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x11, 0x03, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x28, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x75, 0x03, 0x00, 0x00,
0x2C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x4C, 0x03, 0x00, 0x00,
0x1C, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xBC, 0x03, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0xD4, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x94, 0x03, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x28, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0xF8, 0x03, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xA2, 0x03, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x04, 0x00, 0x00,
0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xF4, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xD8, 0x03, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0x1B, 0x04, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x30, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x14, 0x04, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x54, 0x04, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD4, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x26, 0x04, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x03, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x68, 0x04, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x04, 0x00, 0x00,
0x50, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x84, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x54, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
0xA8, 0x04, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xC4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x78, 0x04, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x94, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0x00, 0x00, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x76, 0x65, 0x72, 0x74, 0x65,
0x78, 0x5F, 0x77, 0x5F, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x00, 0x75,
0x69, 0x6E, 0x74, 0x33, 0x00, 0xAB, 0xAB, 0xAB, 0x01, 0x00, 0x13, 0x00,
0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xAB, 0x02, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x76,
0x65, 0x72, 0x74, 0x65, 0x78, 0x5F, 0x62, 0x61, 0x73, 0x65, 0x5F, 0x69,
0x6E, 0x64, 0x65, 0x78, 0x00, 0x64, 0x77, 0x6F, 0x72, 0x64, 0x00, 0xAB,
0x78, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x5F, 0x65, 0x6E, 0x64, 0x69,
0x61, 0x6E, 0x00, 0x64, 0x77, 0x6F, 0x72, 0x64, 0x00, 0xAB, 0xAB, 0xAB,
0x00, 0x00, 0x13, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0x02, 0x00, 0x00,
0x78, 0x65, 0x5F, 0x6E, 0x64, 0x63, 0x5F, 0x73, 0x63, 0x61, 0x6C, 0x65,
0x00, 0x66, 0x6C, 0x6F, 0x61, 0x74, 0x33, 0x00, 0x01, 0x00, 0x03, 0x00,
0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x25, 0x03, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x76,
0x65, 0x72, 0x74, 0x65, 0x78, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x5F,
0x65, 0x6E, 0x64, 0x69, 0x61, 0x6E, 0x00, 0x78, 0x65, 0x5F, 0x6E, 0x64,
0x63, 0x5F, 0x6F, 0x66, 0x66, 0x73, 0x65, 0x74, 0x00, 0x78, 0x65, 0x5F,
0x70, 0x69, 0x78, 0x65, 0x6C, 0x5F, 0x68, 0x61, 0x6C, 0x66, 0x5F, 0x70,
0x69, 0x78, 0x65, 0x6C, 0x5F, 0x6F, 0x66, 0x66, 0x73, 0x65, 0x74, 0x00,
0x66, 0x6C, 0x6F, 0x61, 0x74, 0x00, 0xAB, 0xAB, 0x00, 0x00, 0x03, 0x00,
0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x90, 0x03, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x70,
0x6F, 0x69, 0x6E, 0x74, 0x5F, 0x73, 0x69, 0x7A, 0x65, 0x00, 0x66, 0x6C,
0x6F, 0x61, 0x74, 0x32, 0x00, 0xAB, 0xAB, 0xAB, 0x01, 0x00, 0x03, 0x00,
0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xCA, 0x03, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x73,
0x73, 0x61, 0x61, 0x5F, 0x69, 0x6E, 0x76, 0x5F, 0x73, 0x63, 0x61, 0x6C,
0x65, 0x00, 0x78, 0x65, 0x5F, 0x70, 0x69, 0x78, 0x65, 0x6C, 0x5F, 0x70,
0x6F, 0x73, 0x5F, 0x72, 0x65, 0x67, 0x00, 0x78, 0x65, 0x5F, 0x61, 0x6C,
0x70, 0x68, 0x61, 0x5F, 0x74, 0x65, 0x73, 0x74, 0x00, 0x69, 0x6E, 0x74,
0x00, 0xAB, 0xAB, 0xAB, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x02, 0x00, 0x00,
0x78, 0x65, 0x5F, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5F, 0x62, 0x61,
0x73, 0x65, 0x5F, 0x69, 0x6E, 0x64, 0x65, 0x78, 0x00, 0x78, 0x65, 0x5F,
0x6E, 0x64, 0x63, 0x5F, 0x63, 0x6F, 0x6E, 0x74, 0x72, 0x6F, 0x6C, 0x00,
0x78, 0x65, 0x5F, 0x70, 0x69, 0x78, 0x65, 0x6C, 0x5F, 0x70, 0x6F, 0x73,
0x5F, 0x72, 0x65, 0x67, 0x00, 0x78, 0x65, 0x5F, 0x6E, 0x64, 0x63, 0x5F,
0x73, 0x63, 0x61, 0x6C, 0x65, 0x00, 0x66, 0x6C, 0x6F, 0x61, 0x74, 0x33,
0x00, 0xAB, 0xAB, 0xAB, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x29, 0x04, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x61, 0x6C, 0x70, 0x68, 0x61,
0x5F, 0x74, 0x65, 0x73, 0x74, 0x5F, 0x72, 0x61, 0x6E, 0x67, 0x65, 0x00,
0x78, 0x65, 0x5F, 0x63, 0x6F, 0x6C, 0x6F, 0x72, 0x5F, 0x65, 0x78, 0x70,
0x5F, 0x62, 0x69, 0x61, 0x73, 0x00, 0x66, 0x6C, 0x6F, 0x61, 0x74, 0x34,
0x00, 0xAB, 0xAB, 0xAB, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x1E, 0x03, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x70, 0x69, 0x78, 0x65, 0x6C,
0x5F, 0x68, 0x61, 0x6C, 0x66, 0x5F, 0x70, 0x69, 0x78, 0x65, 0x6C, 0x5F,
0x6F, 0x66, 0x66, 0x73, 0x65, 0x74, 0x00, 0x66, 0x6C, 0x6F, 0x61, 0x74,
0x00, 0xAB, 0xAB, 0xAB, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7A, 0x04, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x63, 0x6F, 0x6C, 0x6F, 0x72,
0x67, 0x03, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x6E, 0x64, 0x63, 0x5F, 0x6F,
0x66, 0x66, 0x73, 0x65, 0x74, 0x00, 0x78, 0x65, 0x5F, 0x61, 0x6C, 0x70,
0x68, 0x61, 0x5F, 0x74, 0x65, 0x73, 0x74, 0x00, 0x69, 0x6E, 0x74, 0x00,
0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x03, 0x00, 0x00,
0x78, 0x65, 0x5F, 0x70, 0x6F, 0x69, 0x6E, 0x74, 0x5F, 0x73, 0x69, 0x7A,
0x65, 0x00, 0x66, 0x6C, 0x6F, 0x61, 0x74, 0x32, 0x00, 0xAB, 0xAB, 0xAB,
0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x03, 0x00, 0x00,
0x78, 0x65, 0x5F, 0x73, 0x73, 0x61, 0x61, 0x5F, 0x69, 0x6E, 0x76, 0x5F,
0x73, 0x63, 0x61, 0x6C, 0x65, 0x00, 0x78, 0x65, 0x5F, 0x61, 0x6C, 0x70,
0x68, 0x61, 0x5F, 0x74, 0x65, 0x73, 0x74, 0x5F, 0x72, 0x61, 0x6E, 0x67,
0x65, 0x00, 0x78, 0x65, 0x5F, 0x63, 0x6F, 0x6C, 0x6F, 0x72, 0x5F, 0x65,
0x78, 0x70, 0x5F, 0x62, 0x69, 0x61, 0x73, 0x00, 0x66, 0x6C, 0x6F, 0x61,
0x74, 0x34, 0x00, 0xAB, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4C, 0x04, 0x00, 0x00, 0x78, 0x65, 0x5F, 0x63, 0x6F, 0x6C, 0x6F, 0x72,
0x5F, 0x6F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x5F, 0x6D, 0x61, 0x70, 0x00,
0x75, 0x69, 0x6E, 0x74, 0x34, 0x00, 0xAB, 0xAB, 0x01, 0x00, 0x13, 0x00,
0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xBC, 0x04, 0x00, 0x00, 0x4D, 0x69, 0x63, 0x72,
0x00, 0x00, 0x00, 0x00, 0x8C, 0x04, 0x00, 0x00, 0x4D, 0x69, 0x63, 0x72,
0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C,
0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F,
0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2E, 0x31, 0x00,

View File

@ -7,17 +7,17 @@
// cbuffer xe_system_cbuffer
// {
//
// uint3 xe_vertex_w_format; // Offset: 0 Size: 12 [unused]
// uint xe_vertex_base_index; // Offset: 12 Size: 4 [unused]
// uint xe_vertex_index_endian; // Offset: 0 Size: 4 [unused]
// uint xe_vertex_base_index; // Offset: 4 Size: 4 [unused]
// uint xe_ndc_control; // Offset: 8 Size: 4 [unused]
// uint xe_pixel_pos_reg; // Offset: 12 Size: 4 [unused]
// float3 xe_ndc_scale; // Offset: 16 Size: 12
// uint xe_vertex_index_endian; // Offset: 28 Size: 4 [unused]
// float xe_pixel_half_pixel_offset; // Offset: 28 Size: 4 [unused]
// float3 xe_ndc_offset; // Offset: 32 Size: 12 [unused]
// float xe_pixel_half_pixel_offset; // Offset: 44 Size: 4 [unused]
// int xe_alpha_test; // Offset: 44 Size: 4 [unused]
// float2 xe_point_size; // Offset: 48 Size: 8
// float2 xe_ssaa_inv_scale; // Offset: 56 Size: 8 [unused]
// uint xe_pixel_pos_reg; // Offset: 64 Size: 4 [unused]
// int xe_alpha_test; // Offset: 68 Size: 4 [unused]
// float2 xe_alpha_test_range; // Offset: 72 Size: 8 [unused]
// float2 xe_alpha_test_range; // Offset: 64 Size: 8 [unused]
// float4 xe_color_exp_bias; // Offset: 80 Size: 16 [unused]
// uint4 xe_color_output_map; // Offset: 96 Size: 16 [unused]
//

View File

@ -3,20 +3,20 @@
cbuffer xe_system_cbuffer : register(b0) {
// vec4 0
uint3 xe_vertex_w_format;
uint xe_vertex_index_endian;
uint xe_vertex_base_index;
uint xe_ndc_control;
uint xe_pixel_pos_reg;
// vec4 1
float3 xe_ndc_scale;
uint xe_vertex_index_endian;
float xe_pixel_half_pixel_offset;
// vec4 2
float3 xe_ndc_offset;
float xe_pixel_half_pixel_offset;
int xe_alpha_test;
// vec4 3
float2 xe_point_size;
float2 xe_ssaa_inv_scale;
// vec4 4
uint xe_pixel_pos_reg;
int xe_alpha_test;
float2 xe_alpha_test_range;
// vec4 5
float4 xe_color_exp_bias;

View File

@ -688,11 +688,35 @@ void DxbcShaderTranslator::StartTranslation() {
}
void DxbcShaderTranslator::CompleteVertexShader() {
// Get flags of what we should do with the position.
// Bit 0: XY are pre-divided by W.
// Bit 1: Z is pre-divided by W.
// Bit 2: W is not 1/W.
// Bit 3: Viewport depth is reversed.
rdef_constants_used_ |= 1ull << uint32_t(RdefConstantIndex::kSysNDCControl);
uint32_t ndc_control_temp = PushSystemTemp();
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_AND) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(12));
shader_code_.push_back(
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b1111, 1));
shader_code_.push_back(ndc_control_temp);
shader_code_.push_back(EncodeVectorReplicatedOperand(
D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER, kSysConst_NDCControl_Comp, 3));
shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
shader_code_.push_back(uint32_t(CbufferRegister::kSystemConstants));
shader_code_.push_back(kSysConst_NDCControl_Vec);
shader_code_.push_back(EncodeVectorSwizzledOperand(
D3D10_SB_OPERAND_TYPE_IMMEDIATE32, kSwizzleXYZW, 0));
shader_code_.push_back(1 << 0);
shader_code_.push_back(1 << 1);
shader_code_.push_back(1 << 2);
shader_code_.push_back(1 << 3);
++stat_.instruction_count;
++stat_.int_instruction_count;
// Revert getting the reciprocal of W and dividing XY by W if needed.
// TODO(Triang3l): Check if having XY or Z pre-divided by W should enable
// affine interpolation.
rdef_constants_used_ |= 1ull
<< uint32_t(RdefConstantIndex::kSysVertexWFormat);
uint32_t w_format_temp = PushSystemTemp();
// If the shader has returned 1/W, restore W. First take the reciprocal, which
// may be either W (what we need) or 1/W, depending on the vertex W format.
@ -709,16 +733,13 @@ void DxbcShaderTranslator::CompleteVertexShader() {
// Then, if the shader returns 1/W (vtx_w0_fmt is 0), write 1/(1/W) to the
// position.
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_MOVC) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(11));
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
shader_code_.push_back(
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b1000, 1));
shader_code_.push_back(system_temp_position_);
shader_code_.push_back(
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER,
kSysConst_VertexWFormat_Comp + 2, 3));
shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
shader_code_.push_back(uint32_t(CbufferRegister::kSystemConstants));
shader_code_.push_back(kSysConst_VertexWFormat_Vec);
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 2, 1));
shader_code_.push_back(ndc_control_temp);
shader_code_.push_back(
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 3, 1));
shader_code_.push_back(system_temp_position_);
@ -745,18 +766,13 @@ void DxbcShaderTranslator::CompleteVertexShader() {
// If vtx_xy_fmt and/or vtx_z_fmt are 1, XY and/or Z are pre-divided by W.
// Restore them in this case.
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_MOVC) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(11));
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
shader_code_.push_back(
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0111, 1));
shader_code_.push_back(system_temp_position_);
shader_code_.push_back(EncodeVectorSwizzledOperand(
D3D10_SB_OPERAND_TYPE_CONSTANT_BUFFER,
kSysConst_VertexWFormat_Comp | (kSysConst_VertexWFormat_Comp << 2) |
((kSysConst_VertexWFormat_Comp + 1) << 4),
3));
shader_code_.push_back(uint32_t(RdefConstantBufferIndex::kSystemConstants));
shader_code_.push_back(uint32_t(CbufferRegister::kSystemConstants));
shader_code_.push_back(kSysConst_VertexWFormat_Vec);
shader_code_.push_back(
EncodeVectorSwizzledOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b00010000, 1));
shader_code_.push_back(ndc_control_temp);
shader_code_.push_back(
EncodeVectorSwizzledOperand(D3D10_SB_OPERAND_TYPE_TEMP, kSwizzleXYZW, 1));
shader_code_.push_back(w_format_temp);
@ -768,7 +784,8 @@ void DxbcShaderTranslator::CompleteVertexShader() {
// Release w_format_temp.
PopSystemTemp();
// Apply scale for drawing without a viewport.
// Apply scale for drawing without a viewport, and also remap from OpenGL
// Z clip space to Direct3D if needed.
rdef_constants_used_ |= 1ull << uint32_t(RdefConstantIndex::kSysNDCScale);
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_MUL) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
@ -789,6 +806,46 @@ void DxbcShaderTranslator::CompleteVertexShader() {
++stat_.instruction_count;
++stat_.float_instruction_count;
// Reverse Z (Z = W - Z) if the viewport depth is inverted.
uint32_t reverse_z_temp = PushSystemTemp();
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_ADD) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(8));
shader_code_.push_back(
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0001, 1));
shader_code_.push_back(reverse_z_temp);
shader_code_.push_back(
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 3, 1));
shader_code_.push_back(system_temp_position_);
shader_code_.push_back(
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 2, 1) |
ENCODE_D3D10_SB_OPERAND_EXTENDED(1));
shader_code_.push_back(
ENCODE_D3D10_SB_EXTENDED_OPERAND_MODIFIER(D3D10_SB_OPERAND_MODIFIER_NEG));
shader_code_.push_back(system_temp_position_);
++stat_.instruction_count;
++stat_.float_instruction_count;
shader_code_.push_back(ENCODE_D3D10_SB_OPCODE_TYPE(D3D10_SB_OPCODE_MOVC) |
ENCODE_D3D10_SB_TOKENIZED_INSTRUCTION_LENGTH(9));
shader_code_.push_back(
EncodeVectorMaskedOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0b0100, 1));
shader_code_.push_back(system_temp_position_);
shader_code_.push_back(
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 3, 1));
shader_code_.push_back(ndc_control_temp);
shader_code_.push_back(
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 0, 1));
shader_code_.push_back(reverse_z_temp);
shader_code_.push_back(
EncodeVectorSelectOperand(D3D10_SB_OPERAND_TYPE_TEMP, 2, 1));
shader_code_.push_back(system_temp_position_);
++stat_.instruction_count;
++stat_.movc_instruction_count;
// Release reverse_z_temp.
PopSystemTemp();
// Release ndc_control_temp.
PopSystemTemp();
// Apply offset (multiplied by W) for drawing without a viewport and for half
// pixel offset.
rdef_constants_used_ |= 1ull << uint32_t(RdefConstantIndex::kSysNDCOffset);
@ -7214,7 +7271,6 @@ const DxbcShaderTranslator::RdefType DxbcShaderTranslator::rdef_types_[size_t(
{"float4", 1, 3, 1, 4, 0, 0, RdefTypeIndex::kUnknown, nullptr},
{"int", 0, 2, 1, 1, 0, 0, RdefTypeIndex::kUnknown, nullptr},
{"uint", 0, 19, 1, 1, 0, 0, RdefTypeIndex::kUnknown, nullptr},
{"uint3", 1, 19, 1, 3, 0, 0, RdefTypeIndex::kUnknown, nullptr},
{"uint4", 1, 19, 1, 4, 0, 0, RdefTypeIndex::kUnknown, nullptr},
{nullptr, 1, 19, 1, 4, 8, 0, RdefTypeIndex::kUint4, nullptr},
{nullptr, 1, 19, 1, 4, 32, 0, RdefTypeIndex::kUint4, nullptr},
@ -7230,21 +7286,21 @@ const DxbcShaderTranslator::RdefConstant
DxbcShaderTranslator::RdefConstantIndex::kCount)] = {
// SYSTEM CONSTANTS MUST BE UPDATED IF THEIR LAYOUT CHANGES!
// System constants vec4 0.
{"xe_vertex_w_format", RdefTypeIndex::kUint3, 0, 12},
{"xe_vertex_base_index", RdefTypeIndex::kUint, 12, 4},
{"xe_vertex_index_endian", RdefTypeIndex::kUint, 0, 4},
{"xe_vertex_base_index", RdefTypeIndex::kUint, 4, 4},
{"xe_ndc_control", RdefTypeIndex::kUint, 8, 4},
{"xe_pixel_pos_reg", RdefTypeIndex::kUint, 12, 4},
// System constants vec4 1.
{"xe_ndc_scale", RdefTypeIndex::kFloat3, 16, 12},
{"xe_vertex_index_endian", RdefTypeIndex::kUint, 28, 4},
{"xe_pixel_half_pixel_offset", RdefTypeIndex::kFloat, 28, 4},
// System constants vec4 2.
{"xe_ndc_offset", RdefTypeIndex::kFloat3, 32, 12},
{"xe_pixel_half_pixel_offset", RdefTypeIndex::kFloat, 44, 4},
{"xe_alpha_test", RdefTypeIndex::kInt, 44, 4},
// System constants vec4 3.
{"xe_point_size", RdefTypeIndex::kFloat2, 48, 8},
{"xe_ssaa_inv_scale", RdefTypeIndex::kFloat2, 56, 8},
// System constants vec4 4.
{"xe_pixel_pos_reg", RdefTypeIndex::kUint, 64, 4},
{"xe_alpha_test", RdefTypeIndex::kInt, 68, 4},
{"xe_alpha_test_range", RdefTypeIndex::kFloat2, 72, 8},
{"xe_alpha_test_range", RdefTypeIndex::kFloat2, 64, 8},
// System constants vec4 5.
{"xe_color_exp_bias", RdefTypeIndex::kFloat4, 80, 16},
// System constants vec4 6.

View File

@ -33,27 +33,28 @@ class DxbcShaderTranslator : public ShaderTranslator {
// - d3d12/shaders/xenos_draw.hlsli (for geometry shaders).
struct SystemConstants {
// vec4 0
uint32_t vertex_w_format[3];
uint32_t vertex_index_endian;
uint32_t vertex_base_index;
uint32_t ndc_control;
uint32_t pixel_pos_reg;
// vec4 1
float ndc_scale[3];
uint32_t vertex_index_endian;
float pixel_half_pixel_offset;
// vec4 2
float ndc_offset[3];
float pixel_half_pixel_offset;
// 0 - disabled, 1 - passes if in range, -1 - fails if in range.
int32_t alpha_test;
// vec4 3
float point_size[2];
float ssaa_inv_scale[2];
// vec3 4
uint32_t pixel_pos_reg;
// 0 - disabled, 1 - passes if in range, -1 - fails if in range.
int32_t alpha_test;
// The range is floats as uints so it's easier to pass infinity.
uint32_t alpha_test_range[2];
uint32_t padding_4[2];
// vec4 5
float color_exp_bias[4];
@ -139,32 +140,32 @@ class DxbcShaderTranslator : public ShaderTranslator {
};
enum : uint32_t {
kSysConst_VertexWFormat_Vec = 0,
kSysConst_VertexWFormat_Comp = 0,
kSysConst_VertexIndexEndian_Vec = 0,
kSysConst_VertexIndexEndian_Comp = 0,
kSysConst_VertexBaseIndex_Vec = 0,
kSysConst_VertexBaseIndex_Comp = 3,
kSysConst_VertexBaseIndex_Comp = 1,
kSysConst_NDCControl_Vec = 0,
kSysConst_NDCControl_Comp = 2,
kSysConst_PixelPosReg_Vec = 0,
kSysConst_PixelPosReg_Comp = 3,
kSysConst_NDCScale_Vec = 1,
kSysConst_NDCScale_Comp = 0,
kSysConst_VertexIndexEndian_Vec = 1,
kSysConst_VertexIndexEndian_Comp = 3,
kSysConst_PixelHalfPixelOffset_Vec = 1,
kSysConst_PixelHalfPixelOffset_Comp = 3,
kSysConst_NDCOffset_Vec = 2,
kSysConst_NDCOffset_Comp = 0,
kSysConst_PixelHalfPixelOffset_Vec = 2,
kSysConst_PixelHalfPixelOffset_Comp = 3,
kSysConst_AlphaTest_Vec = 2,
kSysConst_AlphaTest_Comp = 3,
kSysConst_PointSize_Vec = 3,
kSysConst_PointSize_Comp = 0,
kSysConst_SSAAInvScale_Vec = 3,
kSysConst_SSAAInvScale_Comp = 2,
kSysConst_PixelPosReg_Vec = 4,
kSysConst_PixelPosReg_Comp = 0,
kSysConst_AlphaTest_Vec = 4,
kSysConst_AlphaTest_Comp = 1,
kSysConst_AlphaTestRange_Vec = 4,
kSysConst_AlphaTestRange_Comp = 2,
kSysConst_AlphaTestRange_Comp = 0,
kSysConst_ColorExpBias_Vec = 5,
@ -397,7 +398,6 @@ class DxbcShaderTranslator : public ShaderTranslator {
kFloat4,
kInt,
kUint,
kUint3,
kUint4,
// Bool constants.
kUint4Array8,
@ -439,16 +439,16 @@ class DxbcShaderTranslator : public ShaderTranslator {
enum class RdefConstantIndex {
kSystemConstantFirst,
kSysVertexWFormat = kSystemConstantFirst,
kSysVertexBaseIndex,
kSysNDCScale,
kSysVertexBaseIndex = kSystemConstantFirst,
kSysVertexIndexEndian,
kSysNDCOffset,
kSysNDCControl,
kSysPixelPosReg,
kSysNDCScale,
kSysPixelHalfPixelOffset,
kSysNDCOffset,
kSysAlphaTest,
kSysPointSize,
kSysSSAAInvScale,
kSysPixelPosReg,
kSysAlphaTest,
kSysAlphaTestRange,
kSysColorExpBias,
kSysColorOutputMap,