In order to handle pixel formats that consist of floating point data, enable
floatMode field in the dri config, and set __DRI_ATTRIB_FLOAT_BIT in the
render type attribute.

Signed-off-by: Kevin Strasser <kevin.stras...@intel.com>
---
 src/mesa/drivers/dri/common/utils.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/common/utils.c 
b/src/mesa/drivers/dri/common/utils.c
index 1fdc160..a57033b 100644
--- a/src/mesa/drivers/dri/common/utils.c
+++ b/src/mesa/drivers/dri/common/utils.c
@@ -237,6 +237,7 @@ driCreateConfigs(mesa_format format,
    int blue_bits;
    int alpha_bits;
    bool is_srgb;
+   bool is_float;
 
    switch (format) {
    case MESA_FORMAT_B5G6R5_UNORM:
@@ -290,6 +291,7 @@ driCreateConfigs(mesa_format format,
    blue_bits = _mesa_get_format_bits(format, GL_BLUE_BITS);
    alpha_bits = _mesa_get_format_bits(format, GL_ALPHA_BITS);
    is_srgb = _mesa_get_format_color_encoding(format) == GL_SRGB;
+   is_float = _mesa_get_format_datatype(format) == GL_FLOAT;
 
    num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * 
num_msaa_modes;
    configs = calloc(num_modes + 1, sizeof *configs);
@@ -319,6 +321,7 @@ driCreateConfigs(mesa_format format,
                    c++;
 
                    memset(modes, 0, sizeof *modes);
+                   modes->floatMode = is_float;
                    modes->redBits   = red_bits;
                    modes->greenBits = green_bits;
                    modes->blueBits  = blue_bits;
@@ -492,6 +495,8 @@ driGetConfigAttribIndex(const __DRIconfig *config,
     case __DRI_ATTRIB_RENDER_TYPE:
         /* no support for color index mode */
        *value = __DRI_ATTRIB_RGBA_BIT;
+        if (config->modes.floatMode)
+            *value |= __DRI_ATTRIB_FLOAT_BIT;
        break;
     case __DRI_ATTRIB_CONFIG_CAVEAT:
        if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG)
-- 
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to