diff options
author | Eric Anholt <[email protected]> | 2018-02-23 09:10:36 -0800 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2018-02-23 15:07:18 -0800 |
commit | 97dc0773032d6284ea5c63758abf704d877f65dc (patch) | |
tree | f50c97dc67630e3bbf7ecefd6baf4efddb497923 /src/gallium/drivers/vc5/vc5_screen.c | |
parent | 880573e7370b866c94513f59ad0bb0b10660643f (diff) |
broadcom/vc5: Ignore unused usage flags in is_format_supported.
Like for vc4, the new DISPLAY_TARGET flag ended up causing no formats to
match. Just drop the whole retval == usage thing and return early when we
hit a known unsupported case.
Fixes: f7604d8af521 ("st/dri: only expose config formats that are display targets")
Diffstat (limited to 'src/gallium/drivers/vc5/vc5_screen.c')
-rw-r--r-- | src/gallium/drivers/vc5/vc5_screen.c | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/src/gallium/drivers/vc5/vc5_screen.c b/src/gallium/drivers/vc5/vc5_screen.c index 47727d0adad..5d63fb6ec0b 100644 --- a/src/gallium/drivers/vc5/vc5_screen.c +++ b/src/gallium/drivers/vc5/vc5_screen.c @@ -426,7 +426,6 @@ vc5_screen_is_format_supported(struct pipe_screen *pscreen, unsigned usage) { struct vc5_screen *screen = vc5_screen(pscreen); - unsigned retval = 0; if (sample_count > 1 && sample_count != VC5_MAX_SAMPLES) return FALSE; @@ -482,49 +481,39 @@ vc5_screen_is_format_supported(struct pipe_screen *pscreen, case PIPE_FORMAT_R8G8B8_SSCALED: case PIPE_FORMAT_R8G8_SSCALED: case PIPE_FORMAT_R8_SSCALED: - retval |= PIPE_BIND_VERTEX_BUFFER; break; default: - break; + return FALSE; } } if ((usage & PIPE_BIND_RENDER_TARGET) && - vc5_rt_format_supported(&screen->devinfo, format)) { - retval |= PIPE_BIND_RENDER_TARGET; + !vc5_rt_format_supported(&screen->devinfo, format)) { + return FALSE; } if ((usage & PIPE_BIND_SAMPLER_VIEW) && - vc5_tex_format_supported(&screen->devinfo, format)) { - retval |= PIPE_BIND_SAMPLER_VIEW; + !vc5_tex_format_supported(&screen->devinfo, format)) { + return FALSE; } if ((usage & PIPE_BIND_DEPTH_STENCIL) && - (format == PIPE_FORMAT_S8_UINT_Z24_UNORM || - format == PIPE_FORMAT_X8Z24_UNORM || - format == PIPE_FORMAT_Z16_UNORM || - format == PIPE_FORMAT_Z32_FLOAT || - format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)) { - retval |= PIPE_BIND_DEPTH_STENCIL; + !(format == PIPE_FORMAT_S8_UINT_Z24_UNORM || + format == PIPE_FORMAT_X8Z24_UNORM || + format == PIPE_FORMAT_Z16_UNORM || + format == PIPE_FORMAT_Z32_FLOAT || + format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)) { + return FALSE; } if ((usage & PIPE_BIND_INDEX_BUFFER) && - (format == PIPE_FORMAT_I8_UINT || - format == PIPE_FORMAT_I16_UINT || - format == PIPE_FORMAT_I32_UINT)) { - retval |= PIPE_BIND_INDEX_BUFFER; - } - -#if 0 - if (retval != usage) { - fprintf(stderr, - "not supported: format=%s, target=%d, sample_count=%d, " - "usage=0x%x, retval=0x%x\n", util_format_name(format), - target, sample_count, usage, retval); + !(format == PIPE_FORMAT_I8_UINT || + format == PIPE_FORMAT_I16_UINT || + format == PIPE_FORMAT_I32_UINT)) { + return FALSE; } -#endif - return retval == usage; + return TRUE; } #define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x))) |