nv20: set surface status in clear()
[mesa.git] / src / gallium / drivers / softpipe / sp_state_derived.c
index 68702eafcf3e7ca49c26257a21c05b5d40ad00a3..6b6a4c3ff3487a4fd9ab6becbafae0d959c80a5f 100644 (file)
@@ -25,7 +25,8 @@
  * 
  **************************************************************************/
 
-#include "pipe/p_util.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
 #include "pipe/p_shader_tokens.h"
 #include "draw/draw_context.h"
 #include "draw/draw_vertex.h"
@@ -61,9 +62,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
 
    if (vinfo->num_attribs == 0) {
       /* compute vertex layout now */
-      const struct pipe_shader_state *vs = &softpipe->vs->shader;
       const struct sp_fragment_shader *spfs = softpipe->fs;
-      const struct pipe_shader_state *fs = &softpipe->fs->shader;
       const enum interp_mode colorInterp
          = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
       uint i;
@@ -73,10 +72,16 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
           * simply emit the whole post-xform vertex as-is:
           */
          struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf;
+         const uint num = draw_num_vs_outputs(softpipe->draw);
+         uint i;
+
+         /* No longer any need to try and emit draw vertex_header info.
+          */
          vinfo_vbuf->num_attribs = 0;
-         draw_emit_vertex_attr(vinfo_vbuf, EMIT_ALL, INTERP_NONE, 0);
-         vinfo_vbuf->size = 4 * vs->num_outputs
-                          + sizeof(struct vertex_header) / 4;
+         for (i = 0; i < num; i++) {
+            draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i);
+         }
+         draw_compute_vertex_size(vinfo_vbuf);
       }
 
       /*
@@ -158,17 +163,8 @@ softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe)
 static void
 compute_cliprect(struct softpipe_context *sp)
 {
-   unsigned surfWidth, surfHeight;
-
-   if (sp->framebuffer.num_cbufs > 0) {
-      surfWidth = sp->framebuffer.cbufs[0]->width;
-      surfHeight = sp->framebuffer.cbufs[0]->height;
-   }
-   else {
-      /* no surface? */
-      surfWidth = sp->scissor.maxx;
-      surfHeight = sp->scissor.maxy;
-   }
+   uint surfWidth = sp->framebuffer.width;
+   uint surfHeight = sp->framebuffer.height;
 
    if (sp->rasterizer->scissor) {
       /* clip to scissor rect */