[Mesa-dev] [RFC 02/20] glsl: glsl_type serialization

Matt Turner mattst88 at gmail.com
Wed Jun 4 16:36:38 PDT 2014


On Mon, Jun 2, 2014 at 5:05 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> Will be utilized by IR serialization to serialize user defined types.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Reviewed-by: Paul Berry <stereotype441 at gmail.com> (v1)
> ---
>  src/glsl/glsl_types.cpp | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
>  src/glsl/glsl_types.h   |  6 +++++
>  2 files changed, 64 insertions(+)
>
> diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
> index 849a79a..212d533 100644
> --- a/src/glsl/glsl_types.cpp
> +++ b/src/glsl/glsl_types.cpp
> @@ -143,6 +143,64 @@ glsl_type::glsl_type(const glsl_struct_field *fields, unsigned num_fields,
>  }
>
>
> +void
> +glsl_type::serialize(memory_writer &mem) const
> +{
> +   uint32_t data_len = 0;
> +
> +   mem.write_string(name);
> +
> +   unsigned start_pos = mem.position();
> +   mem.write_uint32_t(data_len);
> +
> +   /**
> +    * Used to notify reader if a user defined type
> +    * has been serialized before.
> +    */
> +   uint8_t user_type_exists = 0;
> +
> +   /* Serialize only user defined types. */
> +   switch (base_type) {
> +   case GLSL_TYPE_ARRAY:
> +   case GLSL_TYPE_STRUCT:
> +   case GLSL_TYPE_INTERFACE:
> +      break;
> +   default:
> +      goto serilization_epilogue;

serialization


More information about the mesa-dev mailing list