v3d/compiler: implement nir_intrinsic_get_ubo_size

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
This commit is contained in:
Iago Toral Quiroga
2020-08-26 11:58:47 +02:00
committed by Marge Bot
parent f4c754bcd1
commit d93d903a37
3 changed files with 12 additions and 1 deletions

View File

@@ -2201,6 +2201,12 @@ ntq_emit_intrinsic(struct v3d_compile *c, nir_intrinsic_instr *instr)
nir_src_as_uint(instr->src[0])));
break;
case nir_intrinsic_get_ubo_size:
ntq_store_dest(c, &instr->dest, 0,
vir_uniform(c, QUNIFORM_GET_UBO_SIZE,
nir_src_comp_as_uint(instr->src[0], 0)));
break;
case nir_intrinsic_load_user_clip_plane:
for (int i = 0; i < nir_intrinsic_dest_components(instr); i++) {
ntq_store_dest(c, &instr->dest, i,

View File

@@ -251,8 +251,9 @@ enum quniform_contents {
/* Returns the base offset of the SSBO given by the data value. */
QUNIFORM_SSBO_OFFSET,
/* Returns the size of the SSBO given by the data value. */
/* Returns the size of the SSBO or UBO given by the data value. */
QUNIFORM_GET_BUFFER_SIZE,
QUNIFORM_GET_UBO_SIZE,
/* Sizes (in pixels) of a shader image given by the data value. */
QUNIFORM_IMAGE_WIDTH,

View File

@@ -122,6 +122,10 @@ vir_dump_uniform(enum quniform_contents contents,
fprintf(stderr, "ssbo_size[%d]", data);
break;
case QUNIFORM_GET_UBO_SIZE:
fprintf(stderr, "ubo_size[%d]", data);
break;
case QUNIFORM_NUM_WORK_GROUPS:
fprintf(stderr, "num_wg.%c", data < 3 ? "xyz"[data] : '?');
break;