KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

Best practices validation should warn when the render area / viewport / scissor rectangle intersection is nothing

Open
#10,402 4 comments 0 reactions 0 assignees View on GitHub
BestPractices
Dominant language
C++
Stars
1k
Forks
504
Avg merge
11h 35m
Merged PRs (30d)
224

Description

The Vulkan spec only states that the render area rectangle specified in the render pass (or when starting dynamic rendering) must lie completely within the image(s) being rendered to. This is correctly verified by the validation layers.

However, the viewport rectangles and the scissor rectangles have no such requirements. While this strikes me as an issue in itself, it seems like this was deliberately left out from the spec, which I assume was for a good reason.

This means that it's possible that when a draw is executed, the intersection of the render area rectangle, the viewport rectangle and the scissor rectangle is simply... nothing.

Example:
- Render area rectangle: (0, 0, 1920, 1080)
- Viewport rectangle: (-1000, -1000, 0.01f, 0.01f)
- Scissor rectangle: (5000, 5000, 10, 10)

This is according to the Vulkan spec a perfectly valid setup, which will obviously produce nothing. It stands to reason that if the intersection between these three rectangles does not exist, then any draw calls performed cannot ever produce any fragment output. This should be considered a programmer error, and be reported by the best practices validation layer.

Semi-related, setting the viewport rectangle larger than the render area seems to in some cases cause device losses on some hardware/OS/driver combinations. So it seems like not all drivers are correctly handling the vast possibly misuse of the viewport rectangle and the scissor rectangle that the spec allows, even when there would actually be some output.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Vulkan render-area, viewport, and scissor rules described in the issue, including render-pass and dynamic-rendering setup. Trace the best-practices validation paths for these rectangles and determine how an empty intersection should be detected; done means an appropriate warning is reported for draws that cannot produce fragment output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.