-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SM64/F3D] Use WriteDifferingAndRevert for bleed #461
base: main
Are you sure you want to change the base?
Conversation
Noticed something othermode is doing sigh back to vs code I go |
Write all logic remains unaffected, obviously. A new dict was added to map each mode cmd to its default. For the actual bleed part, we fIrst need to add geo mode reverts of the last material to the geo mode of the current material, since the current material may not set them now. For othermodes we do something different, get all reverts and add any that doesn´t get set again by the current material ignoring bleeding. For the geo mode revert, we keep track of one geo mode command for set and clear, updating it as we go. For othermodes we keep track of all of the command types and then revert them using the new dict.
ba73388
to
8ef2b02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixed my issues with point lights, thank you
I feel like I could improve this further in terms of how resets are handled, will look into it later today, functionality shouldn't change tho unless I find a bug |
We cannot just assume that othermodeh or othermodel are always setting the same bits, so instead we write the diff of the current cmd to the one already in the reset dict, this means that if a materials sets rendermode and another sets alpha compare (for example) it will still revert the rendermode because those bits will be carried over in the reset dict
Fixes lag at start up from draw layers being set unnecessarily. Some clean up that I already did in Fast-64#461
Fixes lag at start up from draw layers being set unnecessarily. Some clean up that I already did in Fast-64#461
* [Repo Settings] Only set if different Fixes lag at start up from draw layers being set unnecessarily. Some clean up that I already did in #461 * Request Changes Co-Authored-By: Dragorn421 <[email protected]> --------- Co-authored-by: Dragorn421 <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Export using bleed, image differs from expected output.
Export without bleed, image matches expectation
For reference, I've taken a look at one pair of the offending display lists (the bottom two pictured in the test grid): https://hastebin.com/share/fokuqototo.markdown
You can see that without bleed, I am setting the render mode and othermode settings, and reverting them each time. With bleed, the othermode settings are bled as expected, but so is the render mode
as far as the middle test mats, I am not exactly sure where they went wrong, but they definitely are not right.
# handle write diff, save pre bleed cmds | ||
is_rendermode_cmd = lambda cmd: isinstance(cmd, DPSetRenderMode) or ( | ||
isinstance(cmd, SPSetOtherMode) and cmd.sets_rendermode | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use lambda for a named function, make this a def.
for j, cmd in enumerate(gfx.commands): | ||
if self.bleed_individual_cmd(commands_bled, cmd, bleed_state, last_cmd_list): | ||
commands_bled.commands[j] = None | ||
# remove Nones from list | ||
while None in commands_bled.commands: | ||
commands_bled.commands.remove(None) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not exactly sure what, but something funky is going on here. I inspected some display lists exported using bleed and they were not properly setting the render modes.
the test in question was to have two materials that are the same, but with different geo/render modes. the geo modes were properly set to match the material, but the render modes were not. In fact the render mode setting for the second material was completely missing
Write all logic remains unaffected, obviously.
A new dict was added to map each mode cmd to its default.
For the actual bleed part, we fIrst need to add geo mode reverts of the last material to the geo mode of the current material, since the current material may not set them now. For othermodes we do something different, get all reverts and add any that doesn´t get set again by the current material ignoring bleeding.
For the geo mode revert, we keep track of one geo mode command for set and clear, updating it as we go. For othermodes we keep track of all of the command types and then revert them using the new dict.
Diff example: Lilaa3/HackerSM64@c9d217e