OSDN Git Service

r300: Add line stipple state to rs_state.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Thu, 29 Jan 2009 23:50:46 +0000 (15:50 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 2 Feb 2009 07:30:32 +0000 (23:30 -0800)
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_state.c

index f246c57..1398278 100644 (file)
@@ -61,12 +61,14 @@ struct r300_fs_state {
 
 struct r300_rs_state {
     uint32_t vap_control_status;    /* R300_VAP_CNTL_STATUS: 0x2140 */
-    uint32_t depth_scale_front;     /* R300_SU_POLY_OFFSET_FRONT_SCALE: 0x42a4 */
-    uint32_t depth_offset_front;    /* R300_SU_POLY_OFFSET_FRONT_OFFSET: 0x42a8 */
-    uint32_t depth_scale_back;      /* R300_SU_POLY_OFFSET_BACK_SCALE: 0x42ac */
-    uint32_t depth_offset_back;     /* R300_SU_POLY_OFFSET_BACK_OFFSET: 0x42b0 */
+    uint32_t depth_scale_front;  /* R300_SU_POLY_OFFSET_FRONT_SCALE: 0x42a4 */
+    uint32_t depth_offset_front;/* R300_SU_POLY_OFFSET_FRONT_OFFSET: 0x42a8 */
+    uint32_t depth_scale_back;    /* R300_SU_POLY_OFFSET_BACK_SCALE: 0x42ac */
+    uint32_t depth_offset_back;  /* R300_SU_POLY_OFFSET_BACK_OFFSET: 0x42b0 */
     uint32_t polygon_offset_enable; /* R300_SU_POLY_OFFSET_ENABLE: 0x42b4 */
     uint32_t cull_mode;             /* R300_SU_CULL_MODE: 0x42b8 */
+    uint32_t line_stipple_config;   /* R300_GA_LINE_STIPPLE_CONFIG: 0x4328 */
+    uint32_t line_stipple_value;    /* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */
 };
 
 struct r300_sampler_state {
index 907ebe5..ee947fe 100644 (file)
@@ -440,9 +440,6 @@ struct pipe_rasterizer_state
     unsigned point_size_per_vertex:1; /**< size computed in vertex shader */
     unsigned multisample:1;         /* XXX maybe more ms state in future */
     unsigned line_smooth:1;
-    unsigned line_stipple_enable:1;
-    unsigned line_stipple_factor:8;  /**< [1..256] actually */
-    unsigned line_stipple_pattern:16;
     unsigned line_last_pixel:1;
     unsigned bypass_clipping:1;
     unsigned bypass_vs:1; /**< Skip the vertex shader.  Note that the shader is
@@ -504,6 +501,15 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
                 pack_float_32(state->offset_scale);
     }
 
+    if (state->line_stipple_enable) {
+        rs->line_stipple_config =
+            R300_GA_LINE_STIPPLE_CONFIG_LINE_RESET_LINE |
+            (pack_float_32((float)state->line_stipple_factor) &
+                R300_GA_LINE_STIPPLE_CONFIG_STIPPLE_SCALE_MASK);
+        /* XXX this might need to be scaled up */
+        rs->line_stipple_value = state->line_stipple_pattern;
+    }
+
     /* XXX this is part of HW TCL */
     /* XXX endian control */
     rs->vap_control_status = R300_VAP_TCL_BYPASS;