{
struct softpipe_context *softpipe = setup->softpipe;
const struct tgsi_shader_info *fsInfo = &setup->softpipe->fs_variant->info;
- const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe);
+ const struct sp_setup_info *sinfo = &softpipe->setup_info;
uint fragSlot;
float v[3];
+ assert(sinfo->valid);
+
/* z and w are done by linear interpolation:
*/
v[0] = setup->vmin[0][2];
/* setup interpolation for all the remaining attributes:
*/
for (fragSlot = 0; fragSlot < fsInfo->num_inputs; fragSlot++) {
- const uint vertSlot = vinfo->attrib[fragSlot].src_index;
+ const uint vertSlot = sinfo->attrib[fragSlot].src_index;
uint j;
- switch (vinfo->attrib[fragSlot].interp_mode) {
+ switch (sinfo->attrib[fragSlot].interp) {
case INTERP_CONSTANT:
- for (j = 0; j < TGSI_NUM_CHANNELS; j++)
+ for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
const_coeff(setup, &setup->coef[fragSlot], vertSlot, j);
+ }
break;
case INTERP_LINEAR:
for (j = 0; j < TGSI_NUM_CHANNELS; j++) {
{
struct softpipe_context *softpipe = setup->softpipe;
const struct tgsi_shader_info *fsInfo = &setup->softpipe->fs_variant->info;
- const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe);
+ const struct sp_setup_info *sinfo = &softpipe->setup_info;
uint fragSlot;
float area;
float v[2];
+ assert(sinfo->valid);
+
/* use setup->vmin, vmax to point to vertices */
if (softpipe->rasterizer->flatshade_first)
setup->vprovoke = v0;
/* setup interpolation for all the remaining attributes:
*/
for (fragSlot = 0; fragSlot < fsInfo->num_inputs; fragSlot++) {
- const uint vertSlot = vinfo->attrib[fragSlot].src_index;
+ const uint vertSlot = sinfo->attrib[fragSlot].src_index;
uint j;
- switch (vinfo->attrib[fragSlot].interp_mode) {
+ switch (sinfo->attrib[fragSlot].interp) {
case INTERP_CONSTANT:
for (j = 0; j < TGSI_NUM_CHANNELS; j++)
const_coeff(setup, &setup->coef[fragSlot], vertSlot, j);
const boolean round = (boolean) setup->softpipe->rasterizer->point_smooth;
const float x = v0[0][0]; /* Note: data[0] is always position */
const float y = v0[0][1];
- const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe);
+ const struct sp_setup_info *sinfo = &softpipe->setup_info;
uint fragSlot;
uint layer = 0;
unsigned viewport_index = 0;
print_vertex(setup, v0);
#endif
+ assert(sinfo->valid);
+
if (setup->softpipe->no_rast || setup->softpipe->rasterizer->rasterizer_discard)
return;
const_coeff(setup, &setup->posCoef, 0, 3);
for (fragSlot = 0; fragSlot < fsInfo->num_inputs; fragSlot++) {
- const uint vertSlot = vinfo->attrib[fragSlot].src_index;
+ const uint vertSlot = sinfo->attrib[fragSlot].src_index;
uint j;
- switch (vinfo->attrib[fragSlot].interp_mode) {
+ switch (sinfo->attrib[fragSlot].interp) {
case INTERP_CONSTANT:
/* fall-through */
case INTERP_LINEAR:
static void
invalidate_vertex_layout(struct softpipe_context *softpipe)
{
- softpipe->vertex_info.num_attribs = 0;
+ softpipe->setup_info.valid = 0;
}
* (simple float[][4]) used by the 'draw' module into vertices for
* rasterization.
*
- * This function validates the vertex layout and returns a pointer to a
- * vertex_info object.
+ * This function validates the vertex layout.
*/
-struct vertex_info *
-softpipe_get_vertex_info(struct softpipe_context *softpipe)
+static void
+softpipe_compute_vertex_info(struct softpipe_context *softpipe)
{
- struct vertex_info *vinfo = &softpipe->vertex_info;
+ struct sp_setup_info *sinfo = &softpipe->setup_info;
int vs_index;
- if (vinfo->num_attribs == 0) {
- /* compute vertex layout now */
+ if (sinfo->valid == 0) {
+ /* compute vertex layout for vbuf now */
const struct tgsi_shader_info *fsInfo = &softpipe->fs_variant->info;
struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf;
const uint num = draw_num_shader_outputs(softpipe->draw);
* Loop over fragment shader inputs, searching for the matching output
* from the vertex shader.
*/
- vinfo->num_attribs = 0;
for (i = 0; i < fsInfo->num_inputs; i++) {
int src;
enum interp_mode interp = INTERP_LINEAR;
TGSI_SEMANTIC_BCOLOR,
fsInfo->input_semantic_index[i]);
- draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src);
+ sinfo->attrib[i].interp = interp;
+ /*
+ * note src can be -1 if not found. Would need special handling,
+ * (as we don't tell draw anything about it) just force to 0.
+ * It's wrong either way but should be safer...
+ */
+ if (src < 0)
+ src = 0;
+ sinfo->attrib[i].src_index = src;
}
/* Figure out if we need pointsize as well. */
if (vs_index >= 0) {
softpipe->psize_slot = vs_index;
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
}
/* Figure out if we need viewport index */
0);
if (vs_index >= 0) {
softpipe->viewport_index_slot = vs_index;
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
}
/* Figure out if we need layer */
0);
if (vs_index >= 0) {
softpipe->layer_slot = vs_index;
- draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
}
-
- draw_compute_vertex_size(vinfo);
+ softpipe->setup_info.valid = 1;
}
- return vinfo;
+ return;
}
/**
* Called from vbuf module.
*
- * Note that there's actually two different vertex layouts in softpipe.
- *
- * The normal one is computed in softpipe_get_vertex_info() above and is
- * used by the point/line/tri "setup" code.
- *
- * The other one (this one) is only used by the vbuf module (which is
- * not normally used by default but used in testing). For the vbuf module,
- * we basically want to pass-through the draw module's vertex layout as-is.
- * When the softpipe vbuf code begins drawing, the normal vertex layout
- * will come into play again.
+ * Note the vertex layout used for vbuf is simply telling it to pass
+ * through everything as is. The mapping actually used for setup is
+ * stored separately (but calculated here too at the same time).
*/
struct vertex_info *
softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe)
{
- (void) softpipe_get_vertex_info(softpipe);
+ softpipe_compute_vertex_info(softpipe);
return &softpipe->vertex_info_vbuf;
}