From a427c200801d8f0b3b15f3238e0767504d5bc4c0 Mon Sep 17 00:00:00 2001 From: Kevin Strasser Date: Thu, 24 Jan 2019 17:10:02 -0800 Subject: dri: Add fp16 formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add dri formats for RGBA ordered 64 bpp IEEE 754 half precision floating point. Leverage existing offscreen render support for MESA_FORMAT_RGBA_FLOAT16 and MESA_FORMAT_RGBX_FLOAT16. Signed-off-by: Kevin Strasser Reviewed-by: Adam Jackson Reviewed-by: Marek Olšák Reviewed-by: Emil Velikov --- src/mesa/drivers/dri/common/dri_util.c | 8 ++++++++ src/mesa/drivers/dri/common/utils.c | 14 ++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index ac3a04bceff..a384cadd557 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -886,6 +886,14 @@ static const struct { .image_format = __DRI_IMAGE_FORMAT_XRGB8888, .mesa_format = MESA_FORMAT_B8G8R8X8_UNORM, }, + { + .image_format = __DRI_IMAGE_FORMAT_ABGR16161616F, + .mesa_format = MESA_FORMAT_RGBA_FLOAT16, + }, + { + .image_format = __DRI_IMAGE_FORMAT_XBGR16161616F, + .mesa_format = MESA_FORMAT_RGBX_FLOAT16, + }, { .image_format = __DRI_IMAGE_FORMAT_ARGB2101010, .mesa_format = MESA_FORMAT_B10G10R10A2_UNORM, diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 86ccfd637be..44e4e0f3720 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -212,6 +212,12 @@ driCreateConfigs(mesa_format format, /* MESA_FORMAT_R10G10B10A2_UNORM */ {{ 0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000 }, { 0, 10, 20, 30 }}, + /* MESA_FORMAT_RGBX_FLOAT16 */ + {{ 0, 0, 0, 0}, + { 0, 16, 32, -1 }}, + /* MESA_FORMAT_RGBA_FLOAT16 */ + {{ 0, 0, 0, 0}, + { 0, 16, 32, 48 }}, }; const uint32_t * masks; @@ -260,6 +266,14 @@ driCreateConfigs(mesa_format format, masks = format_table[4].masks; shifts = format_table[4].shifts; break; + case MESA_FORMAT_RGBX_FLOAT16: + masks = format_table[9].masks; + shifts = format_table[9].shifts; + break; + case MESA_FORMAT_RGBA_FLOAT16: + masks = format_table[10].masks; + shifts = format_table[10].shifts; + break; case MESA_FORMAT_R10G10B10X2_UNORM: masks = format_table[7].masks; shifts = format_table[7].shifts; -- cgit v1.2.3