Merged
Conversation
bjornbytes
reviewed
Feb 25, 2026
Owner
bjornbytes
left a comment
There was a problem hiding this comment.
I only tested foveation on Quest 2 which doesn't support dynamic rendering, so I missed this pipeline flag.
Contributor
Author
|
Reverted both unnecessary changes |
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.
Copilot Prompt:
User: I think there is a bug in configuring the foveation for vulkan.
If the foveation is off no artifacts appear.
If the foveation is on artifacts apprear.
It looks like there is a small quad texture interleaved with the main framebuffer. it seems to be the same quad but at different locations per eye. the quad seem to show artifacts of repeated or old fragments, the color of the frags seem of.
Check the lovr graphics to see potential issues how the foveation is set up.
Here's a summary of the three bugs found and fixed in gpu_vk.c:
1. Missing
VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXTpipeline flag (most likely cause of your artifacts)When dynamic rendering (
VK_KHR_dynamic_rendering) is active, pipelines used with fragment density maps must have VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT. Without it, the driver compiles the pipeline unaware of fragment density variation — the fragment shader runs at uniform resolution, but the framebuffer has subsampled regions from the density map. This produces exactly what you see: small quad-shaped regions with stale/wrong fragments at different locations per eye (each eye's density map offsets differ).2. Wrong tracked layout for foveation textures (gpu_vk.c)
getNaturalLayoutfell through toVK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHRforGPU_TEXTURE_FOVEATIONtextures. The correct layout isVK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT. While the layout tracking isn't currently used for explicit transitions of the foveation texture, this mismatch is wrong state that could cause issues with validation layers or future code.3.
fragmentDensityMapNonSubsampledImagesenabled unconditionallyThe feature was enabled without querying whether the physical device supports it. Now it queries the actual device support before enabling. If a device doesn't support non-subsampled images but foveation is requested, this could cause device creation failure or undefined behavior.
Tested on Meta Quest 3.
Artifacts are gone.
This is ofc a vibe coding fix attempt. Please review carefully. Used copilot claude 4.6.