diff options
author | Brian Paul <[email protected]> | 2011-07-13 10:58:01 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-09-23 07:58:47 -0600 |
commit | 2f40e4aac7ab79deb06ff6ab9ae03a896d7a9169 (patch) | |
tree | a9223f69183aa85899b538ef08f10dad91ffdb6f /src/gallium/drivers/svga/svga_tgsi_decl_sm30.c | |
parent | 9a41ecaddddb2f371e207901ae4d86918049c5aa (diff) |
svga: implement point sprite suppport
Emit the SVGA3D_RS_POINTSPRITEENABLE render state.
When sprite_coord_mode=PIPE_SPRITE_COORD_LOWER_LEFT emit extra frag
shader code to invert the Y coordinate of the incoming texcoord.
Diffstat (limited to 'src/gallium/drivers/svga/svga_tgsi_decl_sm30.c')
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_decl_sm30.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c index ed4b000e4f3..6f162ea7e33 100644 --- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c @@ -234,7 +234,36 @@ static boolean ps30_input( struct svga_shader_emitter *emit, emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count++ ); reg = dst( emit->input_map[idx] ); - return emit_decl( emit, reg, usage, index ); + if (!emit_decl( emit, reg, usage, index )) + return FALSE; + + if (semantic.Name == TGSI_SEMANTIC_GENERIC && + emit->key.fkey.sprite_origin_lower_left && + index >= 1 && + emit->key.fkey.tex[index - 1].sprite_texgen) { + /* This is a sprite texture coord with lower-left origin. + * We need to invert the texture T coordinate since the SVGA3D + * device only supports an upper-left origin. + */ + unsigned unit = index - 1; + + emit->inverted_texcoords |= (1 << unit); + + /* save original texcoord reg */ + emit->ps_true_texcoord[unit] = emit->input_map[idx]; + + /* this temp register will be the results of the MAD instruction */ + emit->ps_inverted_texcoord[unit] = + src_register(SVGA3DREG_TEMP, emit->nr_hw_temp); + emit->nr_hw_temp++; + + emit->ps_inverted_texcoord_input[unit] = idx; + + /* replace input_map entry with the temp register */ + emit->input_map[idx] = emit->ps_inverted_texcoord[unit]; + } + + return TRUE; } } |