This commit is contained in:
libretroadmin 2023-06-01 20:29:05 +02:00
parent 27aeb314a1
commit f3fe46393c
11 changed files with 213 additions and 228 deletions

View File

@ -29,27 +29,9 @@ RETRO_BEGIN_DECLS
typedef struct d3d8_video
{
bool keep_aspect;
bool should_resize;
bool quitting;
bool needs_restore;
bool overlays_enabled;
/* TODO - refactor this away properly. */
bool resolution_hd_enable;
/* Only used for Xbox */
bool widescreen_mode;
unsigned cur_mon_id;
unsigned dev_rotation;
overlay_t *menu;
void *renderchain_data;
math_matrix_4x4 mvp;
math_matrix_4x4 mvp_rotate;
math_matrix_4x4 mvp_transposed;
struct video_viewport vp;
struct video_shader shader;
video_info_t video_info;
@ -63,14 +45,31 @@ typedef struct d3d8_video
struct
{
int size;
int offset;
void *buffer;
void *decl;
int size;
int offset;
}menu_display;
size_t overlays_size;
overlay_t *overlays;
size_t overlays_size;
unsigned cur_mon_id;
unsigned dev_rotation;
math_matrix_4x4 mvp; /* float alignment */
math_matrix_4x4 mvp_rotate; /* float alignment */
math_matrix_4x4 mvp_transposed; /* float alignment */
bool keep_aspect;
bool should_resize;
bool quitting;
bool needs_restore;
bool overlays_enabled;
/* TODO - refactor this away properly. */
bool resolution_hd_enable;
/* Only used for Xbox */
bool widescreen_mode;
} d3d8_video_t;
RETRO_END_DECLS

View File

@ -14,8 +14,8 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GL_CORE_COMMON_H
#define __GL_CORE_COMMON_H
#ifndef __GL3_DEFINES_H
#define __GL3_DEFINES_H
#include <boolean.h>
#include <string.h>
@ -139,8 +139,6 @@ typedef struct gl3
bool pbo_readback_valid[GL_CORE_NUM_PBOS];
} gl3_t;
void gl3_bind_scratch_vbo(gl3_t *gl, const void *data, size_t size);
RETRO_END_DECLS
#endif

View File

@ -42,15 +42,17 @@
typedef struct RegOp
{
int fd;
void *ptr;
int fd;
int only_mmap;
int only_munmap;
} RegOp;
typedef struct fpga
{
bool rgb32;
RegOp regOp; /* ptr alignment */
volatile unsigned *framebuffer;
unsigned char *menu_frame;
unsigned menu_width;
unsigned menu_height;
unsigned menu_pitch;
@ -59,10 +61,7 @@ typedef struct fpga
unsigned video_pitch;
unsigned video_bits;
unsigned menu_bits;
RegOp regOp;
volatile unsigned *framebuffer;
unsigned char *menu_frame;
bool rgb32;
} fpga_t;
static unsigned int get_memory_size(void)

View File

@ -46,6 +46,19 @@
#include "../common/win32_common.h"
#endif
struct bitmap_info
{
BITMAPINFOHEADER header;
union
{
RGBQUAD colors;
DWORD masks[3];
} u;
};
HDC win32_gdi_hdc;
static void *dinput_gdi;
/*
* DISPLAY DRIVER
*/
@ -331,20 +344,6 @@ font_renderer_t gdi_font = {
* VIDEO DRIVER
*/
HDC win32_gdi_hdc;
static void *dinput_gdi;
struct bitmap_info
{
BITMAPINFOHEADER header;
union
{
RGBQUAD colors;
DWORD masks[3];
} u;
};
static void gfx_ctx_gdi_update_title(void)
{
char title[128];
@ -881,10 +880,10 @@ static void gdi_set_texture_frame(void *data,
free(gdi->menu_frame);
gdi->menu_frame = NULL;
if ( !gdi->menu_frame ||
gdi->menu_width != width ||
gdi->menu_height != height ||
gdi->menu_pitch != pitch)
if ( !gdi->menu_frame
|| (gdi->menu_width != width)
|| (gdi->menu_height != height)
|| (gdi->menu_pitch != pitch))
{
if (pitch && height)
{

View File

@ -27,7 +27,7 @@
#include <stdlib.h>
#include "../common/gl3_common.h"
#include "../common/gl3_defines.h"
#include <encodings/utf.h>
#include <gfx/gl_capabilities.h>
@ -67,6 +67,22 @@ static void gl3_set_viewport(gl3_t *gl,
unsigned viewport_height,
bool force_full, bool allow_rotate);
/**
* GL3 COMMON
*/
static void gl3_bind_scratch_vbo(gl3_t *gl, const void *data, size_t size)
{
if (!gl->scratch_vbos[gl->scratch_vbo_index])
glGenBuffers(1, &gl->scratch_vbos[gl->scratch_vbo_index]);
glBindBuffer(GL_ARRAY_BUFFER, gl->scratch_vbos[gl->scratch_vbo_index]);
glBufferData(GL_ARRAY_BUFFER, size, data, GL_STREAM_DRAW);
gl->scratch_vbo_index++;
if (gl->scratch_vbo_index >= GL_CORE_NUM_VBOS)
gl->scratch_vbo_index = 0;
}
/**
* DISPLAY DRIVER
*/
@ -953,17 +969,6 @@ static void gl3_fence_iterate(gl3_t *gl, unsigned hard_sync_frames)
}
}
void gl3_bind_scratch_vbo(gl3_t *gl, const void *data, size_t size)
{
if (!gl->scratch_vbos[gl->scratch_vbo_index])
glGenBuffers(1, &gl->scratch_vbos[gl->scratch_vbo_index]);
glBindBuffer(GL_ARRAY_BUFFER, gl->scratch_vbos[gl->scratch_vbo_index]);
glBufferData(GL_ARRAY_BUFFER, size, data, GL_STREAM_DRAW);
gl->scratch_vbo_index++;
if (gl->scratch_vbo_index >= GL_CORE_NUM_VBOS)
gl->scratch_vbo_index = 0;
}
#ifdef HAVE_OVERLAY
static void gl3_free_overlay(gl3_t *gl)
{

View File

@ -55,6 +55,21 @@
#include "../font_driver.h"
/* Temporary workaround for GX2 not being able to poll flags during init */
static gfx_ctx_driver_t gx2_fake_context;
static const wiiu_render_mode_t gx2_render_mode_map[] =
{
{0}, /* GX2_TV_SCAN_MODE_NONE */
{854, 480, GX2_TV_RENDER_MODE_WIDE_480P}, /* GX2_TV_SCAN_MODE_576I */
{854, 480, GX2_TV_RENDER_MODE_WIDE_480P}, /* GX2_TV_SCAN_MODE_480I */
{854, 480, GX2_TV_RENDER_MODE_WIDE_480P}, /* GX2_TV_SCAN_MODE_480P */
{1280, 720, GX2_TV_RENDER_MODE_WIDE_720P}, /* GX2_TV_SCAN_MODE_720P */
{0}, /* GX2_TV_SCAN_MODE_unk */
{1920, 1080, GX2_TV_RENDER_MODE_WIDE_1080P}, /* GX2_TV_SCAN_MODE_1080I */
{1920, 1080, GX2_TV_RENDER_MODE_WIDE_1080P} /* GX2_TV_SCAN_MODE_1080P */
};
/*
* DISPLAY DRIVER
*/
@ -717,21 +732,6 @@ font_renderer_t wiiu_font =
* VIDEO DRIVER
*/
/* Temporary workaround for gx2 not being able to poll flags during init */
static gfx_ctx_driver_t gx2_fake_context;
static const wiiu_render_mode_t gx2_render_mode_map[] =
{
{0}, /* GX2_TV_SCAN_MODE_NONE */
{854, 480, GX2_TV_RENDER_MODE_WIDE_480P}, /* GX2_TV_SCAN_MODE_576I */
{854, 480, GX2_TV_RENDER_MODE_WIDE_480P}, /* GX2_TV_SCAN_MODE_480I */
{854, 480, GX2_TV_RENDER_MODE_WIDE_480P}, /* GX2_TV_SCAN_MODE_480P */
{1280, 720, GX2_TV_RENDER_MODE_WIDE_720P}, /* GX2_TV_SCAN_MODE_720P */
{0}, /* GX2_TV_SCAN_MODE_unk */
{1920, 1080, GX2_TV_RENDER_MODE_WIDE_1080P}, /* GX2_TV_SCAN_MODE_1080I */
{1920, 1080, GX2_TV_RENDER_MODE_WIDE_1080P} /* GX2_TV_SCAN_MODE_1080P */
};
static bool gx2_set_shader(void *data,
enum rarch_shader_type type, const char *path);
@ -1549,8 +1549,8 @@ static bool wiiu_init_frame_textures(wiiu_video_t *wiiu, unsigned width, unsigne
GX2CalcSurfaceSizeAndAlignment(&wiiu->pass[i].texture.surface);
GX2InitTextureRegs(&wiiu->pass[i].texture);
if ( (i != (wiiu->shader_preset->passes - 1))
|| (width != wiiu->vp.width)
if ( (i != (wiiu->shader_preset->passes - 1))
|| (width != wiiu->vp.width)
|| (height != wiiu->vp.height))
{
wiiu->pass[i].mem1 = true;

View File

@ -75,111 +75,6 @@
}
#endif
extern syssram* __SYS_LockSram(void);
extern u32 __SYS_UnlockSram(u32 write);
struct gx_overlay_data
{
GXTexObj tex;
float tex_coord[8];
float vertex_coord[8];
float alpha_mod;
};
typedef struct gx_video
{
bool should_resize;
bool keep_aspect;
bool double_strike;
bool rgb32;
bool menu_texture_enable;
bool vsync;
#ifdef HAVE_OVERLAY
bool overlay_enable;
bool overlay_full_screen;
#endif
int8_t system_xOrigin;
int8_t used_system_xOrigin;
int8_t xOriginNeg;
int8_t xOriginPos;
int8_t yOriginNeg;
int8_t yOriginPos;
uint16_t xOrigin;
uint16_t yOrigin;
unsigned scale;
unsigned overscan_correction_top;
unsigned overscan_correction_bottom;
unsigned old_width;
unsigned old_height;
unsigned current_framebuf;
#ifdef HAVE_OVERLAY
unsigned overlays;
#endif
uint32_t orientation;
video_viewport_t vp;
void *framebuf[2];
uint32_t *menu_data; /* FIXME: Should be const uint16_t*. */
#ifdef HAVE_OVERLAY
struct gx_overlay_data *overlay;
#endif
} gx_video_t;
static struct
{
unsigned width;
unsigned height;
GXTexObj obj;
uint32_t *data; /* needs to be resizable. */
} g_tex;
static struct
{
uint32_t data[240 * 212];
GXTexObj obj;
} menu_tex ATTRIBUTE_ALIGN(32);
static OSCond g_video_cond;
static volatile bool g_draw_done = false;
static uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32);
static uint8_t display_list[1024] ATTRIBUTE_ALIGN(32);
static uint32_t retraceCount = 0;
static uint32_t referenceRetraceCount = 0;
static unsigned max_height = 0;
static size_t display_list_size = 0;
GXRModeObj gx_mode;
float verts[16] ATTRIBUTE_ALIGN(32) = {
-1, 1, -0.5,
1, 1, -0.5,
-1, -1, -0.5,
1, -1, -0.5,
};
float vertex_ptr[8] ATTRIBUTE_ALIGN(32) = {
0, 0,
1, 0,
0, 1,
1, 1,
};
u8 color_ptr[16] ATTRIBUTE_ALIGN(32) = {
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
};
enum
{
GX_RESOLUTIONS_DEFAULT = 0,
@ -225,6 +120,108 @@ enum
GX_RESOLUTIONS_LAST = GX_RESOLUTIONS_640_480,
};
extern syssram* __SYS_LockSram(void);
extern u32 __SYS_UnlockSram(u32 write);
struct gx_overlay_data
{
GXTexObj tex;
float tex_coord[8];
float vertex_coord[8];
float alpha_mod;
};
typedef struct gx_video
{
video_viewport_t vp;
void *framebuf[2];
uint32_t *menu_data; /* FIXME: Should be const uint16_t*. */
#ifdef HAVE_OVERLAY
struct gx_overlay_data *overlay;
#endif
unsigned scale;
unsigned overscan_correction_top;
unsigned overscan_correction_bottom;
unsigned old_width;
unsigned old_height;
unsigned current_framebuf;
#ifdef HAVE_OVERLAY
unsigned overlays;
#endif
uint32_t orientation;
uint16_t xOrigin;
uint16_t yOrigin;
int8_t system_xOrigin;
int8_t used_system_xOrigin;
int8_t xOriginNeg;
int8_t xOriginPos;
int8_t yOriginNeg;
int8_t yOriginPos;
bool should_resize;
bool keep_aspect;
bool double_strike;
bool rgb32;
bool menu_texture_enable;
bool vsync;
#ifdef HAVE_OVERLAY
bool overlay_enable;
bool overlay_full_screen;
#endif
} gx_video_t;
static struct
{
uint32_t *data; /* needs to be resizable. */
unsigned width;
unsigned height;
GXTexObj obj;
} g_tex;
static struct
{
uint32_t data[240 * 212];
GXTexObj obj;
} menu_tex ATTRIBUTE_ALIGN(32);
static OSCond g_video_cond;
static volatile bool g_draw_done = false;
static uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32);
static uint8_t display_list[1024] ATTRIBUTE_ALIGN(32);
static uint32_t retraceCount = 0;
static uint32_t referenceRetraceCount = 0;
static unsigned max_height = 0;
static size_t display_list_size = 0;
static GXRModeObj gx_mode;
float verts[16] ATTRIBUTE_ALIGN(32) = {
-1, 1, -0.5,
1, 1, -0.5,
-1, -1, -0.5,
1, -1, -0.5,
};
float vertex_ptr[8] ATTRIBUTE_ALIGN(32) = {
0, 0,
1, 0,
0, 1,
1, 1,
};
u8 color_ptr[16] ATTRIBUTE_ALIGN(32) = {
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
};
unsigned menu_gx_resolutions[][2] = {
{ 0, 0 }, /* Let the system choose its preferred resolution, for NTSC is 640x480 */
{ 512, 192 },

View File

@ -181,9 +181,9 @@ static bool network_gfx_frame(void *data, const void *frame,
menu_driver_frame(menu_is_alive, video_info);
#endif
if ( network_video_width != frame_width ||
network_video_height != frame_height ||
network_video_pitch != pitch)
if ( (network_video_width != frame_width)
|| (network_video_height != frame_height)
|| (network_video_pitch != pitch))
{
if (frame_width > 4 && frame_height > 4)
{
@ -211,9 +211,9 @@ static bool network_gfx_frame(void *data, const void *frame,
height = network_video_height;
pitch = network_video_pitch;
if ( frame_width == 4 &&
frame_height == 4 &&
(frame_width < width && frame_height < height))
if ( (frame_width == 4)
&& (frame_height == 4)
&& (frame_width < width && frame_height < height))
draw = false;
#ifdef HAVE_MENU
@ -222,8 +222,8 @@ static bool network_gfx_frame(void *data, const void *frame,
#endif
}
if ( network->video_width != width
|| network->video_height != height)
if ( (network->video_width != width)
|| (network->video_height != height))
{
network->video_width = width;
network->video_height = height;
@ -402,10 +402,10 @@ static void network_set_texture_frame(void *data,
network_menu_frame = NULL;
}
if ( !network_menu_frame ||
network_menu_width != width ||
network_menu_height != height ||
network_menu_pitch != pitch)
if ( !network_menu_frame
|| (network_menu_width != width)
|| (network_menu_height != height)
|| (network_menu_pitch != pitch))
if (pitch && height)
network_menu_frame = (unsigned char*)malloc(pitch * height);
@ -461,14 +461,11 @@ static const video_poke_interface_t network_poke_interface = {
static void network_gfx_get_poke_interface(void *data,
const video_poke_interface_t **iface)
{
(void)data;
*iface = &network_poke_interface;
}
static void network_gfx_set_viewport(void *data, unsigned viewport_width,
unsigned viewport_height, bool force_full, bool allow_rotate)
{
}
unsigned viewport_height, bool force_full, bool allow_rotate) { }
bool network_has_menu_frame(void)
{

View File

@ -66,7 +66,6 @@ typedef struct oga_surface
int pitch;
int prime_fd;
int rk_format;
int display_fd;
uint32_t handle;
} oga_surface_t;
@ -79,28 +78,25 @@ typedef struct oga_framebuf
typedef struct oga_video
{
int fd;
uint32_t connector_id;
drmModeModeInfo mode;
int drm_width;
int drm_height;
float display_ar;
uint32_t crtc_id;
oga_surface_t* frame_surface;
oga_surface_t* menu_surface;
oga_framebuf_t* pages[NUM_PAGES];
int cur_page;
int scale_mode;
int rotation;
bool threaded;
oga_surface_t* msg_surface;
oga_surface_t *frame_surface;
oga_surface_t *menu_surface;
oga_framebuf_t *pages[NUM_PAGES];
oga_surface_t *msg_surface;
const font_renderer_driver_t *font_driver;
void *font;
int msg_width;
int msg_height;
int fd;
int drm_width;
int drm_height;
int cur_page;
int scale_mode;
int rotation;
uint32_t crtc_id;
uint32_t connector_id;
float display_ar;
bool threaded;
char last_msg[128];
} oga_video_t;

View File

@ -64,27 +64,22 @@ typedef struct omapfb_state
typedef struct omapfb_data
{
const char* fbname;
int fd;
void *fb_mem;
unsigned fb_framesize;
omapfb_page_t *pages;
int num_pages;
const char* fbname;
void *fb_mem;
omapfb_page_t *cur_page;
omapfb_page_t *old_page;
/* current and saved (for later restore) states */
omapfb_state_t* current_state;
omapfb_state_t* saved_state;
int fd;
int num_pages;
unsigned fb_framesize;
/* native screen size */
unsigned nat_w, nat_h;
/* bytes per pixel */
unsigned bpp;
bool sync;
} omapfb_data_t;

View File

@ -32,7 +32,7 @@
#include "slang_reflection.hpp"
#include "spirv_glsl.hpp"
#include "../common/gl3_common.h"
#include "../common/gl3_defines.h"
#include "../../retroarch.h"
#include "../../verbosity.h"