diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-08-20 14:58:46 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-21 08:40:55 -0700 |
commit | 024f9cf24ff012e6fdf582c2852b591d2d51d00d (patch) | |
tree | 40195893c7c9e07fcd97c876df2faaea798903e1 | |
parent | 8fc4ca82e3dc8ab6f9e9667534b0b507bc664833 (diff) |
pan/decode: Validate texture dimensionality
Textures of a smaller dimension don't need higher dimensions printed.
This allows us to be more compact, while enforcing verification that
higher dimensions must be zero.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r-- | src/panfrost/pandecode/decode.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/src/panfrost/pandecode/decode.c b/src/panfrost/pandecode/decode.c index e5d22b5562b..3a32d25cabe 100644 --- a/src/panfrost/pandecode/decode.c +++ b/src/panfrost/pandecode/decode.c @@ -1759,14 +1759,41 @@ pandecode_texture(mali_ptr u, pandecode_log("struct mali_texture_descriptor texture_descriptor_%"PRIx64"_%d_%d = {\n", u, job_no, tex); pandecode_indent++; - pandecode_prop("width = MALI_POSITIVE(%" PRId16 ")", t->width + 1); - pandecode_prop("height = MALI_POSITIVE(%" PRId16 ")", t->height + 1); - pandecode_prop("depth = MALI_POSITIVE(%" PRId16 ")", t->depth + 1); - pandecode_prop("array_size = MALI_POSITIVE(%" PRId16 ")", t->array_size + 1); - pandecode_prop("nr_mipmap_levels = %" PRId8, t->nr_mipmap_levels); - struct mali_texture_format f = t->format; + /* See the definiton of enum mali_texture_type */ + + unsigned dimension = + (f.type == MALI_TEX_CUBE) ? 2 : f.type; + + /* All four width/height/depth/array_size dimensions are present + * regardless of the type of texture, but it is an error to have + * non-zero dimensions for unused dimensions. Verify this. array_size + * can always be set, as can width. */ + + if (t->height && dimension < 2) + pandecode_msg("XXX: nonzero height for <2D texture\n"); + + if (t->depth && dimension < 3) + pandecode_msg("XXX: nonzero depth for <2D texture\n"); + + /* Print only the dimensions that are actually there */ + + pandecode_log("dim: %d", t->width + 1); + + if (dimension >= 2) + pandecode_log_cont("x%u", t->height + 1); + + if (dimension >= 3) + pandecode_log_cont("x%u", t->depth + 1); + + if (t->array_size) + pandecode_log_cont("[%u]", t->array_size + 1); + + pandecode_log_cont("\n"); + + pandecode_prop("nr_mipmap_levels = %" PRId8, t->nr_mipmap_levels); + pandecode_log(".format = {\n"); pandecode_indent++; |