mirror of
https://github.com/libretro/RetroArch
synced 2025-03-18 04:21:19 +00:00
Merge pull request #1564 from aliaspider/master
(3DS) add very basic display of the loaded core's framebuffer.
This commit is contained in:
commit
a891c587c0
@ -120,7 +120,7 @@ void GPU_SetDummyTexEnv(u8 num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// topscreen
|
// topscreen
|
||||||
void renderFrame()
|
void renderFrame(ctr_video_t* ctr)
|
||||||
{
|
{
|
||||||
GPU_SetViewport((u32*)osConvertVirtToPhys((u32)gpuDOut),
|
GPU_SetViewport((u32*)osConvertVirtToPhys((u32)gpuDOut),
|
||||||
(u32*)osConvertVirtToPhys((u32)gpuOut), 0, 0, fbheight * 2, fbwidth);
|
(u32*)osConvertVirtToPhys((u32)gpuOut), 0, 0, fbheight * 2, fbwidth);
|
||||||
@ -159,7 +159,7 @@ void renderFrame()
|
|||||||
//texturing stuff
|
//texturing stuff
|
||||||
GPU_SetTexture(GPU_TEXUNIT0, (u32*)osConvertVirtToPhys((u32)texData), gpu_tex_w, gpu_tex_h,
|
GPU_SetTexture(GPU_TEXUNIT0, (u32*)osConvertVirtToPhys((u32)texData), gpu_tex_w, gpu_tex_h,
|
||||||
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR),
|
GPU_TEXTURE_MAG_FILTER(GPU_LINEAR) | GPU_TEXTURE_MIN_FILTER(GPU_LINEAR),
|
||||||
GPU_RGBA4);
|
ctr->menu_texture_enable?GPU_RGBA4:GPU_RGB565);
|
||||||
|
|
||||||
u32 bufferoffset = 0x00000000;
|
u32 bufferoffset = 0x00000000;
|
||||||
u64 bufferpermutations = 0x210;
|
u64 bufferpermutations = 0x210;
|
||||||
@ -257,6 +257,9 @@ static bool ctr_frame(void* data, const void* frame,
|
|||||||
settings_t* settings = config_get_ptr();
|
settings_t* settings = config_get_ptr();
|
||||||
|
|
||||||
// int i;
|
// int i;
|
||||||
|
static uint64_t currentTick,lastTick;
|
||||||
|
static float fps=0.0;
|
||||||
|
static int total_frames = 0;
|
||||||
static int frames = 0;
|
static int frames = 0;
|
||||||
|
|
||||||
if (!width || !height)
|
if (!width || !height)
|
||||||
@ -278,7 +281,18 @@ static bool ctr_frame(void* data, const void* frame,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("frames: %i\r", frames++);fflush(stdout);
|
frames++;
|
||||||
|
currentTick = osGetTime();
|
||||||
|
uint32_t diff = currentTick - lastTick;
|
||||||
|
if(diff > 1000)
|
||||||
|
{
|
||||||
|
fps = (float)frames * (1000.0 / diff);
|
||||||
|
lastTick = currentTick;
|
||||||
|
frames = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("fps: %8.4f frames: %i\r", fps, total_frames++, currentTick);fflush(stdout);
|
||||||
|
|
||||||
// gfxFlushBuffers();
|
// gfxFlushBuffers();
|
||||||
// gspWaitForEvent(GSPEVENT_VBlank0, true);
|
// gspWaitForEvent(GSPEVENT_VBlank0, true);
|
||||||
|
|
||||||
@ -291,12 +305,30 @@ static bool ctr_frame(void* data, const void* frame,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!ctr->menu_texture_enable && frame)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
uint8_t* dst = (uint8_t*)texData2;
|
||||||
|
const uint8_t* src = frame;
|
||||||
|
if (width > tex_w)
|
||||||
|
width = tex_w;
|
||||||
|
if (height > tex_h)
|
||||||
|
height = tex_h;
|
||||||
|
for (i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
memcpy(dst, src, width*2);
|
||||||
|
dst += tex_w*2;
|
||||||
|
src += pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
GSPGPU_FlushDataCache(NULL, (u8*)texData2, texture_bin_size);
|
GSPGPU_FlushDataCache(NULL, (u8*)texData2, texture_bin_size);
|
||||||
GX_SetDisplayTransfer(NULL, (u32*)texData2, tex_size, (u32*)texData, gpu_tex_size,
|
GX_SetDisplayTransfer(NULL, (u32*)texData2, tex_size, (u32*)texData, gpu_tex_size,
|
||||||
0x3302); // rgb32=0x0 rgb32=0x0 ??=0x0 linear2swizzeled=0x2
|
0x3302); // rgb32=0x0 rgb32=0x0 ??=0x0 linear2swizzeled=0x2
|
||||||
gspWaitForPPF();
|
gspWaitForPPF();
|
||||||
|
|
||||||
renderFrame();
|
renderFrame(ctr);
|
||||||
GPUCMD_Finalize();
|
GPUCMD_Finalize();
|
||||||
|
|
||||||
// for (i = 0; i < 16; i++)
|
// for (i = 0; i < 16; i++)
|
||||||
@ -319,7 +351,7 @@ static bool ctr_frame(void* data, const void* frame,
|
|||||||
gspWaitForPSC0();
|
gspWaitForPSC0();
|
||||||
gfxSwapBuffersGpu();
|
gfxSwapBuffersGpu();
|
||||||
|
|
||||||
gspWaitForEvent(GSPEVENT_VBlank0, true);
|
// gspWaitForEvent(GSPEVENT_VBlank0, true);
|
||||||
|
|
||||||
|
|
||||||
// gfxFlushBuffers();
|
// gfxFlushBuffers();
|
||||||
|
@ -257,7 +257,7 @@ retro_time_t rarch_get_time_usec(void)
|
|||||||
gettimeofday(&tv,NULL);
|
gettimeofday(&tv,NULL);
|
||||||
return (1000000 * tv.tv_sec + tv.tv_usec);
|
return (1000000 * tv.tv_sec + tv.tv_usec);
|
||||||
#elif defined(_3DS)
|
#elif defined(_3DS)
|
||||||
return osGetTime();
|
return osGetTime() * 1000;
|
||||||
#else
|
#else
|
||||||
#error "Your platform does not have a timer function implemented in rarch_get_time_usec(). Cannot continue."
|
#error "Your platform does not have a timer function implemented in rarch_get_time_usec(). Cannot continue."
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user