Skip to content

[EPIC]: Improve rasterization tests coverageΒ #1146

@EmilioLaiso

Description

@EmilioLaiso

Legend

πŸ—οΈ - Requires backend/yaml work

πŸ‘ - Testable

Vertex Shader

Semantics

  • SV_VertexID
  • SV_Position
    • Already covered by all graphics tests
  • SV_ClipDistance[n] - πŸ‘
  • SV_CullDistance[n] - πŸ‘
  • SV_InstanceID - πŸ—οΈ
  • SV_StartVertexLocation - πŸ—οΈ
  • SV_StartInstanceLocation - πŸ—οΈ
  • SV_RenderTargetArrayIndex - πŸ—οΈ
  • SV_ViewportArrayIndex - πŸ—οΈ
  • SV_ViewID - πŸ—οΈ

Functional

  • Non-Float32 vertex attribute formats (Int32, UInt32, Float16, Int16, UInt16) - πŸ‘
  • Normalized integer attribute formats (UNorm8, SNorm8, UNorm16, SNorm16) - πŸ‘
  • Multiple varyings to PS β€” many simultaneous user semantics, mixed integer/float types - πŸ‘
  • Struct-typed varyings between VS and PS - πŸ‘
  • CBuffer read in VS (real mul(MVP, position) instead of pass-through) - πŸ‘
  • Push constants in VS - πŸ‘
  • StructuredBuffer<T> read from VS - πŸ‘
  • ByteAddressBuffer read from VS - πŸ‘
  • RWStructuredBuffer write from VS (different UAV path than PS-side write) - πŸ‘
  • Texture2D.SampleLevel(...) from VS (no derivatives in VS) - πŸ‘
  • Texture2D.Load(...) from VS - πŸ‘
  • SV_Position with W β‰  1 (verify perspective divide downstream) - πŸ‘
  • Multiple vertex buffer slots (stream 0 + stream 1) - πŸ—οΈ
  • Per-instance attributes (input rate INSTANCE) - πŸ—οΈ
  • Indexed draws + BaseVertex - πŸ—οΈ
  • Strip topologies + primitive restart - πŸ—οΈ

Niche / vendor behavior

  • Provoking-vertex consistency (FIRST is the default on D3D12 / VK / MTL) with a nointerpolation integer varying - πŸ‘
  • Vertex at clip-plane boundary (x = Β±w, y = Β±w, z = 0 / w) - πŸ‘
  • Vertex with W close to 0 (numerical stability) - πŸ‘
  • NaN / Inf in SV_Position (must be clipped, no rasterized output) - πŸ‘
  • Subnormal positions (FTZ vs preserve at the rasterizer) - πŸ‘
  • Negative-area / degenerate triangles - πŸ‘

Pixel Shader

Semantics

  • SV_Position (input)
    • Implicitly used by every graphics test; explicitly asserted at pixel center in GraphicsSystemValues.test
  • SV_PrimitiveID
  • SV_IsFrontFace
  • SV_ClipDistance[n] (input) - πŸ‘
  • SV_CullDistance[n] (input) - πŸ‘
  • SV_Depth (output) - πŸ‘
  • SV_DepthGreaterEqual (output) - πŸ‘
  • SV_DepthLessEqual (output) - πŸ‘
  • SV_Target1..SV_Target7 (MRT) - πŸ—οΈ
  • SV_StencilRef (output) - πŸ—οΈ
  • SV_SampleIndex (input) - πŸ—οΈ
  • SV_Coverage (input) - πŸ—οΈ
  • SV_Coverage (output) - πŸ—οΈ
  • SV_InnerCoverage (input) - πŸ—οΈ
  • SV_Barycentrics (input) - πŸ—οΈ
  • SV_RenderTargetArrayIndex (input from VS/GS) - πŸ—οΈ
  • SV_ViewportArrayIndex (input from VS/GS) - πŸ—οΈ

Functional

Niche / vendor behavior

  • Helper-invocation suppression β€” discarded lane's writes blocked, but its derivatives still drive the quad's other lanes - πŸ‘
  • Quad message-passing (QuadReadAcrossX/Y/Diagonal) under partial coverage - πŸ‘
  • SV_Position.xy exactly at pixel center (x + 0.5, y + 0.5) - πŸ‘
  • Depth clamping outside [MinDepth, MaxDepth] (clipped vs clamped vs undefined) - πŸ‘
  • SV_IsFrontFace for zero-area / degenerate triangles - πŸ‘
  • discard + SV_Depth write interaction (depth must not be written) - πŸ‘
  • clip() with NaN / Inf operand - πŸ‘
  • Pixel coverage at exact triangle edge (top-left rule) - πŸ‘
  • Sample-frequency shading (PS runs per-sample, not per-pixel) - πŸ—οΈ

Hull Shader

πŸ—οΈ Stage-level prerequisites (must land before any test below):

  • Extend Stages enum with Hull.
  • Patch-list topologies (PatchList<3>, PatchList<4>, ..., PatchList<32>) per backend.
  • HS attribute reflection: [domain], [partitioning], [outputtopology], [outputcontrolpoints], [patchconstantfunc], [maxtessfactor].
  • Tessellation pipeline state on each backend (D3D12 already supports it; VK needs tessellationShader feature; MTL via metal-irconverter).

Semantics

  • SV_TessFactor (3 / 4 / 2 floats by domain) - πŸ—οΈ
  • SV_InsideTessFactor (1 / 2 / 0 floats by domain) - πŸ—οΈ
  • SV_OutputControlPointID - πŸ—οΈ
  • SV_PrimitiveID (HS input) - πŸ—οΈ
  • HullSystemValues.test β€” bundled test - πŸ—οΈ

Functional

  • Pass-through HS (factor 1, identity control points) - πŸ—οΈ
  • InputPatch<T, N> reading from VS output - πŸ—οΈ
  • OutputPatch<T, M> to DS - πŸ—οΈ
  • Patch-constant function reading CBuffer - πŸ—οΈ
  • Per-edge varying tess factors - πŸ—οΈ
  • Patch culling via SV_TessFactor = 0 (entire patch discarded) - πŸ—οΈ
  • Negative tess factor (must be treated as 0) - πŸ—οΈ
  • SV_TessFactor clamping at [maxtessfactor] - πŸ—οΈ
  • HS reads UAV / SRV - πŸ—οΈ

Niche / vendor behavior

  • Tess factor Inf / NaN handling (spec says clamped to max) - πŸ—οΈ
  • Patch with all coincident control points (degenerate) - πŸ—οΈ
  • Tess factor > 64 (spec says clamp; observe driver behavior) - πŸ—οΈ
  • HS invocations seeing partial control-point arrays - πŸ—οΈ

Domain Shader

πŸ—οΈ Stage-level prerequisites:

  • Extend Stages enum with Domain.
  • DS pipeline state on each backend (paired with HS).

Semantics

  • SV_DomainLocation (float2 for tri/quad, float for isoline) - πŸ—οΈ
  • SV_PrimitiveID (DS input) - πŸ—οΈ
  • SV_Position (DS output to rasterizer) - πŸ—οΈ
  • SV_ClipDistance / SV_CullDistance (DS output) - πŸ—οΈ
  • DomainSystemValues.test β€” bundled test - πŸ—οΈ

Functional

  • Domain: tri (barycentric SV_DomainLocation) - πŸ—οΈ
  • Domain: quad (UV SV_DomainLocation) - πŸ—οΈ
  • Domain: isoline - πŸ—οΈ
  • Partitioning: integer - πŸ—οΈ
  • Partitioning: fractional_even - πŸ—οΈ
  • Partitioning: fractional_odd - πŸ—οΈ
  • Partitioning: pow2 - πŸ—οΈ
  • Output topology: triangle_cw - πŸ—οΈ
  • Output topology: triangle_ccw - πŸ—οΈ
  • Output topology: line - πŸ—οΈ
  • Output topology: point - πŸ—οΈ
  • Adaptive tessellation: varying per-edge factors, no T-junctions between adjacent patches - πŸ—οΈ
  • DS displacement (sample heightmap, write modified SV_Position) - πŸ—οΈ
  • DS reads CBuffer / SRV - πŸ—οΈ

Niche / vendor behavior

  • fractional_* partitioning vertex-count is implementation-defined within bounds β€” assert with tolerance, not exact - πŸ—οΈ
  • SV_DomainLocation precision near 0 / 1 boundaries - πŸ—οΈ
  • Isoline outside.x (density) vs outside.y (detail) β€” easy to invert - πŸ—οΈ
  • CW / CCW output topology must match the rasterizer's front-face convention (vendors sometimes invert one path) - πŸ—οΈ
  • Sub-pixel tessellation precision (zoom in on a quad and verify smoothness) - πŸ—οΈ

Geometry Shader

πŸ—οΈ Stage-level prerequisites:

  • Extend Stages enum with Geometry.
  • GS pipeline state on each backend.
  • [maxvertexcount(N)] and [instance(N)] reflection.
  • Variable input topology (point, line, triangle, lineadj, triangleadj).
  • Output stream types (PointStream<T>, LineStream<T>, TriangleStream<T>).

Semantics

  • SV_PrimitiveID (GS input β€” auto-generated per input primitive) - πŸ—οΈ
  • SV_GSInstanceID (when [instance(N)] is used) - πŸ—οΈ
  • SV_RenderTargetArrayIndex (GS output) - πŸ—οΈ
  • SV_ViewportArrayIndex (GS output) - πŸ—οΈ
  • GeometrySystemValues.test β€” bundled test - πŸ—οΈ

Functional

  • Pass-through GS (1 in, 1 out, same topology β€” verifies pipeline plumbing) - πŸ—οΈ
  • Point-to-quad expansion (point sprite β€” input point, 4 vertices out as triangle strip) - πŸ—οΈ
  • Line-to-triangle ribbons (line in, two triangles out) - πŸ—οΈ
  • Triangle subdivision (1 input β†’ 4 output triangles) - πŸ—οΈ
  • Topology change: triangle in β†’ line out (wireframe) - πŸ—οΈ
  • Selective output: if (cond) stream.Append(v); β€” some primitives produce 0 outputs - πŸ—οΈ
  • [instance(N)] GS instancing β€” N invocations per input primitive - πŸ—οΈ
  • Adjacency input triangleadj (6 vertices: 3 triangle + 3 neighbors), use neighbor data for silhouette detection - πŸ—οΈ
  • [maxvertexcount(1024)] β€” spec minimum upper bound; verify large outputs - πŸ—οΈ
  • GS UAV write (each invocation writes a unique slot) - πŸ—οΈ
  • GS reads CBuffer / SRV - πŸ—οΈ
  • RestartStrip() mid-output - πŸ—οΈ

Niche / vendor behavior

  • Empty stream β€” [maxvertexcount(N)] declared, 0 emitted, primitive vanishes - πŸ—οΈ
  • Provoking vertex of GS-emitted primitives (implementation-defined, assert consistency) - πŸ—οΈ
  • Exceeding [maxvertexcount] (undefined per spec, observe behavior) - πŸ—οΈ
  • GS performance falls β€” soak test with high output rate (correctness under throughput pressure) - πŸ—οΈ
  • GS-emitted primitive interaction with SV_RenderTargetArrayIndex β€” different primitives to different RT slices - πŸ—οΈ

Cross-cutting / Pipeline

Topologies

  • Triangle list
    • All current graphics tests
  • Triangle strip - πŸ—οΈ
  • Line list - πŸ—οΈ
  • Line strip - πŸ—οΈ
  • Point list - πŸ—οΈ
  • Triangle list with adjacency - πŸ—οΈ
  • Line list with adjacency - πŸ—οΈ
  • Patch lists (3, 4, 16, 32 control points) - πŸ—οΈ
  • Primitive restart with strip topologies - πŸ—οΈ

Pipeline state

  • Multiple render targets (NumRenderTargets > 1) - πŸ—οΈ
  • Depth-only rendering (no color attachment) - πŸ—οΈ
  • Stencil read / write - πŸ—οΈ
  • Configurable blend state - πŸ—οΈ
  • Conservative rasterization - πŸ—οΈ
  • Variable-rate shading - πŸ—οΈ
  • MSAA pipeline state (SampleCount > 1) - πŸ—οΈ

Multi-stage pipelines

  • VS β†’ HS β†’ DS β†’ PS (no GS) - πŸ—οΈ
  • VS β†’ GS β†’ PS (no tessellation) - πŸ—οΈ
  • VS β†’ HS β†’ DS β†’ GS β†’ PS (full pipeline) - πŸ—οΈ
  • Resource visibility flags per stage (D3D12_SHADER_VISIBILITY_*) - πŸ‘
  • CBuffer accessed from multiple stages (deduplication, single binding) - πŸ‘
  • Push constants accessed from multiple stages - πŸ‘
  • Stage-interface signature compatibility (mismatched semantics between adjacent stages must error) - πŸ‘

Cross-backend determinism

  • Same shader produces byte-exact PNG across DX / VK / MTL on simple geometry - πŸ‘
  • Document DiffRMS / Intervals tolerance per goldenimage test - πŸ‘
  • WARP vs hardware GPU drift profile per test (existing tests already absorb it; document explicitly) - πŸ‘

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions