Add 2x2 shading rate generation and management functionality for VRS testing #5
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.
Summary
This PR implements functionality to generate, save, and load a full-screen 2x2 shading rate pattern for Variable Rate Shading (VRS) testing in the Vulkan demo application.
Changes Made
Backend Implementation
generate2x2ShadingRate()
: Creates a full-screen 2x2 shading rate pattern by filling the entire shading rate image withVK_FRAGMENT_SHADING_RATE_2X2_BIT_KHR
(value 0x5)save2x2ShadingRate()
: Generates and saves the 2x2 pattern to a dedicated file (shading_rate_2x2.dat
) with proper metadata validationload2x2ShadingRate()
: Loads the saved 2x2 pattern with compatibility checks for dimensions and formatNative Interface Integration
Save2x2ShadingRate()
andLoad2x2ShadingRate()
NAPI functions inPluginRender
classUI Enhancements
Technical Details
The 2x2 shading rate reduces rendering resolution to 1/4 (2x2 pixel blocks share the same fragment shader execution), making it ideal for performance testing scenarios. The implementation:
Testing
The functionality can be tested by:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.