diff --git a/gfx/common/caca_defines.h b/gfx/common/caca_defines.h deleted file mode 100644 index 510a7ce17f..0000000000 --- a/gfx/common/caca_defines.h +++ /dev/null @@ -1,44 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * copyright (c) 2011-2017 - Daniel De Matteis - * copyright (c) 2016-2019 - Brad Parker - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * 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. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __CACA_DEFINES_H -#define __CACA_DEFINES_H - -struct caca_canvas; -struct caca_dither; -struct caca_display; - -typedef struct caca_canvas caca_canvas_t; -typedef struct caca_dither caca_dither_t; -typedef struct caca_display caca_display_t; - -typedef struct caca -{ - caca_canvas_t *cv; - caca_dither_t *dither; - caca_display_t *display; - unsigned char *menu_frame; - unsigned menu_width; - unsigned menu_height; - unsigned menu_pitch; - unsigned video_width; - unsigned video_height; - unsigned video_pitch; - bool rgb32; -} caca_t; - -#endif diff --git a/gfx/common/gl1_defines.h b/gfx/common/gl1_defines.h deleted file mode 100644 index 1e9085bd3c..0000000000 --- a/gfx/common/gl1_defines.h +++ /dev/null @@ -1,70 +0,0 @@ -/* RetroArch - A frontend for libretro. - * Copyright (C) 2010-2014 - Hans-Kristian Arntzen - * copyright (c) 2011-2017 - Daniel De Matteis - * copyright (c) 2016-2019 - Brad Parker - * - * RetroArch is free software: you can redistribute it and/or modify it under the terms - * 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. - * - * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with RetroArch. - * If not, see . - */ - -#ifndef __GL1_DEFINES_H -#define __GL1_DEFINES_H - -#include -#include - -#if defined(__APPLE__) -#include -#include -#else -#if defined(_WIN32) && !defined(_XBOX) -#define WIN32_LEAN_AND_MEAN -#include -#endif -#ifdef VITA -#include -#else -#include -#include -#endif -#endif - -#include "../video_driver.h" - -#ifdef VITA -#define GL_RGBA8 GL_RGBA -#define GL_RGB8 GL_RGB -#define GL_BGRA_EXT GL_RGBA /* Currently unsupported in vitaGL */ -#define GL_CLAMP GL_CLAMP_TO_EDGE -#endif - -#define RARCH_GL1_INTERNAL_FORMAT32 GL_RGBA8 -#define RARCH_GL1_TEXTURE_TYPE32 GL_BGRA_EXT -#define RARCH_GL1_FORMAT32 GL_UNSIGNED_BYTE - -enum gl1_flags -{ - GL1_FLAG_FULLSCREEN = (1 << 0), - GL1_FLAG_MENU_SIZE_CHANGED = (1 << 1), - GL1_FLAG_RGB32 = (1 << 2), - GL1_FLAG_SUPPORTS_BGRA = (1 << 3), - GL1_FLAG_KEEP_ASPECT = (1 << 4), - GL1_FLAG_SHOULD_RESIZE = (1 << 5), - GL1_FLAG_MENU_TEXTURE_ENABLE = (1 << 6), - GL1_FLAG_MENU_TEXTURE_FULLSCREEN = (1 << 7), - GL1_FLAG_SMOOTH = (1 << 8), - GL1_FLAG_MENU_SMOOTH = (1 << 9), - GL1_FLAG_OVERLAY_ENABLE = (1 << 10), - GL1_FLAG_OVERLAY_FULLSCREEN = (1 << 11), - GL1_FLAG_FRAME_DUPE_LOCK = (1 << 12) -}; - -#endif diff --git a/gfx/common/gx2_defines.h b/gfx/common/gx2_defines.h deleted file mode 100644 index 05a71d912f..0000000000 --- a/gfx/common/gx2_defines.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef __GX2_DEFINES_H -#define __GX2_DEFINES_H - -#include - -#include "../video_defines.h" -#include "../video_shader_parse.h" - -#include "../drivers/gx2_shaders/frame.h" -#include "../drivers/gx2_shaders/tex.h" -#include "../drivers/gx2_shaders/sprite.h" -#include "../drivers/gx2_shaders/menu_shaders.h" - -#undef _X -#undef _B - -#define _X 0x00 -#define _Y 0x01 -#define _Z 0x02 -#define _W 0x03 -#define _R 0x00 -#define _G 0x01 -#define _B 0x02 -#define _A 0x03 -#define _0 0x04 -#define _1 0x05 -#define GX2_COMP_SEL(c0, c1, c2, c3) (((c0) << 24) | ((c1) << 16) | ((c2) << 8) | (c3)) - -#define COLOR_ARGB(r, g, b, a) (((u32)(a) << 24) | ((u32)(r) << 16) | ((u32)(g) << 8) | ((u32)(b) << 0)) -#define COLOR_RGBA(r, g, b, a) (((u32)(r) << 24) | ((u32)(g) << 16) | ((u32)(b) << 8) | ((u32)(a) << 0)) - -typedef struct -{ - int width; - int height; - GX2TVRenderMode mode; -} wiiu_render_mode_t; - -struct gx2_overlay_data -{ - GX2Texture tex; - sprite_vertex_t v; - float alpha_mod; -}; - -typedef struct -{ - struct - { - GX2Texture texture; - int width; - int height; - bool enable; - sprite_vertex_t* v; - } menu; - -#ifdef HAVE_OVERLAY - struct gx2_overlay_data *overlay; - unsigned overlays; - bool overlay_enable; - bool overlay_full_screen; -#endif - - GX2Sampler sampler_nearest[RARCH_WRAP_MAX]; - GX2Sampler sampler_linear[RARCH_WRAP_MAX]; - GX2Texture texture; - frame_vertex_t *v; - GX2_vec2 *ubo_vp; - GX2_vec2 *ubo_tex; - GX2_mat4x4 *ubo_mvp; - void *input_ring_buffer; - void *output_ring_buffer; - u32 input_ring_buffer_size; - u32 output_ring_buffer_size; - - int width; - int height; - - float* menu_shader_vbo; - menu_shader_uniform_t* menu_shader_ubo; - - struct - { - sprite_vertex_t* v; - int size; - int current; - } vertex_cache; - - struct - { - tex_shader_vertex_t* v; - int size; - int current; - } vertex_cache_tex; - - void *drc_scan_buffer; - void *tv_scan_buffer; - void *cmd_buffer; - GX2ColorBuffer color_buffer; - GX2ContextState *ctx_state; - struct video_shader *shader_preset; - struct - { - GFDFile *gfd; - float *vs_ubos[2]; - float *ps_ubos[2]; - GX2Texture texture; - GX2ColorBuffer color_buffer; - bool mem1; - } pass[GFX_MAX_SHADERS]; - GX2Texture luts[GFX_MAX_TEXTURES]; - - wiiu_render_mode_t render_mode; - video_viewport_t vp; - int frames; - OSTime last_vsync; - unsigned rotation; - bool vsync; - bool rgb32; - bool smooth; - bool keep_aspect; - bool should_resize; - bool render_msg_enabled; -} wiiu_video_t; - -#endif diff --git a/gfx/common/orbis_defines.h b/gfx/common/orbis_defines.h deleted file mode 100644 index a1436cbd9d..0000000000 --- a/gfx/common/orbis_defines.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef ORBIS_DEFINES_H__ -#define ORBIS_DEFINES_H__ - -#ifdef HAVE_EGL -#include -#include "../common/egl_common.h" -#endif - -#define ATTR_ORBISGL_WIDTH 1920 -#define ATTR_ORBISGL_HEIGHT 1080 - -#if defined(HAVE_OOSDK) -#define SIZEOF_SCE_SHDR_CACHE_CONFIG 0x10C -TYPE_BEGIN(struct _SceShdrCacheConfig, SIZEOF_SCE_SHDR_CACHE_CONFIG); - TYPE_FIELD(uint32_t ver, 0x00); - TYPE_FIELD(uint32_t unk1, 0x04); - TYPE_FIELD(uint32_t unk2, 0x08); - TYPE_FIELD(char cache_dir[128], 0x0C); -TYPE_END(); -typedef struct _SceShdrCacheConfig SceShdrCacheConfig; - -bool scePigletSetShaderCacheConfiguration(const SceShdrCacheConfig *config); -#endif - -typedef struct -{ -#ifdef HAVE_EGL - egl_ctx_data_t egl; - ScePglConfig pgl_config; -#if defined(HAVE_OOSDK) - SceShdrCacheConfig shdr_cache_config; -#endif -#endif - SceWindow native_window; - bool resize; - unsigned width, height; - float refresh_rate; -} orbis_ctx_data_t; - -#endif diff --git a/gfx/drivers/caca_gfx.c b/gfx/drivers/caca_gfx.c index d124934932..2239dfa709 100644 --- a/gfx/drivers/caca_gfx.c +++ b/gfx/drivers/caca_gfx.c @@ -30,12 +30,34 @@ #include "../../menu/menu_driver.h" #endif -#include "../common/caca_defines.h" #include "../font_driver.h" #include "../../driver.h" #include "../../verbosity.h" +struct caca_canvas; +struct caca_dither; +struct caca_display; + +typedef struct caca_canvas caca_canvas_t; +typedef struct caca_dither caca_dither_t; +typedef struct caca_display caca_display_t; + +typedef struct caca +{ + caca_canvas_t *cv; + caca_dither_t *dither; + caca_display_t *display; + unsigned char *menu_frame; + unsigned menu_width; + unsigned menu_height; + unsigned menu_pitch; + unsigned video_width; + unsigned video_height; + unsigned video_pitch; + bool rgb32; +} caca_t; + typedef struct { const font_renderer_driver_t *font_driver; diff --git a/gfx/drivers/gl1.c b/gfx/drivers/gl1.c index ba02c7572f..4f6f651dad 100644 --- a/gfx/drivers/gl1.c +++ b/gfx/drivers/gl1.c @@ -39,6 +39,25 @@ #include "../../config.h" #endif +#include +#include + +#if defined(__APPLE__) +#include +#include +#else +#if defined(_WIN32) && !defined(_XBOX) +#define WIN32_LEAN_AND_MEAN +#include +#endif +#ifdef VITA +#include +#else +#include +#include +#endif +#endif + #ifdef HAVE_MENU #include "../../menu/menu_driver.h" #endif @@ -47,12 +66,12 @@ #endif #include "../font_driver.h" +#include "../video_driver.h" #include "../../configuration.h" #include "../../retroarch.h" #include "../../verbosity.h" #include "../../frontend/frontend_driver.h" -#include "../common/gl1_defines.h" #if defined(_WIN32) && !defined(_XBOX) #include "../common/win32_common.h" @@ -64,8 +83,34 @@ #ifdef VITA #include + +#define GL_RGBA8 GL_RGBA +#define GL_RGB8 GL_RGB +#define GL_BGRA_EXT GL_RGBA /* Currently unsupported in vitaGL */ +#define GL_CLAMP GL_CLAMP_TO_EDGE #endif +#define RARCH_GL1_INTERNAL_FORMAT32 GL_RGBA8 +#define RARCH_GL1_TEXTURE_TYPE32 GL_BGRA_EXT +#define RARCH_GL1_FORMAT32 GL_UNSIGNED_BYTE + +enum gl1_flags +{ + GL1_FLAG_FULLSCREEN = (1 << 0), + GL1_FLAG_MENU_SIZE_CHANGED = (1 << 1), + GL1_FLAG_RGB32 = (1 << 2), + GL1_FLAG_SUPPORTS_BGRA = (1 << 3), + GL1_FLAG_KEEP_ASPECT = (1 << 4), + GL1_FLAG_SHOULD_RESIZE = (1 << 5), + GL1_FLAG_MENU_TEXTURE_ENABLE = (1 << 6), + GL1_FLAG_MENU_TEXTURE_FULLSCREEN = (1 << 7), + GL1_FLAG_SMOOTH = (1 << 8), + GL1_FLAG_MENU_SMOOTH = (1 << 9), + GL1_FLAG_OVERLAY_ENABLE = (1 << 10), + GL1_FLAG_OVERLAY_FULLSCREEN = (1 << 11), + GL1_FLAG_FRAME_DUPE_LOCK = (1 << 12) +}; + typedef struct gl1 { struct video_viewport vp; diff --git a/gfx/drivers/gx2_gfx.c b/gfx/drivers/gx2_gfx.c index 14fed4f7cf..02f3c30f5e 100644 --- a/gfx/drivers/gx2_gfx.c +++ b/gfx/drivers/gx2_gfx.c @@ -47,14 +47,130 @@ #include "../gfx_widgets.h" #endif -#include "../common/gx2_defines.h" +#include "../video_defines.h" #include "../video_shader_parse.h" #include "../drivers_shader/slang_process.h" +#include "../drivers/gx2_shaders/frame.h" +#include "../drivers/gx2_shaders/tex.h" +#include "../drivers/gx2_shaders/sprite.h" +#include "../drivers/gx2_shaders/menu_shaders.h" #include "../../wiiu/system/memory.h" #include "../../wiiu/wiiu_dbg.h" #include "../font_driver.h" +#undef _X +#undef _B + +#define _X 0x00 +#define _Y 0x01 +#define _Z 0x02 +#define _W 0x03 +#define _R 0x00 +#define _G 0x01 +#define _B 0x02 +#define _A 0x03 +#define _0 0x04 +#define _1 0x05 +#define GX2_COMP_SEL(c0, c1, c2, c3) (((c0) << 24) | ((c1) << 16) | ((c2) << 8) | (c3)) + +#define COLOR_ARGB(r, g, b, a) (((u32)(a) << 24) | ((u32)(r) << 16) | ((u32)(g) << 8) | ((u32)(b) << 0)) +#define COLOR_RGBA(r, g, b, a) (((u32)(r) << 24) | ((u32)(g) << 16) | ((u32)(b) << 8) | ((u32)(a) << 0)) + +typedef struct +{ + int width; + int height; + GX2TVRenderMode mode; +} wiiu_render_mode_t; + +struct gx2_overlay_data +{ + GX2Texture tex; + sprite_vertex_t v; + float alpha_mod; +}; + +typedef struct +{ + struct + { + GX2Texture texture; + int width; + int height; + bool enable; + sprite_vertex_t* v; + } menu; + +#ifdef HAVE_OVERLAY + struct gx2_overlay_data *overlay; + unsigned overlays; + bool overlay_enable; + bool overlay_full_screen; +#endif + + GX2Sampler sampler_nearest[RARCH_WRAP_MAX]; + GX2Sampler sampler_linear[RARCH_WRAP_MAX]; + GX2Texture texture; + frame_vertex_t *v; + GX2_vec2 *ubo_vp; + GX2_vec2 *ubo_tex; + GX2_mat4x4 *ubo_mvp; + void *input_ring_buffer; + void *output_ring_buffer; + u32 input_ring_buffer_size; + u32 output_ring_buffer_size; + + int width; + int height; + + float* menu_shader_vbo; + menu_shader_uniform_t* menu_shader_ubo; + + struct + { + sprite_vertex_t* v; + int size; + int current; + } vertex_cache; + + struct + { + tex_shader_vertex_t* v; + int size; + int current; + } vertex_cache_tex; + + void *drc_scan_buffer; + void *tv_scan_buffer; + void *cmd_buffer; + GX2ColorBuffer color_buffer; + GX2ContextState *ctx_state; + struct video_shader *shader_preset; + struct + { + GFDFile *gfd; + float *vs_ubos[2]; + float *ps_ubos[2]; + GX2Texture texture; + GX2ColorBuffer color_buffer; + bool mem1; + } pass[GFX_MAX_SHADERS]; + GX2Texture luts[GFX_MAX_TEXTURES]; + + wiiu_render_mode_t render_mode; + video_viewport_t vp; + int frames; + OSTime last_vsync; + unsigned rotation; + bool vsync; + bool rgb32; + bool smooth; + bool keep_aspect; + bool should_resize; + bool render_msg_enabled; +} wiiu_video_t; + typedef struct { GX2Texture texture; diff --git a/gfx/drivers_context/orbis_ctx.c b/gfx/drivers_context/orbis_ctx.c index 8d9899eae1..87b08d0e52 100644 --- a/gfx/drivers_context/orbis_ctx.c +++ b/gfx/drivers_context/orbis_ctx.c @@ -29,11 +29,46 @@ #include "../common/egl_common.h" #endif -#include "../common/orbis_defines.h" #include "../../frontend/frontend_driver.h" #include "../../configuration.h" #include +#ifdef HAVE_EGL +#include +#include "../common/egl_common.h" +#endif + +#define ATTR_ORBISGL_WIDTH 1920 +#define ATTR_ORBISGL_HEIGHT 1080 + +#if defined(HAVE_OOSDK) +#define SIZEOF_SCE_SHDR_CACHE_CONFIG 0x10C +TYPE_BEGIN(struct _SceShdrCacheConfig, SIZEOF_SCE_SHDR_CACHE_CONFIG); + TYPE_FIELD(uint32_t ver, 0x00); + TYPE_FIELD(uint32_t unk1, 0x04); + TYPE_FIELD(uint32_t unk2, 0x08); + TYPE_FIELD(char cache_dir[128], 0x0C); +TYPE_END(); +typedef struct _SceShdrCacheConfig SceShdrCacheConfig; + +bool scePigletSetShaderCacheConfiguration(const SceShdrCacheConfig *config); +#endif + +typedef struct +{ +#ifdef HAVE_EGL + egl_ctx_data_t egl; + ScePglConfig pgl_config; +#if defined(HAVE_OOSDK) + SceShdrCacheConfig shdr_cache_config; +#endif +#endif + SceWindow native_window; + bool resize; + unsigned width, height; + float refresh_rate; +} orbis_ctx_data_t; + /* TODO/FIXME - static globals */ static enum gfx_ctx_api ctx_orbis_api = GFX_CTX_OPENGL_API;