Exemple #1
0
bool vogl_vao_state::serialize(json_node &node, vogl_blob_manager &blob_manager) const
{
    VOGL_FUNC_TRACER

    VOGL_NOTE_UNUSED(blob_manager);

    if (!m_is_valid)
        return false;

    node.add_key_value("handle", m_snapshot_handle);
    node.add_key_value("has_been_bound", m_has_been_bound);
    node.add_key_value("element_array_binding", m_element_array_binding);

    json_node &vertex_attribs_array = node.add_array("vertex_attribs");
    for (uint32_t i = 0; i < m_vertex_attribs.size(); i++)
    {
        const vogl_vertex_attrib_desc &desc = m_vertex_attribs[i];

        json_node &attribs_obj = vertex_attribs_array.add_object();
        attribs_obj.add_key_value("pointer", desc.m_pointer);
        attribs_obj.add_key_value("array_binding", desc.m_array_binding);
        attribs_obj.add_key_value("size", desc.m_size);
        attribs_obj.add_key_value("type", get_gl_enums().find_gl_name(desc.m_type));
        attribs_obj.add_key_value("stride", desc.m_stride);
        attribs_obj.add_key_value("integer", desc.m_integer);
        attribs_obj.add_key_value("divisor", desc.m_divisor);
        attribs_obj.add_key_value("enabled", desc.m_enabled);
        attribs_obj.add_key_value("normalized", desc.m_normalized);
    }

    return true;
}
bool vogl_default_framebuffer_state::serialize(json_node &node, vogl_blob_manager &blob_manager) const
{
    if (!m_valid)
        return false;

    if (!m_fb_attribs.serialize(node.add_object("attribs")))
        return false;

    json_node &framebuffers_array = node.add_array("framebuffers");
    for (uint i = 0; i < cDefFramebufferTotal; i++)
    {
        json_node &object_node = framebuffers_array.add_object();
        if (m_textures[i].is_valid())
        {
            if (!m_textures[i].serialize(object_node, blob_manager))
                return false;
        }
    }

    return true;
}
bool vogl_display_list::serialize(json_node &node, vogl_blob_manager &blob_manager, const vogl_ctypes *pCtypes) const
{
    VOGL_FUNC_TRACER

    node.add_key_value("handle", m_handle);
    node.add_key_value("valid", m_valid);
    node.add_key_value("generating", m_generating);
    node.add_key_value("xfont", m_xfont);

    if (m_xfont)
    {
        node.add_key_value("xfont_glyph", m_xfont_glyph);
        node.add_key_value("xfont_name", m_xfont_name);
    }

    if (m_packets.size())
    {
        vogl_trace_packet::json_serialize_params params;
        params.m_pBlob_manager = &blob_manager;

        json_node &packets_array = node.add_array("packets");
        for (uint i = 0; i < m_packets.size(); i++)
        {
            const uint8_vec &packet_buf = m_packets.get_packet_buf(i);

            vogl_trace_packet packet(pCtypes);
            if (!packet.deserialize(packet_buf.get_ptr(), packet_buf.size(), true))
                return false;

            if (!packet.json_serialize(packets_array.add_object(), params))
                return false;
        }
    }

    return true;
}