Skip to content
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

fix merge conflicts from mat_bleed PR. #1

Merged
merged 18 commits into from
Mar 19, 2023

Conversation

jesusyoshi54
Copy link

@jesusyoshi54 jesusyoshi54 commented Feb 19, 2023

The important changes are in f3d_texture_writer, everything else should be already a part of the bleed PR.
About the changes there, for mat bleed to work more efficiently, I created different GfxLists for the material cmds, and the tiles. These get combined together into fMaterial.material at the end of material saving, namely fModel.onMaterialCommandsBuilt(fMaterial, material, drawLayer). In order for mat bleed to work properly, I changed the saved GfxLists inside of the multitexManager.writeAll to the necessary ones. For large textures, the GfxList is already set to be the FTriGroup.triList, which is already accounted for inside of the bleed function.

Other than that, the only things that should have been changed are saveOtherModeHDefinition to pass in an extra argument of f3d, and two lines in f3d_bleed to remove the use of fMaterial.useLargeTextures.

Speaking of that, while looking through the changes and testing, I found an issue in sm64_geolayout_writer where this is still used. I left a comment on the offending line.

scut and others added 13 commits November 28, 2022 18:45
* added material bleeding to FMesh objects via an export option in the global F3D panel settings

* fixed tile scrolls with inline mats, tile scrolls now repeat in each inline material, and use a material name of the mesh plus the offset of the material DL inside the inline mesh Gfx. Also fixed a bug where tile scrolls for tiles not set would still export, resulting in UB behavior

* removed comments

* optimized and cleaned up mat bleeding setup code, improved which gbi cmds get bled

* made inline a property of fMaterial, made fMaterials be generated from fModel for inheritance of inline property, cleaned up and clarified some comments

* added a comment_name prop to GfxList to prevent renaming of bled fMesh.draw objects interfering with DL referencing

* added hashing to gbi base classes

* made tile scroll exporting better in mat_bleeding, renamed variables, added more consistency with inline checks, made fMesh inline exporting act from FMesh.draw instead of constructing from individual gfx components, vtx culling now works with inline materials

* renamed variables, cleaned up bleed functions, added extra callback functions to bleed methods, changed set tile calculation to happen during bleed, made inline property of subclasses occur on initialization instead of within the class, fixed .bleed method of sync classes, made bleed more isolated by adding pre and post processing, and removing inline checks throughout f3d writing

* fixed issue with bleed not working on fMesh objects that revert materials at the end

* optimized bleed for large textures, removed some vestigial code from old texture scroll format, added extra faisafe to bleed so it doesn't execute while using certain export modes while inline setting is not checked

* added in support for bleeds in sm64 armatures

* removed useless sync from bled gfxLists with no drawn tris, fixed bleed logic for trigroups and tile size cmds

* made bleeding its own class instead of being a part of the fMesh class

* removed inline bool and logic from everything but fModel, and centralized logic throughout code so that it works with those changes

* separated mat bleed into its own file, changed where mat write method is overridden from inside FModel to its initialization calls

* made render mode reset cmd work gooder and cleaned up on_bleed_end

* removed inline prop from fModel, made constructor of fModel classes and subclasses explicit from passed arguments

* removed inline prop from OOTModel classes

* removed inline argument from FModel.to_c_scroll

* Fixed duplicate scroll variable names with inlined meshes with multiple scroll materials

* fixed bleeding for geo layouts when rooms are used, optimized how last used materials are kept track of during jump nodes

* clear out last used material in last_materials dict for geo layout bleed if culling is used

* added fix to other mode encoding if using f3d_old exporting

---------

Co-authored-by: scut <scut>
Co-authored-by: kurethedead <epicureanistik@gmail.com>
Fixed save_textures() error when "Save Textures As PNGs" is enabled
@jesusyoshi54
Copy link
Author

I made some updates to the texture bleeding. The first is that I made it so that there is only one gfx_list for texture data, and that that gfx_list is the one being used for storing texture data.
The algorithm I used to determine if I could bleed a cmd for the texture gfx_list is pretty simple and can be found in bleed_texturesin f3d_bleed.py. First I iterate other the last gfx_list, and the current one, and I create a dictionary tmem: DPSetTextureImage. Then I check for conflicts within this dictionary, if you are at the same tmem value, and load the same image, I can remove that load. I remove the load by iterating over the cmds in the list, and getting rid of the DPSetTextureImage cmd. After that, I will remove the subsequent DPSetTile cmd and the associated loading cmd. After the loading cmd is removed, I set a flag to not remove anything else until I remove another DPSetTextureImage cmd.
After the image removing is done, I can remove cmds as normal. Normal bleed procedure has a blacklist of cmds to not bleed, and all of the associated texture image loading cmds should be in there. Therefore all that should be bleed going forward are DPSetTileSize cmds or Syncs, if they pass the associated function check for them to bleed.
While doing this change, I also added some additional logic for the gfx scroll tags so that they're only applied if there is a scroll

@sauraen
Copy link
Owner

sauraen commented Mar 19, 2023

Looks good to me!

@sauraen sauraen merged commit 6d87d4d into sauraen:CITexFixes Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants