mirror of https://github.com/xemu-project/xemu.git
nv2a: (Probably partial) handling for `1D7C`
Implements handling for the unknown 0x1D7C command in order to match observed behavior in the MS Dashboard and Tenchu: Return from Darkness. Setting 1D7C's low bit appears to disable the line and poly smoothing commands. Fixes #1162 [Test](https://github.com/abaire/nxdk_pgraph_tests/blob/main/src/tests/three_d_primitive_tests.cpp) [HW Results](https://github.com/abaire/nxdk_pgraph_tests_golden_results/wiki/Results-3D_primitive)
This commit is contained in:
parent
d557a294fe
commit
5cd1e3cbca
|
@ -517,6 +517,7 @@ static const VMStateDescription vmstate_nv2a = {
|
|||
VMSTATE_INT32_ARRAY(pgraph.gl_draw_arrays_start, NV2AState, 1250),
|
||||
VMSTATE_INT32_ARRAY(pgraph.gl_draw_arrays_count, NV2AState, 1250),
|
||||
VMSTATE_UINT32_ARRAY(pgraph.regs, NV2AState, 0x2000),
|
||||
VMSTATE_BOOL(pgraph.smoothing_enabled, NV2AState),
|
||||
VMSTATE_UINT32(pmc.pending_interrupts, NV2AState),
|
||||
VMSTATE_UINT32(pmc.enabled_interrupts, NV2AState),
|
||||
VMSTATE_UINT32(pfifo.pending_interrupts, NV2AState),
|
||||
|
|
|
@ -360,6 +360,8 @@ typedef struct PGRAPHState {
|
|||
bool ltc1_dirty[NV2A_LTC1_COUNT];
|
||||
|
||||
float material_alpha;
|
||||
// FIXME: Find the correct register for this.
|
||||
bool smoothing_enabled;
|
||||
|
||||
// should figure out where these are in lighting context
|
||||
float light_infinite_half_vector[NV2A_MAX_LIGHTS][3];
|
||||
|
|
|
@ -1220,6 +1220,8 @@
|
|||
# define NV097_SET_ZMIN_MAX_CONTROL_ZCLAMP_EN 0x000000F0
|
||||
# define NV097_SET_ZMIN_MAX_CONTROL_ZCLAMP_EN_CULL 0
|
||||
# define NV097_SET_ZMIN_MAX_CONTROL_ZCLAMP_EN_CLAMP 1
|
||||
# define NV097_SET_SMOOTHING_CONTROL 0x00001D7C
|
||||
# define NV097_SET_SMOOTHING_CONTROL_DISABLE 0x00000001
|
||||
# define NV097_SET_ZSTENCIL_CLEAR_VALUE 0x00001D8C
|
||||
# define NV097_SET_COLOR_CLEAR_VALUE 0x00001D90
|
||||
# define NV097_CLEAR_SURFACE 0x00001D94
|
||||
|
|
|
@ -3049,14 +3049,16 @@ DEF_METHOD(NV097, SET_BEGIN_END)
|
|||
glEnable(GL_PROGRAM_POINT_SIZE);
|
||||
|
||||
/* Edge Antialiasing */
|
||||
if (pg->regs[NV_PGRAPH_SETUPRASTER] &
|
||||
NV_PGRAPH_SETUPRASTER_LINESMOOTHENABLE) {
|
||||
if (pg->smoothing_enabled
|
||||
&& pg->regs[NV_PGRAPH_SETUPRASTER] &
|
||||
NV_PGRAPH_SETUPRASTER_LINESMOOTHENABLE) {
|
||||
glEnable(GL_LINE_SMOOTH);
|
||||
} else {
|
||||
glDisable(GL_LINE_SMOOTH);
|
||||
}
|
||||
if (pg->regs[NV_PGRAPH_SETUPRASTER] &
|
||||
NV_PGRAPH_SETUPRASTER_POLYSMOOTHENABLE) {
|
||||
if (pg->smoothing_enabled
|
||||
&& pg->regs[NV_PGRAPH_SETUPRASTER] &
|
||||
NV_PGRAPH_SETUPRASTER_POLYSMOOTHENABLE) {
|
||||
glEnable(GL_POLYGON_SMOOTH);
|
||||
} else {
|
||||
glDisable(GL_POLYGON_SMOOTH);
|
||||
|
@ -3457,6 +3459,14 @@ DEF_METHOD(NV097, SET_ZMIN_MAX_CONTROL)
|
|||
}
|
||||
}
|
||||
|
||||
DEF_METHOD(NV097, SET_SMOOTHING_CONTROL)
|
||||
{
|
||||
// FIXME: Find the correct register for this.
|
||||
pg->smoothing_enabled = !GET_MASK(parameter,
|
||||
NV097_SET_SMOOTHING_CONTROL_DISABLE);
|
||||
// FIXME: Handle the remaining bits (observed values 0xFFFF0000, 0xFFFF0001)
|
||||
}
|
||||
|
||||
DEF_METHOD(NV097, SET_ZSTENCIL_CLEAR_VALUE)
|
||||
{
|
||||
pg->regs[NV_PGRAPH_ZSTENCILCLEARVALUE] = parameter;
|
||||
|
@ -4027,6 +4037,7 @@ void pgraph_init(NV2AState *d)
|
|||
shader_cache_init(pg);
|
||||
|
||||
pg->material_alpha = 0.0f;
|
||||
pg->smoothing_enabled = false;
|
||||
SET_MASK(pg->regs[NV_PGRAPH_CONTROL_3], NV_PGRAPH_CONTROL_3_SHADEMODE,
|
||||
NV_PGRAPH_CONTROL_3_SHADEMODE_SMOOTH);
|
||||
pg->primitive_mode = PRIM_TYPE_INVALID;
|
||||
|
|
|
@ -169,6 +169,7 @@ DEF_METHOD_RANGE(NV097, SET_VERTEX_DATA4S_M, 32)
|
|||
DEF_METHOD(NV097, SET_SEMAPHORE_OFFSET)
|
||||
DEF_METHOD(NV097, BACK_END_WRITE_SEMAPHORE_RELEASE)
|
||||
DEF_METHOD(NV097, SET_ZMIN_MAX_CONTROL)
|
||||
DEF_METHOD(NV097, SET_SMOOTHING_CONTROL)
|
||||
DEF_METHOD(NV097, SET_ZSTENCIL_CLEAR_VALUE)
|
||||
DEF_METHOD(NV097, SET_COLOR_CLEAR_VALUE)
|
||||
DEF_METHOD(NV097, CLEAR_SURFACE)
|
||||
|
|
Loading…
Reference in New Issue