Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • mesa mesa
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 3.2k
    • Issues 3.2k
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1k
    • Merge requests 1k
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MesaMesa
  • mesamesa
  • Merge requests
  • !21426

nir/lower_blend: Support dual-source blending properly

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Alyssa Rosenzweig requested to merge alyssa/mesa:panvk/2src into main Feb 20, 2023
  • Overview 10
  • Commits 2
  • Pipelines 5
  • Changes 5
Now that we're working on lowered I/O, passing in the dual source blend colour
via a sideband doesn't make any sense. The primary source blend colours are
implicitly passed in as the sources of store_output intrinsics; likewise, we
should get dual source blend colours from their respective stores. And since
dual colours are only needed by blending, we can delete the stores as we go.
That means nir_lower_blend now provides an all-in-one software lowering of dual
source blending with no driver support needed! It even works for 8 dual-src
render targets, but I don't have a use case for that.

The only tricky bit here is making sure we are robust against different orders
of store_output within the exit block. In particular, if we naively lower

   x = ...
   primary color = x
   y = ...
   dual color = y

we end up emitting uses of y before it has been defined, something like

   x = ...
   primary color = blend(x, y)
   y = ...

Instead, we remove dual stores and sink blend stores to the bottom of the block,
so we end up with the correct

   x = ...
   y = ...
   primary color = blend(x, y)

lower_io_to_temporaries ensures that the stores will be in the same (exit)
block, so we don't need to sink further than that ourselves.

The motivation of this change is to support dual-source blending in PanVK in a sane way. So far, with these patches + the trivial enable on top of !20906 (merged), about 99% of the relevant tests pass. I'm completely at a loss for what's going wrong with the remaining ones and vaguely suspicious of a preexisting panvk bug this is exposing.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: panvk/2src