shader_recompiler: Maintain loss of precision when folding half-float unpack. #2201
+25
−1
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.
When folding a pair of half unpack and pack instructions, maintain the loss of precision that should have happened from converting to 16-bit float using a quantize op.
Fixes some missing lighting in CUSA05637. The game stores a set of control bits in the alpha channel during rendering in order to control lighting properties in later shaders. This involves dividing to convert it to a normalized float when writing, and multiplying to convert it back to an 8-bit integer when reading. When writing they compensate for the loss of precision when packing to 16-bit float on PS4 by adding a constant
0.5 / 255
, but without the loss in precision this ends up changing the bits when transformed back into an integer in the lighting shader.The lighting components that are now visible in this game seem to have some color problems but those appear to be a separate issue from this.