From c14be63c5647e4406a0a4d80570a4def593b551b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 14 Dec 2009 17:23:22 +0100 Subject: [PATCH] tgsi/ureg: Add ureg_DECL_gs_input(). Allows one to declare GS input registers. --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 31 ++++++++++++++++++++++++-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 ++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 3f943845f5b..1e730e53427 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -89,6 +89,11 @@ struct ureg_program unsigned vs_inputs[UREG_MAX_INPUT/32]; + struct { + unsigned index; + } gs_input[UREG_MAX_INPUT]; + unsigned nr_gs_inputs; + struct { unsigned semantic_name; unsigned semantic_index; @@ -278,6 +283,22 @@ ureg_DECL_vs_input( struct ureg_program *ureg, } +struct ureg_src +ureg_DECL_gs_input(struct ureg_program *ureg, + unsigned index) +{ + if (ureg->nr_gs_inputs < UREG_MAX_INPUT) { + ureg->gs_input[ureg->nr_gs_inputs].index = index; + ureg->nr_gs_inputs++; + } else { + set_bad(ureg); + } + + /* XXX: Add suport for true 2D input registers. */ + return ureg_src_register(TGSI_FILE_INPUT, index); +} + + struct ureg_dst ureg_DECL_output( struct ureg_program *ureg, unsigned name, @@ -964,8 +985,7 @@ static void emit_decls( struct ureg_program *ureg ) emit_decl_range( ureg, TGSI_FILE_INPUT, i, 1 ); } } - } - else { + } else if (ureg->processor == TGSI_PROCESSOR_FRAGMENT) { for (i = 0; i < ureg->nr_fs_inputs; i++) { emit_decl( ureg, TGSI_FILE_INPUT, @@ -974,6 +994,13 @@ static void emit_decls( struct ureg_program *ureg ) ureg->fs_input[i].semantic_index, ureg->fs_input[i].interp ); } + } else { + for (i = 0; i < ureg->nr_gs_inputs; i++) { + emit_decl_range(ureg, + TGSI_FILE_INPUT, + ureg->gs_input[i].index, + 1); + } } for (i = 0; i < ureg->nr_outputs; i++) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 94cc70a2082..7e3e7bcf1d3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -133,6 +133,10 @@ struct ureg_src ureg_DECL_vs_input( struct ureg_program *, unsigned index ); +struct ureg_src +ureg_DECL_gs_input(struct ureg_program *, + unsigned index); + struct ureg_dst ureg_DECL_output( struct ureg_program *, unsigned semantic_name, -- 2.30.2