summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-08-27 01:28:09 +0200
committerLuca Barbieri <luca@luca-barbieri.com>2010-09-05 18:11:55 +0200
commitf7138a0876a19ae1912f99df37acc04cfe7a5f3e (patch)
tree362ecde1332d2a3e4c71a2533cd03f2ccafbdd83
parentcc29ca927d471155f2b7b32dc2dea5cc647fc3ec (diff)
llvmpipe: respect fragment clamping and turn on ARB_color_buffer_float
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c9
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.h1
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 675e59760e..7441c8e00d 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -182,7 +182,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 701eed589a..f7d6b6ac8b 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 */
@@ -1093,6 +1100,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 48c63473c6..45a8afae29 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;
+ unsigned clamp_fragment_color:1;
unsigned nr_cbufs:8;
unsigned nr_samplers:8; /* actually derivable from just the shader */
unsigned flatshade:1;