2012-04-21 21:13:50 +00:00
|
|
|
/* RetroArch - A frontend for libretro.
|
2014-01-01 00:50:59 +00:00
|
|
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
2015-01-07 17:06:50 +00:00
|
|
|
* Copyright (C) 2011-2015 - Daniel De Matteis
|
|
|
|
* Copyright (C) 2012-2015 - Michael Lelli
|
2011-12-14 13:26:40 +00:00
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
2011-12-14 13:26:40 +00:00
|
|
|
* of the GNU General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
2012-04-21 21:13:50 +00:00
|
|
|
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
2011-12-14 13:26:40 +00:00
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
2012-04-21 21:31:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along with RetroArch.
|
2011-12-14 13:26:40 +00:00
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-08-15 19:08:56 +00:00
|
|
|
#include "../../driver.h"
|
|
|
|
#include "../../general.h"
|
2015-01-12 22:38:21 +00:00
|
|
|
#include "../drivers_font_renderer/bitmap.h"
|
2015-02-13 18:11:53 +00:00
|
|
|
#include "../../menu/menu_driver.h"
|
2015-01-18 22:59:57 +00:00
|
|
|
#include "../video_viewport.h"
|
2015-01-18 19:03:33 +00:00
|
|
|
#include "../video_monitor.h"
|
2012-09-01 02:20:30 +00:00
|
|
|
|
|
|
|
#ifdef HW_RVL
|
2014-08-15 19:08:56 +00:00
|
|
|
#include "../../wii/mem2_manager.h"
|
2012-09-01 02:20:30 +00:00
|
|
|
#endif
|
|
|
|
|
2014-08-15 19:08:56 +00:00
|
|
|
#include "gx_gfx.h"
|
2011-12-14 13:26:40 +00:00
|
|
|
#include <gccore.h>
|
|
|
|
#include <ogcsys.h>
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2014-02-21 01:38:15 +00:00
|
|
|
#include "ppc_asm.h"
|
2014-08-15 19:08:56 +00:00
|
|
|
#include "gx_gfx_inl.h"
|
2015-01-12 05:51:57 +00:00
|
|
|
#include "gx_sdk_defines.h"
|
2013-04-19 14:09:37 +00:00
|
|
|
|
2012-08-28 00:36:05 +00:00
|
|
|
#define SYSMEM1_SIZE 0x01800000
|
|
|
|
|
2012-08-07 04:04:17 +00:00
|
|
|
void *g_framebuf[2];
|
|
|
|
unsigned g_current_framebuf;
|
2012-01-03 10:32:07 +00:00
|
|
|
|
2012-08-07 04:04:17 +00:00
|
|
|
bool g_vsync;
|
2014-06-07 01:12:58 +00:00
|
|
|
OSCond g_video_cond;
|
2012-08-07 04:04:17 +00:00
|
|
|
volatile bool g_draw_done;
|
2012-08-20 03:20:28 +00:00
|
|
|
uint32_t g_orientation;
|
2011-12-14 13:26:40 +00:00
|
|
|
|
2012-11-22 07:08:11 +00:00
|
|
|
static struct
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
2014-09-09 04:59:17 +00:00
|
|
|
uint32_t *data; /* needs to be resizable. */
|
2014-05-31 00:21:07 +00:00
|
|
|
unsigned width;
|
|
|
|
unsigned height;
|
2011-12-14 13:26:40 +00:00
|
|
|
GXTexObj obj;
|
2012-11-22 07:08:11 +00:00
|
|
|
} g_tex;
|
2011-12-14 13:26:40 +00:00
|
|
|
|
2012-11-22 07:08:11 +00:00
|
|
|
static struct
|
2012-08-07 02:30:18 +00:00
|
|
|
{
|
2012-09-12 04:17:33 +00:00
|
|
|
uint32_t data[240 * 200];
|
2012-08-07 02:30:18 +00:00
|
|
|
GXTexObj obj;
|
2012-08-07 04:04:17 +00:00
|
|
|
} menu_tex ATTRIBUTE_ALIGN(32);
|
2012-08-07 02:30:18 +00:00
|
|
|
|
2012-08-07 04:04:17 +00:00
|
|
|
uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32);
|
|
|
|
uint8_t display_list[1024] ATTRIBUTE_ALIGN(32);
|
2012-08-16 16:40:52 +00:00
|
|
|
uint16_t gx_width, gx_height;
|
2012-08-07 04:04:17 +00:00
|
|
|
size_t display_list_size;
|
2012-09-12 01:19:22 +00:00
|
|
|
GXRModeObj gx_mode;
|
|
|
|
unsigned gx_old_width, gx_old_height;
|
2011-12-14 13:26:40 +00:00
|
|
|
|
2014-06-04 03:34:47 +00:00
|
|
|
static u8 _gxtexmode0ids[8] = {0x80,0x81,0x82,0x83,0xA0,0xA1,0xA2,0xA3};
|
|
|
|
static u8 _gxtexmode1ids[8] = {0x84,0x85,0x86,0x87,0xA4,0xA5,0xA6,0xA7};
|
|
|
|
static u8 _gxteximg0ids[8] = {0x88,0x89,0x8A,0x8B,0xA8,0xA9,0xAA,0xAB};
|
|
|
|
static u8 _gxteximg3ids[8] = {0x94,0x95,0x96,0x97,0xB4,0xB5,0xB6,0xB7};
|
|
|
|
|
2012-08-07 22:36:47 +00:00
|
|
|
float verts[16] ATTRIBUTE_ALIGN(32) = {
|
|
|
|
-1, 1, -0.5,
|
2014-02-20 22:58:06 +00:00
|
|
|
1, 1, -0.5,
|
2012-08-07 22:36:47 +00:00
|
|
|
-1, -1, -0.5,
|
|
|
|
1, -1, -0.5,
|
|
|
|
};
|
|
|
|
|
2012-08-20 03:20:28 +00:00
|
|
|
float vertex_ptr[8] ATTRIBUTE_ALIGN(32) = {
|
2012-08-07 22:36:47 +00:00
|
|
|
0, 0,
|
2014-02-20 22:58:06 +00:00
|
|
|
1, 0,
|
2012-08-07 22:36:47 +00:00
|
|
|
0, 1,
|
|
|
|
1, 1,
|
|
|
|
};
|
|
|
|
|
2014-02-21 00:26:50 +00:00
|
|
|
u8 color_ptr[16] ATTRIBUTE_ALIGN(32) = {
|
|
|
|
0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
|
0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
|
0xFF, 0xFF, 0xFF, 0xFF,
|
|
|
|
0xFF, 0xFF, 0xFF, 0xFF,
|
2012-08-07 22:36:47 +00:00
|
|
|
};
|
|
|
|
|
2015-02-24 19:22:45 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GX_RESOLUTIONS_512_192 = 0,
|
|
|
|
GX_RESOLUTIONS_598_200,
|
|
|
|
GX_RESOLUTIONS_640_200,
|
|
|
|
GX_RESOLUTIONS_384_224,
|
|
|
|
GX_RESOLUTIONS_448_224,
|
|
|
|
GX_RESOLUTIONS_480_224,
|
|
|
|
GX_RESOLUTIONS_512_224,
|
|
|
|
GX_RESOLUTIONS_576_224,
|
|
|
|
GX_RESOLUTIONS_608_224,
|
|
|
|
GX_RESOLUTIONS_640_224,
|
|
|
|
GX_RESOLUTIONS_340_232,
|
|
|
|
GX_RESOLUTIONS_512_232,
|
|
|
|
GX_RESOLUTIONS_512_236,
|
|
|
|
GX_RESOLUTIONS_336_240,
|
|
|
|
GX_RESOLUTIONS_352_240,
|
|
|
|
GX_RESOLUTIONS_384_240,
|
|
|
|
GX_RESOLUTIONS_512_240,
|
|
|
|
GX_RESOLUTIONS_530_240,
|
|
|
|
GX_RESOLUTIONS_608_240,
|
|
|
|
GX_RESOLUTIONS_640_240,
|
|
|
|
GX_RESOLUTIONS_512_384,
|
|
|
|
GX_RESOLUTIONS_598_400,
|
|
|
|
GX_RESOLUTIONS_640_400,
|
|
|
|
GX_RESOLUTIONS_384_448,
|
|
|
|
GX_RESOLUTIONS_448_448,
|
|
|
|
GX_RESOLUTIONS_480_448,
|
|
|
|
GX_RESOLUTIONS_512_448,
|
|
|
|
GX_RESOLUTIONS_576_448,
|
|
|
|
GX_RESOLUTIONS_608_448,
|
|
|
|
GX_RESOLUTIONS_640_448,
|
|
|
|
GX_RESOLUTIONS_340_464,
|
|
|
|
GX_RESOLUTIONS_512_464,
|
|
|
|
GX_RESOLUTIONS_512_472,
|
|
|
|
GX_RESOLUTIONS_352_480,
|
|
|
|
GX_RESOLUTIONS_384_480,
|
|
|
|
GX_RESOLUTIONS_512_480,
|
|
|
|
GX_RESOLUTIONS_530_480,
|
|
|
|
GX_RESOLUTIONS_608_480,
|
|
|
|
GX_RESOLUTIONS_640_480,
|
|
|
|
GX_RESOLUTIONS_LAST,
|
|
|
|
};
|
|
|
|
|
2015-02-24 20:57:51 +00:00
|
|
|
static unsigned menu_current_gx_resolution = GX_RESOLUTIONS_640_480;
|
|
|
|
|
2015-02-24 19:22:45 +00:00
|
|
|
unsigned menu_gx_resolutions[GX_RESOLUTIONS_LAST][2] = {
|
|
|
|
{ 512, 192 },
|
|
|
|
{ 598, 200 },
|
|
|
|
{ 640, 200 },
|
|
|
|
{ 384, 224 },
|
|
|
|
{ 448, 224 },
|
|
|
|
{ 480, 224 },
|
|
|
|
{ 512, 224 },
|
|
|
|
{ 576, 224 },
|
|
|
|
{ 608, 224 },
|
|
|
|
{ 640, 224 },
|
|
|
|
{ 340, 232 },
|
|
|
|
{ 512, 232 },
|
|
|
|
{ 512, 236 },
|
|
|
|
{ 336, 240 },
|
|
|
|
{ 352, 240 },
|
|
|
|
{ 384, 240 },
|
|
|
|
{ 512, 240 },
|
|
|
|
{ 530, 240 },
|
|
|
|
{ 608, 240 },
|
|
|
|
{ 640, 240 },
|
|
|
|
{ 512, 384 },
|
|
|
|
{ 598, 400 },
|
|
|
|
{ 640, 400 },
|
|
|
|
{ 384, 448 },
|
|
|
|
{ 448, 448 },
|
|
|
|
{ 480, 448 },
|
|
|
|
{ 512, 448 },
|
|
|
|
{ 576, 448 },
|
|
|
|
{ 608, 448 },
|
|
|
|
{ 640, 448 },
|
|
|
|
{ 340, 464 },
|
|
|
|
{ 512, 464 },
|
|
|
|
{ 512, 472 },
|
|
|
|
{ 352, 480 },
|
|
|
|
{ 384, 480 },
|
|
|
|
{ 512, 480 },
|
|
|
|
{ 530, 480 },
|
|
|
|
{ 608, 480 },
|
|
|
|
{ 640, 480 },
|
|
|
|
};
|
|
|
|
|
|
|
|
extern unsigned menu_current_gx_resolution;
|
|
|
|
|
2012-09-12 01:19:22 +00:00
|
|
|
static void retrace_callback(u32 retrace_count)
|
|
|
|
{
|
|
|
|
(void)retrace_count;
|
|
|
|
g_draw_done = true;
|
2014-06-07 01:12:58 +00:00
|
|
|
OSSignalCond(g_video_cond);
|
2012-09-12 01:19:22 +00:00
|
|
|
}
|
|
|
|
|
2014-02-20 21:23:29 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
static void gx_render_overlay(void *data);
|
|
|
|
static void gx_free_overlay(gx_video_t *gx)
|
|
|
|
{
|
|
|
|
free(gx->overlay);
|
|
|
|
gx->overlay = NULL;
|
|
|
|
gx->overlays = 0;
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_InvalidateTexAll();
|
2014-02-20 21:23:29 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-02-24 20:57:51 +00:00
|
|
|
static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines,
|
|
|
|
bool fullscreen)
|
2012-09-12 01:19:22 +00:00
|
|
|
{
|
2013-11-01 17:12:06 +00:00
|
|
|
unsigned modetype, level, viHeightMultiplier, viWidth, tvmode,
|
|
|
|
max_width, max_height, i;
|
|
|
|
bool progressive;
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2015-02-13 18:11:53 +00:00
|
|
|
menu_handle_t *menu = menu_driver_resolve();
|
2014-05-28 15:55:05 +00:00
|
|
|
|
|
|
|
(void)level;
|
|
|
|
|
2013-11-01 17:12:06 +00:00
|
|
|
_CPU_ISR_Disable(level);
|
2014-06-07 01:50:47 +00:00
|
|
|
VISetBlack(true);
|
|
|
|
VIFlush();
|
2013-11-01 17:12:06 +00:00
|
|
|
viHeightMultiplier = 1;
|
2014-08-10 21:03:18 +00:00
|
|
|
viWidth = g_settings.video.viwidth;
|
2012-09-12 01:19:22 +00:00
|
|
|
#if defined(HW_RVL)
|
2013-11-01 17:12:06 +00:00
|
|
|
progressive = CONF_GetProgressiveScan() > 0 && VIDEO_HaveComponentCable();
|
2012-09-12 01:19:22 +00:00
|
|
|
switch (CONF_GetVideo())
|
|
|
|
{
|
|
|
|
case CONF_VIDEO_PAL:
|
|
|
|
if (CONF_GetEuRGB60() > 0)
|
|
|
|
tvmode = VI_EURGB60;
|
2012-12-23 20:43:20 +00:00
|
|
|
else
|
|
|
|
tvmode = VI_PAL;
|
2012-09-12 01:19:22 +00:00
|
|
|
break;
|
|
|
|
case CONF_VIDEO_MPAL:
|
|
|
|
tvmode = VI_MPAL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
tvmode = VI_NTSC;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#else
|
2013-11-01 17:12:06 +00:00
|
|
|
progressive = VIDEO_HaveComponentCable();
|
|
|
|
tvmode = VIDEO_GetCurrentTvMode();
|
2012-09-12 01:19:22 +00:00
|
|
|
#endif
|
|
|
|
switch (tvmode)
|
|
|
|
{
|
|
|
|
case VI_PAL:
|
|
|
|
max_width = VI_MAX_WIDTH_PAL;
|
2013-02-10 22:18:59 +00:00
|
|
|
max_height = /* VI_MAX_HEIGHT_PAL */ 574;
|
2012-09-12 01:19:22 +00:00
|
|
|
break;
|
|
|
|
case VI_MPAL:
|
|
|
|
max_width = VI_MAX_WIDTH_MPAL;
|
|
|
|
max_height = VI_MAX_HEIGHT_MPAL;
|
|
|
|
break;
|
|
|
|
case VI_EURGB60:
|
|
|
|
max_width = VI_MAX_WIDTH_NTSC;
|
|
|
|
max_height = VI_MAX_HEIGHT_NTSC;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
tvmode = VI_NTSC;
|
|
|
|
max_width = VI_MAX_WIDTH_EURGB60;
|
|
|
|
max_height = VI_MAX_HEIGHT_EURGB60;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-12-23 17:52:35 +00:00
|
|
|
if (lines == 0 || fbWidth == 0)
|
|
|
|
{
|
|
|
|
GXRModeObj tmp_mode;
|
|
|
|
VIDEO_GetPreferredMode(&tmp_mode);
|
|
|
|
fbWidth = tmp_mode.fbWidth;
|
|
|
|
lines = tmp_mode.xfbHeight;
|
|
|
|
}
|
|
|
|
|
2012-09-12 13:36:18 +00:00
|
|
|
if (lines <= max_height / 2)
|
|
|
|
{
|
|
|
|
modetype = VI_NON_INTERLACE;
|
|
|
|
viHeightMultiplier = 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
modetype = (progressive) ? VI_PROGRESSIVE : VI_INTERLACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lines > max_height)
|
|
|
|
lines = max_height;
|
2012-11-28 14:36:04 +00:00
|
|
|
|
2012-09-12 13:36:18 +00:00
|
|
|
if (fbWidth > max_width)
|
2012-11-28 14:36:04 +00:00
|
|
|
fbWidth = max_width;
|
2012-09-12 01:19:22 +00:00
|
|
|
|
|
|
|
gx_mode.viTVMode = VI_TVMODE(tvmode, modetype);
|
|
|
|
gx_mode.fbWidth = fbWidth;
|
2013-02-06 04:11:35 +00:00
|
|
|
gx_mode.efbHeight = min(lines, 480);
|
2013-02-06 02:36:15 +00:00
|
|
|
|
2013-02-09 17:49:43 +00:00
|
|
|
if (modetype == VI_NON_INTERLACE && lines > max_height / 2)
|
|
|
|
gx_mode.xfbHeight = max_height / 2;
|
|
|
|
else if (modetype != VI_NON_INTERLACE && lines > max_height)
|
|
|
|
gx_mode.xfbHeight = max_height;
|
2012-09-12 01:19:22 +00:00
|
|
|
else
|
2013-02-06 02:36:15 +00:00
|
|
|
gx_mode.xfbHeight = lines;
|
2012-11-28 14:36:04 +00:00
|
|
|
|
2013-02-06 02:36:15 +00:00
|
|
|
gx_mode.viWidth = viWidth;
|
|
|
|
gx_mode.viHeight = gx_mode.xfbHeight * viHeightMultiplier;
|
|
|
|
gx_mode.viXOrigin = (max_width - gx_mode.viWidth) / 2;
|
2014-09-09 04:59:17 +00:00
|
|
|
gx_mode.viYOrigin =
|
|
|
|
(max_height - gx_mode.viHeight) / (2 * viHeightMultiplier);
|
2012-09-12 01:19:22 +00:00
|
|
|
gx_mode.xfbMode = modetype == VI_INTERLACE ? VI_XFBMODE_DF : VI_XFBMODE_SF;
|
|
|
|
gx_mode.field_rendering = GX_FALSE;
|
|
|
|
gx_mode.aa = GX_FALSE;
|
|
|
|
|
2013-11-01 17:12:06 +00:00
|
|
|
for (i = 0; i < 12; i++)
|
2012-09-12 01:19:22 +00:00
|
|
|
gx_mode.sample_pattern[i][0] = gx_mode.sample_pattern[i][1] = 6;
|
|
|
|
|
|
|
|
if (modetype == VI_INTERLACE)
|
|
|
|
{
|
|
|
|
gx_mode.vfilter[0] = 8;
|
|
|
|
gx_mode.vfilter[1] = 8;
|
|
|
|
gx_mode.vfilter[2] = 10;
|
|
|
|
gx_mode.vfilter[3] = 12;
|
|
|
|
gx_mode.vfilter[4] = 10;
|
|
|
|
gx_mode.vfilter[5] = 8;
|
|
|
|
gx_mode.vfilter[6] = 8;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gx_mode.vfilter[0] = 0;
|
|
|
|
gx_mode.vfilter[1] = 0;
|
|
|
|
gx_mode.vfilter[2] = 21;
|
|
|
|
gx_mode.vfilter[3] = 22;
|
|
|
|
gx_mode.vfilter[4] = 21;
|
|
|
|
gx_mode.vfilter[5] = 0;
|
|
|
|
gx_mode.vfilter[6] = 0;
|
|
|
|
}
|
|
|
|
|
2013-03-10 19:33:32 +00:00
|
|
|
gx->vp.full_width = gx_mode.fbWidth;
|
|
|
|
gx->vp.full_height = gx_mode.xfbHeight;
|
2012-12-23 17:52:35 +00:00
|
|
|
gx->double_strike = (modetype == VI_NON_INTERLACE);
|
2012-09-12 01:19:22 +00:00
|
|
|
gx->should_resize = true;
|
|
|
|
|
2014-06-07 01:50:47 +00:00
|
|
|
VIConfigure(&gx_mode);
|
2012-09-12 13:36:18 +00:00
|
|
|
VIDEO_ClearFrameBuffer(&gx_mode, g_framebuf[0], COLOR_BLACK);
|
|
|
|
VIDEO_ClearFrameBuffer(&gx_mode, g_framebuf[1], COLOR_BLACK);
|
2014-06-07 01:50:47 +00:00
|
|
|
VISetNextFrameBuffer(g_framebuf[0]);
|
|
|
|
VISetPostRetraceCallback(retrace_callback);
|
|
|
|
VISetBlack(false);
|
|
|
|
VIFlush();
|
2012-09-12 01:19:22 +00:00
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetViewportJitter(0, 0, gx_mode.fbWidth, gx_mode.efbHeight, 0, 1, 1);
|
|
|
|
GX_SetDispCopySrc(0, 0, gx_mode.fbWidth, gx_mode.efbHeight);
|
2013-02-06 02:36:15 +00:00
|
|
|
|
|
|
|
f32 y_scale = GX_GetYScaleFactor(gx_mode.efbHeight, gx_mode.xfbHeight);
|
2014-06-07 01:50:47 +00:00
|
|
|
u16 xfbWidth = VIPadFrameBufferWidth(gx_mode.fbWidth);
|
2013-02-06 02:36:15 +00:00
|
|
|
u16 xfbHeight = GX_SetDispCopyYScale(y_scale);
|
2014-02-19 20:01:36 +00:00
|
|
|
(void)xfbHeight;
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetDispCopyDst(xfbWidth, xfbHeight);
|
2013-02-06 02:36:15 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_SetCopyFilter(gx_mode.aa, gx_mode.sample_pattern,
|
2014-10-04 05:09:30 +00:00
|
|
|
(gx_mode.xfbMode == VI_XFBMODE_SF) ? GX_FALSE : g_settings.video.vfilter,
|
2012-09-12 01:19:22 +00:00
|
|
|
gx_mode.vfilter);
|
2014-02-20 00:40:38 +00:00
|
|
|
GXColor color = { 0, 0, 0, 0xff };
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetCopyClear(color, GX_MAX_Z24);
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_SetFieldMode(gx_mode.field_rendering,
|
|
|
|
(gx_mode.viHeight == 2 * gx_mode.xfbHeight) ? GX_ENABLE : GX_DISABLE);
|
2012-09-12 01:19:22 +00:00
|
|
|
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_InvalidateTexAll();
|
|
|
|
GX_Flush();
|
2013-11-07 22:47:28 +00:00
|
|
|
_CPU_ISR_Restore(level);
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
RARCH_LOG("GX Resolution: %dx%d (%s)\n", gx_mode.fbWidth,
|
|
|
|
gx_mode.efbHeight, (gx_mode.viTVMode & 3) == VI_INTERLACE
|
|
|
|
? "interlaced" : "progressive");
|
2013-11-07 22:47:28 +00:00
|
|
|
|
2015-02-13 18:11:53 +00:00
|
|
|
if (menu)
|
2013-11-07 22:47:28 +00:00
|
|
|
{
|
2015-02-13 18:11:53 +00:00
|
|
|
menu->frame_buf.height = gx_mode.efbHeight / (gx->double_strike ? 1 : 2);
|
|
|
|
menu->frame_buf.height &= ~3;
|
|
|
|
if (menu->frame_buf.height > 240)
|
|
|
|
menu->frame_buf.height = 240;
|
|
|
|
|
|
|
|
menu->frame_buf.width = gx_mode.fbWidth / (gx_mode.fbWidth < 400 ? 1 : 2);
|
|
|
|
menu->frame_buf.width &= ~3;
|
|
|
|
if (menu->frame_buf.width > 400)
|
|
|
|
menu->frame_buf.width = 400;
|
2013-11-07 22:47:28 +00:00
|
|
|
}
|
2012-09-12 01:19:22 +00:00
|
|
|
|
2012-12-23 20:43:20 +00:00
|
|
|
if (tvmode == VI_PAL)
|
|
|
|
{
|
|
|
|
if (modetype == VI_NON_INTERLACE)
|
2015-01-18 18:01:13 +00:00
|
|
|
driver_set_refresh_rate(50.0801f);
|
2012-12-23 20:43:20 +00:00
|
|
|
else
|
2015-01-18 18:01:13 +00:00
|
|
|
driver_set_refresh_rate(50.0f);
|
2012-12-23 20:43:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (modetype == VI_NON_INTERLACE)
|
2015-01-18 18:01:13 +00:00
|
|
|
driver_set_refresh_rate(59.8261f);
|
2012-12-23 20:43:20 +00:00
|
|
|
else
|
2015-01-18 18:01:13 +00:00
|
|
|
driver_set_refresh_rate(59.94f);
|
2012-12-23 20:43:20 +00:00
|
|
|
}
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
/* Don't spam the queue when scrolling through resolutions. */
|
2013-11-07 22:47:28 +00:00
|
|
|
msg_queue_clear(g_extern.msg_queue);
|
|
|
|
|
2012-09-12 01:19:22 +00:00
|
|
|
g_current_framebuf = 0;
|
|
|
|
}
|
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
static void gx_set_aspect_ratio(void *data, unsigned aspect_ratio_idx)
|
2012-08-16 16:40:52 +00:00
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
if (aspect_ratio_idx == ASPECT_RATIO_SQUARE)
|
2015-01-18 22:59:57 +00:00
|
|
|
video_viewport_set_square_pixel(
|
2014-09-09 04:59:17 +00:00
|
|
|
g_extern.system.av_info.geometry.base_width,
|
|
|
|
g_extern.system.av_info.geometry.base_height);
|
2013-04-20 08:56:04 +00:00
|
|
|
else if (aspect_ratio_idx == ASPECT_RATIO_CORE)
|
2015-01-18 22:59:57 +00:00
|
|
|
video_viewport_set_core();
|
2013-04-20 08:56:04 +00:00
|
|
|
else if (aspect_ratio_idx == ASPECT_RATIO_CONFIG)
|
2015-01-18 22:59:57 +00:00
|
|
|
video_viewport_set_config();
|
2012-08-16 16:40:52 +00:00
|
|
|
|
2013-04-20 08:56:04 +00:00
|
|
|
g_extern.system.aspect_ratio = aspectratio_lut[aspect_ratio_idx].value;
|
2014-05-28 22:57:40 +00:00
|
|
|
|
|
|
|
if (gx)
|
|
|
|
{
|
|
|
|
gx->keep_aspect = true;
|
|
|
|
gx->should_resize = true;
|
|
|
|
}
|
2012-08-16 16:40:52 +00:00
|
|
|
}
|
|
|
|
|
2013-11-01 17:12:06 +00:00
|
|
|
static void setup_video_mode(void *data)
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
2014-05-28 22:57:40 +00:00
|
|
|
unsigned i;
|
2014-05-31 00:21:07 +00:00
|
|
|
if (!g_framebuf[0])
|
|
|
|
for (i = 0; i < 2; i++)
|
2014-09-09 04:59:17 +00:00
|
|
|
g_framebuf[i] = MEM_K0_TO_K1(
|
|
|
|
memalign(32, 640 * 576 * VI_DISPLAY_PIX_SZ));
|
2011-12-14 20:44:03 +00:00
|
|
|
|
2012-06-25 19:27:41 +00:00
|
|
|
g_current_framebuf = 0;
|
|
|
|
g_draw_done = true;
|
2012-08-20 03:20:28 +00:00
|
|
|
g_orientation = ORIENTATION_NORMAL;
|
2014-06-07 01:12:58 +00:00
|
|
|
OSInitThreadQueue(&g_video_cond);
|
2012-09-12 01:19:22 +00:00
|
|
|
|
2012-09-12 13:36:18 +00:00
|
|
|
VIDEO_GetPreferredMode(&gx_mode);
|
2015-02-24 20:57:51 +00:00
|
|
|
gx_set_video_mode(data, 0, 0, true);
|
2011-12-14 13:26:40 +00:00
|
|
|
}
|
|
|
|
|
2013-11-01 17:12:06 +00:00
|
|
|
static void init_texture(void *data, unsigned width, unsigned height)
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
2014-06-10 00:15:29 +00:00
|
|
|
unsigned g_filter, menu_w, menu_h;
|
2013-04-19 14:09:37 +00:00
|
|
|
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
|
2014-02-19 20:50:44 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-05-28 15:55:05 +00:00
|
|
|
struct __gx_texobj *fb_ptr = (struct __gx_texobj*)&g_tex.obj;
|
|
|
|
struct __gx_texobj *menu_ptr = (struct __gx_texobj*)&menu_tex.obj;
|
2015-02-13 22:41:34 +00:00
|
|
|
menu_handle_t *menu = menu_driver_resolve();
|
2014-02-19 20:50:44 +00:00
|
|
|
|
2013-02-03 02:47:27 +00:00
|
|
|
width &= ~3;
|
|
|
|
height &= ~3;
|
2014-02-19 20:50:44 +00:00
|
|
|
g_filter = g_settings.video.smooth ? GX_LINEAR : GX_NEAR;
|
2014-06-10 00:15:29 +00:00
|
|
|
menu_w = 320;
|
|
|
|
menu_h = 240;
|
2013-11-07 22:47:28 +00:00
|
|
|
|
2015-02-13 22:41:34 +00:00
|
|
|
if (menu)
|
2013-11-07 22:47:28 +00:00
|
|
|
{
|
2015-02-13 22:41:34 +00:00
|
|
|
menu_w = menu->frame_buf.width;
|
|
|
|
menu_h = menu->frame_buf.height;
|
2013-11-07 22:47:28 +00:00
|
|
|
}
|
2012-09-12 01:19:22 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
__GX_InitTexObj(fb_ptr, g_tex.data, width, height,
|
|
|
|
(gx->rgb32) ? GX_TF_RGBA8 : gx->menu_texture_enable ?
|
|
|
|
GX_TF_RGB5A3 : GX_TF_RGB565,
|
|
|
|
GX_CLAMP, GX_CLAMP, GX_FALSE);
|
2014-02-22 21:07:23 +00:00
|
|
|
__GX_InitTexObjFilterMode(fb_ptr, g_filter, g_filter);
|
2014-09-09 04:59:17 +00:00
|
|
|
__GX_InitTexObj(menu_ptr, menu_tex.data, menu_w, menu_h,
|
|
|
|
GX_TF_RGB5A3, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
2014-02-22 21:07:23 +00:00
|
|
|
__GX_InitTexObjFilterMode(menu_ptr, g_filter, g_filter);
|
|
|
|
__GX_InvalidateTexAll(__gx);
|
2012-09-12 01:19:22 +00:00
|
|
|
}
|
2011-12-14 20:44:03 +00:00
|
|
|
|
2014-05-31 00:21:07 +00:00
|
|
|
static void init_vtx(void *data, const video_info_t *video)
|
2012-09-12 01:19:22 +00:00
|
|
|
{
|
2014-05-31 00:21:07 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-02-22 16:04:29 +00:00
|
|
|
|
|
|
|
GX_SetCullMode(GX_CULL_NONE);
|
|
|
|
GX_SetClipMode(GX_CLIP_DISABLE);
|
2011-12-14 13:26:40 +00:00
|
|
|
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetZMode(GX_ENABLE, GX_ALWAYS, GX_ENABLE);
|
|
|
|
GX_SetColorUpdate(GX_TRUE);
|
|
|
|
GX_SetAlphaUpdate(GX_FALSE);
|
2011-12-14 13:26:40 +00:00
|
|
|
|
2011-12-14 20:44:03 +00:00
|
|
|
Mtx44 m;
|
2011-12-14 23:28:47 +00:00
|
|
|
guOrtho(m, 1, -1, -1, 1, 0.4, 0.6);
|
2011-12-14 13:26:40 +00:00
|
|
|
GX_LoadProjectionMtx(m, GX_ORTHOGRAPHIC);
|
2011-12-14 20:44:03 +00:00
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_ClearVtxDesc();
|
|
|
|
GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
|
|
|
|
GX_SetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
|
|
|
GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX8);
|
2011-12-14 13:26:40 +00:00
|
|
|
|
|
|
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
|
|
|
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
2014-02-21 00:26:50 +00:00
|
|
|
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetArray(GX_VA_POS, verts, 3 * sizeof(float));
|
|
|
|
GX_SetArray(GX_VA_TEX0, vertex_ptr, 2 * sizeof(float));
|
|
|
|
GX_SetArray(GX_VA_CLR0, color_ptr, 4 * sizeof(u8));
|
2011-12-14 13:26:40 +00:00
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetNumTexGens(1);
|
|
|
|
GX_SetNumChans(1);
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_SetChanCtrl(GX_COLOR0A0, GX_DISABLE, GX_SRC_REG,
|
|
|
|
GX_SRC_VTX, GX_LIGHTNULL, GX_DF_NONE, GX_AF_NONE);
|
2014-02-21 00:26:50 +00:00
|
|
|
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
|
|
|
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_InvVtxCache();
|
2011-12-14 21:29:12 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA,
|
|
|
|
GX_BL_INVSRCALPHA, GX_LO_CLEAR);
|
2014-02-19 20:50:44 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
if (gx->scale != video->input_scale ||
|
|
|
|
gx->rgb32 != video->rgb32)
|
2014-05-31 00:21:07 +00:00
|
|
|
{
|
|
|
|
RARCH_LOG("[GX] reallocate texture\n");
|
|
|
|
free(g_tex.data);
|
2014-09-09 04:59:17 +00:00
|
|
|
g_tex.data = memalign(32,
|
|
|
|
RARCH_SCALE_BASE * RARCH_SCALE_BASE * video->input_scale *
|
|
|
|
video->input_scale * (video->rgb32 ? 4 : 2));
|
2014-05-31 00:21:07 +00:00
|
|
|
g_tex.width = g_tex.height = RARCH_SCALE_BASE * video->input_scale;
|
|
|
|
|
|
|
|
if (!g_tex.data)
|
|
|
|
{
|
|
|
|
RARCH_ERR("[GX] Error allocating video texture\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
DCFlushRange(g_tex.data, g_tex.width *
|
|
|
|
g_tex.height * video->rgb32 ? 4 : 2);
|
2014-05-31 00:21:07 +00:00
|
|
|
|
|
|
|
gx->rgb32 = video->rgb32;
|
|
|
|
gx->scale = video->input_scale;
|
|
|
|
gx->should_resize = true;
|
|
|
|
|
|
|
|
init_texture(data, g_tex.width, g_tex.height);
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_Flush();
|
2011-12-14 13:26:40 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
static void build_disp_list(void)
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
|
|
|
DCInvalidateRange(display_list, sizeof(display_list));
|
|
|
|
GX_BeginDispList(display_list, sizeof(display_list));
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 4);
|
2011-12-14 13:26:40 +00:00
|
|
|
for (unsigned i = 0; i < 4; i++)
|
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_Position1x8(i);
|
|
|
|
GX_Color1x8(i);
|
|
|
|
GX_TexCoord1x8(i);
|
2011-12-14 13:26:40 +00:00
|
|
|
}
|
|
|
|
GX_End();
|
|
|
|
display_list_size = GX_EndDispList();
|
|
|
|
}
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
#if 0
|
|
|
|
#define TAKE_EFB_SCREENSHOT_ON_EXIT
|
|
|
|
#endif
|
2012-08-24 20:51:11 +00:00
|
|
|
|
2012-08-25 03:31:58 +00:00
|
|
|
#ifdef TAKE_EFB_SCREENSHOT_ON_EXIT
|
2012-08-24 20:51:11 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
/* Adapted from code by Crayon for GRRLIB (http://code.google.com/p/grrlib) */
|
2013-01-03 02:02:52 +00:00
|
|
|
static void gx_efb_screenshot(void)
|
2012-08-24 20:51:11 +00:00
|
|
|
{
|
2012-08-25 03:31:58 +00:00
|
|
|
int x, y;
|
2012-08-24 20:51:11 +00:00
|
|
|
|
|
|
|
uint8_t tga_header[] = {0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0xE0, 0x01, 0x18, 0x00};
|
|
|
|
FILE *out = fopen("/screenshot.tga", "wb");
|
|
|
|
|
|
|
|
if (!out)
|
|
|
|
return;
|
2012-08-25 03:31:58 +00:00
|
|
|
|
2012-08-24 20:51:11 +00:00
|
|
|
fwrite(tga_header, 1, sizeof(tga_header), out);
|
2012-08-25 03:31:58 +00:00
|
|
|
|
|
|
|
for (y = 479; y >= 0; --y)
|
2012-08-24 20:51:11 +00:00
|
|
|
{
|
2012-08-25 03:31:58 +00:00
|
|
|
uint8_t line[640 * 3];
|
|
|
|
unsigned i = 0;
|
|
|
|
for (x = 0; x < 640; x++)
|
|
|
|
{
|
|
|
|
GXColor color;
|
|
|
|
GX_PeekARGB(x, y, &color);
|
|
|
|
line[i++] = color.b;
|
|
|
|
line[i++] = color.g;
|
|
|
|
line[i++] = color.r;
|
|
|
|
}
|
|
|
|
fwrite(line, 1, sizeof(line), out);
|
2012-08-24 20:51:11 +00:00
|
|
|
}
|
|
|
|
|
2012-08-25 03:31:58 +00:00
|
|
|
fclose(out);
|
2012-08-24 20:51:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2012-08-09 01:54:27 +00:00
|
|
|
static void *gx_init(const video_info_t *video,
|
2012-01-07 23:57:44 +00:00
|
|
|
const input_driver_t **input, void **input_data)
|
|
|
|
{
|
2012-08-07 17:12:51 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)calloc(1, sizeof(gx_video_t));
|
|
|
|
if (!gx)
|
|
|
|
return NULL;
|
2013-11-01 15:33:32 +00:00
|
|
|
|
|
|
|
void *gxinput = input_gx.init();
|
|
|
|
*input = gxinput ? &input_gx : NULL;
|
|
|
|
*input_data = gxinput;
|
|
|
|
|
2014-06-07 01:50:47 +00:00
|
|
|
VIInit();
|
2013-11-01 17:12:06 +00:00
|
|
|
GX_Init(gx_fifo, sizeof(gx_fifo));
|
2014-05-29 21:59:59 +00:00
|
|
|
g_vsync = video->vsync;
|
2013-11-01 17:12:06 +00:00
|
|
|
|
|
|
|
setup_video_mode(gx);
|
2014-05-31 00:21:07 +00:00
|
|
|
init_vtx(gx, video);
|
2014-02-22 16:04:29 +00:00
|
|
|
build_disp_list();
|
2013-11-01 17:12:06 +00:00
|
|
|
|
|
|
|
gx->vp.full_width = gx_mode.fbWidth;
|
|
|
|
gx->vp.full_height = gx_mode.xfbHeight;
|
|
|
|
gx->should_resize = true;
|
|
|
|
gx_old_width = gx_old_height = 0;
|
|
|
|
|
2012-08-07 17:12:51 +00:00
|
|
|
return gx;
|
|
|
|
}
|
|
|
|
|
2013-02-03 02:51:55 +00:00
|
|
|
#define ASM_BLITTER
|
2012-07-28 19:15:47 +00:00
|
|
|
|
2012-08-10 18:48:56 +00:00
|
|
|
#ifdef ASM_BLITTER
|
|
|
|
|
2012-12-19 04:04:26 +00:00
|
|
|
static void update_texture_asm(const uint32_t *src, const uint32_t *dst,
|
2012-10-21 22:54:27 +00:00
|
|
|
unsigned width, unsigned height, unsigned pitch)
|
2012-06-25 19:27:41 +00:00
|
|
|
{
|
2014-09-09 04:59:17 +00:00
|
|
|
register uint32_t tmp0, tmp1, tmp2, tmp3, line2, line2b,
|
|
|
|
line3, line3b, line4, line4b, line5;
|
2012-06-25 19:27:41 +00:00
|
|
|
|
2012-12-19 04:04:26 +00:00
|
|
|
asm volatile (
|
2012-06-25 19:27:41 +00:00
|
|
|
" srwi %[width], %[width], 2 \n"
|
|
|
|
" srwi %[height], %[height], 2 \n"
|
|
|
|
" subi %[tmp3], %[dst], 4 \n"
|
|
|
|
" mr %[dst], %[tmp3] \n"
|
|
|
|
" subi %[dst], %[dst], 4 \n"
|
|
|
|
" mr %[line2], %[pitch] \n"
|
|
|
|
" addi %[line2b], %[line2], 4 \n"
|
|
|
|
" mulli %[line3], %[pitch], 2 \n"
|
|
|
|
" addi %[line3b], %[line3], 4 \n"
|
|
|
|
" mulli %[line4], %[pitch], 3 \n"
|
|
|
|
" addi %[line4b], %[line4], 4 \n"
|
|
|
|
" mulli %[line5], %[pitch], 4 \n"
|
|
|
|
|
|
|
|
"2: mtctr %[width] \n"
|
|
|
|
" mr %[tmp0], %[src] \n"
|
|
|
|
|
|
|
|
"1: lwz %[tmp1], 0(%[src]) \n"
|
|
|
|
" stwu %[tmp1], 8(%[dst]) \n"
|
|
|
|
" lwz %[tmp2], 4(%[src]) \n"
|
|
|
|
" stwu %[tmp2], 8(%[tmp3]) \n"
|
|
|
|
|
|
|
|
" lwzx %[tmp1], %[line2], %[src] \n"
|
|
|
|
" stwu %[tmp1], 8(%[dst]) \n"
|
|
|
|
" lwzx %[tmp2], %[line2b], %[src] \n"
|
|
|
|
" stwu %[tmp2], 8(%[tmp3]) \n"
|
|
|
|
|
|
|
|
" lwzx %[tmp1], %[line3], %[src] \n"
|
|
|
|
" stwu %[tmp1], 8(%[dst]) \n"
|
|
|
|
" lwzx %[tmp2], %[line3b], %[src] \n"
|
|
|
|
" stwu %[tmp2], 8(%[tmp3]) \n"
|
|
|
|
|
|
|
|
" lwzx %[tmp1], %[line4], %[src] \n"
|
|
|
|
" stwu %[tmp1], 8(%[dst]) \n"
|
|
|
|
" lwzx %[tmp2], %[line4b], %[src] \n"
|
|
|
|
" stwu %[tmp2], 8(%[tmp3]) \n"
|
|
|
|
|
|
|
|
" addi %[src], %[src], 8 \n"
|
|
|
|
" bdnz 1b \n"
|
|
|
|
|
|
|
|
" add %[src], %[tmp0], %[line5] \n"
|
|
|
|
" subic. %[height], %[height], 1 \n"
|
|
|
|
" bne 2b \n"
|
|
|
|
: [tmp0] "=&b" (tmp0),
|
|
|
|
[tmp1] "=&b" (tmp1),
|
|
|
|
[tmp2] "=&b" (tmp2),
|
|
|
|
[tmp3] "=&b" (tmp3),
|
|
|
|
[line2] "=&b" (line2),
|
|
|
|
[line2b] "=&b" (line2b),
|
|
|
|
[line3] "=&b" (line3),
|
|
|
|
[line3b] "=&b" (line3b),
|
|
|
|
[line4] "=&b" (line4),
|
|
|
|
[line4b] "=&b" (line4b),
|
|
|
|
[line5] "=&b" (line5),
|
2012-12-19 04:04:26 +00:00
|
|
|
[dst] "+&b" (dst)
|
2012-06-25 19:27:41 +00:00
|
|
|
: [src] "b" (src),
|
|
|
|
[width] "b" (width),
|
|
|
|
[height] "b" (height),
|
2012-10-21 22:54:27 +00:00
|
|
|
[pitch] "b" (pitch)
|
2012-11-22 07:08:11 +00:00
|
|
|
: "cc"
|
2012-06-25 19:27:41 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2012-07-28 19:15:47 +00:00
|
|
|
#endif
|
|
|
|
|
2012-12-19 03:15:31 +00:00
|
|
|
#define BLIT_LINE_16(off) \
|
2012-04-14 14:41:01 +00:00
|
|
|
{ \
|
2012-12-19 03:15:31 +00:00
|
|
|
const uint32_t *tmp_src = src; \
|
2012-01-02 13:50:03 +00:00
|
|
|
uint32_t *tmp_dst = dst; \
|
2014-02-21 04:50:13 +00:00
|
|
|
for (unsigned x = 0; x < width2 >> 1; x++, tmp_src += 2, tmp_dst += 8) \
|
2012-04-14 14:41:01 +00:00
|
|
|
{ \
|
2012-12-23 17:31:46 +00:00
|
|
|
tmp_dst[ 0 + off] = BLIT_LINE_16_CONV(tmp_src[0]); \
|
|
|
|
tmp_dst[ 1 + off] = BLIT_LINE_16_CONV(tmp_src[1]); \
|
2012-04-14 14:41:01 +00:00
|
|
|
} \
|
2012-12-19 03:15:31 +00:00
|
|
|
src += tmp_pitch; \
|
2012-08-07 02:30:18 +00:00
|
|
|
}
|
|
|
|
|
2012-12-19 03:15:31 +00:00
|
|
|
#define BLIT_LINE_32(off) \
|
|
|
|
{ \
|
|
|
|
const uint16_t *tmp_src = src; \
|
|
|
|
uint16_t *tmp_dst = dst; \
|
2014-02-21 04:50:13 +00:00
|
|
|
for (unsigned x = 0; x < width2 >> 3; x++, tmp_src += 8, tmp_dst += 32) \
|
2012-12-19 03:15:31 +00:00
|
|
|
{ \
|
|
|
|
tmp_dst[ 0 + off] = tmp_src[0] | 0xFF00; \
|
|
|
|
tmp_dst[ 16 + off] = tmp_src[1]; \
|
|
|
|
tmp_dst[ 1 + off] = tmp_src[2] | 0xFF00; \
|
|
|
|
tmp_dst[ 17 + off] = tmp_src[3]; \
|
|
|
|
tmp_dst[ 2 + off] = tmp_src[4] | 0xFF00; \
|
|
|
|
tmp_dst[ 18 + off] = tmp_src[5]; \
|
|
|
|
tmp_dst[ 3 + off] = tmp_src[6] | 0xFF00; \
|
|
|
|
tmp_dst[ 19 + off] = tmp_src[7]; \
|
|
|
|
} \
|
|
|
|
src += tmp_pitch; \
|
|
|
|
}
|
|
|
|
|
2012-12-19 04:04:26 +00:00
|
|
|
static void convert_texture16(const uint32_t *_src, uint32_t *_dst,
|
|
|
|
unsigned width, unsigned height, unsigned pitch)
|
2012-04-14 14:41:01 +00:00
|
|
|
{
|
2012-08-25 01:29:05 +00:00
|
|
|
#ifdef ASM_BLITTER
|
2012-12-19 03:16:04 +00:00
|
|
|
width &= ~3;
|
|
|
|
height &= ~3;
|
|
|
|
update_texture_asm(_src, _dst, width, height, pitch);
|
2012-08-25 01:29:05 +00:00
|
|
|
#else
|
2013-02-03 02:47:27 +00:00
|
|
|
width &= ~3;
|
2012-12-19 03:16:04 +00:00
|
|
|
height &= ~3;
|
|
|
|
unsigned tmp_pitch = pitch >> 2;
|
|
|
|
unsigned width2 = width >> 1;
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
/* Texture data is 4x4 tiled @ 16bpp.
|
|
|
|
* Use 32-bit to transfer more data per cycle.
|
|
|
|
*/
|
2012-12-23 17:31:46 +00:00
|
|
|
const uint32_t *src = _src;
|
2012-12-19 03:16:04 +00:00
|
|
|
uint32_t *dst = _dst;
|
|
|
|
for (unsigned i = 0; i < height; i += 4, dst += 4 * width2)
|
|
|
|
{
|
2012-12-23 17:31:46 +00:00
|
|
|
#define BLIT_LINE_16_CONV(x) x
|
2012-12-19 03:15:31 +00:00
|
|
|
BLIT_LINE_16(0)
|
|
|
|
BLIT_LINE_16(2)
|
|
|
|
BLIT_LINE_16(4)
|
|
|
|
BLIT_LINE_16(6)
|
2012-12-23 17:31:46 +00:00
|
|
|
#undef BLIT_LINE_16_CONV
|
2012-08-07 02:30:18 +00:00
|
|
|
}
|
2012-12-19 03:16:04 +00:00
|
|
|
#endif
|
2012-12-19 04:04:26 +00:00
|
|
|
}
|
2012-08-07 02:30:18 +00:00
|
|
|
|
2012-12-23 17:31:46 +00:00
|
|
|
static void convert_texture16_conv(const uint32_t *_src, uint32_t *_dst,
|
|
|
|
unsigned width, unsigned height, unsigned pitch)
|
|
|
|
{
|
2014-05-28 22:57:40 +00:00
|
|
|
unsigned i, tmp_pitch, width2;
|
2013-02-03 02:47:27 +00:00
|
|
|
width &= ~3;
|
2012-12-23 17:31:46 +00:00
|
|
|
height &= ~3;
|
2014-05-28 22:57:40 +00:00
|
|
|
tmp_pitch = pitch >> 2;
|
|
|
|
width2 = width >> 1;
|
2012-12-23 17:31:46 +00:00
|
|
|
|
2014-05-28 22:57:40 +00:00
|
|
|
const uint32_t *src = (const uint32_t*)_src;
|
|
|
|
uint32_t *dst = (uint32_t*)_dst;
|
|
|
|
for (i = 0; i < height; i += 4, dst += 4 * width2)
|
2012-12-23 17:31:46 +00:00
|
|
|
{
|
|
|
|
#define BLIT_LINE_16_CONV(x) (0x80008000 | (((x) & 0xFFC0FFC0) >> 1) | ((x) & 0x001F001F))
|
|
|
|
BLIT_LINE_16(0)
|
|
|
|
BLIT_LINE_16(2)
|
|
|
|
BLIT_LINE_16(4)
|
|
|
|
BLIT_LINE_16(6)
|
|
|
|
#undef BLIT_LINE_16_CONV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-19 04:04:26 +00:00
|
|
|
static void convert_texture32(const uint32_t *_src, uint32_t *_dst,
|
|
|
|
unsigned width, unsigned height, unsigned pitch)
|
|
|
|
{
|
2014-05-28 22:57:40 +00:00
|
|
|
unsigned i, tmp_pitch, width2;
|
2013-02-03 02:47:27 +00:00
|
|
|
width &= ~3;
|
2012-12-19 04:04:26 +00:00
|
|
|
height &= ~3;
|
2014-05-28 22:57:40 +00:00
|
|
|
tmp_pitch = pitch >> 1;
|
|
|
|
width2 = width << 1;
|
2012-12-19 04:04:26 +00:00
|
|
|
|
|
|
|
const uint16_t *src = (uint16_t *) _src;
|
|
|
|
uint16_t *dst = (uint16_t *) _dst;
|
2014-05-28 22:57:40 +00:00
|
|
|
for (i = 0; i < height; i += 4, dst += 4 * width2)
|
2012-12-19 04:04:26 +00:00
|
|
|
{
|
|
|
|
BLIT_LINE_32(0)
|
|
|
|
BLIT_LINE_32(4)
|
|
|
|
BLIT_LINE_32(8)
|
|
|
|
BLIT_LINE_32(12)
|
|
|
|
}
|
2012-11-22 07:08:11 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
static void gx_resize(void *data)
|
2012-08-16 16:40:52 +00:00
|
|
|
{
|
2013-01-03 02:02:52 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
|
|
|
|
2012-08-21 02:50:15 +00:00
|
|
|
int x = 0, y = 0;
|
2013-03-10 19:33:32 +00:00
|
|
|
unsigned width = gx->vp.full_width, height = gx->vp.full_height;
|
2013-02-14 14:47:52 +00:00
|
|
|
|
2012-08-16 16:40:52 +00:00
|
|
|
#ifdef HW_RVL
|
2014-08-31 01:38:21 +00:00
|
|
|
VIDEO_SetTrapFilter(g_extern.console.softfilter_enable);
|
2012-08-16 16:40:52 +00:00
|
|
|
#endif
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetDispCopyGamma(g_extern.console.screen.gamma_correction);
|
2012-08-16 16:40:52 +00:00
|
|
|
|
2015-02-05 20:19:00 +00:00
|
|
|
if (gx->keep_aspect && gx_mode.efbHeight >= 240) /* ignore this for custom resolutions */
|
2012-08-16 16:40:52 +00:00
|
|
|
{
|
2013-03-17 21:05:15 +00:00
|
|
|
float desired_aspect = g_extern.system.aspect_ratio;
|
2012-08-20 03:20:28 +00:00
|
|
|
if (desired_aspect == 0.0)
|
|
|
|
desired_aspect = 1.0;
|
2012-08-29 19:15:24 +00:00
|
|
|
#ifdef HW_RVL
|
2014-09-09 04:59:17 +00:00
|
|
|
float device_aspect = CONF_GetAspectRatio() == CONF_ASPECT_4_3 ?
|
|
|
|
4.0 / 3.0 : 16.0 / 9.0;
|
2012-08-29 19:15:24 +00:00
|
|
|
#else
|
|
|
|
float device_aspect = 4.0 / 3.0;
|
|
|
|
#endif
|
2014-09-09 04:59:17 +00:00
|
|
|
if (g_orientation == ORIENTATION_VERTICAL ||
|
|
|
|
g_orientation == ORIENTATION_FLIPPED_ROTATED)
|
2012-08-20 03:20:28 +00:00
|
|
|
desired_aspect = 1.0 / desired_aspect;
|
2012-08-16 16:40:52 +00:00
|
|
|
float delta;
|
|
|
|
|
|
|
|
#ifdef RARCH_CONSOLE
|
2012-10-15 04:24:39 +00:00
|
|
|
if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
|
2012-08-16 16:40:52 +00:00
|
|
|
{
|
2014-09-09 04:59:17 +00:00
|
|
|
if (!g_extern.console.screen.viewports.custom_vp.width ||
|
|
|
|
!g_extern.console.screen.viewports.custom_vp.height)
|
2012-08-21 01:56:07 +00:00
|
|
|
{
|
2012-10-15 04:24:39 +00:00
|
|
|
g_extern.console.screen.viewports.custom_vp.x = 0;
|
|
|
|
g_extern.console.screen.viewports.custom_vp.y = 0;
|
2013-03-10 19:33:32 +00:00
|
|
|
g_extern.console.screen.viewports.custom_vp.width = gx->vp.full_width;
|
|
|
|
g_extern.console.screen.viewports.custom_vp.height = gx->vp.full_height;
|
2012-08-21 01:56:07 +00:00
|
|
|
}
|
|
|
|
|
2012-10-15 04:24:39 +00:00
|
|
|
x = g_extern.console.screen.viewports.custom_vp.x;
|
|
|
|
y = g_extern.console.screen.viewports.custom_vp.y;
|
|
|
|
width = g_extern.console.screen.viewports.custom_vp.width;
|
|
|
|
height = g_extern.console.screen.viewports.custom_vp.height;
|
2012-08-16 16:40:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
if (fabs(device_aspect - desired_aspect) < 0.0001)
|
|
|
|
{
|
2014-09-09 04:59:17 +00:00
|
|
|
/* If the aspect ratios of screen and desired aspect ratio
|
|
|
|
* are sufficiently equal (floating point stuff),
|
|
|
|
* assume they are actually equal. */
|
2012-08-16 16:40:52 +00:00
|
|
|
}
|
|
|
|
else if (device_aspect > desired_aspect)
|
|
|
|
{
|
|
|
|
delta = (desired_aspect / device_aspect - 1.0) / 2.0 + 0.5;
|
|
|
|
x = (unsigned)(width * (0.5 - delta));
|
|
|
|
width = (unsigned)(2.0 * width * delta);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
delta = (device_aspect / desired_aspect - 1.0) / 2.0 + 0.5;
|
|
|
|
y = (unsigned)(height * (0.5 - delta));
|
|
|
|
height = (unsigned)(2.0 * height * delta);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-10 19:33:32 +00:00
|
|
|
gx->vp.x = x;
|
|
|
|
gx->vp.y = y;
|
|
|
|
gx->vp.width = width;
|
|
|
|
gx->vp.height = height;
|
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetViewportJitter(x, y, width, height, 0, 1, 1);
|
2012-08-20 03:20:28 +00:00
|
|
|
|
|
|
|
Mtx44 m1, m2;
|
|
|
|
float top = 1, bottom = -1, left = -1, right = 1;
|
2013-01-11 18:44:13 +00:00
|
|
|
|
2012-08-20 03:20:28 +00:00
|
|
|
guOrtho(m1, top, bottom, left, right, 0, 1);
|
2013-01-21 23:12:19 +00:00
|
|
|
GX_LoadPosMtxImm(m1, GX_PNMTX1);
|
|
|
|
|
2012-08-20 03:20:28 +00:00
|
|
|
unsigned degrees;
|
|
|
|
switch(g_orientation)
|
|
|
|
{
|
|
|
|
case ORIENTATION_VERTICAL:
|
|
|
|
degrees = 90;
|
|
|
|
break;
|
|
|
|
case ORIENTATION_FLIPPED:
|
|
|
|
degrees = 180;
|
|
|
|
break;
|
|
|
|
case ORIENTATION_FLIPPED_ROTATED:
|
|
|
|
degrees = 270;
|
|
|
|
break;
|
2012-08-20 23:47:04 +00:00
|
|
|
default:
|
|
|
|
degrees = 0;
|
|
|
|
break;
|
2012-08-20 03:20:28 +00:00
|
|
|
}
|
|
|
|
guMtxIdentity(m2);
|
|
|
|
guMtxRotDeg(m2, 'Z', degrees);
|
|
|
|
guMtxConcat(m1, m2, m1);
|
|
|
|
GX_LoadPosMtxImm(m1, GX_PNMTX0);
|
|
|
|
|
2013-11-01 17:12:06 +00:00
|
|
|
init_texture(data, 4, 4);
|
2012-09-12 01:19:22 +00:00
|
|
|
gx_old_width = gx_old_height = 0;
|
2012-08-16 16:40:52 +00:00
|
|
|
gx->should_resize = false;
|
|
|
|
}
|
|
|
|
|
2012-08-27 20:09:53 +00:00
|
|
|
static void gx_blit_line(unsigned x, unsigned y, const char *message)
|
|
|
|
{
|
2012-09-12 03:33:44 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
|
|
|
|
2012-08-27 20:09:53 +00:00
|
|
|
const GXColor b = {
|
|
|
|
.r = 0x00,
|
|
|
|
.g = 0x00,
|
|
|
|
.b = 0x00,
|
|
|
|
.a = 0xff
|
|
|
|
};
|
|
|
|
const GXColor w = {
|
|
|
|
.r = 0xff,
|
|
|
|
.g = 0xff,
|
|
|
|
.b = 0xff,
|
|
|
|
.a = 0xff
|
|
|
|
};
|
|
|
|
|
|
|
|
unsigned h;
|
|
|
|
|
2012-09-12 03:33:44 +00:00
|
|
|
if (!*message)
|
|
|
|
return;
|
|
|
|
|
2012-09-12 04:17:33 +00:00
|
|
|
bool double_width = gx_mode.fbWidth > 400;
|
|
|
|
unsigned width = (double_width ? 2 : 1);
|
2012-09-12 03:33:44 +00:00
|
|
|
unsigned height = FONT_HEIGHT * (gx->double_strike ? 1 : 2);
|
|
|
|
for (h = 0; h < height; h++)
|
2012-08-27 20:09:53 +00:00
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x, y + h, b);
|
2012-09-12 04:17:33 +00:00
|
|
|
if (double_width)
|
2014-02-20 00:40:38 +00:00
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + 1, y + h, b);
|
2014-02-20 00:40:38 +00:00
|
|
|
}
|
2012-08-27 20:09:53 +00:00
|
|
|
}
|
|
|
|
|
2012-09-12 04:17:33 +00:00
|
|
|
x += (double_width ? 2 : 1);
|
2012-08-27 20:09:53 +00:00
|
|
|
|
|
|
|
while (*message)
|
|
|
|
{
|
|
|
|
for (unsigned j = 0; j < FONT_HEIGHT; j++)
|
|
|
|
{
|
|
|
|
for (unsigned i = 0; i < FONT_WIDTH; i++)
|
|
|
|
{
|
|
|
|
GXColor c;
|
|
|
|
uint8_t rem = 1 << ((i + j * FONT_WIDTH) & 7);
|
|
|
|
unsigned offset = (i + j * FONT_WIDTH) >> 3;
|
2012-12-13 21:12:51 +00:00
|
|
|
bool col = (bitmap_bin[FONT_OFFSET((unsigned char) *message) + offset] & rem);
|
2012-08-27 20:09:53 +00:00
|
|
|
|
|
|
|
if (col)
|
|
|
|
c = w;
|
|
|
|
else
|
|
|
|
c = b;
|
|
|
|
|
2012-09-12 03:33:44 +00:00
|
|
|
if (!gx->double_strike)
|
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + (i * width), y + (j * 2), c);
|
2012-09-12 04:17:33 +00:00
|
|
|
if (double_width)
|
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + (i * width) + 1, y + (j * 2), c);
|
|
|
|
GX_PokeARGB(x + (i * width) + 1, y + (j * 2) + 1, c);
|
2012-09-12 04:17:33 +00:00
|
|
|
}
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + (i * width), y + (j * 2) + 1, c);
|
2012-09-12 03:33:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + (i * width), y + j, c);
|
2012-09-12 04:17:33 +00:00
|
|
|
if (double_width)
|
2014-02-20 00:40:38 +00:00
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + (i * width) + 1, y + j, c);
|
2014-02-20 00:40:38 +00:00
|
|
|
}
|
2012-09-12 03:33:44 +00:00
|
|
|
}
|
2012-08-27 20:09:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-12 03:33:44 +00:00
|
|
|
for (unsigned h = 0; h < height; h++)
|
2012-08-27 20:09:53 +00:00
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + (FONT_WIDTH * width), y + h, b);
|
2012-09-12 04:17:33 +00:00
|
|
|
if (double_width)
|
2014-02-20 00:40:38 +00:00
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_PokeARGB(x + (FONT_WIDTH * width) + 1, y + h, b);
|
2014-02-20 00:40:38 +00:00
|
|
|
}
|
2012-08-27 20:09:53 +00:00
|
|
|
}
|
|
|
|
|
2012-09-12 04:17:33 +00:00
|
|
|
x += FONT_WIDTH_STRIDE * (double_width ? 2 : 1);
|
2012-08-27 20:09:53 +00:00
|
|
|
message++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-09 01:54:27 +00:00
|
|
|
static bool gx_frame(void *data, const void *frame,
|
2011-12-14 13:26:40 +00:00
|
|
|
unsigned width, unsigned height, unsigned pitch,
|
|
|
|
const char *msg)
|
|
|
|
{
|
2015-01-18 19:03:33 +00:00
|
|
|
char fps_txt[128], fps_text_buf[128];
|
|
|
|
bool fps_draw = g_settings.fps_show;
|
2014-05-28 22:57:40 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2013-04-19 14:09:37 +00:00
|
|
|
struct __gx_regdef *__gx = (struct __gx_regdef*)__gxregs;
|
2012-09-12 13:36:18 +00:00
|
|
|
u8 clear_efb = GX_FALSE;
|
2012-08-07 21:52:09 +00:00
|
|
|
|
2014-06-03 23:21:56 +00:00
|
|
|
RARCH_PERFORMANCE_INIT(gx_frame);
|
|
|
|
RARCH_PERFORMANCE_START(gx_frame);
|
|
|
|
|
2014-06-10 00:15:29 +00:00
|
|
|
if(!gx || (!frame && !gx->menu_texture_enable))
|
2012-12-19 02:12:00 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
if (!frame)
|
2014-09-09 04:59:17 +00:00
|
|
|
width = height = 4; /* draw a black square in the background */
|
2012-08-08 03:40:17 +00:00
|
|
|
|
2013-04-19 10:35:16 +00:00
|
|
|
if(gx->should_resize)
|
2012-08-08 17:55:38 +00:00
|
|
|
{
|
2014-02-22 16:04:29 +00:00
|
|
|
gx_resize(gx);
|
2012-09-12 13:36:18 +00:00
|
|
|
clear_efb = GX_TRUE;
|
2012-08-08 17:55:38 +00:00
|
|
|
}
|
|
|
|
|
2014-06-10 00:15:29 +00:00
|
|
|
while (((g_vsync || gx->menu_texture_enable)) && !g_draw_done)
|
2014-06-07 01:12:58 +00:00
|
|
|
OSSleepThread(g_video_cond);
|
2012-06-25 19:27:41 +00:00
|
|
|
|
2014-05-31 00:21:07 +00:00
|
|
|
width = min(g_tex.width, width);
|
|
|
|
height = min(g_tex.height, height);
|
|
|
|
|
2012-09-12 01:19:22 +00:00
|
|
|
if (width != gx_old_width || height != gx_old_height)
|
|
|
|
{
|
2013-11-01 17:12:06 +00:00
|
|
|
init_texture(data, width, height);
|
2012-09-12 01:19:22 +00:00
|
|
|
gx_old_width = width;
|
|
|
|
gx_old_height = height;
|
|
|
|
}
|
|
|
|
|
2012-06-25 19:27:41 +00:00
|
|
|
g_draw_done = false;
|
|
|
|
g_current_framebuf ^= 1;
|
2012-12-19 03:08:47 +00:00
|
|
|
|
2013-06-07 23:45:04 +00:00
|
|
|
|
2012-12-19 03:08:47 +00:00
|
|
|
if (frame)
|
2012-12-19 03:16:04 +00:00
|
|
|
{
|
2014-06-03 23:21:56 +00:00
|
|
|
RARCH_PERFORMANCE_INIT(gx_frame_convert);
|
|
|
|
RARCH_PERFORMANCE_START(gx_frame_convert);
|
|
|
|
|
2012-12-23 17:31:46 +00:00
|
|
|
if (gx->rgb32)
|
2012-12-19 04:04:26 +00:00
|
|
|
convert_texture32(frame, g_tex.data, width, height, pitch);
|
2014-06-10 00:15:29 +00:00
|
|
|
else if (gx->menu_texture_enable)
|
2012-12-23 17:31:46 +00:00
|
|
|
convert_texture16_conv(frame, g_tex.data, width, height, pitch);
|
2012-12-19 03:16:04 +00:00
|
|
|
else
|
2012-12-19 04:04:26 +00:00
|
|
|
convert_texture16(frame, g_tex.data, width, height, pitch);
|
2012-12-19 03:16:04 +00:00
|
|
|
DCFlushRange(g_tex.data, height * (width << (gx->rgb32 ? 2 : 1)));
|
2014-06-03 23:21:56 +00:00
|
|
|
|
|
|
|
RARCH_PERFORMANCE_STOP(gx_frame_convert);
|
2012-12-19 03:16:04 +00:00
|
|
|
}
|
2012-12-19 03:08:47 +00:00
|
|
|
|
2014-06-10 00:15:29 +00:00
|
|
|
if (gx->menu_texture_enable && gx->menu_data)
|
2012-12-19 03:16:04 +00:00
|
|
|
{
|
2015-02-13 22:41:34 +00:00
|
|
|
menu_handle_t *menu = menu_driver_resolve();
|
|
|
|
|
|
|
|
if (menu)
|
|
|
|
{
|
|
|
|
convert_texture16(gx->menu_data, menu_tex.data,
|
|
|
|
menu->frame_buf.width,
|
|
|
|
menu->frame_buf.height,
|
|
|
|
menu->frame_buf.width * 2);
|
|
|
|
DCFlushRange(menu_tex.data,
|
|
|
|
menu->frame_buf.width *
|
|
|
|
menu->frame_buf.height * 2);
|
|
|
|
}
|
2012-12-19 03:16:04 +00:00
|
|
|
}
|
2012-12-19 03:08:47 +00:00
|
|
|
|
2014-02-22 21:07:23 +00:00
|
|
|
__GX_InvalidateTexAll(__gx);
|
2012-08-07 21:52:09 +00:00
|
|
|
|
2014-02-22 21:18:47 +00:00
|
|
|
__GX_SetCurrentMtx(__gx, GX_PNMTX0);
|
2014-06-04 03:34:47 +00:00
|
|
|
__GX_LoadTexObj(&g_tex.obj, GX_TEXMAP0);
|
2014-02-22 21:18:47 +00:00
|
|
|
__GX_CallDispList(__gx, display_list, display_list_size);
|
2012-08-07 21:52:09 +00:00
|
|
|
|
2014-06-10 00:15:29 +00:00
|
|
|
if (gx->menu_texture_enable)
|
2012-08-07 02:30:18 +00:00
|
|
|
{
|
2014-02-22 21:18:47 +00:00
|
|
|
__GX_SetCurrentMtx(__gx, GX_PNMTX1);
|
2012-08-07 02:30:18 +00:00
|
|
|
GX_LoadTexObj(&menu_tex.obj, GX_TEXMAP0);
|
2014-02-22 21:18:47 +00:00
|
|
|
__GX_CallDispList(__gx, display_list, display_list_size);
|
2012-08-07 02:30:18 +00:00
|
|
|
}
|
2011-12-14 13:26:40 +00:00
|
|
|
|
2014-02-20 21:23:29 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
if (gx->overlay_enable)
|
|
|
|
gx_render_overlay(gx);
|
|
|
|
#endif
|
|
|
|
|
2014-02-20 23:58:40 +00:00
|
|
|
GX_DrawDone();
|
|
|
|
|
2015-01-18 19:03:33 +00:00
|
|
|
video_monitor_get_fps(fps_txt, sizeof(fps_txt),
|
2014-09-09 04:59:17 +00:00
|
|
|
fps_draw ? fps_text_buf : NULL, sizeof(fps_text_buf));
|
2013-06-17 22:14:45 +00:00
|
|
|
|
2013-10-07 19:54:29 +00:00
|
|
|
if (fps_draw)
|
2012-08-27 20:09:53 +00:00
|
|
|
{
|
|
|
|
char mem1_txt[128];
|
|
|
|
unsigned x = 15;
|
2012-12-23 20:43:20 +00:00
|
|
|
unsigned y = 35;
|
2012-08-27 20:09:53 +00:00
|
|
|
|
2013-10-15 22:40:23 +00:00
|
|
|
gx_blit_line(x, y, fps_text_buf);
|
2012-09-12 03:33:44 +00:00
|
|
|
y += FONT_HEIGHT * (gx->double_strike ? 1 : 2);
|
2014-09-09 04:59:17 +00:00
|
|
|
snprintf(mem1_txt, sizeof(mem1_txt), "MEM1: %8d / %8d",
|
|
|
|
SYSMEM1_SIZE - SYS_GetArena1Size(), SYSMEM1_SIZE);
|
2012-08-27 20:09:53 +00:00
|
|
|
gx_blit_line(x, y, mem1_txt);
|
|
|
|
#ifdef HW_RVL
|
2012-09-12 03:33:44 +00:00
|
|
|
y += FONT_HEIGHT * (gx->double_strike ? 1 : 2);
|
2012-08-27 20:09:53 +00:00
|
|
|
char mem2_txt[128];
|
2014-09-09 04:59:17 +00:00
|
|
|
snprintf(mem2_txt, sizeof(mem2_txt), "MEM2: %8d / %8d",
|
|
|
|
gx_mem2_used(), gx_mem2_total());
|
2012-08-27 20:09:53 +00:00
|
|
|
gx_blit_line(x, y, mem2_txt);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-06-10 00:15:29 +00:00
|
|
|
if (msg && !gx->menu_texture_enable)
|
2013-01-14 21:31:33 +00:00
|
|
|
{
|
|
|
|
unsigned x = 7 * (gx->double_strike ? 1 : 2);
|
2013-03-10 19:33:32 +00:00
|
|
|
unsigned y = gx->vp.full_height - (35 * (gx->double_strike ? 1 : 2));
|
2013-01-14 21:31:33 +00:00
|
|
|
gx_blit_line(x, y, msg);
|
|
|
|
clear_efb = GX_TRUE;
|
|
|
|
}
|
2013-01-14 05:26:45 +00:00
|
|
|
|
2014-02-22 21:07:23 +00:00
|
|
|
__GX_CopyDisp(__gx, g_framebuf[g_current_framebuf], clear_efb);
|
|
|
|
__GX_Flush(__gx);
|
2014-06-07 01:50:47 +00:00
|
|
|
VISetNextFrameBuffer(g_framebuf[g_current_framebuf]);
|
|
|
|
VIFlush();
|
2011-12-14 13:26:40 +00:00
|
|
|
|
2013-04-13 12:28:12 +00:00
|
|
|
g_extern.frame_count++;
|
|
|
|
|
2014-06-03 23:21:56 +00:00
|
|
|
RARCH_PERFORMANCE_STOP(gx_frame);
|
|
|
|
|
2011-12-14 13:26:40 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-08-09 01:54:27 +00:00
|
|
|
static void gx_set_nonblock_state(void *data, bool state)
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
|
|
|
(void)data;
|
2012-06-25 19:27:41 +00:00
|
|
|
g_vsync = !state;
|
2011-12-14 13:26:40 +00:00
|
|
|
}
|
|
|
|
|
2012-08-09 01:54:27 +00:00
|
|
|
static bool gx_alive(void *data)
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-08-09 01:54:27 +00:00
|
|
|
static bool gx_focus(void *data)
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-01-18 21:32:14 +00:00
|
|
|
static bool gx_suppress_screensaver(void *data, bool enable)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
(void)enable;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-10-08 15:23:02 +00:00
|
|
|
static bool gx_has_windowed(void *data)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-08-09 01:54:27 +00:00
|
|
|
static void gx_free(void *data)
|
2011-12-14 13:26:40 +00:00
|
|
|
{
|
2014-02-20 21:23:29 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)driver.video_data;
|
2014-05-28 22:57:40 +00:00
|
|
|
|
2014-05-29 21:59:59 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
|
|
|
gx_free_overlay(gx);
|
2014-02-20 21:23:29 +00:00
|
|
|
#endif
|
2014-05-29 03:55:21 +00:00
|
|
|
|
|
|
|
GX_DrawDone();
|
|
|
|
GX_AbortFrame();
|
|
|
|
GX_Flush();
|
2014-06-07 01:50:47 +00:00
|
|
|
VISetBlack(true);
|
|
|
|
VIFlush();
|
|
|
|
VIWaitForRetrace();
|
2014-05-29 21:59:59 +00:00
|
|
|
|
|
|
|
free(data);
|
2011-12-14 13:26:40 +00:00
|
|
|
}
|
|
|
|
|
2012-12-23 17:31:46 +00:00
|
|
|
static void gx_set_rotation(void *data, unsigned orientation)
|
2012-04-13 23:00:09 +00:00
|
|
|
{
|
2013-03-10 18:14:28 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2012-08-20 03:20:28 +00:00
|
|
|
g_orientation = orientation;
|
2014-05-28 22:57:40 +00:00
|
|
|
|
|
|
|
if (gx)
|
|
|
|
gx->should_resize = true;
|
2012-04-13 23:00:09 +00:00
|
|
|
}
|
|
|
|
|
2013-04-07 12:05:39 +00:00
|
|
|
static void gx_set_texture_frame(void *data, const void *frame,
|
|
|
|
bool rgb32, unsigned width, unsigned height, float alpha)
|
2013-03-10 18:14:28 +00:00
|
|
|
{
|
2013-04-07 12:05:39 +00:00
|
|
|
(void)rgb32;
|
|
|
|
(void)width;
|
|
|
|
(void)height;
|
|
|
|
(void)alpha;
|
|
|
|
|
2013-03-10 18:14:28 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-05-28 22:57:40 +00:00
|
|
|
|
|
|
|
if (gx)
|
|
|
|
gx->menu_data = (uint32_t*)frame;
|
2013-03-10 18:14:28 +00:00
|
|
|
}
|
|
|
|
|
2013-04-18 16:33:03 +00:00
|
|
|
static void gx_set_texture_enable(void *data, bool enable, bool full_screen)
|
2013-04-07 12:05:39 +00:00
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-05-28 15:55:05 +00:00
|
|
|
|
|
|
|
(void)full_screen;
|
|
|
|
|
2014-05-28 22:57:40 +00:00
|
|
|
if (gx)
|
|
|
|
{
|
2014-06-10 00:15:29 +00:00
|
|
|
gx->menu_texture_enable = enable;
|
2014-09-09 04:59:17 +00:00
|
|
|
/* need to make sure the game texture is the right pixel
|
|
|
|
* format for menu overlay. */
|
2014-05-28 22:57:40 +00:00
|
|
|
gx->should_resize = true;
|
|
|
|
}
|
2013-04-07 12:05:39 +00:00
|
|
|
}
|
|
|
|
|
2013-03-10 18:39:37 +00:00
|
|
|
static void gx_apply_state_changes(void *data)
|
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-05-28 22:57:40 +00:00
|
|
|
|
|
|
|
if (gx)
|
|
|
|
gx->should_resize = true;
|
2013-03-10 18:39:37 +00:00
|
|
|
}
|
|
|
|
|
2015-02-14 04:52:05 +00:00
|
|
|
static void gx_viewport_info(void *data, struct video_viewport *vp)
|
2013-03-10 19:33:32 +00:00
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
|
|
|
*vp = gx->vp;
|
|
|
|
}
|
|
|
|
|
2014-09-09 20:41:04 +00:00
|
|
|
static bool gx_read_viewport(void *data, uint8_t *buffer)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
(void)buffer;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-02-24 19:22:45 +00:00
|
|
|
static void gx_get_video_output_size(void *data, unsigned *width, unsigned *height)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
|
|
|
|
*width = menu_gx_resolutions[menu_current_gx_resolution][0];
|
|
|
|
*height = menu_gx_resolutions[menu_current_gx_resolution][1];
|
|
|
|
}
|
|
|
|
|
2015-02-24 20:57:51 +00:00
|
|
|
static void gx_get_video_output_prev(void *data)
|
2015-02-24 20:36:23 +00:00
|
|
|
{
|
|
|
|
if (menu_current_gx_resolution > 0)
|
|
|
|
menu_current_gx_resolution--;
|
|
|
|
}
|
|
|
|
|
2015-02-24 20:57:51 +00:00
|
|
|
static void gx_get_video_output_next(void *data)
|
2015-02-24 20:36:23 +00:00
|
|
|
{
|
|
|
|
if (menu_current_gx_resolution < GX_RESOLUTIONS_LAST - 1)
|
|
|
|
{
|
|
|
|
#ifdef HW_RVL
|
|
|
|
if ((menu_current_gx_resolution + 1) > GX_RESOLUTIONS_640_480)
|
|
|
|
if (CONF_GetVideo() != CONF_VIDEO_PAL)
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
menu_current_gx_resolution++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-10 01:42:16 +00:00
|
|
|
static const video_poke_interface_t gx_poke_interface = {
|
2015-02-24 20:57:51 +00:00
|
|
|
gx_set_video_mode,
|
2015-02-08 17:39:12 +00:00
|
|
|
NULL,
|
2015-02-24 19:22:45 +00:00
|
|
|
gx_get_video_output_size,
|
2015-02-24 20:36:23 +00:00
|
|
|
gx_get_video_output_prev,
|
|
|
|
gx_get_video_output_next,
|
2013-03-10 19:12:50 +00:00
|
|
|
NULL,
|
2013-03-10 01:42:16 +00:00
|
|
|
gx_set_aspect_ratio,
|
2013-03-10 18:39:37 +00:00
|
|
|
gx_apply_state_changes,
|
2013-04-07 12:05:39 +00:00
|
|
|
gx_set_texture_frame,
|
|
|
|
gx_set_texture_enable,
|
2013-03-10 01:42:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void gx_get_poke_interface(void *data, const video_poke_interface_t **iface)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
*iface = &gx_poke_interface;
|
|
|
|
}
|
|
|
|
|
2014-02-19 22:53:23 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2014-02-20 21:23:29 +00:00
|
|
|
static void gx_overlay_tex_geom(void *data, unsigned image, float x, float y, float w, float h);
|
|
|
|
static void gx_overlay_vertex_geom(void *data, unsigned image, float x, float y, float w, float h);
|
2014-02-19 22:53:23 +00:00
|
|
|
static bool gx_overlay_load(void *data, const struct texture_image *images, unsigned num_images)
|
|
|
|
{
|
|
|
|
unsigned i;
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
|
|
|
|
|
|
|
gx_free_overlay(gx);
|
|
|
|
gx->overlay = (struct gx_overlay_data*)calloc(num_images, sizeof(*gx->overlay));
|
|
|
|
if (!gx->overlay)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
gx->overlays = num_images;
|
|
|
|
|
|
|
|
for (i = 0; i < num_images; i++)
|
|
|
|
{
|
2014-05-28 22:57:40 +00:00
|
|
|
struct gx_overlay_data *o = (struct gx_overlay_data*)&gx->overlay[i];
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_InitTexObj(&o->tex, images[i].pixels, images[i].width,
|
|
|
|
images[i].height,
|
|
|
|
GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
2014-02-19 22:53:23 +00:00
|
|
|
GX_InitTexObjFilterMode(&g_tex.obj, GX_LINEAR, GX_LINEAR);
|
2014-09-09 04:59:17 +00:00
|
|
|
DCFlushRange(images[i].pixels, images[i].width *
|
|
|
|
images[i].height * sizeof(uint32_t));
|
|
|
|
gx_overlay_tex_geom(gx, i, 0, 0, 1, 1); /* Default. Stretch to whole screen. */
|
2014-02-19 22:53:23 +00:00
|
|
|
gx_overlay_vertex_geom(gx, i, 0, 0, 1, 1);
|
|
|
|
gx->overlay[i].alpha_mod = 1.0f;
|
|
|
|
}
|
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_InvalidateTexAll();
|
2014-02-19 22:53:23 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
static void gx_overlay_tex_geom(void *data, unsigned image,
|
|
|
|
float x, float y, float w, float h)
|
2014-02-19 22:53:23 +00:00
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-05-28 22:57:40 +00:00
|
|
|
struct gx_overlay_data *o;
|
|
|
|
|
|
|
|
o = NULL;
|
|
|
|
|
|
|
|
if (gx)
|
|
|
|
o = (struct gx_overlay_data*)&gx->overlay[image];
|
2014-02-19 22:53:23 +00:00
|
|
|
|
2014-05-28 22:57:40 +00:00
|
|
|
if (o)
|
|
|
|
{
|
|
|
|
o->tex_coord[0] = x;
|
|
|
|
o->tex_coord[1] = y;
|
|
|
|
o->tex_coord[2] = x + w;
|
|
|
|
o->tex_coord[3] = y;
|
|
|
|
o->tex_coord[4] = x;
|
|
|
|
o->tex_coord[5] = y + h;
|
|
|
|
o->tex_coord[6] = x + w;
|
|
|
|
o->tex_coord[7] = y + h;
|
|
|
|
}
|
2014-02-19 22:53:23 +00:00
|
|
|
}
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
static void gx_overlay_vertex_geom(void *data, unsigned image,
|
|
|
|
float x, float y, float w, float h)
|
2014-02-19 22:53:23 +00:00
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-05-28 22:57:40 +00:00
|
|
|
struct gx_overlay_data *o;
|
|
|
|
|
|
|
|
o = NULL;
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
/* Flipped, so we preserve top-down semantics. */
|
2014-02-20 22:58:06 +00:00
|
|
|
y = 1.0f - y;
|
|
|
|
h = -h;
|
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
/* expand from 0 - 1 to -1 - 1 */
|
2014-02-20 22:58:06 +00:00
|
|
|
x = (x * 2.0f) - 1.0f;
|
|
|
|
y = (y * 2.0f) - 1.0f;
|
|
|
|
w = (w * 2.0f);
|
|
|
|
h = (h * 2.0f);
|
|
|
|
|
2014-05-28 22:57:40 +00:00
|
|
|
if (gx)
|
|
|
|
o = (struct gx_overlay_data*)&gx->overlay[image];
|
|
|
|
|
|
|
|
if (o)
|
|
|
|
{
|
|
|
|
o->vertex_coord[0] = x;
|
|
|
|
o->vertex_coord[1] = y;
|
|
|
|
o->vertex_coord[2] = x + w;
|
|
|
|
o->vertex_coord[3] = y;
|
|
|
|
o->vertex_coord[4] = x;
|
|
|
|
o->vertex_coord[5] = y + h;
|
|
|
|
o->vertex_coord[6] = x + w;
|
|
|
|
o->vertex_coord[7] = y + h;
|
|
|
|
}
|
2014-02-19 22:53:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void gx_overlay_enable(void *data, bool state)
|
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
|
|
|
gx->overlay_enable = state;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gx_overlay_full_screen(void *data, bool enable)
|
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
|
|
|
gx->overlay_full_screen = enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gx_overlay_set_alpha(void *data, unsigned image, float mod)
|
|
|
|
{
|
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
|
|
|
gx->overlay[image].alpha_mod = mod;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void gx_render_overlay(void *data)
|
|
|
|
{
|
2014-02-20 21:23:29 +00:00
|
|
|
gx_video_t *gx = (gx_video_t*)data;
|
2014-02-19 22:53:23 +00:00
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetCurrentMtx(GX_PNMTX1);
|
|
|
|
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
|
|
|
|
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
|
|
|
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
2014-02-21 00:26:50 +00:00
|
|
|
|
2014-02-20 21:23:29 +00:00
|
|
|
for (unsigned i = 0; i < gx->overlays; i++)
|
2014-02-19 22:53:23 +00:00
|
|
|
{
|
|
|
|
GX_LoadTexObj(&gx->overlay[i].tex, GX_TEXMAP0);
|
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_Begin(GX_TRIANGLESTRIP, GX_VTXFMT0, 4);
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_Position3f32(gx->overlay[i].vertex_coord[0],
|
|
|
|
gx->overlay[i].vertex_coord[1], -0.5);
|
2014-02-21 01:00:00 +00:00
|
|
|
GX_Color4u8(255, 255, 255, (u8)(gx->overlay[i].alpha_mod * 255.0f));
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_TexCoord2f32(gx->overlay[i].tex_coord[0],
|
|
|
|
gx->overlay[i].tex_coord[1]);
|
2014-02-21 01:00:00 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_Position3f32(gx->overlay[i].vertex_coord[2],
|
|
|
|
gx->overlay[i].vertex_coord[3], -0.5);
|
2014-02-21 01:00:00 +00:00
|
|
|
GX_Color4u8(255, 255, 255, (u8)(gx->overlay[i].alpha_mod * 255.0f));
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_TexCoord2f32(gx->overlay[i].tex_coord[2],
|
|
|
|
gx->overlay[i].tex_coord[3]);
|
2014-02-21 01:00:00 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_Position3f32(gx->overlay[i].vertex_coord[4],
|
|
|
|
gx->overlay[i].vertex_coord[5], -0.5);
|
2014-02-21 01:00:00 +00:00
|
|
|
GX_Color4u8(255, 255, 255, (u8)(gx->overlay[i].alpha_mod * 255.0f));
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_TexCoord2f32(gx->overlay[i].tex_coord[4],
|
|
|
|
gx->overlay[i].tex_coord[5]);
|
2014-02-21 01:00:00 +00:00
|
|
|
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_Position3f32(gx->overlay[i].vertex_coord[6],
|
|
|
|
gx->overlay[i].vertex_coord[7], -0.5);
|
2014-02-21 01:00:00 +00:00
|
|
|
GX_Color4u8(255, 255, 255, (u8)(gx->overlay[i].alpha_mod * 255.0f));
|
2014-09-09 04:59:17 +00:00
|
|
|
GX_TexCoord2f32(gx->overlay[i].tex_coord[6],
|
|
|
|
gx->overlay[i].tex_coord[7]);
|
2014-02-21 01:00:00 +00:00
|
|
|
GX_End();
|
2014-02-19 22:53:23 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 16:04:29 +00:00
|
|
|
GX_SetVtxDesc(GX_VA_POS, GX_INDEX8);
|
|
|
|
GX_SetVtxDesc(GX_VA_TEX0, GX_INDEX8);
|
|
|
|
GX_SetVtxDesc(GX_VA_CLR0, GX_INDEX8);
|
2014-02-19 22:53:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const video_overlay_interface_t gx_overlay_interface = {
|
|
|
|
gx_overlay_enable,
|
|
|
|
gx_overlay_load,
|
|
|
|
gx_overlay_tex_geom,
|
|
|
|
gx_overlay_vertex_geom,
|
|
|
|
gx_overlay_full_screen,
|
|
|
|
gx_overlay_set_alpha,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void gx_get_overlay_interface(void *data, const video_overlay_interface_t **iface)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
*iface = &gx_overlay_interface;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-09-09 18:18:06 +00:00
|
|
|
static bool gx_set_shader(void *data,
|
|
|
|
enum rarch_shader_type type, const char *path)
|
|
|
|
{
|
|
|
|
(void)data;
|
|
|
|
(void)type;
|
|
|
|
(void)path;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-09-11 05:06:20 +00:00
|
|
|
video_driver_t video_gx = {
|
2014-06-02 10:04:48 +00:00
|
|
|
gx_init,
|
|
|
|
gx_frame,
|
|
|
|
gx_set_nonblock_state,
|
|
|
|
gx_alive,
|
|
|
|
gx_focus,
|
2015-01-18 21:32:14 +00:00
|
|
|
gx_suppress_screensaver,
|
2014-10-08 15:23:02 +00:00
|
|
|
gx_has_windowed,
|
2014-09-09 18:18:06 +00:00
|
|
|
gx_set_shader,
|
2014-06-02 10:04:48 +00:00
|
|
|
gx_free,
|
|
|
|
"gx",
|
|
|
|
gx_set_rotation,
|
|
|
|
gx_viewport_info,
|
2014-09-09 20:41:04 +00:00
|
|
|
gx_read_viewport,
|
2014-02-19 22:53:23 +00:00
|
|
|
#ifdef HAVE_OVERLAY
|
2014-06-02 10:04:48 +00:00
|
|
|
gx_get_overlay_interface,
|
2014-02-19 22:53:23 +00:00
|
|
|
#endif
|
2014-06-02 10:04:48 +00:00
|
|
|
gx_get_poke_interface,
|
2011-12-14 13:26:40 +00:00
|
|
|
};
|