Browse Source

mesa/st: glsl_to_tgsi: add tests for the new temporary lifetime tracker

This patch adds a set of unit tests for the new lifetime tracker.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
tags/17.3-branchpoint
Gert Wollny 8 years ago
parent
commit
7be6d8fe12

+ 1
- 0
configure.ac View File

src/mesa/drivers/osmesa/osmesa.pc src/mesa/drivers/osmesa/osmesa.pc
src/mesa/drivers/x11/Makefile src/mesa/drivers/x11/Makefile
src/mesa/main/tests/Makefile src/mesa/main/tests/Makefile
src/mesa/state_tracker/tests/Makefile
src/util/Makefile src/util/Makefile
src/util/tests/hash_table/Makefile src/util/tests/hash_table/Makefile
src/util/xmlpool/Makefile src/util/xmlpool/Makefile

+ 1
- 1
src/mesa/Makefile.am View File

# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE. # IN THE SOFTWARE.


SUBDIRS = . main/tests
SUBDIRS = . main/tests state_tracker/tests


if HAVE_XLIB_GLX if HAVE_XLIB_GLX
SUBDIRS += drivers/x11 SUBDIRS += drivers/x11

+ 11
- 1
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.cpp View File

/* Scan the program and estimate the required register life times. /* Scan the program and estimate the required register life times.
* The array lifetimes must be pre-allocated * The array lifetimes must be pre-allocated
*/ */
void
bool
get_temp_registers_required_lifetimes(void *mem_ctx, exec_list *instructions, get_temp_registers_required_lifetimes(void *mem_ctx, exec_list *instructions,
int ntemps, struct lifetime *lifetimes) int ntemps, struct lifetime *lifetimes)
{ {
} }
break; break;
} }
case TGSI_OPCODE_CAL:
case TGSI_OPCODE_RET:
/* These opcodes are not supported and if a subroutine would
* be called in a shader, then the lifetime tracking would have
* to follow that call to see which registers are used there.
* Since this is not done, we have to bail out here and signal
* that no register merge will take place.
*/
return false;
default: { default: {
for (unsigned j = 0; j < num_inst_src_regs(inst); j++) { for (unsigned j = 0; j < num_inst_src_regs(inst); j++) {
const st_src_reg& src = inst->src[j]; const st_src_reg& src = inst->src[j];
RENAME_DEBUG(cerr << "==================================\n\n"); RENAME_DEBUG(cerr << "==================================\n\n");


delete[] acc; delete[] acc;
return true;
} }


/* Code below used for debugging */ /* Code below used for debugging */

+ 6
- 2
src/mesa/state_tracker/st_glsl_to_tgsi_temprename.h View File

int end; int end;
}; };


/** Evaluates the required life times of temporary registers in a shader
/** Evaluates the required life times of temporary registers in a shader.
* The life time estimation can only be run sucessfully if the shader doesn't
* call a subroutine.
* @param[in] mem_ctx a memory context that can be used with the ralloc_* functions * @param[in] mem_ctx a memory context that can be used with the ralloc_* functions
* @param[in] instructions the shader to be anlzyed * @param[in] instructions the shader to be anlzyed
* @param[in] ntemps number of temporaries reserved for this shader * @param[in] ntemps number of temporaries reserved for this shader
* allocated memory that can hold ntemps lifetime structures. On output * allocated memory that can hold ntemps lifetime structures. On output
* the life times contains the life times for the registers with the * the life times contains the life times for the registers with the
* exception of TEMP[0]. * exception of TEMP[0].
* @returns: true if the lifetimes were estimated, false if not (i.e. if a
* subroutine was called).
*/ */
void
bool
get_temp_registers_required_lifetimes(void *mem_ctx, exec_list *instructions, get_temp_registers_required_lifetimes(void *mem_ctx, exec_list *instructions,
int ntemps, struct lifetime *lifetimes); int ntemps, struct lifetime *lifetimes);



+ 36
- 0
src/mesa/state_tracker/tests/Makefile.am View File

AM_CFLAGS = \
$(PTHREAD_CFLAGS)

AM_CXXFLAGS = \
$(LLVM_CXXFLAGS)

AM_CPPFLAGS = \
-I$(top_srcdir)/src/gtest/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/src/mapi \
-I$(top_builddir)/src/mesa \
-I$(top_srcdir)/src/mesa \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/gallium/include \
-I$(top_srcdir)/src/gallium/auxiliary \
$(DEFINES)

TESTS = st-renumerate-test
check_PROGRAMS = st-renumerate-test

st_renumerate_test_SOURCES = \
test_glsl_to_tgsi_lifetime.cpp

st_renumerate_test_LDFLAGS = \
$(LLVM_LDFLAGS)

st_renumerate_test_LDADD = \
$(top_builddir)/src/mesa/libmesagallium.la \
$(top_builddir)/src/mapi/shared-glapi/libglapi.la \
$(top_builddir)/src/gallium/auxiliary/libgallium.la \
$(top_builddir)/src/util/libmesautil.la \
$(top_builddir)/src/gtest/libgtest.la \
$(GALLIUM_COMMON_LIB_DEPS) \
$(LLVM_LIBS) \
$(PTHREAD_LIBS) \
$(DLOPEN_LIBS)

+ 1428
- 0
src/mesa/state_tracker/tests/test_glsl_to_tgsi_lifetime.cpp
File diff suppressed because it is too large
View File


Loading…
Cancel
Save