diff options
author | Jason Ekstrand <[email protected]> | 2018-03-21 16:48:35 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-06-22 20:15:57 -0700 |
commit | 39bf61aa37b0336aa27d8e3d2bf64587f07ff477 (patch) | |
tree | 71862af4a722fd8a2ef95aa5de09820fc0e7e411 /src/compiler/nir/nir_serialize.c | |
parent | eb40540b8aa30279b80fa3a879e20bbb5d16838f (diff) |
nir: Add a concept of per-member structs and a lowering pass
This adds a concept of "members" to a variable with an interface type.
It allows you to specify the full variable data for each member of the
interface instead of once for the variable. We also add a lowering pass
to lower those variables to a sequence of variables and rewrite all the
derefs accordingly.
Acked-by: Rob Clark <[email protected]>
Acked-by: Bas Nieuwenhuizen <[email protected]>
Acked-by: Dave Airlie <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_serialize.c')
-rw-r--r-- | src/compiler/nir/nir_serialize.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_serialize.c b/src/compiler/nir/nir_serialize.c index 155205d2198..39f6d8298d7 100644 --- a/src/compiler/nir/nir_serialize.c +++ b/src/compiler/nir/nir_serialize.c @@ -149,6 +149,11 @@ write_variable(write_ctx *ctx, const nir_variable *var) blob_write_uint32(ctx->blob, !!(var->interface_type)); if (var->interface_type) encode_type_to_blob(ctx->blob, var->interface_type); + blob_write_uint32(ctx->blob, var->num_members); + if (var->num_members > 0) { + blob_write_bytes(ctx->blob, (uint8_t *) var->members, + var->num_members * sizeof(*var->members)); + } } static nir_variable * @@ -180,6 +185,13 @@ read_variable(read_ctx *ctx) var->interface_type = decode_type_from_blob(ctx->blob); else var->interface_type = NULL; + var->num_members = blob_read_uint32(ctx->blob); + if (var->num_members > 0) { + var->members = ralloc_array(var, struct nir_variable_data, + var->num_members); + blob_copy_bytes(ctx->blob, (uint8_t *) var->members, + var->num_members * sizeof(*var->members)); + } return var; } |