1c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell/**************************************************************************
2c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell *
3877128505431adaf817dc8069172ebe4a1cdf5d8José Fonseca * Copyright 2007 VMware, Inc.
4c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * All Rights Reserved.
5c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell *
6c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
7c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * copy of this software and associated documentation files (the
8c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * "Software"), to deal in the Software without restriction, including
9c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
10c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
11c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * permit persons to whom the Software is furnished to do so, subject to
12c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * the following conditions:
13c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell *
14c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * The above copyright notice and this permission notice (including the
15c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * next paragraph) shall be included in all copies or substantial portions
16c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * of the Software.
17c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell *
18c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21877128505431adaf817dc8069172ebe4a1cdf5d8José Fonseca * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell *
26c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell **************************************************************************/
27c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell#ifndef SP_SETUP_H
28c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell#define SP_SETUP_H
29c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell
30c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwellstruct setup_context;
31c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwellstruct softpipe_context;
32c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell
332dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger/**
342dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger * Attribute interpolation mode
352dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger */
362dbc20e45689e09766552517a74e2270e49817b5Roland Scheideggerenum sp_interp_mode {
372dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger   SP_INTERP_POS,       /**< special case for frag position */
382dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger   SP_INTERP_CONSTANT,
392dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger   SP_INTERP_LINEAR,
402dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger   SP_INTERP_PERSPECTIVE
412dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger};
422dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger
432dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger
44892e2d1395375c6f904af5250371c8d2784c8762Roland Scheideggerstruct sp_setup_info {
45892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger   unsigned valid;
46892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger   struct {
472dbc20e45689e09766552517a74e2270e49817b5Roland Scheidegger      unsigned interp:8;      /**< SP_INTERP_X */
488d4039ecdb167771d4b085f70b9666438be1c6adRoland Scheidegger      int src_index:8;
49892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger   } attrib[PIPE_MAX_SHADER_OUTPUTS];
50892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger};
51892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger
52871d39ec8c168fa58d8758013e99da63fa58111dKeith Whitwellvoid
53892e2d1395375c6f904af5250371c8d2784c8762Roland Scheideggersp_setup_tri(struct setup_context *setup,
54892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger             const float (*v0)[4],
55892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger             const float (*v1)[4],
56892e2d1395375c6f904af5250371c8d2784c8762Roland Scheidegger             const float (*v2)[4]);
57c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell
58c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwellvoid
599a0ff33ad60cb63d430c4f93f6531f7aa2ec2ba8Brian Paulsp_setup_line(struct setup_context *setup,
60c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell           const float (*v0)[4],
61c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell           const float (*v1)[4]);
62c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell
63c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwellvoid
649a0ff33ad60cb63d430c4f93f6531f7aa2ec2ba8Brian Paulsp_setup_point( struct setup_context *setup,
65c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell             const float (*v0)[4] );
66c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell
6700f97ad5def91d485de0e5dd79fd39fae9ed3ce1Edward O'Callaghanstatic inline unsigned
6800f97ad5def91d485de0e5dd79fd39fae9ed3ce1Edward O'Callaghansp_clamp_viewport_idx(int idx)
6900f97ad5def91d485de0e5dd79fd39fae9ed3ce1Edward O'Callaghan{
7000f97ad5def91d485de0e5dd79fd39fae9ed3ce1Edward O'Callaghan   return (PIPE_MAX_VIEWPORTS > idx && idx >= 0) ? idx : 0;
7100f97ad5def91d485de0e5dd79fd39fae9ed3ce1Edward O'Callaghan}
72c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell
739a0ff33ad60cb63d430c4f93f6531f7aa2ec2ba8Brian Paulstruct setup_context *sp_setup_create_context( struct softpipe_context *softpipe );
749a0ff33ad60cb63d430c4f93f6531f7aa2ec2ba8Brian Paulvoid sp_setup_prepare( struct setup_context *setup );
759a0ff33ad60cb63d430c4f93f6531f7aa2ec2ba8Brian Paulvoid sp_setup_destroy_context( struct setup_context *setup );
76c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell
77c95dcc49629b72b95826e87e067d7a48753605fbKeith Whitwell#endif
78