OSDN Git Service

mesa/st: glsl_to_tgsi: implement new temporary register lifetime tracker
authorGert Wollny <gw.fossdev@gmail.com>
Fri, 30 Jun 2017 06:35:06 +0000 (08:35 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 6 Sep 2017 09:49:39 +0000 (11:49 +0200)
commit978c437b1290124619dc7decc6c2e929722eda01
treed5b0a2b14d95c1951f64fab52b725b2698dca995
parent732246701f58a6be4bd377fbd2ecf1f10737824e
mesa/st: glsl_to_tgsi: implement new temporary register lifetime tracker

This patch adds a class for tracking the life times of temporary registers
in the glsl to tgsi translation. The algorithm runs in three steps:
First, in order to minimize the number of needed memory allocations the
program is scanned to evaluate the number of scopes.
Then, the program is scanned  second time to record the important register
access time points: first and last reads and writes and their link to the
execution scope (loop, if/else branch, switch case).
In the third step for each register the actual minimal life time is
evaluated.

In addition, when compiled in debug mode (i.e. NDEBUG is not defined)
the shaders and estimated temporary life times can be logged to stderr
by setting the environment variable GLSL_TO_TGSI_RENAME_DEBUG.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/mesa/Makefile.sources
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp [new file with mode: 0644]
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.h [new file with mode: 0644]