diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-02-16 17:01:02 -0500 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-02-18 14:44:08 +0000 |
commit | 7d3c48f131ec84aa759a6290a20e2b0c02ad8834 (patch) | |
tree | 8a600f675a61b7e99b7f9fd38aed7abfba8e7921 /src/gallium/drivers | |
parent | 027944c7c8ccbff940484b1ed7cc5d75b9593640 (diff) |
panfrost: Debitfieldize mali_uniform_buffer_meta
It fits snugly in a u64, just give a macro for direct computation rather
than fudging around with bitfields. Not sure if this actually matters
with well-optimized compilers but it makes the code subjectively cleaner
so it's worth it for that if nothing else.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3838>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3838>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 60ccf66f841..6f45901ee81 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1097,12 +1097,11 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) unsigned ubo_count = panfrost_ubo_count(ctx, i); assert(ubo_count >= 1); - size_t sz = sizeof(struct mali_uniform_buffer_meta) * ubo_count; - struct mali_uniform_buffer_meta ubos[PAN_MAX_CONST_BUFFERS]; + size_t sz = sizeof(uint64_t) * ubo_count; + uint64_t ubos[PAN_MAX_CONST_BUFFERS]; /* Upload uniforms as a UBO */ - ubos[0].size = MALI_POSITIVE((2 + uniform_count)); - ubos[0].ptr = transfer.gpu >> 2; + ubos[0] = MALI_MAKE_UBO(2 + uniform_count, transfer.gpu); /* The rest are honest-to-goodness UBOs */ @@ -1114,9 +1113,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) if (!enabled || empty) { /* Stub out disabled UBOs to catch accesses */ - - ubos[ubo].size = 0; - ubos[ubo].ptr = 0xDEAD0000; + ubos[ubo] = MALI_MAKE_UBO(0, 0xDEAD0000); continue; } @@ -1124,10 +1121,7 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) unsigned bytes_per_field = 16; unsigned aligned = ALIGN_POT(usz, bytes_per_field); - unsigned fields = aligned / bytes_per_field; - - ubos[ubo].size = MALI_POSITIVE(fields); - ubos[ubo].ptr = gpu >> 2; + ubos[ubo] = MALI_MAKE_UBO(aligned / bytes_per_field, gpu); } mali_ptr ubufs = panfrost_upload_transient(batch, ubos, sz); |