Three small fixes: MAC address, redundant shader rebuild, unused edge list - #2751
Open
Umberto-DEV wants to merge 3 commits into
Open
Three small fixes: MAC address, redundant shader rebuild, unused edge list#2751Umberto-DEV wants to merge 3 commits into
Umberto-DEV wants to merge 3 commits into
Conversation
SetupDirectBoot() writes the six MAC bytes in three 16-bit stores, but the destination address is fixed, so all three land on 0x02FFFCF4 and only the last two bytes end up in memory. The next field starts at 0x02FFFCFA, which leaves exactly six bytes for the address, and the user settings loop below uses 0x02FFFC80+i in the same way.
SetRenderSettings() deletes and recompiles every shader and reallocates the buffers on each call, even when it is called with the values already in use. The GL renderer bails out on the same condition; the compute one does not. ScaleFactor starts at 0, which is not a valid scale, so the first call still goes through and the renderer is always initialised.
The edge marking pass in RenderSceneChunk() has been commented out since the OpenGL renderer landed, so RenderPolygonEdgeBatch() has no callers and nothing ever reads the edge index list. The list is still built for every polygon and uploaded to the GPU on every frame. Gate both the build and the commented-out draw on one constant, so whoever restores the pass flips it in the same commit and the two cannot disagree. This does not change what is drawn.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three unrelated fixes, one commit each.
1. Only two of the six bytes of the MAC address are written —
src/SPI.cppWhen a DSi game boots directly, melonDS writes the address to the same spot three times instead of moving along. Four of the six bytes never arrive, so the emulated console ends up with an address its firmware never gave it.
What changes for you: fixes a bug. I don't know of a game that misbehaves because of it, and I'm not claiming there is one.
2. Changing a video setting rebuilds every shader, even when nothing changed —
src/GPU3D_Compute.cppEvery time the renderer is handed its settings it throws away all its shaders and rebuilds them, even when the values are the ones it is already using. The OpenGL renderer already checks for this; the compute one doesn't.
What changes for you: faster. On a test device, changing video settings rebuilt 33 shaders ten times in one session. After the fix: none. It still rebuilds on startup, where it has to.
3. The renderer prepares data for a drawing step that is switched off —
src/GPU3D_OpenGL.cppThe edge outlines step has been commented out for years, but the list of edges it would need is still built for every polygon and sent to the graphics card every frame. This doesn't turn the step back on — it just stops paying for it while it's off.
What changes for you: removes work that has no effect. I haven't measured how much.
What this doesn't prove
Fixes 1 and 3 aren't backed by a measurement — I can show the bug in the code, not its effect on screen. Fix 2 was measured on Android only.