Mesa (floating): llvmpipe: respect fragment clamping and turn on ARB_color_buffer_float
Luca Barbieri
lb at kemper.freedesktop.org
Fri Aug 27 12:49:17 UTC 2010
Module: Mesa
Branch: floating
Commit: 31924658717b5981a63f2555fb9f320322f7dd89
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31924658717b5981a63f2555fb9f320322f7dd89
Author: Luca Barbieri <luca at luca-barbieri.com>
Date: Fri Aug 27 01:28:09 2010 +0200
llvmpipe: respect fragment clamping and turn on ARB_color_buffer_float
---
src/gallium/drivers/llvmpipe/lp_screen.c | 2 +-
src/gallium/drivers/llvmpipe/lp_state_fs.c | 9 +++++++++
src/gallium/drivers/llvmpipe/lp_state_fs.h | 1 +
3 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 075e1a0..35a5985 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -175,7 +175,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 0;
case PIPE_CAP_UNCLAMPED_FRAGMENT_COLOR:
case PIPE_CAP_UNCLAMPED_VERTEX_COLOR:
- return 0;
+ return 1;
default:
assert(0);
return 0;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index a1cd030..b2f9f72 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -331,6 +331,13 @@ generate_fs(struct llvmpipe_context *lp,
lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
+ if(key->clamp_fragment_color)
+ {
+ struct lp_build_context bld;
+ lp_build_context_init(&bld, builder, type);
+ out = lp_build_clamp(&bld, out, bld.zero, bld.one);
+ }
+
/* Alpha test */
/* XXX: should the alpha reference value be passed separately? */
/* XXX: should only test the final assignment to alpha */
@@ -1077,6 +1084,8 @@ make_variant_key(struct llvmpipe_context *lp,
key->alpha.func = lp->depth_stencil->alpha.func;
/* alpha.ref_value is passed in jit_context */
+ key->clamp_fragment_color = lp->rasterizer->clamp_fragment_color;
+
key->flatshade = lp->rasterizer->flatshade;
if (lp->active_query_count) {
key->occlusion_count = TRUE;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h
index 036d0d0..15d3f17 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.h
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h
@@ -52,6 +52,7 @@ struct lp_fragment_shader_variant_key
struct pipe_alpha_state alpha;
struct pipe_blend_state blend;
enum pipe_format zsbuf_format;
+ unsigned clamp_fragment_color:1;
unsigned nr_cbufs:8;
unsigned nr_samplers:8; /* actually derivable from just the shader */
unsigned flatshade:1;
More information about the mesa-commit
mailing list