summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/draw
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-12-10 18:11:31 -0700
committerBrian Paul <brian.paul@tungstengraphics.com>2008-12-10 18:11:31 -0700
commit0c31661e73dd2979df22a275452efc71c7064f81 (patch)
tree8f6347c716219b513c56d827d88f461fa62da0a6 /src/gallium/auxiliary/draw
parentb716de47798defa7d22b0f15b201af6fba27f0b9 (diff)
parentd0bc5293d6e1e9c34fa822b7c2928932ed22462c (diff)
Merge commit 'origin/gallium-0.1' into gallium-0.2
Diffstat (limited to 'src/gallium/auxiliary/draw')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.c16
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h5
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_offset.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h2
4 files changed, 20 insertions, 6 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c
index b2a34811c2..7bd4a2e221 100644
--- a/src/gallium/auxiliary/draw/draw_context.c
+++ b/src/gallium/auxiliary/draw/draw_context.c
@@ -103,6 +103,18 @@ void draw_flush( struct draw_context *draw )
}
+/**
+ * Specify the Minimum Resolvable Depth factor for polygon offset.
+ * This factor potentially depends on the number of Z buffer bits,
+ * the rasterization algorithm and the arithmetic performed on Z
+ * values between vertex shading and rasterization. It will vary
+ * from one driver to another.
+ */
+void draw_set_mrd(struct draw_context *draw, double mrd)
+{
+ draw->mrd = mrd;
+}
+
/**
* Register new primitive rasterization/rendering state.
@@ -377,7 +389,7 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw,
unsigned eltSize,
unsigned min_index,
unsigned max_index,
- void *elements )
+ const void *elements )
{
draw->pt.user.elts = elements;
draw->pt.user.eltSize = eltSize;
@@ -389,7 +401,7 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw,
void
draw_set_mapped_element_buffer( struct draw_context *draw,
unsigned eltSize,
- void *elements )
+ const void *elements )
{
draw->pt.user.elts = elements;
draw->pt.user.eltSize = eltSize;
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 8f5cecf438..d529e4e9a2 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -72,6 +72,7 @@ void draw_enable_line_stipple(struct draw_context *draw, boolean enable);
void draw_enable_point_sprites(struct draw_context *draw, boolean enable);
+void draw_set_mrd(struct draw_context *draw, double mrd);
boolean
draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe);
@@ -129,11 +130,11 @@ draw_set_mapped_element_buffer_range( struct draw_context *draw,
unsigned eltSize,
unsigned min_index,
unsigned max_index,
- void *elements );
+ const void *elements );
void draw_set_mapped_element_buffer( struct draw_context *draw,
unsigned eltSize,
- void *elements );
+ const void *elements );
void draw_set_mapped_vertex_buffer(struct draw_context *draw,
unsigned attr, const void *buffer);
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index 1fea5e6dcb..8ddc4ee617 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -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 = stage->draw->rasterizer->offset_units * stage->draw->mrd;
offset->scale = stage->draw->rasterizer->offset_scale;
stage->tri = offset_tri;
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 6097fff2c6..81e4eae401 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -172,6 +172,8 @@ struct draw_context
boolean force_passthrough; /**< never clip or shade */
+ double mrd; /**< minimum resolvable depth value, for polygon offset */
+
/* pipe state that we need: */
const struct pipe_rasterizer_state *rasterizer;
struct pipe_viewport_state viewport;