From 9ddad4874460e8af78cf0994ae688d5f1459d11a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 25 Oct 2016 20:18:31 +0200 Subject: [PATCH] Create gfx/video_defines.h --- config.def.h | 2 +- gfx/video_defines.h | 106 ++++++++++++++++++++++++++++++++++++++++++++ gfx/video_driver.h | 95 +++++---------------------------------- 3 files changed, 118 insertions(+), 85 deletions(-) create mode 100644 gfx/video_defines.h diff --git a/config.def.h b/config.def.h index 5b7ea8b22d..75d7d782b7 100644 --- a/config.def.h +++ b/config.def.h @@ -18,7 +18,7 @@ #define __CONFIG_DEF_H #include -#include "gfx/video_driver.h" +#include "gfx/video_defines.h" #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/gfx/video_defines.h b/gfx/video_defines.h new file mode 100644 index 0000000000..b7f1b6a9a6 --- /dev/null +++ b/gfx/video_defines.h @@ -0,0 +1,106 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2016 - Daniel De Matteis + * + * 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 __VIDEO_DEFINES__H +#define __VIDEO_DEFINES__H + +#include + +RETRO_BEGIN_DECLS + +enum texture_filter_type +{ + TEXTURE_FILTER_LINEAR = 0, + TEXTURE_FILTER_NEAREST, + TEXTURE_FILTER_MIPMAP_LINEAR, + TEXTURE_FILTER_MIPMAP_NEAREST +}; + +enum aspect_ratio +{ + ASPECT_RATIO_4_3 = 0, + ASPECT_RATIO_16_9, + ASPECT_RATIO_16_10, + ASPECT_RATIO_16_15, + ASPECT_RATIO_1_1, + ASPECT_RATIO_2_1, + ASPECT_RATIO_3_2, + ASPECT_RATIO_3_4, + ASPECT_RATIO_4_1, + ASPECT_RATIO_4_4, + ASPECT_RATIO_5_4, + ASPECT_RATIO_6_5, + ASPECT_RATIO_7_9, + ASPECT_RATIO_8_3, + ASPECT_RATIO_8_7, + ASPECT_RATIO_19_12, + ASPECT_RATIO_19_14, + ASPECT_RATIO_30_17, + ASPECT_RATIO_32_9, + ASPECT_RATIO_CONFIG, + ASPECT_RATIO_SQUARE, + ASPECT_RATIO_CORE, + ASPECT_RATIO_CUSTOM, + + ASPECT_RATIO_END +}; + +enum rotation +{ + ORIENTATION_NORMAL = 0, + ORIENTATION_VERTICAL, + ORIENTATION_FLIPPED, + ORIENTATION_FLIPPED_ROTATED, + ORIENTATION_END +}; + +enum rarch_display_type +{ + /* Non-bindable types like consoles, KMS, VideoCore, etc. */ + RARCH_DISPLAY_NONE = 0, + /* video_display => Display*, video_window => Window */ + RARCH_DISPLAY_X11, + /* video_display => N/A, video_window => HWND */ + RARCH_DISPLAY_WIN32, + RARCH_DISPLAY_OSX +}; + +#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM + +/* ABGR color format defines */ + +#define WHITE 0xffffffffu +#define RED 0xff0000ffu +#define GREEN 0xff00ff00u +#define BLUE 0xffff0000u +#define YELLOW 0xff00ffffu +#define PURPLE 0xffff00ffu +#define CYAN 0xffffff00u +#define ORANGE 0xff0063ffu +#define SILVER 0xff8c848cu +#define LIGHTBLUE 0xFFFFE0E0U +#define LIGHTORANGE 0xFFE0EEFFu + +#define FONT_COLOR_RGBA(r, g, b, a) (((unsigned)(r) << 24) | ((g) << 16) | ((b) << 8) | ((a) << 0)) +#define FONT_COLOR_GET_RED(col) (((col) >> 24) & 0xff) +#define FONT_COLOR_GET_GREEN(col) (((col) >> 16) & 0xff) +#define FONT_COLOR_GET_BLUE(col) (((col) >> 8) & 0xff) +#define FONT_COLOR_GET_ALPHA(col) (((col) >> 0) & 0xff) +#define FONT_COLOR_ARGB_TO_RGBA(col) ( (((col) >> 24) & 0xff) | (((unsigned)(col) << 8) & 0xffffff00) ) + +RETRO_END_DECLS + +#endif diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 84afa131df..49dd6767b4 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -33,6 +33,7 @@ #endif #include "font_driver.h" +#include "video_defines.h" #include "video_filter.h" #include "video_shader_parse.h" @@ -40,63 +41,6 @@ RETRO_BEGIN_DECLS -enum texture_filter_type -{ - TEXTURE_FILTER_LINEAR = 0, - TEXTURE_FILTER_NEAREST, - TEXTURE_FILTER_MIPMAP_LINEAR, - TEXTURE_FILTER_MIPMAP_NEAREST -}; - -enum aspect_ratio -{ - ASPECT_RATIO_4_3 = 0, - ASPECT_RATIO_16_9, - ASPECT_RATIO_16_10, - ASPECT_RATIO_16_15, - ASPECT_RATIO_1_1, - ASPECT_RATIO_2_1, - ASPECT_RATIO_3_2, - ASPECT_RATIO_3_4, - ASPECT_RATIO_4_1, - ASPECT_RATIO_4_4, - ASPECT_RATIO_5_4, - ASPECT_RATIO_6_5, - ASPECT_RATIO_7_9, - ASPECT_RATIO_8_3, - ASPECT_RATIO_8_7, - ASPECT_RATIO_19_12, - ASPECT_RATIO_19_14, - ASPECT_RATIO_30_17, - ASPECT_RATIO_32_9, - ASPECT_RATIO_CONFIG, - ASPECT_RATIO_SQUARE, - ASPECT_RATIO_CORE, - ASPECT_RATIO_CUSTOM, - - ASPECT_RATIO_END -}; - -enum rotation -{ - ORIENTATION_NORMAL = 0, - ORIENTATION_VERTICAL, - ORIENTATION_FLIPPED, - ORIENTATION_FLIPPED_ROTATED, - ORIENTATION_END -}; - -enum rarch_display_type -{ - /* Non-bindable types like consoles, KMS, VideoCore, etc. */ - RARCH_DISPLAY_NONE = 0, - /* video_display => Display*, video_window => Window */ - RARCH_DISPLAY_X11, - /* video_display => N/A, video_window => HWND */ - RARCH_DISPLAY_WIN32, - RARCH_DISPLAY_OSX -}; - typedef struct video_info { unsigned width; @@ -137,13 +81,6 @@ typedef struct video_info #endif } video_info_t; -#define FONT_COLOR_RGBA(r, g, b, a) (((unsigned)(r) << 24) | ((g) << 16) | ((b) << 8) | ((a) << 0)) -#define FONT_COLOR_GET_RED(col) (((col) >> 24) & 0xff) -#define FONT_COLOR_GET_GREEN(col) (((col) >> 16) & 0xff) -#define FONT_COLOR_GET_BLUE(col) (((col) >> 8) & 0xff) -#define FONT_COLOR_GET_ALPHA(col) (((col) >> 0) & 0xff) -#define FONT_COLOR_ARGB_TO_RGBA(col) ( (((col) >> 24) & 0xff) | (((unsigned)(col) << 8) & 0xffffff00) ) - /* Optionally implemented interface to poke more * deeply into video driver. */ @@ -152,7 +89,8 @@ typedef struct video_poke_interface uintptr_t (*load_texture)(void *video_data, void *data, bool threaded, enum texture_filter_type filter_type); void (*unload_texture)(void *data, uintptr_t id); - void (*set_video_mode)(void *data, unsigned width, unsigned height, bool fullscreen); + void (*set_video_mode)(void *data, unsigned width, + unsigned height, bool fullscreen); void (*set_filtering)(void *data, unsigned index, bool smooth); void (*get_video_output_size)(void *data, unsigned *width, unsigned *height); @@ -267,24 +205,9 @@ typedef struct video_driver unsigned (*wrap_type_to_enum)(enum gfx_wrap_type type); } video_driver_t; -#define LAST_ASPECT_RATIO ASPECT_RATIO_CUSTOM extern char rotation_lut[4][32]; -/* ABGR color format defines */ - -#define WHITE 0xffffffffu -#define RED 0xff0000ffu -#define GREEN 0xff00ff00u -#define BLUE 0xffff0000u -#define YELLOW 0xff00ffffu -#define PURPLE 0xffff00ffu -#define CYAN 0xffffff00u -#define ORANGE 0xff0063ffu -#define SILVER 0xff8c848cu -#define LIGHTBLUE 0xFFFFE0E0U -#define LIGHTORANGE 0xFFE0EEFFu - struct aspect_ratio_elem { char name[64]; @@ -342,8 +265,10 @@ bool video_driver_is_hw_context(void); bool video_driver_is_threaded(void); void video_driver_deinit_hw_context(void); struct retro_hw_render_callback *video_driver_get_hw_context(void); -const struct retro_hw_render_context_negotiation_interface *video_driver_get_context_negotiation_interface(void); -void video_driver_set_context_negotiation_interface(const struct retro_hw_render_context_negotiation_interface *iface); +const struct retro_hw_render_context_negotiation_interface +*video_driver_get_context_negotiation_interface(void); +void video_driver_set_context_negotiation_interface(const struct + retro_hw_render_context_negotiation_interface *iface); void video_driver_set_video_cache_context(void); void video_driver_unset_video_cache_context(void); bool video_driver_is_video_cache_context(void); @@ -357,8 +282,10 @@ bool video_driver_has_gpu_record(void); uint8_t *video_driver_get_gpu_record(void); bool video_driver_gpu_record_init(unsigned size); void video_driver_gpu_record_deinit(void); -bool video_driver_get_current_software_framebuffer(struct retro_framebuffer *fb); -bool video_driver_get_hw_render_interface(const struct retro_hw_render_interface **iface); +bool video_driver_get_current_software_framebuffer(struct + retro_framebuffer *fb); +bool video_driver_get_hw_render_interface(const struct + retro_hw_render_interface **iface); bool video_driver_get_viewport_info(struct video_viewport *viewport); void video_driver_set_title_buf(void); void video_driver_monitor_adjust_system_rates(void);