mesa/st: add tgsi-lowering code for depth-clamp
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 5 Jun 2019 13:39:41 +0000 (15:39 +0200)
committerGert Wollny <gw.fossdev@gmail.com>
Thu, 1 Aug 2019 05:58:53 +0000 (05:58 +0000)
commitb048d8bf8f056759d1845a799d4ba2ac84bce30f
treeef6c4b6f0abc8d662970ffdd497aa21057368f28
parent78ba12f40f79f94d082b7f32e121b3d149792bed
mesa/st: add tgsi-lowering code for depth-clamp

This is a TGSI pass that lowers depth-clamping into shader-operations,
by replacing the depth-value with 0 (a z-coordinate of zero will always
pass the OpenGL depth test conditions), and using a dedicated varying to
interpolate the real depth-value instead. Finally we replace the
depth-output in the fragment shader.

v1 implemented by Erik Faye-Lund <erik.faye-lund@collabora.com>
v2: Add support for handling depth clip mode, and refactor code
v3: - Rename *_vs functions to *_last_vertex_stage (Erik)
    - Use 0.0 depth to avoid clipping (Erik)
v4: Fix inversion of bool value for clip control property

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/Makefile.sources
src/mesa/meson.build
src/mesa/state_tracker/st_tgsi_lower_depth_clamp.c [new file with mode: 0644]
src/mesa/state_tracker/st_tgsi_lower_depth_clamp.h [new file with mode: 0644]