Skip to content

Commit

Permalink
Moved XP variant to makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
sauraen committed Sep 22, 2024
1 parent 3598a54 commit 800385c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 28 deletions.
54 changes: 27 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ default: F3DEX3_BrZ F3DEX3_BrW
# List of all compile-time options supported by the microcode source.
ALL_OPTIONS := \
CFG_G_BRANCH_W \
CFG_DEBUG_NORMALS \
CFG_NO_OCCLUSION_PLANE \
CFG_LEGACY_VTX_PIPE \
CFG_EXTRA_PRECISION \
CFG_PROFILING_A \
CFG_PROFILING_B \
CFG_PROFILING_C
Expand Down Expand Up @@ -139,44 +139,44 @@ define rule_builder_final
$$(eval $$(call ucode_rule))
endef

define rule_builder_dbgn
NAME_FINAL := $(NAME_DBGN)
OPTIONS_FINAL := $(OPTIONS_DBGN)
define rule_builder_prof
NAME_FINAL := $(NAME_PROF)
OPTIONS_FINAL := $(OPTIONS_PROF)
$$(eval $$(call rule_builder_final))

NAME_FINAL := $(NAME_DBGN)_dbgN
OPTIONS_FINAL := $(OPTIONS_DBGN) CFG_DEBUG_NORMALS
NAME_FINAL := $(NAME_PROF)_PA
OPTIONS_FINAL := $(OPTIONS_PROF) CFG_PROFILING_A
$$(eval $$(call rule_builder_final))
endef

define rule_builder_prof
NAME_DBGN := $(NAME_PROF)
OPTIONS_DBGN := $(OPTIONS_PROF)
$$(eval $$(call rule_builder_dbgn))

NAME_DBGN := $(NAME_PROF)_PA
OPTIONS_DBGN := $(OPTIONS_PROF) CFG_PROFILING_A
$$(eval $$(call rule_builder_dbgn))

NAME_DBGN := $(NAME_PROF)_PB
OPTIONS_DBGN := $(OPTIONS_PROF) CFG_PROFILING_B
$$(eval $$(call rule_builder_dbgn))
NAME_FINAL := $(NAME_PROF)_PB
OPTIONS_FINAL := $(OPTIONS_PROF) CFG_PROFILING_B
$$(eval $$(call rule_builder_final))

NAME_DBGN := $(NAME_PROF)_PC
OPTIONS_DBGN := $(OPTIONS_PROF) CFG_PROFILING_C
$$(eval $$(call rule_builder_dbgn))
NAME_FINAL := $(NAME_PROF)_PC
OPTIONS_FINAL := $(OPTIONS_PROF) CFG_PROFILING_C
$$(eval $$(call rule_builder_final))
endef

define rule_builder_noc
NAME_PROF := $(NAME_NOC)
OPTIONS_PROF := $(OPTIONS_NOC)
define rule_builder_xp
NAME_PROF := $(NAME_XP)
OPTIONS_PROF := $(OPTIONS_XP)
$$(eval $$(call rule_builder_prof))

NAME_PROF := $(NAME_NOC)_NOC
OPTIONS_PROF := $(OPTIONS_NOC) CFG_NO_OCCLUSION_PLANE
NAME_PROF := $(NAME_XP)_XP
OPTIONS_PROF := $(OPTIONS_XP) CFG_EXTRA_PRECISION
$$(eval $$(call rule_builder_prof))
endef

define rule_builder_noc
NAME_XP := $(NAME_NOC)
OPTIONS_XP := $(OPTIONS_NOC)
$$(eval $$(call rule_builder_xp))

NAME_XP := $(NAME_NOC)_NOC
OPTIONS_XP := $(OPTIONS_NOC) CFG_NO_OCCLUSION_PLANE
$$(eval $$(call rule_builder_xp))
endef

define rule_builder_lvp
NAME_NOC := $(NAME_LVP)
OPTIONS_NOC := $(OPTIONS_LVP)
Expand Down
10 changes: 10 additions & 0 deletions docs/Documentation/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,18 @@ SM64), or `BrW` if the microcode is replacing F3DZEX (i.e. OoT or MM). This
controls whether `SPBranchLessZ*` uses the vertex's W coordinate or screen Z
coordinate.

## Extra Precision (`XP`)

This configuration attempts to reproduce F3DEX(1) numerical behavior for Z
buffer coefficients, potentially improving Z fighting in some cases of decals or
opaque surfaces intended to behave like decals.

## Debug Normals (`dbgN`)

Debug Normals has been moved out of the Makefile as it is not a microcode
version intended to be shipped. It can still be enabled by changing
`CFG_DEBUG_NORMALS equ 0` to `1` in the microcode.

To help debug lighting issues when integrating F3DEX3 into your romhack, this
feature causes the vertex colors of any material with lighting enabled to be set
to the transformed, normalized world space normals. The X, Y, and Z components
Expand Down
11 changes: 11 additions & 0 deletions docs/Documentation/Design Tradeoffs.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,17 @@ behavior when supplying a direct-mapped or physical address such as 0x80101000,
segment 0 must always be 0x00000000 so that this address resolves to e.g.
0x101000 as expected in this example.

## Non-textured tris

In F3DEX2, the RSP time for drawing non-textured tris was significantly lower
than for textured tris, by skipping a chunk of computation for the texture
coefficients if they were disabled. In F3DEX3, little to no computation is
skipped when textures are disabled, which means that the performance gain from
disabling textures in F3DEX2 has been mostly eliminated. (RDP time savings from
avoiding loading a texture are unaffected of course.) However, almost all
materials use textures, and F3DEX3 is a little faster at drawing textured tris
than F3DEX2, so this is still a benefit overall.

## Obscure semantic differences from F3DEX2 that should never matter in practice

- `SPLoadUcode*` corrupts the current M inverse transpose matrix state. If using
Expand Down
2 changes: 1 addition & 1 deletion f3dex3.s
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,6 @@ tPosLmH equ $v8
tPosHmM equ $v11
tPosHmL equ $v12 // not computed directly in CFG_EXTRA_PRECISION

CFG_EXTRA_PRECISION equ 0
.if CFG_EXTRA_PRECISION
tNRPosFactor equ $v31[4] // 4
tNRNegFactor equ $v31[0] // -4
Expand Down Expand Up @@ -3534,6 +3533,7 @@ lt_after_xfrm_normals:
jal lt_normalize
luv vPairLt, (ltBufOfs + 0)(curLight) // Total light level, init to ambient
// Set up ambient occlusion: light *= (factor * (alpha - 1) + 1)
CFG_DEBUG_NORMALS equ 0 // Can manually enable here
.if CFG_DEBUG_NORMALS
.warning "Debug normals visualization is enabled"
vmudh $v29, vOne, $v31[5] // 0x4000; middle gray
Expand Down

0 comments on commit 800385c

Please sign in to comment.