Esempio n. 1
0
//Return read buffer , 0 if none
bool asRingRead(u8* dst,u32 sz)
{
	if (sz==0)
		sz=BufferSampleCount;
	if (asRingUsedCount()>=sz)
	{
		const u32 ptr=ReadPtr;
		if ((ReadPtr+sz)<=RingBufferSampleCount)
		{
			//R ... W, just copy the sz :)
			memcpy(dst,&RingBuffer[ptr],sz*sizeof(s16)*2);
		}
		else
		{
			//...W R...., just copy the sz :)
			const u32 szhi=RingBufferSampleCount-ptr;
			const u32 szlow=sz-szhi;

			memcpy(dst,&RingBuffer[ptr],szhi*sizeof(s16)*2);
			dst+=szhi*sizeof(s16)*2;
			memcpy(dst,&RingBuffer[0],szlow*sizeof(s16)*2);
		}
		ReadPtr=(ptr+sz)%RingBufferSampleCount;
		
		speed_limit.Set();
		return true;
	}
	else
	{
		//printf("ONLY %d used, rd=%d, wt=%d\n",asRingUsedCount(),ReadPtr,WritePtr);
		return false;
	}
}
Esempio n. 2
0
void FinishRender(TA_context* ctx)
{
	verify(rqueue == ctx);
	mtx_rqueue.Lock();
	rqueue = 0;
	mtx_rqueue.Unlock();

	tactx_Recycle(ctx);
	frame_finished.Set();
}
Esempio n. 3
0
bool rend_frame(TA_context* ctx, bool draw_osd) {
	bool proc = renderer->Process(ctx);
	re.Set();

	bool do_swp = proc && renderer->Render();

	if (do_swp && draw_osd)
		renderer->DrawOSD();

	return do_swp;
}
Esempio n. 4
0
void FinishRender(TA_context* ctx)
{
	verify(rqueue == ctx);
#ifndef TARGET_NO_THREADS
   slock_lock(mtx_rqueue);
#endif
	rqueue = 0;
#ifndef TARGET_NO_THREADS
   slock_unlock(mtx_rqueue);
#endif

	tactx_Recycle(ctx);
	frame_finished.Set();
}
Esempio n. 5
0
void os_consume(double t)
{
	double cyc=t*190*1000*1000;

	if ((cycl_glob+cyc)<10*1000*1000)
	{
		InterlockedExchangeAdd(&cycl_glob,cyc);
	}
	else
	{
		cycl_glob=10*1000*1000;
	}

	evt_hld.Set();
}
Esempio n. 6
0
void rend_start_render()
{
	pend_rend = false;
	bool is_rtt=(FB_W_SOF1& 0x1000000)!=0;
	TA_context* ctx = tactx_Pop(CORE_CURRENT_CTX);

	SetREP(ctx);

	if (ctx)
	{
		if (!ctx->rend.Overrun)
		{
			//printf("REP: %.2f ms\n",render_end_pending_cycles/200000.0);
			FillBGP(ctx);
			
			ctx->rend.isRTT=is_rtt;
			ctx->rend.isAutoSort = UsingAutoSort();

			ctx->rend.fb_X_CLIP=FB_X_CLIP;
			ctx->rend.fb_Y_CLIP=FB_Y_CLIP;
			
			max_idx=max(max_idx,ctx->rend.idx.used());
			max_vtx=max(max_vtx,ctx->rend.verts.used());
			max_op=max(max_op,ctx->rend.global_param_op.used());
			max_pt=max(max_pt,ctx->rend.global_param_pt.used());
			max_tr=max(max_tr,ctx->rend.global_param_tr.used());
			
			max_mvo=max(max_mvo,ctx->rend.global_param_mvo.used());
			max_modt=max(max_modt,ctx->rend.modtrig.used());

#if HOST_OS==OS_WINDOWS && 0
			printf("max: idx: %d, vtx: %d, op: %d, pt: %d, tr: %d, mvo: %d, modt: %d, ov: %d\n", max_idx, max_vtx, max_op, max_pt, max_tr, max_mvo, max_modt, ovrn);
#endif
			if (QueueRender(ctx))  {
				palette_update();
				rs.Set();
				pend_rend = true;
			}
		}
		else
		{
			ovrn++;
			printf("WARNING: Rendering context is overrun (%d), aborting frame\n",ovrn);
			tactx_Recycle(ctx);
		}
	}
}
Esempio n. 7
0
bool rend_single_frame()
{
	//wait render start only if no frame pending
	do
	{
		rs.Wait();
		_pvrrc = DequeueRender();
	}
	while (!_pvrrc);

	bool proc = renderer->Process(_pvrrc);
	re.Set();
	
	bool do_swp = proc && renderer->Render();
		
	if (do_swp)
		renderer->DrawOSD();

	//clear up & free data ..
	FinishRender(_pvrrc);
	_pvrrc=0;

	return do_swp;
}