26 #include "../../config.h" 34 #include "../../verbosity.h" 35 #include "../font_driver.h" 36 #include "../video_coord_array.h" 37 #include "../video_driver.h" 42 #if defined(HAVE_PSGL) 43 #define RARCH_GL_FRAMEBUFFER GL_FRAMEBUFFER_OES 44 #define RARCH_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_OES 45 #define RARCH_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT 46 #elif (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) 47 #define RARCH_GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT 48 #define RARCH_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE_EXT 49 #define RARCH_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT 51 #define RARCH_GL_FRAMEBUFFER GL_FRAMEBUFFER 52 #define RARCH_GL_FRAMEBUFFER_COMPLETE GL_FRAMEBUFFER_COMPLETE 53 #define RARCH_GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0 56 #if defined(HAVE_OPENGLES2) || defined(HAVE_OPENGLES3) || defined(HAVE_OPENGLES_3_1) || defined(HAVE_OPENGLES_3_2) 57 #define RARCH_GL_RENDERBUFFER GL_RENDERBUFFER 58 #if defined(HAVE_OPENGLES2) 59 #define RARCH_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES 61 #define RARCH_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8 63 #define RARCH_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT 64 #define RARCH_GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT 65 #elif (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) 66 #define RARCH_GL_RENDERBUFFER GL_RENDERBUFFER_EXT 67 #define RARCH_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_EXT 68 #define RARCH_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_EXT 69 #define RARCH_GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_EXT 70 #elif defined(HAVE_PSGL) 71 #define RARCH_GL_RENDERBUFFER GL_RENDERBUFFER_OES 72 #define RARCH_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_SCE 73 #define RARCH_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT_OES 74 #define RARCH_GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT_OES 76 #define RARCH_GL_RENDERBUFFER GL_RENDERBUFFER 77 #define RARCH_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8 78 #define RARCH_GL_DEPTH_ATTACHMENT GL_DEPTH_ATTACHMENT 79 #define RARCH_GL_STENCIL_ATTACHMENT GL_STENCIL_ATTACHMENT 82 #if (defined(__MACH__) && (defined(__ppc__) || defined(__ppc64__))) 83 #define RARCH_GL_MAX_RENDERBUFFER_SIZE GL_MAX_RENDERBUFFER_SIZE_EXT 84 #elif defined(HAVE_PSGL) 85 #define RARCH_GL_MAX_RENDERBUFFER_SIZE GL_MAX_RENDERBUFFER_SIZE_OES 87 #define RARCH_GL_MAX_RENDERBUFFER_SIZE GL_MAX_RENDERBUFFER_SIZE 90 #if defined(HAVE_PSGL) 91 #define glGenerateMipmap glGenerateMipmapOES 94 #if defined(__APPLE__) || defined(HAVE_PSGL) 95 #define GL_RGBA32F GL_RGBA32F_ARB 98 #if defined(HAVE_PSGL) 99 #define RARCH_GL_INTERNAL_FORMAT32 GL_ARGB_SCE 100 #define RARCH_GL_INTERNAL_FORMAT16 GL_RGB5 101 #define RARCH_GL_TEXTURE_TYPE32 GL_BGRA 102 #define RARCH_GL_TEXTURE_TYPE16 GL_BGRA 103 #define RARCH_GL_FORMAT32 GL_UNSIGNED_INT_8_8_8_8_REV 104 #define RARCH_GL_FORMAT16 GL_RGB5 105 #elif defined(HAVE_OPENGLES) 108 #define GL_BGRA_EXT 0x80E1 111 #define GL_BGRA8_EXT 0x93A1 115 #define RARCH_GL_INTERNAL_FORMAT32 GL_RGBA 117 #define RARCH_GL_INTERNAL_FORMAT32 GL_BGRA_EXT 119 #define RARCH_GL_INTERNAL_FORMAT16 GL_RGB 120 #define RARCH_GL_TEXTURE_TYPE32 GL_BGRA_EXT 121 #define RARCH_GL_TEXTURE_TYPE16 GL_RGB 122 #define RARCH_GL_FORMAT32 GL_UNSIGNED_BYTE 123 #define RARCH_GL_FORMAT16 GL_UNSIGNED_SHORT_5_6_5 126 #define RARCH_GL_INTERNAL_FORMAT32 GL_RGBA8 127 #define RARCH_GL_INTERNAL_FORMAT16 GL_RGBA8 128 #define RARCH_GL_TEXTURE_TYPE32 GL_BGRA 129 #define RARCH_GL_TEXTURE_TYPE16 GL_BGRA 130 #define RARCH_GL_FORMAT32 GL_UNSIGNED_INT_8_8_8_8_REV 131 #define RARCH_GL_FORMAT16 GL_UNSIGNED_INT_8_8_8_8_REV 137 #define GL_RGB565 0x8D62 139 #define RARCH_GL_INTERNAL_FORMAT16_565 GL_RGB565 140 #define RARCH_GL_TEXTURE_TYPE16_565 GL_RGB 141 #define RARCH_GL_FORMAT16_565 GL_UNSIGNED_SHORT_5_6_5 144 #if defined(HAVE_OPENGLES2) 145 #define NO_GL_CLAMP_TO_BORDER 148 #if defined(HAVE_OPENGLES) 149 #ifndef GL_UNPACK_ROW_LENGTH 150 #define GL_UNPACK_ROW_LENGTH 0x0CF2 153 #ifndef GL_SRGB_ALPHA_EXT 154 #define GL_SRGB_ALPHA_EXT 0x8C42 169 const void *mat_data);
171 gl_t *
gl,
void *chain_data,
unsigned i,
172 unsigned internal_fmt,
unsigned texture_fmt,
173 unsigned texture_type);
180 unsigned fmt,
unsigned type,
210 unsigned fbo_width,
unsigned fbo_height);
221 unsigned vp_width,
unsigned vp_height);
231 const char *context_ident,
338 #ifndef HAVE_OPENGLES 375 const void *
frame,
unsigned base_size);
void(* restore_default_state)(gl_t *gl, void *chain_data)
Definition: gl_common.h:191
void(* deinit_fbo)(gl_t *gl, void *chain_data)
Definition: gl_common.h:200
math_matrix_4x4 mvp
Definition: gl_common.h:311
struct video_tex_info tex_info
Definition: gl_common.h:308
Definition: video_coord_array.h:28
GLenum wrap_mode
Definition: gl_common.h:241
retro_hw_context_type
Definition: libretro.h:1935
bool quitting
Definition: gl_common.h:253
void(* unbind_pbo)(void *data, void *chain_data)
Definition: gl_common.h:184
#define GL_MIRRORED_REPEAT
Definition: glext.h:284
void(* ff_matrix)(const void *data)
Definition: gl_common.h:198
Definition: matrix_4x4.h:40
#define GL_LINEAR_MIPMAP_LINEAR
Definition: nx_gl.h:495
#define GL_NEAREST
Definition: nx_gl.h:503
#define glBindTexture
Definition: glsmsym.h:57
#define INLINE
Definition: retro_inline.h:35
static INLINE bool gl_set_core_context(enum retro_hw_context_type ctx_type)
Definition: gl_common.h:392
void(* init)(gl_t *gl, void *chain_data, unsigned fbo_width, unsigned fbo_height)
Definition: gl_common.h:209
#define RETRO_BEGIN_DECLS
Definition: retro_common_api.h:41
bool should_resize
Definition: gl_common.h:252
GLuint buffer
Definition: glext.h:6555
Definition: video_shader_parse.h:80
void(* set_mvp)(void *data, void *chain_data, void *shader_data, const void *mat_data)
Definition: gl_common.h:166
void(* start_render)(gl_t *gl, void *chain_data, video_frame_info_t *video_info)
Definition: gl_common.h:215
GLenum internalFormat
Definition: glext.h:9307
struct scaler_ctx scaler
Definition: gl_common.h:313
bool has_fbo
Definition: gl_common.h:248
Definition: ffmpeg_core.c:151
GLuint pbo_readback[4]
Definition: gl_common.h:279
static const unsigned hard_sync_frames
Definition: config.def.h:166
float * overlay_vertex_coord
Definition: gl_common.h:304
bool menu_texture_enable
Definition: gl_common.h:263
void(* copy_frame)(gl_t *gl, void *chain_data, video_frame_info_t *video_info, const void *frame, unsigned width, unsigned height, unsigned pitch)
Definition: gl_common.h:185
unsigned int GLuint
Definition: nx_gl.h:48
GLsizeiptr size
Definition: glext.h:6559
const float * vertex_ptr
Definition: gl_common.h:302
#define GL_TEXTURE_WRAP_T
Definition: nx_gl.h:472
#define GFX_MAX_TEXTURES
Definition: video_shader_parse.h:34
bool pbo_readback_enable
Definition: gl_common.h:267
Definition: video_driver.h:625
bool menu_texture_full_screen
Definition: gl_common.h:264
int GLsizei
Definition: nx_gl.h:49
bool hw_render_fbo_init
Definition: gl_common.h:247
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
unsigned pbo_readback_index
Definition: gl_common.h:293
unsigned vp_out_width
Definition: gl_common.h:287
struct video_tex_info prev_info[GFX_MAX_TEXTURES]
Definition: gl_common.h:315
void(* bind_pbo)(unsigned idx)
Definition: gl_common.h:183
struct scaler_ctx pbo_readback_scaler
Definition: gl_common.h:309
bool(* read_viewport)(gl_t *gl, void *chain_data, uint8_t *buffer, bool is_idle)
Definition: gl_common.h:201
Definition: video_coord_array.h:48
unsigned tex_index
Definition: gl_common.h:283
void(* init_pbo)(unsigned size, const void *data)
Definition: gl_common.h:182
const gl_renderchain_driver_t * renderchain_driver
Definition: gl_common.h:318
bool core_context_in_use
Definition: gl_common.h:250
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:6303
unsigned last_width[GFX_MAX_TEXTURES]
Definition: gl_common.h:294
typedef bool(RETRO_CALLCONV *retro_replace_image_index_t)(unsigned index
GLuint * overlay_tex
Definition: gl_common.h:277
GLuint menu_texture
Definition: gl_common.h:278
bool(* init_hw_render)(gl_t *gl, void *chain_data, unsigned width, unsigned height)
Definition: gl_common.h:211
#define GL_CLAMP_TO_EDGE
Definition: glext.h:81
void(* renderchain_render)(gl_t *gl, void *chain_data, video_frame_info_t *video_info, uint64_t frame_count, const struct video_tex_info *tex_info, const struct video_tex_info *feedback_info)
Definition: gl_common.h:222
void(* unbind_vao)(void *data, void *chain_data)
Definition: gl_common.h:195
void(* fence_iterate)(void *data, void *chain_data, unsigned hard_sync_frames)
Definition: gl_common.h:174
GLuint coords
Definition: glext.h:8035
unsigned textures
Definition: gl_common.h:284
#define GL_TEXTURE_WRAP_S
Definition: nx_gl.h:471
bool fullscreen
Definition: gl_common.h:254
static INLINE void gl_bind_texture(GLuint id, GLint wrap_mode, GLint mag_filter, GLint min_filter)
Definition: gl_common.h:324
GLenum type
Definition: glext.h:6233
const char * ident
Definition: gl_common.h:233
Definition: video_driver.h:405
bool have_sync
Definition: gl_common.h:265
const float * white_color_ptr
Definition: gl_common.h:303
bool have_full_npot_support
Definition: gl_common.h:258
void(* bind_backbuffer)(void *data, void *chain_data)
Definition: gl_common.h:199
#define BIT32_SET(a, bit)
Definition: retro_miscellaneous.h:109
GLuint fbo_feedback_texture
Definition: gl_common.h:275
void(* new_vao)(void *data, void *chain_data)
Definition: gl_common.h:192
Definition: video_shader_parse.h:81
unsigned last_height[GFX_MAX_TEXTURES]
Definition: gl_common.h:295
unsigned overlays
Definition: gl_common.h:292
unsigned tex_h
Definition: gl_common.h:290
unsigned int GLenum
Definition: nx_gl.h:39
bool overlay_enable
Definition: gl_common.h:261
bool have_mipmap
Definition: gl_common.h:259
void(* free_vao)(void *data, void *chain_data)
Definition: gl_common.h:193
GLint level
Definition: glext.h:6293
bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
Definition: video_driver.c:3353
void(* free)(gl_t *gl, void *chain_data)
Definition: gl_common.h:213
void(* chain_free)(void *data, void *chain_data)
Definition: gl_common.h:207
const gfx_ctx_driver_t * ctx_driver
Definition: gl_common.h:321
bool vsync
Definition: gl_common.h:243
void(* disable_client_arrays)(void *data, void *chain_data)
Definition: gl_common.h:196
Definition: video_driver.h:513
#define GL_TEXTURE_2D
Definition: nx_gl.h:470
Definition: video_driver.h:332
texture_filter_type
Definition: video_defines.h:24
GLenum src
Definition: glext.h:6980
Definition: video_coord_array.h:56
bool support_unpack_row_length
Definition: gl_common.h:256
void * ctx_data
Definition: gl_common.h:320
GLenum texture_fmt
Definition: gl_common.h:240
bool overlay_full_screen
Definition: gl_common.h:262
bool gl_query_core_context_in_use(void)
Definition: gl_capabilities.c:36
bool keep_aspect
Definition: gl_common.h:255
#define GL_NEAREST_MIPMAP_NEAREST
Definition: nx_gl.h:492
GLuint fbo_feedback
Definition: gl_common.h:274
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 idx
Definition: pixman-arm-neon-asm.h:96
#define GL_TEXTURE_MIN_FILTER
Definition: nx_gl.h:474
#define RETRO_END_DECLS
Definition: retro_common_api.h:42
GLint GLint GLsizei GLsizei GLsizei GLint border
Definition: glext.h:6293
Definition: libretro.h:1944
void GLvoid
Definition: nx_gl.h:42
bool tex_mipmap
Definition: gl_common.h:244
#define GL_CLAMP_TO_BORDER
Definition: glext.h:235
Definition: video_shader_parse.h:82
float * overlay_tex_coord
Definition: gl_common.h:305
void(* set_coords)(void *handle_data, void *chain_data, void *shader_data, const struct video_coords *coords)
Definition: gl_common.h:163
unsigned base_size
Definition: gl_common.h:291
GLuint tex_mag_filter
Definition: gl_common.h:272
void * readback_buffer_screenshot
Definition: gl_common.h:301
void * renderchain_data
Definition: gl_common.h:319
void(* recompute_pass_sizes)(gl_t *gl, void *chain_data, unsigned width, unsigned height, unsigned vp_width, unsigned vp_height)
Definition: gl_common.h:218
void(* bind_vao)(void *data, void *chain_data)
Definition: gl_common.h:194
GLenum texture_type
Definition: gl_common.h:239
Definition: video_driver.h:686
#define GL_LINEAR
Definition: nx_gl.h:269
void(* readback)(gl_t *gl, void *chain_data, unsigned alignment, unsigned fmt, unsigned type, void *src)
Definition: gl_common.h:177
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: glext.h:6293
static INLINE unsigned gl_wrap_type_to_enum(enum gfx_wrap_type type)
Definition: gl_common.h:334
Definition: gl_common.h:236
GLint GLint GLsizei width
Definition: glext.h:6293
void(* bind_prev_texture)(gl_t *gl, void *chain_data, const struct video_tex_info *tex_info)
Definition: gl_common.h:203
static INLINE GLenum gl_min_filter_to_mag(GLenum type)
Definition: gl_common.h:377
int version_major
Definition: gl_common.h:269
bool hw_render_use
Definition: gl_common.h:249
void(* deinit_hw_render)(gl_t *gl, void *chain_data)
Definition: gl_common.h:214
bool pbo_readback_valid[4]
Definition: gl_common.h:266
Definition: ffmpeg_fft.c:36
unsigned tex_w
Definition: gl_common.h:289
void(* ff_vertex)(const void *data)
Definition: gl_common.h:197
Definition: video_driver.h:116
GLuint pbo
Definition: gl_common.h:276
void * empty_buf
Definition: gl_common.h:299
gfx_wrap_type
Definition: video_shader_parse.h:75
void(* fence_free)(void *data, void *chain_data)
Definition: gl_common.h:176
RGLSYMGLTEXPARAMETERIPROC glTexParameteri
Definition: nx_glsym.h:656
GLuint hw_render_fbo[GFX_MAX_TEXTURES]
Definition: gl_common.h:281
void * conv_buffer
Definition: gl_common.h:300
bool fbo_inited
Definition: gl_common.h:245
#define GFX_MAX_SHADERS
Definition: video_shader_parse.h:30
Definition: metal_common.m:516
int version_minor
Definition: gl_common.h:270
void(* resolve_extensions)(gl_t *gl, void *chain_data, const char *context_ident, const video_info_t *video)
Definition: gl_common.h:228
struct video_viewport vp
Definition: gl_common.h:310
GLuint tex_min_filter
Definition: gl_common.h:273
unsigned vp_out_height
Definition: gl_common.h:288
GLenum internal_fmt
Definition: gl_common.h:238
bool have_es2_compat
Definition: gl_common.h:257
Definition: gl_common.h:161
video_info_t video_info
Definition: gl_common.h:314
void(* check_fbo_dimensions)(gl_t *gl, void *chain_data)
Definition: gl_common.h:217
void(* init_texture_reference)(gl_t *gl, void *chain_data, unsigned i, unsigned internal_fmt, unsigned texture_fmt, unsigned texture_type)
Definition: gl_common.h:170
GLbitfield flags
Definition: glext.h:7828
#define GL_TEXTURE_MAG_FILTER
Definition: nx_gl.h:473
float * overlay_color_coord
Definition: gl_common.h:306
unsigned fbo_feedback_pass
Definition: gl_common.h:285
math_matrix_4x4 mvp_no_rot
Definition: gl_common.h:311
void gl_load_texture_image(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *data)
Definition: gl_common.c:47
unsigned __int64 uint64_t
Definition: stdint.h:136
unsigned char uint8_t
Definition: stdint.h:124
unsigned int uint32_t
Definition: stdint.h:126
int GLint
Definition: nx_gl.h:45
float menu_texture_alpha
Definition: gl_common.h:297
Definition: video_shader_parse.h:77
GLint GLint GLsizei GLsizei height
Definition: glext.h:6293
void gl_load_texture_data(uint32_t id_data, enum gfx_wrap_type wrap_type, enum texture_filter_type filter_type, unsigned alignment, unsigned width, unsigned height, const void *frame, unsigned base_size)
Definition: gl.c:604
bool fbo_feedback_enable
Definition: gl_common.h:246
#define GL_REPEAT
Definition: nx_gl.h:504
struct video_fbo_rect fbo_rect[GFX_MAX_SHADERS]
Definition: gl_common.h:316
unsigned rotation
Definition: gl_common.h:286