r300c/r300g: add 3155 rv380 pci id
[mesa.git] / src / gallium / auxiliary / draw / draw_pipe_offset.c
index 1fea5e6dcbc5bb5c7f23519d510f1f151a4f929e..8e321946ceda7b7dff528563d27c1c36ef7acd88 100644 (file)
@@ -63,7 +63,7 @@ static INLINE struct offset_stage *offset_stage( struct draw_stage *stage )
 static void do_offset_tri( struct draw_stage *stage,
                           struct prim_header *header )
 {
-   const unsigned pos = stage->draw->vs.position_output;
+   const unsigned pos = draw_current_shader_position_output(stage->draw);
    struct offset_stage *offset = offset_stage(stage);   
    float inv_det = 1.0f / header->det;
 
@@ -122,9 +122,8 @@ static void offset_first_tri( struct draw_stage *stage,
                              struct prim_header *header )
 {
    struct offset_stage *offset = offset_stage(stage);
-   float mrd = 1.0f / 65535.0f; /* XXX this depends on depthbuffer bits! */
 
-   offset->units = stage->draw->rasterizer->offset_units * mrd;
+   offset->units = (float) (stage->draw->rasterizer->offset_units * stage->draw->mrd);
    offset->scale = stage->draw->rasterizer->offset_scale;
 
    stage->tri = offset_tri;
@@ -162,11 +161,12 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
 {
    struct offset_stage *offset = CALLOC_STRUCT(offset_stage);
    if (offset == NULL)
-      goto fail;
+      return NULL;
 
    draw_alloc_temp_verts( &offset->stage, 3 );
 
    offset->stage.draw = draw;
+   offset->stage.name = "offset";
    offset->stage.next = NULL;
    offset->stage.point = draw_pipe_passthrough_point;
    offset->stage.line = draw_pipe_passthrough_line;
@@ -176,10 +176,4 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
    offset->stage.destroy = offset_destroy;
 
    return &offset->stage;
-
- fail:
-   if (offset)
-      offset->stage.destroy( &offset->stage );
-
-   return NULL;
 }