st/nir: Make new helpers for constructing built-in NIR shaders.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 30 Oct 2018 05:30:06 +0000 (22:30 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 5 Feb 2019 21:43:33 +0000 (13:43 -0800)
commitcdc53fa81cbeb80373eac33ef7695d9025caf14b
treee6b10a9f3dae3aed6a9ecc733305ff1a04003cee
parent4f799264d1ac40769f84d27e945e981a89f4346e
st/nir: Make new helpers for constructing built-in NIR shaders.

The state tracker generates several built-in shaders in order to
perform scissored clears, upload/download PBOs, and so on.  These
are currently constructed using TGSI, using ureg and u_simple_shader.

I want to have NIR versions of these shaders, for my Gallium driver
that has a NIR backend but no TGSI support.  To that end, we'll want
a few helpers to help construct simple shaders.

This patch adds two new helpers:

- st_nir_finish_builtin_shader() takes a manually constructed NIR
  shader, applies lowering passes (like st_link_nir would do for GLSL),
  and constructs the pipe_shader_state.

- st_nir_make_passthrough_shader() makes a simple passthrough shader,
  which copies inputs to outputs.  This is similar to u_simple_shaders.

v2: Set info->fs.untyped_color_outputs for vc4/v3d (thanks Eric!).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Rob Clark <robdclark@gmail.com>
Tested-by: Eric Anholt <eric@anholt.net>
src/mesa/Makefile.sources
src/mesa/meson.build
src/mesa/state_tracker/st_nir.h
src/mesa/state_tracker/st_nir_builtins.c [new file with mode: 0644]