summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFritz Koenig <frkoenig@google.com>2019-12-04 16:16:43 -0800
committerDylan Baker <dylan@pnwbakers.com>2019-12-10 09:14:14 -0800
commit22d1e495daa83aee0792cc56151e4b5a960fa04c (patch)
treece2b3e5b19ec24cdc401aa6d8001d440d0c20e9a
parenta67289631f8578a5466548c3f26ebc8e7b269f79 (diff)
freedreno: reorder format check
With the addition of the planar formats helper, the planar formats no longer have a valid block.bits field. Calling util_format_get_blocksize therefore asserts. Reorder the check to see if the format is supported before doing the query to get the blocksize. Fixes: 20f132e5eff2d ("gallium/util: add planar format layouts and helpers") Signed-off-by: Fritz Koenig <frkoenig@google.com> Reviewed-by: Rob Clark <robdclark@chromium.org> (cherry picked from commit c496d442844183968f7c4903c8ed549aa990d15f)
-rw-r--r--src/gallium/drivers/freedreno/a4xx/fd4_screen.c4
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_screen.c4
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_screen.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
index c775ebfd1fc..22b142c9ad1 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_screen.c
@@ -60,9 +60,9 @@ fd4_screen_is_format_supported(struct pipe_screen *pscreen,
}
if ((usage & PIPE_BIND_SAMPLER_VIEW) &&
+ (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0) &&
(target == PIPE_BUFFER ||
- util_format_get_blocksize(format) != 12) &&
- (fd4_pipe2tex(format) != (enum a4xx_tex_fmt)~0)) {
+ util_format_get_blocksize(format) != 12)) {
retval |= PIPE_BIND_SAMPLER_VIEW;
}
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c
index 14f8ab77221..c26e0c86e13 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_screen.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_screen.c
@@ -76,9 +76,9 @@ fd5_screen_is_format_supported(struct pipe_screen *pscreen,
}
if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) &&
+ (fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0) &&
(target == PIPE_BUFFER ||
- util_format_get_blocksize(format) != 12) &&
- (fd5_pipe2tex(format) != (enum a5xx_tex_fmt)~0)) {
+ util_format_get_blocksize(format) != 12)) {
retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE);
}
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c
index dddda98f121..02be60ce3bf 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_screen.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_screen.c
@@ -82,9 +82,9 @@ fd6_screen_is_format_supported(struct pipe_screen *pscreen,
}
if ((usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE)) &&
+ (fd6_pipe2tex(format) != (enum a6xx_tex_fmt)~0) &&
(target == PIPE_BUFFER ||
- util_format_get_blocksize(format) != 12) &&
- (fd6_pipe2tex(format) != (enum a6xx_tex_fmt)~0)) {
+ util_format_get_blocksize(format) != 12)) {
retval |= usage & (PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE);
}