mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-04-25 15:56:00 +03:00
[PR #3306] [MERGED] shader_recompiler: Use VM bit for conditional discard #3372
Labels
No labels
Bloodborne
bug
contributor wanted
documentation
enhancement
frontend
good first issue
help wanted
linux
pull-request
question
release
verification progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/shadPS4#3372
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/shadps4-emu/shadPS4/pull/3306
Author: @raphaelthegreat
Created: 7/23/2025
Status: ✅ Merged
Merged: 7/23/2025
Merged by: @georgemoralis
Base:
main← Head:better-discard📝 Commits (1)
8e469a5shader_recompiler: Use VM bit for conditional discard📊 Changes
5 files changed (+1 additions, -13 deletions)
View changed files
📝
src/shader_recompiler/frontend/control_flow_graph.cpp(+0 -8)📝
src/shader_recompiler/frontend/control_flow_graph.h(+0 -1)📝
src/shader_recompiler/frontend/structured_control_flow.cpp(+0 -1)📝
src/shader_recompiler/frontend/translate/export.cpp(+1 -1)📝
src/shader_recompiler/ir/basic_block.h(+0 -2)📄 Description
Shader export instructions have 2 special bits, the DONE bit is set for the last export instruction in the shader and can be safely ignored. The VM bit is also set on a single export and makes that export responsible for informing the color buffer which pixels are valid and which have been discarded. So use that to insert the conditional discard instead of guessing from the number of predecessors.
This fixes the blocky shadows in Driveclub, the fragment shader used for rendering tree shadows read the alpha value from the texture and did a conditional discard based on it. But because there was no control flow, the predecessor check failed, resulting in the whole shader being eliminated as dead code.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.