Exemplo n.º 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;
}
Exemplo n.º 2
0
bool vogl_renderbuffer_desc::serialize(json_node &node) const
{
    VOGL_FUNC_TRACER

    node.add_key_value("width", m_width);
    node.add_key_value("height", m_height);
    node.add_key_value("internal_format", g_gl_enums.find_name(m_internal_format, "gl"));
    node.add_key_value("samples", m_samples);
    node.add_key_value("red_size", m_red_size);
    node.add_key_value("green_size", m_green_size);
    node.add_key_value("blue_size", m_blue_size);
    node.add_key_value("alpha_size", m_alpha_size);
    node.add_key_value("depth_size", m_depth_size);
    node.add_key_value("stencil_size", m_stencil_size);

    return true;
}
Exemplo n.º 3
0
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;
}