aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorRafael Antognolli <[email protected]>2019-03-27 10:27:18 -0700
committerRafael Antognolli <[email protected]>2019-04-02 15:26:38 -0700
commitc26d8a887d003d70518035e3db1ff3de260e8434 (patch)
tree10cd385acc92b6ee74ebf0508b6e3e94aa19e655 /src/gallium
parent26606672847501b93a4b070165fc23d2d845810a (diff)
iris: Manually apply fast clear color channel overrides.
At the fast clear time, the only swizzle we have available is actually the identity swizzle (which we use for most rendering). So the call to swizzle_color_value() becomes simply a no-op, and doesn't properly zero out the unused channels. We have to manually override those channels. Fixes: a8b5ea8ef015ed4a "iris: Add function to update clear color in surface state." Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/iris/iris_clear.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index 9634b4ee3d1..3a617bb7e21 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -121,8 +121,7 @@ can_fast_clear_color(struct iris_context *ice,
static union isl_color_value
convert_fast_clear_color(struct iris_context *ice,
struct iris_resource *res,
- const union isl_color_value color,
- struct isl_swizzle swizzle)
+ const union isl_color_value color)
{
union isl_color_value override_color = color;
struct pipe_resource *p_res = (void *) res;
@@ -132,7 +131,19 @@ convert_fast_clear_color(struct iris_context *ice,
util_format_description(format);
unsigned colormask = util_format_colormask(desc);
- override_color = swizzle_color_value(color, swizzle);
+ if (util_format_is_intensity(format) ||
+ util_format_is_luminance(format) ||
+ util_format_is_luminance_alpha(format)) {
+ override_color.u32[1] = override_color.u32[0];
+ override_color.u32[2] = override_color.u32[0];
+ if (util_format_is_intensity(format))
+ override_color.u32[3] = override_color.u32[0];
+ } else {
+ for (int chan = 0; chan < 3; chan++) {
+ if (!(colormask & (1 << chan)))
+ override_color.u32[chan] = 0;
+ }
+ }
if (util_format_is_unorm(format)) {
for (int i = 0; i < 4; i++)
@@ -191,7 +202,6 @@ fast_clear_color(struct iris_context *ice,
const struct pipe_box *box,
enum isl_format format,
union isl_color_value color,
- struct isl_swizzle swizzle,
enum blorp_batch_flags blorp_flags)
{
struct iris_batch *batch = &ice->batches[IRIS_BATCH_RENDER];
@@ -199,7 +209,7 @@ fast_clear_color(struct iris_context *ice,
const enum isl_aux_state aux_state =
iris_resource_get_aux_state(res, level, box->z);
- color = convert_fast_clear_color(ice, res, color, swizzle);
+ color = convert_fast_clear_color(ice, res, color);
bool color_changed = !!memcmp(&res->aux.clear_color, &color,
sizeof(color));
@@ -300,7 +310,7 @@ clear_color(struct iris_context *ice,
res->surf.format, format, color);
if (can_fast_clear) {
fast_clear_color(ice, res, level, box, format, color,
- swizzle, blorp_flags);
+ blorp_flags);
return;
}