summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/draw
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2007-12-10 12:06:59 +1100
committerBen Skeggs <skeggsb@gmail.com>2007-12-10 12:06:59 +1100
commit5c1a5b504705214fd5e90b33bb3034e75f6b5994 (patch)
treeac6e3bd4cb94979ad1fce57a3fd01249253ef3ae /src/mesa/pipe/draw
parent1a3987240a547ba6e625c864f10a033858de4c65 (diff)
parentf8f9580a2a1c89af1dc0e169b62440053d9d7e81 (diff)
Merge branch 'upstream-gallium-0.1' into darktama-gallium-0.1
Conflicts: src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c src/mesa/pipe/Makefile src/mesa/pipe/draw/draw_vertex_fetch.c src/mesa/pipe/i915simple/i915_texture.c src/mesa/pipe/softpipe/sp_texture.c src/mesa/pipe/xlib/xm_winsys.c src/mesa/state_tracker/st_cb_fbo.c
Diffstat (limited to 'src/mesa/pipe/draw')
-rw-r--r--src/mesa/pipe/draw/draw_clip.c8
-rw-r--r--src/mesa/pipe/draw/draw_context.c13
-rw-r--r--src/mesa/pipe/draw/draw_cull.c9
-rw-r--r--src/mesa/pipe/draw/draw_feedback.c7
-rw-r--r--src/mesa/pipe/draw/draw_flatshade.c8
-rw-r--r--src/mesa/pipe/draw/draw_linestipple.c9
-rw-r--r--src/mesa/pipe/draw/draw_offset.c8
-rw-r--r--src/mesa/pipe/draw/draw_private.h2
-rw-r--r--src/mesa/pipe/draw/draw_twoside.c8
-rw-r--r--src/mesa/pipe/draw/draw_unfilled.c8
-rw-r--r--src/mesa/pipe/draw/draw_validate.c5
-rw-r--r--src/mesa/pipe/draw/draw_vbuf.c11
-rw-r--r--src/mesa/pipe/draw/draw_vertex_fetch.c1
-rw-r--r--src/mesa/pipe/draw/draw_wide_prims.c10
14 files changed, 103 insertions, 4 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c
index e4c257a0ee..c50376f11f 100644
--- a/src/mesa/pipe/draw/draw_clip.c
+++ b/src/mesa/pipe/draw/draw_clip.c
@@ -415,6 +415,13 @@ static void clip_reset_stipple_counter( struct draw_stage *stage )
}
+static void clip_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Allocate a new clipper stage.
* \return pointer to new stage object
@@ -432,6 +439,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw )
clipper->stage.tri = clip_tri;
clipper->stage.end = clip_end;
clipper->stage.reset_stipple_counter = clip_reset_stipple_counter;
+ clipper->stage.destroy = clip_destroy;
clipper->plane = draw->plane;
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c
index e7997180b5..6792a06a4e 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/mesa/pipe/draw/draw_context.c
@@ -42,7 +42,7 @@ struct draw_context *draw_create( void )
struct draw_context *draw = CALLOC_STRUCT( draw_context );
#if defined(__i386__) || defined(__386__)
- draw->use_sse = GETENV( "GALLIUM_SSE" ) != NULL;
+ draw->use_sse = GETENV( "GALLIUM_NOSSE" ) == NULL;
#else
draw->use_sse = FALSE;
#endif
@@ -85,6 +85,7 @@ struct draw_context *draw_create( void )
draw->prim = ~0; /* != any of PIPE_PRIM_x */
draw_vertex_cache_invalidate( draw );
+ draw_set_mapped_element_buffer( draw, 0, NULL );
return draw;
}
@@ -92,6 +93,16 @@ struct draw_context *draw_create( void )
void draw_destroy( struct draw_context *draw )
{
+ draw->pipeline.wide->destroy( draw->pipeline.wide );
+ draw->pipeline.unfilled->destroy( draw->pipeline.unfilled );
+ draw->pipeline.twoside->destroy( draw->pipeline.twoside );
+ draw->pipeline.offset->destroy( draw->pipeline.offset );
+ draw->pipeline.clip->destroy( draw->pipeline.clip );
+ draw->pipeline.flatshade->destroy( draw->pipeline.flatshade );
+ draw->pipeline.cull->destroy( draw->pipeline.cull );
+ draw->pipeline.feedback->destroy( draw->pipeline.feedback );
+ draw->pipeline.validate->destroy( draw->pipeline.validate );
+ draw->pipeline.rasterize->destroy( draw->pipeline.rasterize );
FREE( draw->vcache.vertex[0] ); /* Frees all the vertices. */
FREE( draw );
}
diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/mesa/pipe/draw/draw_cull.c
index f898834ba5..9bd53f45f2 100644
--- a/src/mesa/pipe/draw/draw_cull.c
+++ b/src/mesa/pipe/draw/draw_cull.c
@@ -116,6 +116,14 @@ static void cull_reset_stipple_counter( struct draw_stage *stage )
stage->next->reset_stipple_counter( stage->next );
}
+
+static void cull_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create a new polygon culling stage.
*/
@@ -133,6 +141,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw )
cull->stage.tri = cull_tri;
cull->stage.end = cull_end;
cull->stage.reset_stipple_counter = cull_reset_stipple_counter;
+ cull->stage.destroy = cull_destroy;
return &cull->stage;
}
diff --git a/src/mesa/pipe/draw/draw_feedback.c b/src/mesa/pipe/draw/draw_feedback.c
index b9906e5b4b..aea6a8184c 100644
--- a/src/mesa/pipe/draw/draw_feedback.c
+++ b/src/mesa/pipe/draw/draw_feedback.c
@@ -224,6 +224,12 @@ static void feedback_reset_stipple_counter( struct draw_stage *stage )
}
+static void feedback_destroy( struct draw_stage *stage )
+{
+ FREE( stage );
+}
+
+
/**
* Create feedback drawing stage.
*/
@@ -239,6 +245,7 @@ struct draw_stage *draw_feedback_stage( struct draw_context *draw )
feedback->stage.tri = feedback_tri;
feedback->stage.end = feedback_end;
feedback->stage.reset_stipple_counter = feedback_reset_stipple_counter;
+ feedback->stage.destroy = feedback_destroy;
return &feedback->stage;
}
diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c
index d46e53f2be..d7551e7948 100644
--- a/src/mesa/pipe/draw/draw_flatshade.c
+++ b/src/mesa/pipe/draw/draw_flatshade.c
@@ -127,6 +127,13 @@ static void flatshade_reset_stipple_counter( struct draw_stage *stage )
}
+static void flatshade_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create flatshading drawing stage.
*/
@@ -144,6 +151,7 @@ struct draw_stage *draw_flatshade_stage( struct draw_context *draw )
flatshade->tri = flatshade_tri;
flatshade->end = flatshade_end;
flatshade->reset_stipple_counter = flatshade_reset_stipple_counter;
+ flatshade->destroy = flatshade_destroy;
return flatshade;
}
diff --git a/src/mesa/pipe/draw/draw_linestipple.c b/src/mesa/pipe/draw/draw_linestipple.c
index 1fac1ebe66..5f0db99b23 100644
--- a/src/mesa/pipe/draw/draw_linestipple.c
+++ b/src/mesa/pipe/draw/draw_linestipple.c
@@ -241,12 +241,18 @@ static void stipple_begin( struct clip_pipe_stage *stage )
}
-
static void stipple_end( struct clip_pipe_stage *stage )
{
stage->next->end( stage->next );
}
+
+static void stipple_destroy( struct clip_pipe_stage *stage )
+{
+ FREE( stage );
+}
+
+
struct clip_pipe_stage *clip_pipe_stipple( struct clip_pipeline *pipe )
{
struct stipple_stage *stipple = CALLOC_STRUCT(stipple_stage);
@@ -261,6 +267,7 @@ struct clip_pipe_stage *clip_pipe_stipple( struct clip_pipeline *pipe )
stipple->stage.tri = clip_passthrough_tri;
stipple->stage.reset_tmps = clip_pipe_reset_tmps;
stipple->stage.end = stipple_end;
+ stipple->stage.destroy = stipple_destroy;
return &stipple->stage;
}
diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/mesa/pipe/draw/draw_offset.c
index 6acc7cbcd2..f8a01db3dd 100644
--- a/src/mesa/pipe/draw/draw_offset.c
+++ b/src/mesa/pipe/draw/draw_offset.c
@@ -151,6 +151,13 @@ static void offset_reset_stipple_counter( struct draw_stage *stage )
}
+static void offset_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create polygon offset drawing stage.
*/
@@ -168,6 +175,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw )
offset->stage.tri = offset_tri;
offset->stage.end = offset_end;
offset->stage.reset_stipple_counter = offset_reset_stipple_counter;
+ offset->stage.destroy = offset_destroy;
return &offset->stage;
}
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index 53d7451113..ca5ca7b3c9 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -124,6 +124,8 @@ struct draw_stage
void (*reset_tmps)( struct draw_stage * );
void (*reset_stipple_counter)( struct draw_stage * );
+
+ void (*destroy)( struct draw_stage * );
};
diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c
index d987b00598..00b4ee45cd 100644
--- a/src/mesa/pipe/draw/draw_twoside.c
+++ b/src/mesa/pipe/draw/draw_twoside.c
@@ -146,6 +146,13 @@ static void twoside_reset_stipple_counter( struct draw_stage *stage )
}
+static void twoside_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create twoside pipeline stage.
*/
@@ -163,6 +170,7 @@ struct draw_stage *draw_twoside_stage( struct draw_context *draw )
twoside->stage.tri = twoside_tri;
twoside->stage.end = twoside_end;
twoside->stage.reset_stipple_counter = twoside_reset_stipple_counter;
+ twoside->stage.destroy = twoside_destroy;
return &twoside->stage;
}
diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c
index 6cab086a45..786826b33c 100644
--- a/src/mesa/pipe/draw/draw_unfilled.c
+++ b/src/mesa/pipe/draw/draw_unfilled.c
@@ -168,6 +168,13 @@ static void unfilled_reset_stipple_counter( struct draw_stage *stage )
}
+static void unfilled_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
/**
* Create unfilled triangle stage.
*/
@@ -186,6 +193,7 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw )
unfilled->stage.tri = unfilled_tri;
unfilled->stage.end = unfilled_end;
unfilled->stage.reset_stipple_counter = unfilled_reset_stipple_counter;
+ unfilled->stage.destroy = unfilled_destroy;
return &unfilled->stage;
}
diff --git a/src/mesa/pipe/draw/draw_validate.c b/src/mesa/pipe/draw/draw_validate.c
index 4e8f986b27..8ce4a926e2 100644
--- a/src/mesa/pipe/draw/draw_validate.c
+++ b/src/mesa/pipe/draw/draw_validate.c
@@ -110,6 +110,10 @@ static void validate_begin( struct draw_stage *stage )
}
+static void validate_destroy( struct draw_stage *stage )
+{
+ FREE( stage );
+}
/**
@@ -127,6 +131,7 @@ struct draw_stage *draw_validate_stage( struct draw_context *draw )
stage->tri = NULL;
stage->end = NULL;
stage->reset_stipple_counter = NULL;
+ stage->destroy = validate_destroy;
return stage;
}
diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/mesa/pipe/draw/draw_vbuf.c
index d00cdec56c..d010aaba07 100644
--- a/src/mesa/pipe/draw/draw_vbuf.c
+++ b/src/mesa/pipe/draw/draw_vbuf.c
@@ -369,6 +369,15 @@ vbuf_reset_stipple_counter( struct draw_stage *stage )
}
+static void vbuf_destroy( struct draw_stage *stage )
+{
+ struct vbuf_stage *vbuf = vbuf_stage( stage );
+
+ FREE( vbuf->indices );
+ FREE( stage );
+}
+
+
/**
* Create a new primitive vbuf/render stage.
*/
@@ -384,12 +393,12 @@ struct draw_stage *draw_vbuf_stage( struct draw_context *draw,
vbuf->stage.tri = vbuf_first_tri;
vbuf->stage.end = vbuf_end;
vbuf->stage.reset_stipple_counter = vbuf_reset_stipple_counter;
+ vbuf->stage.destroy = vbuf_destroy;
vbuf->render = render;
assert(render->max_indices < UNDEFINED_VERTEX_ID);
vbuf->max_indices = render->max_indices;
- /* FIXME: free this memory on takedown */
vbuf->indices = MALLOC( vbuf->max_indices );
vbuf->vertices = NULL;
diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c
index e0759c2e9a..7d983ebd29 100644
--- a/src/mesa/pipe/draw/draw_vertex_fetch.c
+++ b/src/mesa/pipe/draw/draw_vertex_fetch.c
@@ -80,6 +80,7 @@ fetch_attrib4(const void *ptr, enum pipe_format format, float attrib[4])
break;
case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
attrib[0] = (float) ((unsigned char *) ptr)[2] / 255.0f;
attrib[1] = (float) ((unsigned char *) ptr)[1] / 255.0f;
attrib[2] = (float) ((unsigned char *) ptr)[0] / 255.0f;
diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c
index 494a2bc619..a56c9b8893 100644
--- a/src/mesa/pipe/draw/draw_wide_prims.c
+++ b/src/mesa/pipe/draw/draw_wide_prims.c
@@ -315,7 +315,6 @@ static void wide_begin( struct draw_stage *stage )
}
-
static void wide_end( struct draw_stage *stage )
{
stage->next->end( stage->next );
@@ -327,6 +326,14 @@ static void draw_reset_stipple_counter( struct draw_stage *stage )
stage->next->reset_stipple_counter( stage->next );
}
+
+static void wide_destroy( struct draw_stage *stage )
+{
+ draw_free_tmps( stage );
+ FREE( stage );
+}
+
+
struct draw_stage *draw_wide_stage( struct draw_context *draw )
{
struct wide_stage *wide = CALLOC_STRUCT(wide_stage);
@@ -341,6 +348,7 @@ struct draw_stage *draw_wide_stage( struct draw_context *draw )
wide->stage.tri = passthrough_tri;
wide->stage.end = wide_end;
wide->stage.reset_stipple_counter = draw_reset_stipple_counter;
+ wide->stage.destroy = wide_destroy;
return &wide->stage;
}