예제 #1
0
static void log_pm(void)
{
	int count = 0, i;

	LOGFILE("[power]\n");
	log_time();
	log_gps();
	for (i = 0; i <= 1023; i++) {
		if ((pm[i].flags & INFO_FLG_PM)) {
			if (!count)
				LOGFILE("arfcn %d", i);
			LOGFILE(" %d", pm[i].rxlev);
			count++;
			if (count == 12) {
				LOGFILE("\n");
				count = 0;
			}
		} else {
			if (count) {
				LOGFILE("\n");
				count = 0;
			}
		}
	}
	if (count)
		LOGFILE("\n");

	LOGFILE("\n");
	LOGFLUSH();
}
예제 #2
0
static void log_sysinfo(void)
{
	struct rx_meas_stat *meas = &ms->meas;
	struct gsm48_sysinfo *s = &sysinfo;
	int8_t rxlev;
	char ta_str[32] = "";

	if (log_si.ta != 0xff)
		sprintf(ta_str, " TA=%d", log_si.ta);

	LOGP(DSUM, LOGL_INFO, "Cell: ARFCN=%d MCC=%s MNC=%s (%s, %s)%s\n",
		arfcn, gsm_print_mcc(s->mcc), gsm_print_mnc(s->mnc),
		gsm_get_mcc(s->mcc), gsm_get_mnc(s->mcc, s->mnc), ta_str);

	LOGFILE("[sysinfo]\n");
	LOGFILE("arfcn %d\n", s->arfcn);
	log_time();
	log_gps();
	LOGFILE("bsic %d,%d\n", s->bsic >> 3, s->bsic & 7);
	rxlev = meas->rxlev / meas->frames - 110;
	LOGFILE("rxlev %d\n", rxlev);
	if (s->si1)
		log_frame("si1", s->si1_msg);
	if (s->si2)
		log_frame("si2", s->si2_msg);
	if (s->si2bis)
		log_frame("si2bis", s->si2b_msg);
	if (s->si2ter)
		log_frame("si2ter", s->si2t_msg);
	if (s->si3)
		log_frame("si3", s->si3_msg);
	if (s->si4)
		log_frame("si4", s->si4_msg);
	if (log_si.ta != 0xff)
		LOGFILE("ta %d\n", log_si.ta);

	LOGFILE("\n");
	LOGFLUSH();
}
//------------------------------------------------------------------------------
// It is possible to create one VBO for one Mesh; and one EBO for each primitive group
// however, for this sample, we will create only one VBO for all and one EBO
// meshes and primitive groups will have an offset in these buffers
//------------------------------------------------------------------------------
bool Bk3dModelStandard::initResourcesObject()
{
    LOGFLUSH();
    SHOWPROGRESS("Init resources")

    //m_pGenericModel->m_meshFile->pMeshes->n = 60000;
    //
    // create Buffer Object for materials
    //
    if(m_pGenericModel->m_meshFile->pMaterials && m_pGenericModel->m_meshFile->pMaterials->nMaterials )
    {
        //
        // Material UBO: *TABLE* of multiple materials
        // Then offset in it for various drawcalls
        //
        if(m_uboMaterial.Id == 0)
            glGenBuffers(1, &m_uboMaterial.Id);

        m_uboMaterial.Sz = sizeof(MaterialBuffer) * m_pGenericModel->m_materialNItems;
        glNamedBufferDataEXT(m_uboMaterial.Id, m_uboMaterial.Sz, m_pGenericModel->m_material, GL_STATIC_DRAW);
        glBindBufferBase(GL_UNIFORM_BUFFER,UBO_MATERIAL, m_uboMaterial.Id);

        LOGI("%d materials stored in %d Kb\n", m_pGenericModel->m_meshFile->pMaterials->nMaterials, (m_uboMaterial.Sz+512)/1024);
        LOGFLUSH();
    }

    //
    // create Buffer Object for Object-matrices
    //
    if(m_pGenericModel->m_meshFile->pTransforms && m_pGenericModel->m_meshFile->pTransforms->nBones)
    {
        //
        // Transformation UBO: *TABLE* of multiple transformations
        // Then offset in it for various drawcalls
        //
        if(m_uboObjectMatrices.Id == 0)
            glGenBuffers(1, &m_uboObjectMatrices.Id);

        m_uboObjectMatrices.Sz = sizeof(MatrixBufferObject) * m_pGenericModel->m_objectMatricesNItems;
        glNamedBufferDataEXT(m_uboObjectMatrices.Id, m_uboObjectMatrices.Sz, m_pGenericModel->m_objectMatrices, GL_STATIC_DRAW);
        glBindBufferBase(GL_UNIFORM_BUFFER,UBO_MATRIXOBJ, m_uboObjectMatrices.Id);

        LOGI("%d matrices stored in %d Kb\n", m_pGenericModel->m_meshFile->pTransforms->nBones, (m_uboObjectMatrices.Sz + 512)/1024);
        LOGFLUSH();
    }

    //
    // First pass: evaluate the size of the single VBO
    // and store offset to where we'll find data back
    //
    bk3d::Mesh *pMesh = NULL;
    for(int i=0; i< m_pGenericModel->m_meshFile->pMeshes->n; i++)
	{
        SETPROGRESSVAL(100.0f*(float)i/(float)m_pGenericModel->m_meshFile->pMeshes->n);
		pMesh = m_pGenericModel->m_meshFile->pMeshes->p[i];
        //
        // Slots: buffers for vertices
        //
        int n = pMesh->pSlots->n;
        for(int s=0; s<n; s++)
        {
            bk3d::Slot* pS = pMesh->pSlots->p[s];
            GLuint id;
            glGenBuffers(1, &id); // Buffer Object directly kept in the Slot
            pS->userData = id;
            #if 1
                glNamedBufferDataEXT(id, pS->vtxBufferSizeBytes, NULL, GL_STATIC_DRAW);
            #else
                glNamedBufferStorageEXT(id, pS->vtxBufferSizeBytes, NULL, 0); // Not working with NSight !!! https://www.opengl.org/registry/specs/ARB/buffer_storage.txt
            #endif
            glNamedBufferSubDataEXT(id, 0, pS->vtxBufferSizeBytes, pS->pVtxBufferData);
        }
        //
        // Primitive groups
        //
        for(int pg=0; pg<pMesh->pPrimGroups->n; pg++)
        {
            bk3d::PrimGroup* pPG = pMesh->pPrimGroups->p[pg];
            if(pPG->indexArrayByteSize > 0)
            {
                if((pPG->pOwnerOfIB == pPG)||(pPG->pOwnerOfIB == NULL)) // this primitive group doesn't use other's buffer
                {
                    GLuint id;
                    glGenBuffers(1, &id);
                    pPG->userPtr = (int*)id;
                #if 1
                    glNamedBufferDataEXT(id, pPG->indexArrayByteSize, NULL, GL_STATIC_DRAW);
                #else
                    glNamedBufferStorageEXT(id, pPG->indexArrayByteSize, NULL, 0); // Not working with NSight !!! https://www.opengl.org/registry/specs/ARB/buffer_storage.txt
                #endif
                    glNamedBufferSubDataEXT(id, pPG->indexArrayByteOffset, pPG->indexArrayByteSize, pPG->pIndexBufferData);
                } else {
                    pPG->userPtr = pPG->pOwnerOfIB->userPtr;
                }
            } else {
                pPG->userPtr = NULL;
            }
        }
	}
    //LOGI("meshes: %d in :%d VBOs (%f Mb) and %d EBOs (%f Mb) \n", m_pGenericModel->m_meshFile->pMeshes->n, .size(), (float)totalVBOSz/(float)(1024*1024), m_ObjEBOs.size(), (float)totalEBOSz/(float)(1024*1024));
    LOGFLUSH();
    HIDEPROGRESS()
    return true;
}