[Mesa-dev] [PATCH 3/4] llvmpipe: Only advertise unswizzled formats.

jfonseca at vmware.com jfonseca at vmware.com
Wed Nov 28 12:57:53 PST 2012


From: José Fonseca <jfonseca at vmware.com>

Update llvmpipe_is_format_supported and llvmpipe_is_format_unswizzled
so that only the formats that we can render without swizzling are
advertised.

We can still render all D3D10 required formats except
PIPE_FORMAT_R11G11B10_FLOAT, which needs to be implemented in a future
opportunity.

Removal of rendertarget swizzling will be done in a subsequent change.
---
 src/gallium/drivers/llvmpipe/lp_screen.c     |   15 +++++++--------
 src/gallium/drivers/llvmpipe/lp_texture.c    |   23 ++++++-----------------
 src/gallium/drivers/llvmpipe/lp_tile_image.c |    4 ++++
 3 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 74b7b99..f1da6f8 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -315,20 +315,19 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
    if (sample_count > 1)
       return FALSE;
 
-   if (format_desc->format == PIPE_FORMAT_R11G11B10_FLOAT ||
-       format_desc->format == PIPE_FORMAT_R9G9B9E5_FLOAT) 
-     return TRUE;
-
    if (bind & PIPE_BIND_RENDER_TARGET) {
-      if (format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ||
-          format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
+      if (format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB)
          return FALSE;
 
       if (format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
          return FALSE;
+      assert(format_desc->block.width == 1);
+      assert(format_desc->block.height == 1);
+
+      if (format_desc->is_mixed)
+         return FALSE;
 
-      if (format_desc->block.width != 1 ||
-          format_desc->block.height != 1)
+      if (!format_desc->is_array && !format_desc->is_bitmask)
          return FALSE;
    }
 
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index e606123..dcf2665 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -760,29 +760,18 @@ boolean
 llvmpipe_is_format_unswizzled( enum pipe_format format )
 {
    const struct util_format_description *desc = util_format_description(format);
-   unsigned chan;
 
    if (desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||
-       desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB ||
+       (desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
+        desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB) ||
        desc->block.width != 1 ||
-       desc->block.height != 1) {
+       desc->block.height != 1 ||
+       desc->is_mixed ||
+       (!desc->is_array && !desc->is_bitmask)) {
+      assert(0);
       return FALSE;
    }
 
-   for (chan = 0; chan < desc->nr_channels; ++chan) {
-      if (desc->channel[chan].type == UTIL_FORMAT_TYPE_VOID && (chan + 1) == desc->nr_channels)
-         continue;
-
-      if (desc->channel[chan].type != desc->channel[0].type)
-         return FALSE;
-
-      if (desc->channel[chan].normalized != desc->channel[0].normalized)
-         return FALSE;
-
-      if (desc->channel[chan].pure_integer != desc->channel[0].pure_integer)
-         return FALSE;
-   }
-
    return TRUE;
 }
 
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_image.c b/src/gallium/drivers/llvmpipe/lp_tile_image.c
index 4d53cde..d4ce785 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_image.c
+++ b/src/gallium/drivers/llvmpipe/lp_tile_image.c
@@ -195,6 +195,8 @@ lp_tiled_to_linear(const void *src, void *dst,
       const uint bytes_per_tile = tile_w * tile_h * bpp;
       uint i, j;
 
+      assert(0);
+
       for (j = 0; j < height; j += tile_h) {
          for (i = 0; i < width; i += tile_w) {
             uint ii = i + x, jj = j + y;
@@ -284,6 +286,8 @@ lp_linear_to_tiled(const void *src, void *dst,
       const uint bytes_per_tile = tile_w * tile_h * bpp;
       uint i, j;
 
+      assert(0);
+
       for (j = 0; j < height; j += TILE_SIZE) {
          for (i = 0; i < width; i += TILE_SIZE) {
             uint ii = i + x, jj = j + y;
-- 
1.7.9.5



More information about the mesa-dev mailing list