Skip to content

iris: Compact binding tables

Caio Oliveira requested to merge cmarcelo/mesa:r/iris-binding-table into master

This supersedes !266 (closed).

Only create binding table entries for surfaces that we are going to use. To achieve this in a clean way we move the binding table handling to the driver instead of relying on brw. This is similar to what is done in anv. This MR should help with kwg/mesa#15 (closed).

A secondary goal was to make easier to plug ibc into a GL driver, by lifting the need of ibc to manage the binding table.

Example output of INTEL_DEBUG=bt (note texture #0 is not present, since it is unused in this test):

$ INTEL_DEBUG=bt mesa-run -i -b iris bin/stencil-drawpixels -auto -fbo
Running with Mesa (iris) in /home/c/p/mesa/iris/build 
    8bf4fb1b027 iris: Print binding tables when INTEL_DEBUG=bt

Binding table for MESA_SHADER_FRAGMENT (compacted to 1 entries from 17 entries)
  [0] render target #0

Binding table for MESA_SHADER_VERTEX (compacted to 1 entries from 17 entries)
  [0] ubo #0

Binding table for MESA_SHADER_VERTEX (compacted to 0 entries from 16 entries)

Binding table for MESA_SHADER_FRAGMENT (compacted to 2 entries from 19 entries)
  [0] render target #0
  [1] texture #1

Binding table for MESA_SHADER_FRAGMENT (compacted to 2 entries from 19 entries)
  [0] render target #0
  [1] texture #1

Binding table for MESA_SHADER_FRAGMENT (compacted to 2 entries from 18 entries)
  [0] render target #0
  [1] ubo #0

Binding table for MESA_SHADER_VERTEX (compacted to 1 entries from 17 entries)
  [0] ubo #0

PIGLIT: {"result": "pass" }

Example of the effect in a test with ABOs.

$ INTEL_DEBUG=bt mesa-run -i -b iris bin/arb_shader_atomic_counters-semantics |& grep Binding | sort | uniq
Binding table for MESA_SHADER_FRAGMENT (compacted to 1 entries from 17 entries)
Binding table for MESA_SHADER_FRAGMENT (compacted to 2 entries from 17 entries)
Binding table for MESA_SHADER_GEOMETRY (compacted to 1 entries from 16 entries)
Binding table for MESA_SHADER_TESS_CTRL (compacted to 0 entries from 16 entries)
Binding table for MESA_SHADER_TESS_CTRL (compacted to 1 entries from 16 entries)
Binding table for MESA_SHADER_TESS_EVAL (compacted to 0 entries from 16 entries)
Binding table for MESA_SHADER_TESS_EVAL (compacted to 1 entries from 16 entries)
Binding table for MESA_SHADER_VERTEX (compacted to 0 entries from 16 entries)
Binding table for MESA_SHADER_VERTEX (compacted to 1 entries from 16 entries)

Differences from previous MR:

  • No changes to brw.
  • Assign the BTIs still in NIR, keeping the work in the driver.
  • Iris only. i965 has a few other complicated cases to solve, we can look into it in a separate MR.
Edited by Caio Oliveira

Merge request reports