diff options
author | Zack Rusin <zackr@vmware.com> | 2013-05-24 16:17:26 -0400 |
---|---|---|
committer | Zack Rusin <zackr@vmware.com> | 2013-05-25 09:49:20 -0400 |
commit | 7756aae815a26c533948081c2c319c20bcf5962c (patch) | |
tree | 36ca7a4f867101633387215925ce3e0d123f7e94 /src/gallium/auxiliary/draw/draw_pipe_clip.c | |
parent | eaabb4ead07ae043ecc789024028e225ebd0f318 (diff) | |
download | external_mesa3d-7756aae815a26c533948081c2c319c20bcf5962c.zip external_mesa3d-7756aae815a26c533948081c2c319c20bcf5962c.tar.gz external_mesa3d-7756aae815a26c533948081c2c319c20bcf5962c.tar.bz2 |
draw: implement support for multiple viewports
This adds support for multiple viewports to the draw module.
Multiple viewports depend on the presence of geometry shaders
which can write the viewport index.
Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: José Fonseca<jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/gallium/auxiliary/draw/draw_pipe_clip.c')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_pipe_clip.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c b/src/gallium/auxiliary/draw/draw_pipe_clip.c index 8da0c41..b01e519 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c @@ -127,6 +127,8 @@ static void interp( const struct clip_stage *clip, const unsigned clip_attr = draw_current_shader_clipvertex_output(clip->stage.draw); unsigned j; float t_nopersp; + unsigned viewport_index_output = + draw_current_shader_viewport_index_output(clip->stage.draw); /* Vertex header. */ @@ -145,9 +147,14 @@ static void interp( const struct clip_stage *clip, * new window coordinates: */ { + int viewport_index = + draw_current_shader_uses_viewport_index(clip->stage.draw) ? + *((unsigned*)in->data[viewport_index_output]) : 0; const float *pos = dst->pre_clip_pos; - const float *scale = clip->stage.draw->viewport.scale; - const float *trans = clip->stage.draw->viewport.translate; + const float *scale = + clip->stage.draw->viewports[viewport_index].scale; + const float *trans = + clip->stage.draw->viewports[viewport_index].translate; const float oow = 1.0f / pos[3]; dst->data[pos_attr][0] = pos[0] * oow * scale[0] + trans[0]; |