aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2019-04-12 09:52:31 +0200
committerGert Wollny <[email protected]>2019-06-20 08:50:38 +0200
commit28dc096e15fcf072a70a434297b2e00882a6136d (patch)
treecab42d15636ec64e3043a0cd51cb3f1d8e6b3f4f
parent30eb1fdc51d96d443a755138acc425da9e949466 (diff)
virgl: factor out format host bits check
This will make it a single location when we want to replace a format. Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
-rw-r--r--src/gallium/drivers/virgl/virgl_screen.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index 7d09ecc1bd8..e8fbdac6544 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -593,6 +593,18 @@ virgl_is_vertex_format_supported(struct pipe_screen *screen,
return TRUE;
}
+static boolean
+virgl_format_check_bitmask(enum pipe_format format,
+ uint32_t bitmask[16])
+{
+ int big = format / 32;
+ int small = format % 32;
+ if ((bitmask[big] & (1 << small)))
+ return TRUE;
+
+ return FALSE;
+}
+
/**
* Query format support for creating a texture, drawing surface, etc.
* \param format the format to test
@@ -680,12 +692,9 @@ virgl_is_format_supported( struct pipe_screen *screen,
format_desc->block.height != 1)
return FALSE;
- {
- int big = format / 32;
- int small = format % 32;
- if (!(vscreen->caps.caps.v1.render.bitmask[big] & (1 << small)))
- return FALSE;
- }
+ if (!virgl_format_check_bitmask(format,
+ vscreen->caps.caps.v1.render.bitmask))
+ return FALSE;
}
if (bind & PIPE_BIND_DEPTH_STENCIL) {
@@ -728,16 +737,8 @@ virgl_is_format_supported( struct pipe_screen *screen,
return FALSE;
out_lookup:
- {
- int big = format / 32;
- int small = format % 32;
- if (!(vscreen->caps.caps.v1.sampler.bitmask[big] & (1 << small)))
- return FALSE;
- }
- /*
- * Everything else should be supported by u_format.
- */
- return TRUE;
+ return virgl_format_check_bitmask(format,
+ vscreen->caps.caps.v1.sampler.bitmask);
}
static void virgl_flush_frontbuffer(struct pipe_screen *screen,