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

[d3d9] Spec-constant out writes to clip distances when disabled #4508

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

misyltoad
Copy link
Collaborator

Add a new spec constant with a mask of the enabled clip planes such that they can be optimized out to improve performance.

For GPL shaders, override what we return here so it's always true and don't bother putting the mask in the UBO.

Add a new spec constant with a mask of the enabled clip planes such that they can be optimized out to improve performance.

For GPL shaders, override what we return here so it's always true and don't bother putting the mask in the UBO.

Signed-off-by: Autumn Ashton <misyl@froggi.es>
@misyltoad misyltoad force-pushed the misyl/spec-const-clip-plane branch 2 times, most recently from 9aa54b7 to 6870b62 Compare December 4, 2024 16:46
@misyltoad misyltoad force-pushed the misyl/spec-const-clip-plane branch from 6870b62 to 296cb35 Compare December 4, 2024 16:49
@misyltoad misyltoad force-pushed the misyl/spec-const-clip-plane branch from 296cb35 to 7c21717 Compare December 4, 2024 16:54
Compact clip planes to the smallest amount that are enabled.

Signed-off-by: Autumn Ashton <misyl@froggi.es>
@misyltoad misyltoad force-pushed the misyl/spec-const-clip-plane branch from 7c21717 to f54964a Compare December 4, 2024 17:00
@misyltoad misyltoad merged commit d956b18 into master Dec 5, 2024
8 checks passed
temeraire-cx pushed a commit to chaotic-cx/mesa-mirror that referenced this pull request Dec 10, 2024
This reduces the fixed function hardware bottleneck in vertex shading
heavy sections with d3d9 DXVK.

DXVK always declares 6 clip distances, and with
doitsujin/dxvk#4508
it writes 0 for disabled clip planes.

But while working on this, I also discovered that other games also write
constant clip/cull distances:

Foz-DB Navi21:
Totals from 442 (0.56% of 79206) affected shaders:
MaxWaves: 10880 -> 10900 (+0.18%)
Instrs: 283569 -> 282493 (-0.38%); split: -0.38%, +0.01%
CodeSize: 1497596 -> 1491948 (-0.38%); split: -0.38%, +0.00%
VGPRs: 18928 -> 18888 (-0.21%)
Outputs: 3026 -> 2970 (-1.85%)
Latency: 1051990 -> 1048878 (-0.30%); split: -0.47%, +0.18%
InvThroughput: 184190 -> 183366 (-0.45%); split: -0.45%, +0.01%
VClause: 6071 -> 6077 (+0.10%); split: -0.38%, +0.48%
SClause: 6724 -> 6725 (+0.01%); split: -0.12%, +0.13%
Copies: 19624 -> 19160 (-2.36%); split: -2.44%, +0.08%
PreSGPRs: 18634 -> 18526 (-0.58%)
PreVGPRs: 15522 -> 15465 (-0.37%)
VALU: 156964 -> 156330 (-0.40%); split: -0.41%, +0.01%
SALU: 41802 -> 41748 (-0.13%); split: -0.13%, +0.00%

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32518>
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.

3 participants