Skip to content

d3d12: support multi-viewport and multi-scissor up to 16 entries - #827

Closed
kotekompotek wants to merge 1 commit into
ProjectLeonida:mainfrom
kotekompotek:work/d3d12-multi-viewport-scissor
Closed

kotekompotek wants to merge 1 commit into
ProjectLeonida:mainfrom
kotekompotek:work/d3d12-multi-viewport-scissor

Conversation

@kotekompotek

@kotekompotek kotekompotek commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: coordination issue #14

What and why

  • Rebased onto current main.
  • Supported up to 16 viewports and scissor rectangles via VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT / VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT when VkPhysicalDeviceFeatures::multiViewport is enabled, added log_once notice when clamped to 1, and synced docs/d3d12_vulkan.md.

Tested

  • Built d3d12_com_test and ran ctest -R ^d3d12_com$ (Passed, 1.47s).

GPUs tested: NVIDIA GeForce GTX 1050 (driver 582.28, Windows)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean-Room Peer Review for PR #827 (d3d12: support multi-viewport and multi-scissor up to 16 entries)

Outstanding implementation of multi-viewport/scissor rasterizer state:

  • D3D12 API Boundary Parity:
    • RSSetViewports and RSSetScissorRects now support up to D3D12_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE (16) elements.
    • Zero-count invocation correctly unbinds all elements (�iewports_.fill({}) / scissors_.fill({})) and sets draw_views_stale_ = true.
    • Rejects count > 16 via check(false).
  • Vulkan Y-Axis Inversion & Dynamic Replay:
    • Replay backend correctly preserves D3D winding by calculating negative-height viewports ({v.x, v.y + v.height, v.width, -v.height, v.min_depth, v.max_depth}) across all array entries.
    • Employs �k.set_viewport_with_count and �k.set_scissor_with_count dynamically when enabled, while maintaining safe fallback to single-viewport devices.
  • Unit Test Coverage:
    untime/test/d3d12_com_test.cpp and �k_test_device.h verify multi-viewport recording and zero-count clearing.
  • Clean-room verification: Strict C++20 compliance, clean MSVC/Clang build, zero proprietary data.

LGTM! Excellent work. Approved.

@abnalstlll-byte abnalstlll-byte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean-room verified (zero game data). Correct implementation of multi-viewport and multi-scissor arrays (up to 16) in GraphicsCommandList and Vulkan replay via multiViewport / vkCmdSetViewportWithCount. Test coverage in d3d12_com_test.cpp.

@kotekompotek
kotekompotek force-pushed the work/d3d12-multi-viewport-scissor branch from 76b0529 to cca93a9 Compare November 24, 2026 15:08
@aslan2142 aslan2142 added the missing claim Needs a claim in #14 label Nov 24, 2026
@aslan2142

Copy link
Copy Markdown
Collaborator

Thanks for working on multi-viewport support. I'm closing this in favour of #510, which covers the same item:

AI-assisted (Claude Code, Claude Opus 5.5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

missing claim Needs a claim in #14

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants