radeonsi: fix user fence space when MCBP is enabled
[mesa.git] / src / gallium / auxiliary / draw / draw_pipe_wide_line.c
index 98da9cfb999c8dd25abe484c19735c1716ba3082..cdcc43a13d8213006a428a6b1979e2a2a083d5c6 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  * 
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 VMware, Inc.
  * All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  * 
  **************************************************************************/
 
-/* Authors:  Keith Whitwell <keith@tungstengraphics.com>
+/* Authors:  Keith Whitwell <keithw@vmware.com>
  */
 
 #include "pipe/p_context.h"
 
 struct wideline_stage {
    struct draw_stage stage;
-
-   float half_line_width;
 };
 
 
-
-static INLINE struct wideline_stage *wideline_stage( struct draw_stage *stage )
-{
-   return (struct wideline_stage *)stage;
-}
-
-
-
 /**
  * Draw a wide line by drawing a quad (two triangles).
  */
 static void wideline_line( struct draw_stage *stage,
                            struct prim_header *header )
 {
-   /*const struct wideline_stage *wide = wideline_stage(stage);*/
    const unsigned pos = draw_current_shader_position_output(stage->draw);
    const float half_width = 0.5f * stage->draw->rasterizer->line_width;
 
@@ -77,11 +66,11 @@ static void wideline_line( struct draw_stage *stage,
    const float dx = fabsf(pos0[0] - pos2[0]);
    const float dy = fabsf(pos0[1] - pos2[1]);
 
-   const boolean gl_rasterization_rules =
-      stage->draw->rasterizer->gl_rasterization_rules;
+   const boolean half_pixel_center =
+      stage->draw->rasterizer->half_pixel_center;
 
    /* small tweak to meet GL specification */
-   const float bias = gl_rasterization_rules ? 0.125f : 0.0f;
+   const float bias = half_pixel_center ? 0.125f : 0.0f;
 
    /*
     * Draw wide line as a quad (two tris) by "stretching" the line along
@@ -95,7 +84,7 @@ static void wideline_line( struct draw_stage *stage,
       pos1[1] = pos1[1] + half_width - bias;
       pos2[1] = pos2[1] - half_width - bias;
       pos3[1] = pos3[1] + half_width - bias;
-      if (gl_rasterization_rules) {
+      if (half_pixel_center) {
          if (pos0[0] < pos2[0]) {
             /* left to right line */
             pos0[0] -= 0.5f;
@@ -118,7 +107,7 @@ static void wideline_line( struct draw_stage *stage,
       pos1[0] = pos1[0] + half_width + bias;
       pos2[0] = pos2[0] - half_width + bias;
       pos3[0] = pos3[0] + half_width + bias;
-      if (gl_rasterization_rules) {
+      if (half_pixel_center) {
          if (pos0[1] < pos2[1]) {
             /* top to bottom line */
             pos0[1] -= 0.5f;
@@ -202,7 +191,7 @@ static void wideline_destroy( struct draw_stage *stage )
 struct draw_stage *draw_wide_line_stage( struct draw_context *draw )
 {
    struct wideline_stage *wide = CALLOC_STRUCT(wideline_stage);
-   if (wide == NULL)
+   if (!wide)
       goto fail;
 
    wide->stage.draw = draw;