Skip to content

Rework material system material and surface generation #1645

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

Merged
merged 3 commits into from
Apr 14, 2025

Conversation

VReaperV
Copy link
Contributor

Some more changes to allow entities to be added to the material system. This entirely removes the GenerateWorldMaterials() function, instead materials are generated for each MaterialSurface. This also removes a bunch of things from drawSurf_t, tess, Render_*() etc. that were only used to pass information through to the material system.

Also fixed a memory leak in material system portal surface processing.

@VReaperV VReaperV added T-Bug T-Improvement Improvement for an existing feature A-Renderer T-Cleanup labels Apr 13, 2025
@VReaperV VReaperV force-pushed the geometry-optimiser-material branch from 20688cb to 546e4eb Compare April 13, 2025 22:12
@VReaperV VReaperV moved this to In Progress in Material system Apr 13, 2025
@VReaperV VReaperV force-pushed the geometry-optimiser-material branch 4 times, most recently from 25a3921 to 325a174 Compare April 13, 2025 22:50
@slipher
Copy link
Member

slipher commented Apr 13, 2025

Ran tests and got this: ^3Warn: Unhandled exception (15ShaderException): Shader not found: deformVertexes_pulse_2 0. Note that I am NOT using the dummygame.

@VReaperV
Copy link
Contributor Author

Is it possible it's a glsl cache issue? I've just loaded pulse with engine built from this pr and it works fine.

@slipher
Copy link
Member

slipher commented Apr 13, 2025

I can reproduce that with just ./daemon -set r_materialSystem 1 +devmap pulse.

@slipher
Copy link
Member

slipher commented Apr 13, 2025

Is it possible it's a glsl cache issue? I've just loaded pulse with engine built from this pr and it works fine.

No, I still reproduce it with a pristine homepath.

@VReaperV
Copy link
Contributor Author

I did the same thing with homepath, still can't reproduce. I've also added some logging locally, and deformVertexes_pulse_2 0 is loaded after materials are generated.

@illwieckz
Copy link
Member

I can reproduce that with just ./daemon -set r_materialSystem 1 +devmap pulse.

I get the exact same (AMD RDNA3, Mesa radeonsi).

@VReaperV
Copy link
Contributor Author

VReaperV commented Apr 13, 2025

I can reproduce that with just ./daemon -set r_materialSystem 1 +devmap pulse.

I get the exact same (AMD RDNA3, Mesa radeonsi).

So it works on master, but not on this branch? The only thing I could think of is that there's some end-of-string character or something that is messing it up (between tr.loadingMap and tr.world->baseName). Actually, even that shouldn't be able to cause it, because it would just load a new deform shader then.

@illwieckz
Copy link
Member

So it works on master, but not on this branch?

Yes, on my end it works on master but not on this branch.

@VReaperV VReaperV force-pushed the geometry-optimiser-material branch from 325a174 to 559f72f Compare April 14, 2025 05:47
@VReaperV
Copy link
Contributor Author

I was able to reproduce this on vega instead. The issue itself is present on master, but apparently it gets hidden by a race condition: the gfx/buildables/human_base/spawning also uses deform shaders, and it can be loaded before the map shaders since it comes from a QVM call, thereby hiding a bug in deform shader lookup.

@VReaperV
Copy link
Contributor Author

Added a commit to fix this. This should also fix the similar issue in #1600.

@VReaperV VReaperV force-pushed the geometry-optimiser-material branch from 564a173 to 143278f Compare April 14, 2025 07:22
@slipher
Copy link
Member

slipher commented Apr 14, 2025

My tests now complete without erroring out, but they reveal some regressions when material system is enabled. For example:

unvanquished-chasm-egg-further

unvanquished-watah-translucent-sorting

@VReaperV
Copy link
Contributor Author

That's chasm and watah?

@VReaperV
Copy link
Contributor Author

Can't reproduce the watah one running the regular gamelogic, I assume the above screenshots are taken with dummy gamelogic instead.

@slipher
Copy link
Member

slipher commented Apr 14, 2025

No. I don't really use dummy gamelogic anymore since the GLSL building changes broke it.

@VReaperV
Copy link
Contributor Author

Any non-default graphics settings other than r_materialSystem 1?

@illwieckz
Copy link
Member

This is what I get on Watah on viewpos -2882 3079 1285 -76 2, with material system:

unvanquished_2025-04-14_190039_000

Without:

unvanquished_2025-04-14_190258_000

I get the same on mastet anyway, so that's not this branch's fault.

@illwieckz
Copy link
Member

I experience no regression between master and this anymore.

Copy link
Member

@illwieckz illwieckz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@illwieckz illwieckz merged commit 3b96d92 into DaemonEngine:master Apr 14, 2025
9 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Material system Apr 14, 2025
@VReaperV VReaperV deleted the geometry-optimiser-material branch April 14, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Bug T-Cleanup T-Improvement Improvement for an existing feature
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants