Skip to content

GPU: zero blend and depth-stencil padding the pipeline library compares - #2

Closed
makmatvey wants to merge 1 commit into
mainfrom
cursor/gpu-pipeline-desc-padding-d4e6
Closed

makmatvey wants to merge 1 commit into
mainfrom
cursor/gpu-pipeline-desc-padding-d4e6

Conversation

@makmatvey

Copy link
Copy Markdown
Owner

What's wrong

The host's pipeline library tells stored pipelines apart by the raw bytes of their descriptions, padding included. GraphicsState::read copied the title's blend (kind 8) and depth-stencil (kinds 11 and 21) descriptions as they stood, so the two bytes between StencilWriteMask and FrontFace — and the write-mask padding in each blend target — carried whatever was on the title's stack. With the debug layer on, mesh pipelines of one run then differed from a copy of themselves only in that padding, and LoadPipeline refused them (Marvisak#1683).

Closed attempts (Marvisak#1041, Marvisak#1690) did not land. Open Marvisak#1739 clears final mesh-stream outer/nested padding after typed moves; it does not clean the descriptions held in GraphicsState that the classic graphics PSO path and the stream both read from.

What the change does

In crates/victory-gpu/src/pipeline/host.rs:

Tests

  • New unit test read_states_carry_no_padding: reads kinds 21/11/8 from 0xff bytes and checks padding is zero while fields keep the title's values; also checks Default.
  • Existing input-offset host tests unchanged.
  • This agent runs Linux without ml64.exe, so Windows MSVC clippy/tests are left to CI.

No game data was used.

Refs Marvisak#1683. Complementary to Marvisak#1739.

Open in Web Open in Cursor 

The host pipeline library matches stored pipelines by raw description bytes,
padding included. GraphicsState::read copied the title's blend and depth-
stencil descriptions as they stood, so the two bytes between StencilWriteMask
and FrontFace (and the write-mask padding in each blend target) carried the
title's stack. With the debug layer on, mesh pipelines of one run then
differed from a copy of themselves only in that padding and LoadPipeline
refused them.

Zero that padding after kinds 8, 11 and 21, and in Default. Final mesh-stream
outer padding stays with the complementary follow-up; this covers the
descriptions graphics and mesh paths share through GraphicsState.

Co-authored-by: Matsvey Makushenka <matvey.myown@gmail.com>
@makmatvey makmatvey closed this Nov 25, 2026
cursor Bot pushed a commit that referenced this pull request Nov 26, 2026
)

RDNA2 flushes denormal operands of the legacy multiplies to zero, so
0 x anything = 0 also holds for them. The lowering only tested for an exact
float zero, whose result also depends on the host's denormal mode. Test the
exponent bits instead. Follow-up to #2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant