Пример #1
0
	void Perfmeter::render()
	{
		if(!enabled) return;
		
		sys->pvr->setTexture(PVR_LIST_TR_POLY, NULL);
		sys->pvr->sendPolygonHeader(PVR_LIST_TR_POLY);
		sys->pvr->beginPrimitives(PVR_LIST_TR_POLY);
		
		float pct;
		float posx = 32.0f, posy = 424.0f, posz = 4500.0f;
		
		pvr_stats_t stats;
		pvr_get_stats(&stats);
		
		pct = ((float)stats.buf_last_time) * 60.0f / 1000.0f;
		renderBar(pct, posx, posy, posz, 0xff00c0c0, 0xff007070);
		pct = ((float)stats.reg_last_time) * 60.0f / 1000.0f;
		renderBar(pct, posx, posy + 8.0f, posz, 0xff00c000, 0xff007000);
		pct = ((float)stats.rnd_last_time) * 60.0f / 1000.0f;
		renderBar( pct, posx, posy + 16.0f, posz, 0xffc0c000, 0xff707000);
		
		sys->pvr->endPrimitives();
		
		sys->dbgFont->setColorRGBA(1.0f, 1.0f, 1.0f, 1.0f);
		sys->dbgFont->print(sys, posx + barLength + 16.0f, posy, posz, "fps %.2f  buf %d  reg %d  rnd %d\n", (double)stats.frame_rate, (int)stats.buf_last_time, (int)stats.reg_last_time, (int)stats.rnd_last_time);
	}
Пример #2
0
void stats() {
    pvr_stats_t stats;

    pvr_get_stats(&stats);
    dbglog(DBG_DEBUG, "3D Stats: %d VBLs, frame rate ~%f fps\n",
           stats.vbl_count, stats.frame_rate);
}
Пример #3
0
void running_stats(){
	pvr_stats_t stats;
	pvr_get_stats(&stats);

	avgfps = stats.frame_rate;
			
}
Пример #4
0
void running_stats() {
    pvr_stats_t stats;
    pvr_get_stats(&stats);
    if (avgfps == -1)
        avgfps = stats.frame_rate;
    else
        avgfps = (avgfps + stats.frame_rate) / 2.0f;
}
Пример #5
0
void pm_draw() {
	char str[64];
	float pct;
	float posx = 64, posy = 96, posz = 4500;

	// Get our stats
	pvr_stats_t stats;
	pvr_get_stats(&stats);

	// Make sure we're drawing into the right list.
	pvr_list_begin(PVR_LIST_TR_POLY);

	// Make a nice stat display
	sprintf(str, "fps %.2f  buf %d  reg %d  rnd %d",
		(double)stats.frame_rate,
		(int)stats.buf_last_time,
		(int)stats.reg_last_time,
		(int)stats.rnd_last_time);
	plx_fcxt_setcolor4f(fcxt, 1,1,1,1);
	plx_fcxt_setsize(fcxt, 16.0f);
	plx_fcxt_setpos(fcxt, posx, posy, posz);
	plx_fcxt_begin(fcxt);
	plx_fcxt_draw(fcxt, str);
	plx_fcxt_end(fcxt);

	sprintf(str, "avg fps %.2f",
		(double)(60.0 * stats.frame_count / stats.vbl_count));
	plx_fcxt_setpos(fcxt, posx, posy + 16.0f, posz);
	plx_fcxt_begin(fcxt);
	plx_fcxt_draw(fcxt, str);
	plx_fcxt_end(fcxt);

	// Draw a bargraph for registration time
	plx_cxt_texture(NULL);
	plx_cxt_send(PVR_LIST_TR_POLY);

	posy += -40.0f;

	pct = ((float)stats.buf_last_time) * 60.0f / 1000.0f;
	pm_drawbar(pct, posx, posy, posz, 0xff00c0c0, 0xff007070);

	pct = ((float)stats.reg_last_time) * 60.0f / 1000.0f;
	posy += 8.0f;
	pm_drawbar(pct, posx, posy, posz, 0xff00c000, 0xff007000);

	// Draw a bargraph for rendering time
	pct = ((float)stats.rnd_last_time) * 60.0f / 1000.0f;
	posy += 8.0f;
	pm_drawbar(pct, posx, posy, posz, 0xffc0c000, 0xff707000);

	pvr_list_finish();
}
Пример #6
0
int main(int argc, char **argv) {
	cont_cond_t cond;
	uint8	c;
	float	r = 0.0f;
	float	dr = 2;
	float	z = -14.0f;
	GLuint	texture;
	GLuint  dummy;
	int	trans = 0;
	pvr_stats_t	stats;

	/* Initialize KOS */

	/* Use this to test other video modes */
	/* vid_init(DM_320x240, PM_RGB565); */

	/* Normal init */
	pvr_init(&params);

	printf("gltest beginning\n");

	/* Get basic stuff initialized */
	glKosInit();
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(45.0f, 640.0f / 480.0f, 0.1f, 100.0f);
	glMatrixMode(GL_MODELVIEW);
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_KOS_AUTO_UV);

	/* Expect CW verts */
	glFrontFace(GL_CW);

        /* Enable Transparancy */
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	
	/* Load a texture and make to look nice */
	loadtxr("/rd/crate.pcx", &texture);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_FILTER, GL_FILTER_BILINEAR);
        glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATEALPHA);

	glClearColor(0.3f, 0.4f, 0.5f, 1.0f);

	while(1) {
		/* Check key status */
		c = maple_first_controller();
		if (c) {
			if (cont_get_cond(c, &cond) < 0) {
				printf("Error reading controller\n");
			}
			if (!(cond.buttons & CONT_START))
				break;
			if (!(cond.buttons & CONT_DPAD_UP))
				z -= 0.1f;
			if (!(cond.buttons & CONT_DPAD_DOWN))
				z += 0.1f;
			if (!(cond.buttons & CONT_DPAD_LEFT)) {
				/* If manual rotation is requested, then stop
				   the automated rotation */
				dr = 0.0f;
				r -= 2.0f;
			}
			if (!(cond.buttons & CONT_DPAD_RIGHT)) {
				dr = 0.0f;
				r += 2.0f;
			}
			if (!(cond.buttons & CONT_A)) {
				/* This weird logic is to avoid bouncing back
				   and forth before the user lets go of the
				   button. */
				if (!(trans & 0x1000)) {
					if (trans == 0)
						trans = 0x1001;
					else
						trans = 0x1000;
				}
			} else {
				trans &= ~0x1000;
			}
		}

		r += dr;

		/* Begin frame */
		glKosBeginFrame();

		/* Draw four cubes */
		glLoadIdentity();
		glTranslatef(0.0f, 0.0f, z);
		glRotatef(r, 0.0f, 1.0f, 0.5f);
		glPushMatrix();
		
		glTranslatef(-5.0f, 0.0f, 0.0f);
		cube(r);

		glPopMatrix();
		glPushMatrix();
		glTranslatef(5.0f, 0.0f, 0.0f);
		cube(r);

		/* Potentially do two as translucent */
		if (trans & 1) {
			glKosFinishList();
			glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
			glDisable(GL_CULL_FACE);
		}

		glPopMatrix();
		glPushMatrix();
		glTranslatef(0.0f, 5.0f, 0.0f);
		cube(r);

		glPopMatrix();
		glTranslatef(0.0f, -5.0f, 0.0f);
		cube(r);

		if (trans & 1) {
		        glEnable(GL_CULL_FACE);
		}

		/* Finish the frame */
		glKosFinishFrame();
	}

	pvr_get_stats(&stats);
	printf("VBL Count: %d, last_time: %f, frame rate: %f fps\n",
		stats.vbl_count, stats.frame_last_time, stats.frame_rate);

	return 0;
}