From 63386b2f66a6d450889cd5368bc599beb7f1efbf Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 8 Jul 2013 23:45:55 -0400 Subject: util: treat denorm'ed floats like zero The D3D10 spec is very explicit about treatment of denorm floats and the behavior is exactly the same for them as it would be for -0 or +0. This makes our shading code match that behavior, since OpenGL doesn't care and on a few cpu's it's faster (worst case the same). Float16 conversions will likely break but we'll fix them in a follow up commit. Signed-off-by: Zack Rusin Reviewed-by: Jose Fonseca Reviewed-by: Roland Scheidegger --- src/gallium/auxiliary/draw/draw_pt.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gallium/auxiliary/draw/draw_pt.c') diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index d2fe0025bfc..ccde371ffcd 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -459,8 +459,14 @@ draw_vbo(struct draw_context *draw, unsigned instance; unsigned index_limit; unsigned count; + unsigned fpstate = util_fpstate_get(); struct pipe_draw_info resolved_info; + /* Make sure that denorms are treated like zeros. This is + * the behavior required by D3D10. OpenGL doesn't care. + */ + util_fpstate_set_denorms_to_zero(fpstate); + resolve_draw_info(info, &resolved_info); info = &resolved_info; @@ -518,6 +524,7 @@ draw_vbo(struct draw_context *draw, if (index_limit == 0) { /* one of the buffers is too small to do any valid drawing */ debug_warning("draw: VBO too small to draw anything\n"); + util_fpstate_set(fpstate); return; } } @@ -558,4 +565,5 @@ draw_vbo(struct draw_context *draw, if (draw->collect_statistics) { draw->render->pipeline_statistics(draw->render, &draw->statistics); } + util_fpstate_set(fpstate); } -- cgit v1.2.3