summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/svga
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2010-02-12 21:39:29 +0100
committerRoland Scheidegger <[email protected]>2010-02-12 21:39:29 +0100
commit6602889d82d1402338f5d23e37a9f46db99e86c6 (patch)
treede80ae0d9607b02252043852fe385418e4c5379a /src/gallium/drivers/svga
parentaf1052e2804ee5fbcde3c8f8618feeb2c17b51fd (diff)
parent0087f9dc0690e5de139f89ea4577b1824b918757 (diff)
Merge branch 'gallium-dynamicstencilref'
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r--src/gallium/drivers/svga/svga_context.h3
-rw-r--r--src/gallium/drivers/svga/svga_pipe_depthstencil.c14
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c4
-rw-r--r--src/gallium/drivers/svga/svga_state_rss.c31
4 files changed, 44 insertions, 8 deletions
diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h
index f9a641c6df6..03302e2a6ec 100644
--- a/src/gallium/drivers/svga/svga_context.h
+++ b/src/gallium/drivers/svga/svga_context.h
@@ -116,7 +116,6 @@ struct svga_depth_stencil_state {
/* SVGA3D has one ref/mask/writemask triple shared between front &
* back face stencil. We really need two:
*/
- unsigned stencil_ref:8;
unsigned stencil_mask:8;
unsigned stencil_writemask:8;
@@ -199,6 +198,7 @@ struct svga_state
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_blend_color blend_color;
+ struct pipe_stencil_ref stencil_ref;
struct pipe_clip_state clip;
struct pipe_viewport_state viewport;
@@ -376,6 +376,7 @@ struct svga_context
#define SVGA_NEW_VS_RESULT 0x1000000
#define SVGA_NEW_ZERO_STRIDE 0x2000000
#define SVGA_NEW_TEXTURE_FLAGS 0x4000000
+#define SVGA_NEW_STENCIL_REF 0x8000000
diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
index 12bbd233a58..c317bec6d57 100644
--- a/src/gallium/drivers/svga/svga_pipe_depthstencil.c
+++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c
@@ -89,7 +89,6 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
/* SVGA3D has one ref/mask/writemask triple shared between front &
* back face stencil. We really need two:
*/
- ds->stencil_ref = templ->stencil[0].ref_value & 0xff;
ds->stencil_mask = templ->stencil[0].valuemask & 0xff;
ds->stencil_writemask = templ->stencil[0].writemask & 0xff;
}
@@ -102,7 +101,6 @@ svga_create_depth_stencil_state(struct pipe_context *pipe,
ds->stencil[1].zfail = svga_translate_stencil_op(templ->stencil[1].zfail_op);
ds->stencil[1].pass = svga_translate_stencil_op(templ->stencil[1].zpass_op);
- ds->stencil_ref = templ->stencil[1].ref_value & 0xff;
ds->stencil_mask = templ->stencil[1].valuemask & 0xff;
ds->stencil_writemask = templ->stencil[1].writemask & 0xff;
}
@@ -139,12 +137,24 @@ static void svga_delete_depth_stencil_state(struct pipe_context *pipe,
}
+static void svga_set_stencil_ref( struct pipe_context *pipe,
+ const struct pipe_stencil_ref *stencil_ref )
+{
+ struct svga_context *svga = svga_context(pipe);
+
+ svga->curr.stencil_ref = *stencil_ref;
+
+ svga->dirty |= SVGA_NEW_STENCIL_REF;
+}
+
void svga_init_depth_stencil_functions( struct svga_context *svga )
{
svga->pipe.create_depth_stencil_alpha_state = svga_create_depth_stencil_state;
svga->pipe.bind_depth_stencil_alpha_state = svga_bind_depth_stencil_state;
svga->pipe.delete_depth_stencil_alpha_state = svga_delete_depth_stencil_state;
+
+ svga->pipe.set_stencil_ref = svga_set_stencil_ref;
}
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index b70081343d1..2a9adfbb067 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -102,8 +102,8 @@ svga_create_sampler_state(struct pipe_context *pipe,
cso->mipfilter = translate_mip_filter(sampler->min_mip_filter);
cso->magfilter = translate_img_filter( sampler->mag_img_filter );
cso->minfilter = translate_img_filter( sampler->min_img_filter );
- cso->aniso_level = MAX2( (unsigned) sampler->max_anisotropy, 1 );
- if(cso->aniso_level != 1)
+ cso->aniso_level = MAX2( sampler->max_anisotropy, 1 );
+ if(sampler->max_anisotropy)
cso->magfilter = cso->minfilter = SVGA3D_TEX_FILTER_ANISOTROPIC;
cso->lod_bias = sampler->lod_bias;
cso->addressu = translate_wrap_mode(sampler->wrap_s);
diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c
index 5ce9b4ef4f9..68828c252f4 100644
--- a/src/gallium/drivers/svga/svga_state_rss.c
+++ b/src/gallium/drivers/svga/svga_state_rss.c
@@ -26,6 +26,9 @@
#include "util/u_inlines.h"
#include "pipe/p_defines.h"
#include "util/u_math.h"
+#if 0
+#include "util/u_pack_color.h"
+#endif
#include "svga_context.h"
#include "svga_state.h"
@@ -100,6 +103,23 @@ static int emit_rss( struct svga_context *svga,
}
}
+#if 0
+ /* FIXME: shouldn't we emit blend color here */
+ if (dirty & SVGA_NEW_BLEND_COLOR) {
+ union util_color uc;
+ ubyte r = float_to_ubyte(svga->curr.blend_color.color[0]);
+ ubyte g = float_to_ubyte(svga->curr.blend_color.color[1]);
+ ubyte b = float_to_ubyte(svga->curr.blend_color.color[2]);
+ ubyte a = float_to_ubyte(svga->curr.blend_color.color[3]);
+
+ util_pack_color_ub( r, g, b, a,
+ PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+
+ EMIT_RS( svga, uc.ui, BLENDCOLOR, fail );
+ }
+#endif
+
+
if (dirty & (SVGA_NEW_DEPTH_STENCIL | SVGA_NEW_RAST)) {
const struct svga_depth_stencil_state *curr = svga->curr.depth;
@@ -123,8 +143,7 @@ static int emit_rss( struct svga_context *svga,
EMIT_RS( svga, curr->stencil[0].fail, STENCILFAIL, fail );
EMIT_RS( svga, curr->stencil[0].zfail, STENCILZFAIL, fail );
EMIT_RS( svga, curr->stencil[0].pass, STENCILPASS, fail );
-
- EMIT_RS( svga, curr->stencil_ref, STENCILREF, fail );
+
EMIT_RS( svga, curr->stencil_mask, STENCILMASK, fail );
EMIT_RS( svga, curr->stencil_writemask, STENCILWRITEMASK, fail );
}
@@ -160,7 +179,6 @@ static int emit_rss( struct svga_context *svga,
EMIT_RS( svga, curr->stencil[ccw].zfail, CCWSTENCILZFAIL, fail );
EMIT_RS( svga, curr->stencil[ccw].pass, CCWSTENCILPASS, fail );
- EMIT_RS( svga, curr->stencil_ref, STENCILREF, fail );
EMIT_RS( svga, curr->stencil_mask, STENCILMASK, fail );
EMIT_RS( svga, curr->stencil_writemask, STENCILWRITEMASK, fail );
}
@@ -178,6 +196,9 @@ static int emit_rss( struct svga_context *svga,
}
}
+ if (dirty & SVGA_NEW_STENCIL_REF) {
+ EMIT_RS( svga, svga->curr.stencil_ref.ref_value[0], STENCILREF, fail );
+ }
if (dirty & SVGA_NEW_RAST)
{
@@ -257,7 +278,11 @@ struct svga_tracked_state svga_hw_rss =
"hw rss state",
(SVGA_NEW_BLEND |
+#if 0
+ SVGA_NEW_BLEND_COLOR |
+#endif
SVGA_NEW_DEPTH_STENCIL |
+ SVGA_NEW_STENCIL_REF |
SVGA_NEW_RAST |
SVGA_NEW_FRAME_BUFFER |
SVGA_NEW_NEED_PIPELINE),