summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorChristoph Bumiller <[email protected]>2011-09-24 13:22:29 +0200
committerChristoph Bumiller <[email protected]>2011-09-28 16:28:17 +0200
commit16f8308c3df020a786908be065d3dcb90c8ca2a5 (patch)
tree92795591dce6eed395d80a1bbb4041952e78375a /src/gallium/auxiliary
parentf83af361a4e44ee89c63e769501ed93caa22e30f (diff)
gallium: add polygon offset clamp state
This is required for D3D1x and supported by hardware.
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_offset.c6
-rw-r--r--src/gallium/auxiliary/util/u_dump_state.c1
2 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/draw/draw_pipe_offset.c b/src/gallium/auxiliary/draw/draw_pipe_offset.c
index 8afbbfa1569..3da52b10624 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_offset.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_offset.c
@@ -43,6 +43,7 @@ struct offset_stage {
float scale;
float units;
+ float clamp;
};
@@ -90,6 +91,10 @@ static void do_offset_tri( struct draw_stage *stage,
float zoffset = offset->units + MAX2(dzdx, dzdy) * offset->scale;
+ if (offset->clamp)
+ zoffset = (offset->clamp < 0.0f) ? MAX2(zoffset, offset->clamp) :
+ MIN2(zoffset, offset->clamp);
+
/*
* Note: we're applying the offset and clamping per-vertex.
* Ideally, the offset is applied per-fragment prior to fragment shading.
@@ -125,6 +130,7 @@ static void offset_first_tri( struct draw_stage *stage,
offset->units = (float) (stage->draw->rasterizer->offset_units * stage->draw->mrd);
offset->scale = stage->draw->rasterizer->offset_scale;
+ offset->clamp = stage->draw->rasterizer->offset_clamp;
stage->tri = offset_tri;
stage->tri( stage, header );
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 6bb36996632..8a7ec584846 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -332,6 +332,7 @@ util_dump_rasterizer_state(struct os_stream *stream, const struct pipe_rasterize
util_dump_member(stream, float, state, point_size);
util_dump_member(stream, float, state, offset_units);
util_dump_member(stream, float, state, offset_scale);
+ util_dump_member(stream, float, state, offset_clamp);
util_dump_struct_end(stream);
}