summaryrefslogtreecommitdiff
path: root/src/intel/isl/isl_format.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2017-01-21 09:24:26 -0800
committerJason Ekstrand <jason.ekstrand@intel.com>2018-05-09 11:16:33 -0700
commit08cd834996377634cab8c49c50ad2dc66600fa45 (patch)
tree4c4e4736606454ea564bb17fc70b2b884f044ea1 /src/intel/isl/isl_format.c
parent804856fa5735164cc0733ad0ea62adad39b00ae2 (diff)
intel/isl: Add some helpers for working with RGBX formats
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Diffstat (limited to 'src/intel/isl/isl_format.c')
-rw-r--r--src/intel/isl/isl_format.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index a5bbdbceb1a..6de681d5081 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -774,3 +774,35 @@ isl_format_rgb_to_rgbx(enum isl_format rgb)
return ISL_FORMAT_UNSUPPORTED;
}
}
+
+enum isl_format
+isl_format_rgbx_to_rgba(enum isl_format rgbx)
+{
+ assert(isl_format_is_rgbx(rgbx));
+
+ switch (rgbx) {
+ case ISL_FORMAT_R32G32B32X32_FLOAT:
+ return ISL_FORMAT_R32G32B32A32_FLOAT;
+ case ISL_FORMAT_R16G16B16X16_UNORM:
+ return ISL_FORMAT_R16G16B16A16_UNORM;
+ case ISL_FORMAT_R16G16B16X16_FLOAT:
+ return ISL_FORMAT_R16G16B16A16_FLOAT;
+ case ISL_FORMAT_B8G8R8X8_UNORM:
+ return ISL_FORMAT_B8G8R8A8_UNORM;
+ case ISL_FORMAT_B8G8R8X8_UNORM_SRGB:
+ return ISL_FORMAT_B8G8R8A8_UNORM_SRGB;
+ case ISL_FORMAT_R8G8B8X8_UNORM:
+ return ISL_FORMAT_R8G8B8A8_UNORM;
+ case ISL_FORMAT_R8G8B8X8_UNORM_SRGB:
+ return ISL_FORMAT_R8G8B8A8_UNORM_SRGB;
+ case ISL_FORMAT_B10G10R10X2_UNORM:
+ return ISL_FORMAT_B10G10R10A2_UNORM;
+ case ISL_FORMAT_B5G5R5X1_UNORM:
+ return ISL_FORMAT_B5G5R5A1_UNORM;
+ case ISL_FORMAT_B5G5R5X1_UNORM_SRGB:
+ return ISL_FORMAT_B5G5R5A1_UNORM_SRGB;
+ default:
+ assert(!"Invalid RGBX format");
+ return rgbx;
+ }
+}