summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c5
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h15
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c95
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h3
6 files changed, 41 insertions, 79 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index ce6896d16e..d8dc24e451 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -255,9 +255,8 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
struct lp_rasterizer *rast = task->rast;
- const struct lp_rast_clearzs *clearzs = arg.clear_zstencil;
- unsigned clear_value = clearzs->clearzs_value;
- unsigned clear_mask = clearzs->clearzs_mask;
+ unsigned clear_value = arg.clear_zstencil.value;
+ unsigned clear_mask = arg.clear_zstencil.mask;
const unsigned height = TILE_SIZE / TILE_VECTOR_HEIGHT;
const unsigned width = TILE_SIZE * TILE_VECTOR_HEIGHT;
const unsigned block_size = rast->zsbuf.blocksize;
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index 9d3deb4e88..d6e53f31aa 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -88,10 +88,6 @@ struct lp_rast_shader_inputs {
const struct lp_rast_state *state;
};
-struct lp_rast_clearzs {
- unsigned clearzs_value;
- unsigned clearzs_mask;
-};
struct lp_rast_plane {
/* one-pixel sized trivial accept offsets for each plane */
@@ -151,7 +147,10 @@ union lp_rast_cmd_arg {
} triangle;
const struct lp_rast_state *set_state;
uint8_t clear_color[4];
- const struct lp_rast_clearzs *clear_zstencil;
+ struct {
+ unsigned value;
+ unsigned mask;
+ } clear_zstencil;
struct lp_fence *fence;
struct llvmpipe_query *query_obj;
};
@@ -195,13 +194,15 @@ lp_rast_arg_fence( struct lp_fence *fence )
static INLINE union lp_rast_cmd_arg
-lp_rast_arg_clearzs( const struct lp_rast_clearzs *clearzs )
+lp_rast_arg_clearzs( unsigned value, unsigned mask )
{
union lp_rast_cmd_arg arg;
- arg.clear_zstencil = clearzs;
+ arg.clear_zstencil.value = value;
+ arg.clear_zstencil.mask = mask;
return arg;
}
+
static INLINE union lp_rast_cmd_arg
lp_rast_arg_null( void )
{
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 15a09b7100..51389c2312 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -206,7 +206,6 @@ lp_scene_reset(struct lp_scene *scene )
scene->scene_size = 0;
- scene->has_color_clear = FALSE;
scene->has_depthstencil_clear = FALSE;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h
index fa1b311fa1..e933a84b90 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.h
+++ b/src/gallium/drivers/llvmpipe/lp_scene.h
@@ -125,7 +125,6 @@ struct lp_scene {
*/
unsigned scene_size;
- boolean has_color_clear;
boolean has_depthstencil_clear;
/**
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index ae6d678502..3bef620961 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -135,8 +135,7 @@ static void reset_context( struct lp_setup_context *setup )
/* Reset some state:
*/
- setup->clear.flags = 0;
- setup->clear.clearzs.clearzs_mask = 0;
+ memset(&setup->clear, 0, sizeof setup->clear);
/* Have an explicit "start-binning" call and get rid of this
* pointer twiddling?
@@ -195,7 +194,6 @@ begin_binning( struct lp_setup_context *setup )
lp_scene_bin_everywhere( scene,
lp_rast_clear_color,
setup->clear.color );
- scene->has_color_clear = TRUE;
}
}
@@ -205,7 +203,9 @@ begin_binning( struct lp_setup_context *setup )
scene->has_depthstencil_clear = TRUE;
lp_scene_bin_everywhere( scene,
lp_rast_clear_zstencil,
- lp_rast_arg_clearzs(&setup->clear.clearzs) );
+ lp_rast_arg_clearzs(
+ setup->clear.zsmask,
+ setup->clear.zsvalue));
}
}
@@ -341,67 +341,26 @@ lp_setup_clear( struct lp_setup_context *setup,
unsigned flags )
{
struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ uint32_t zsmask = 0;
+ uint32_t zsvalue = 0;
+ uint8_t clear_color[4];
unsigned i;
- boolean full_zs_clear = TRUE;
- uint32_t mask = 0;
LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state);
-
if (flags & PIPE_CLEAR_COLOR) {
- for (i = 0; i < 4; ++i)
- setup->clear.color.clear_color[i] = float_to_ubyte(color[i]);
+ for (i = 0; i < 4; i++)
+ clear_color[i] = float_to_ubyte(color[i]);
}
if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
- if (setup->fb.zsbuf &&
- ((flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) &&
- util_format_is_depth_and_stencil(setup->fb.zsbuf->format))
- full_zs_clear = FALSE;
-
- if (full_zs_clear) {
- setup->clear.clearzs.clearzs_value =
- util_pack_z_stencil(setup->fb.zsbuf->format,
- depth,
- stencil);
- setup->clear.clearzs.clearzs_mask = 0xffffffff;
- }
- else {
- /* hmm */
- uint32_t tmpval;
- if (flags & PIPE_CLEAR_DEPTH) {
- tmpval = util_pack_z(setup->fb.zsbuf->format,
- depth);
- switch (setup->fb.zsbuf->format) {
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- mask = 0xffffff;
- break;
- case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
- mask = 0xffffff00;
- break;
- default:
- assert(0);
- }
- }
- else {
- switch (setup->fb.zsbuf->format) {
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- mask = 0xff000000;
- tmpval = stencil << 24;
- break;
- case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
- mask = 0xff;
- tmpval = stencil;
- break;
- default:
- assert(0);
- tmpval = 0;
- }
- }
- setup->clear.clearzs.clearzs_mask |= mask;
- setup->clear.clearzs.clearzs_value =
- (setup->clear.clearzs.clearzs_value & ~mask) | (tmpval & mask);
- }
+ zsvalue = util_pack_z_stencil(setup->fb.zsbuf->format,
+ depth,
+ stencil);
+
+ zsmask = util_pack_uint_z_stencil(setup->fb.zsbuf->format,
+ 0xffffffff,
+ 0xff);
}
if (setup->state == SETUP_ACTIVE) {
@@ -415,21 +374,13 @@ lp_setup_clear( struct lp_setup_context *setup,
lp_scene_bin_everywhere( scene,
lp_rast_clear_color,
setup->clear.color );
- scene->has_color_clear = TRUE;
}
if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
- if (full_zs_clear)
- scene->has_depthstencil_clear = TRUE;
- else
- setup->clear.clearzs.clearzs_mask = mask;
lp_scene_bin_everywhere( scene,
lp_rast_clear_zstencil,
- lp_rast_arg_clearzs(&setup->clear.clearzs) );
-
-
+ lp_rast_arg_clearzs(zsmask, zsvalue) );
}
-
}
else {
/* Put ourselves into the 'pre-clear' state, specifically to try
@@ -440,6 +391,18 @@ lp_setup_clear( struct lp_setup_context *setup,
set_scene_state( setup, SETUP_CLEARED );
setup->clear.flags |= flags;
+
+ if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
+ setup->clear.zsmask |= zsmask;
+ setup->clear.zsvalue =
+ (setup->clear.zsvalue & ~zsmask) | (zsvalue & zsmask);
+ }
+
+ if (flags & PIPE_CLEAR_COLOR) {
+ memcpy(setup->clear.color.clear_color,
+ clear_color,
+ sizeof clear_color);
+ }
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 91b5d4d79f..fa4e5e9118 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -108,7 +108,8 @@ struct lp_setup_context
struct {
unsigned flags;
union lp_rast_cmd_arg color; /**< lp_rast_clear_color() cmd */
- struct lp_rast_clearzs clearzs; /**< lp_rast_clear_zstencil() cmd */
+ unsigned zsmask;
+ unsigned zsvalue; /**< lp_rast_clear_zstencil() cmd */
} clear;
enum setup_state {