Repository navigation
feat(hle): the title's gamma ramp is applied at present - #112
Merged
Merged
Conversation
D3DDevice_SetGammaRamp was lifted and did nothing: the console applies the ramp in the DAC as each frame is scanned out, so nothing drawn ever carries it, and no replacement put it anywhere. It is now replaced, and the ramp (the Xbox's three 256-byte tables) is looked up per channel in the display resolve (d3d8_display_set_gamma), as a 256x1 texture read only when the ramp is not the identity. Constantine sets identity ramps at its default brightness, so its picture is unchanged there; its Brightness option now takes effect. Not yet seen on screen with a non-identity ramp: MoltenVK's swap chain cannot be read back to check it on a Mac.
phobos665
added a commit
that referenced
this pull request
Nov 2, 2026
Since #112, every title on a Vulkan host (macOS, Linux, Android) has shown a black window. Windows on D3D11 is unaffected. ## Cause #112 gave the display resolve a second texture, the title's gamma ramp at `t10`. The resolve is the draw that copies each frame to the screen. The Vulkan backend has one descriptor set, and it lists exactly the texture slots the renderer binds: `t0`–`t3`, `t8` and `t9`. `build_pipeline` refuses any shader that uses a slot outside that list, so the shader gets no pipeline and its draws are skipped. That happened to the resolve on every frame, whether or not the title sets a gamma ramp, because the shader declares `t10` either way. The log reported it once per run: `[RHI] vulkan: a shader uses binding 26, which the descriptor set does not declare`. ## Fix Add slot 10 to `g_tex_slots`. The comment above the list now says that a new slot must be added there at the same time as it is used in a shader. ## How it was found and checked Max Payne went black when its toolkit pin moved past #112. - **With the fix:** the warning no longer appears, Max Payne runs at 60 fps with its gamma ramp applied, and the window shows the game again. - **Why it went unnoticed:** the frame dumps used in testing (`RECOMP_HLE_D3D8_DUMP`) read the back buffer before the resolve, so they looked normal. The "MoltenVK swap-chain readback returns black" seen while working on #112 was very likely this bug too. Not checked: Linux and Android. They take the same code path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
D3DDevice_SetGammaRamp was lifted and did nothing: the console applies the ramp in the DAC as each frame is scanned out, so nothing drawn ever carries it, and no replacement put it anywhere. It is now replaced, and the ramp (the Xbox's three 256-byte tables) is looked up per channel in the display resolve (d3d8_display_set_gamma), as a 256x1 texture read only when the ramp is not the identity.
Constantine sets identity ramps at its default brightness, so its picture is unchanged there; its Brightness option now takes effect. Not yet seen on screen with a non-identity ramp: MoltenVK's swap chain cannot be read back to check it on a Mac.