summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorNeil Roberts <[email protected]>2015-11-19 16:25:21 +0100
committerNeil Roberts <[email protected]>2016-01-13 12:16:31 +0000
commitcda886a4851ab767fba40e8474d6fa8190347e4f (patch)
treea321f428c9635293e8ef9a2e751dad26a07bf9f8 /src/mesa/drivers
parent4ea0febcb005d6447a6ae4d19ca1de8de44f3da9 (diff)
i965/gen9: Don't allow the RGBX formats for texturing/rendering
The RGBX surface formats aren't renderable so we internally remap them to RGBA when rendering. They are retained as RGBX when used as textures. However since the previous patch fast clears are disabled for surfaces that use a different format for rendering than for texturing. To avoid this situation we can just pretend not to support RGBX formats at all. This will cause the upper layers of mesa to pick an RGBA format internally instead. This should be safe because we always override the alpha component to 1.0 for RGBX in the texture swizzle anyway. We could also do this for all gens except that it's a bit more difficult when the hardware doesn't support texture swizzling. Gens using the blorp have further problems because that doesn't implement this swizzle override. Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_surface_formats.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
index 7bc8b8bd377..b5c1a3531c2 100644
--- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
+++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
@@ -736,6 +736,34 @@ brw_init_surface_formats(struct brw_context *brw)
if (brw->gen >= 8)
ctx->TextureFormatSupported[MESA_FORMAT_Z_UNORM16] = true;
+ /* The RGBX formats are not renderable. Normally these get mapped
+ * internally to RGBA formats when rendering. However on Gen9+ when this
+ * internal override is used fast clears don't work so they are disabled in
+ * brw_meta_fast_clear. To avoid this problem we can just pretend not to
+ * support RGBX formats at all. This will cause the upper layers of Mesa to
+ * pick the RGBA formats instead. This works fine because when it is used
+ * as a texture source the swizzle state is programmed to force the alpha
+ * channel to 1.0 anyway. We could also do this for all gens except that
+ * it's a bit more difficult when the hardware doesn't support texture
+ * swizzling. Gens using the blorp have further problems because that
+ * doesn't implement this swizzle override. We don't need to do this for
+ * BGRX because that actually is supported natively on Gen8+.
+ */
+ if (brw->gen >= 9) {
+ static const mesa_format rgbx_formats[] = {
+ MESA_FORMAT_R8G8B8X8_UNORM,
+ MESA_FORMAT_R8G8B8X8_SRGB,
+ MESA_FORMAT_RGBX_UNORM16,
+ MESA_FORMAT_RGBX_FLOAT16,
+ MESA_FORMAT_RGBX_FLOAT32
+ };
+
+ for (int i = 0; i < ARRAY_SIZE(rgbx_formats); i++) {
+ ctx->TextureFormatSupported[rgbx_formats[i]] = false;
+ brw->format_supported_as_render_target[rgbx_formats[i]] = false;
+ }
+ }
+
/* On hardware that lacks support for ETC1, we map ETC1 to RGBX
* during glCompressedTexImage2D(). See intel_mipmap_tree::wraps_etc1.
*/