summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/iris/iris_clear.c
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-02-21 22:49:40 -0800
committerKenneth Graunke <[email protected]>2019-03-07 11:39:27 -0800
commit809a81ec3a0b8666ec426a88b86fb133ae5f1bcb (patch)
tree936130b1fc8911cd649e2cec830ea007b0c6acef /src/gallium/drivers/iris/iris_clear.c
parentfbc51c4c956bb681c52e3163f73051303b24d8b8 (diff)
iris: Properly support alpha and luminance-alpha formats
For texturing, we map alpha formats to the corresponding red format, as many alpha formats are outright missing, and red is more efficient when sampling anyway. When rendering to A8_UNORM, we use that format directly, so the image gets the shader output's .a/.w channel, rather than the .r/.x channel. All other A* formats are non-renderable, so we can't do much and just mark them as unsupported for rendering. Fortunately, GL only requires rendering to A8_UNORM, so that works out. According to Andre Heider and Timur Kristóf, this fixes font rendering in Witcher 1 (via nine). Andre also reported that it fixes Unigine Heaven (presumably via nine). v2: Use the same swizzle for both sampler views and "render targets". BLORP expects the read swizzle, and will take the inverse when setting up the destination swizzle (and actually applying it in the shaders). We ignore the format swizzle when setting up normal rendering SURFACE_STATEs, which is necessary because it would be an illegal shader channel select combination. Thanks to Jason Ekstrand for pointing out that BLORP took an inverse swizzle. Tested-by: Timur Kristóf <[email protected]> Tested-by: Andre Heider <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/gallium/drivers/iris/iris_clear.c')
-rw-r--r--src/gallium/drivers/iris/iris_clear.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c
index e71d7f450bd..817087f4966 100644
--- a/src/gallium/drivers/iris/iris_clear.c
+++ b/src/gallium/drivers/iris/iris_clear.c
@@ -42,6 +42,7 @@ clear_color(struct iris_context *ice,
const struct pipe_box *box,
bool render_condition_enabled,
enum isl_format format,
+ struct isl_swizzle swizzle,
union isl_color_value color)
{
struct iris_resource *res = (void *) p_res;
@@ -79,7 +80,7 @@ clear_color(struct iris_context *ice,
isl_format_is_rgbx(format))
format = isl_format_rgbx_to_rgba(format);
- blorp_clear(&blorp_batch, &surf, format, ISL_SWIZZLE_IDENTITY,
+ blorp_clear(&blorp_batch, &surf, format, swizzle,
level, box->z, box->depth, box->x, box->y,
box->x + box->width, box->y + box->height,
color, color_write_disable);
@@ -205,7 +206,8 @@ iris_clear(struct pipe_context *ctx,
};
clear_color(ice, psurf->texture, psurf->u.tex.level, &box,
- true, isurf->view.format, *color);
+ true, isurf->view.format, isurf->view.swizzle,
+ *color);
}
}
}
@@ -270,7 +272,8 @@ iris_clear_texture(struct pipe_context *ctx,
isl_color_value_unpack(&color, format, data);
- clear_color(ice, p_res, level, box, true, format, color);
+ clear_color(ice, p_res, level, box, true, format,
+ ISL_SWIZZLE_IDENTITY, color);
}
}
@@ -303,7 +306,7 @@ iris_clear_render_target(struct pipe_context *ctx,
clear_color(ice, psurf->texture, psurf->u.tex.level, &box,
render_condition_enabled,
- isurf->view.format, *color);
+ isurf->view.format, isurf->view.swizzle, *color);
}
/**