r300c/r300g: add 3155 rv380 pci id
[mesa.git] / src / gallium / auxiliary / draw / draw_pipe_wide_point.c
index 8dc50c0ab431b7fc1f6d4a04db5b06bcc12a96b9..6864b4015b38f28128ae9f8e7f4acb5faad0b815 100644 (file)
@@ -64,15 +64,14 @@ struct widepoint_stage {
    struct draw_stage stage;
 
    float half_point_size;
-   float point_size_min;
-   float point_size_max;
 
    float xbias;
    float ybias;
 
    uint texcoord_slot[PIPE_MAX_SHADER_OUTPUTS];
-   uint texcoord_mode[PIPE_MAX_SHADER_OUTPUTS];
+   uint texcoord_enable[PIPE_MAX_SHADER_OUTPUTS];
    uint num_texcoords;
+   uint texcoord_mode;
 
    int psize_slot;
 
@@ -98,10 +97,10 @@ static void set_texcoords(const struct widepoint_stage *wide,
 {
    uint i;
    for (i = 0; i < wide->num_texcoords; i++) {
-      if (wide->texcoord_mode[i] != PIPE_SPRITE_COORD_NONE) {
+      if (wide->texcoord_enable[i]) {
          uint j = wide->texcoord_slot[i];
          v->data[j][0] = tc[0];
-         if (wide->texcoord_mode[i] == PIPE_SPRITE_COORD_LOWER_LEFT)
+         if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
             v->data[j][1] = 1.0f - tc[1];
          else
             v->data[j][1] = tc[1];
@@ -114,7 +113,10 @@ static void set_texcoords(const struct widepoint_stage *wide,
       /* put gl_PointCoord into the extra vertex slot */
       uint slot = wide->stage.draw->extra_shader_outputs.slot;
       v->data[slot][0] = tc[0];
-      v->data[slot][1] = tc[1];
+      if (wide->texcoord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
+         v->data[slot][1] = 1.0f - tc[1];
+      else
+         v->data[slot][1] = tc[1];
       v->data[slot][2] = 0.0F;
       v->data[slot][3] = 1.0F;
    }
@@ -129,9 +131,10 @@ static void set_texcoords(const struct widepoint_stage *wide,
 static void widepoint_point( struct draw_stage *stage,
                              struct prim_header *header )
 {
+   /* XXX should take point_quad_rasterization into account? */
    const struct widepoint_stage *wide = widepoint_stage(stage);
    const unsigned pos = draw_current_shader_position_output(stage->draw);
-   const boolean sprite = (boolean) stage->draw->rasterizer->point_sprite;
+   const boolean sprite = (boolean) stage->draw->rasterizer->sprite_coord_enable;
    float half_size;
    float left_adj, right_adj, bot_adj, top_adj;
 
@@ -151,13 +154,6 @@ static void widepoint_point( struct draw_stage *stage,
    /* point size is either per-vertex or fixed size */
    if (wide->psize_slot >= 0) {
       half_size = header->v[0]->data[wide->psize_slot][0];
-
-      /* XXX: temporary -- do this in the vertex shader??
-       */
-      half_size = CLAMP(half_size,
-                        wide->point_size_min,
-                        wide->point_size_max);
-      
       half_size *= 0.5f; 
    }
    else {
@@ -222,8 +218,6 @@ static void widepoint_first_point( struct draw_stage *stage,
    struct draw_context *draw = stage->draw;
 
    wide->half_point_size = 0.5f * draw->rasterizer->point_size;
-   wide->point_size_min = draw->rasterizer->point_size_min;
-   wide->point_size_max = draw->rasterizer->point_size_max;
    wide->xbias = 0.0;
    wide->ybias = 0.0;
 
@@ -233,21 +227,22 @@ static void widepoint_first_point( struct draw_stage *stage,
 
    /* XXX we won't know the real size if it's computed by the vertex shader! */
    if ((draw->rasterizer->point_size > draw->pipeline.wide_point_threshold) ||
-       (draw->rasterizer->point_sprite && draw->pipeline.point_sprite)) {
+       (draw->rasterizer->sprite_coord_enable && draw->pipeline.point_sprite)) {
       stage->point = widepoint_point;
    }
    else {
       stage->point = draw_pipe_passthrough_point;
    }
 
-   if (draw->rasterizer->point_sprite) {
+   if (draw->rasterizer->sprite_coord_enable) {
       /* find vertex shader texcoord outputs */
       const struct draw_vertex_shader *vs = draw->vs.vertex_shader;
       uint i, j = 0;
+      wide->texcoord_mode = draw->rasterizer->sprite_coord_mode;
       for (i = 0; i < vs->info.num_outputs; i++) {
          if (vs->info.output_semantic_name[i] == TGSI_SEMANTIC_GENERIC) {
             wide->texcoord_slot[j] = i;
-            wide->texcoord_mode[j] = draw->rasterizer->sprite_coord_mode[j];
+            wide->texcoord_enable[j] = (draw->rasterizer->sprite_coord_enable >> j) & 1;
             j++;
          }
       }