diff --git a/gfx/common/gl3_common.h b/gfx/common/gl3_common.h index 6c48362367..d24943c2d3 100644 --- a/gfx/common/gl3_common.h +++ b/gfx/common/gl3_common.h @@ -42,18 +42,18 @@ RETRO_BEGIN_DECLS #define GL_CORE_NUM_PBOS 4 #define GL_CORE_NUM_VBOS 256 #define GL_CORE_NUM_FENCES 8 -struct gl_core_streamed_texture +struct gl3_streamed_texture { GLuint tex; unsigned width; unsigned height; }; -typedef struct gl_core +typedef struct gl3 { const gfx_ctx_driver_t *ctx_driver; void *ctx_data; - gl_core_filter_chain_t *filter_chain; + gl3_filter_chain_t *filter_chain; GLuint *overlay_tex; float *overlay_vertex_coord; float *overlay_tex_coord; @@ -64,8 +64,8 @@ typedef struct gl_core video_info_t video_info; video_viewport_t vp; - struct gl_core_viewport filter_chain_vp; - struct gl_core_streamed_texture textures[GL_CORE_NUM_TEXTURES]; + struct gl3_viewport filter_chain_vp; + struct gl3_streamed_texture textures[GL_CORE_NUM_TEXTURES]; GLuint vao; GLuint menu_texture; @@ -80,13 +80,13 @@ typedef struct gl_core GLuint snow_simple; GLuint snow; GLuint bokeh; - struct gl_core_buffer_locations alpha_blend_loc; - struct gl_core_buffer_locations font_loc; - struct gl_core_buffer_locations ribbon_loc; - struct gl_core_buffer_locations ribbon_simple_loc; - struct gl_core_buffer_locations snow_simple_loc; - struct gl_core_buffer_locations snow_loc; - struct gl_core_buffer_locations bokeh_loc; + struct gl3_buffer_locations alpha_blend_loc; + struct gl3_buffer_locations font_loc; + struct gl3_buffer_locations ribbon_loc; + struct gl3_buffer_locations ribbon_simple_loc; + struct gl3_buffer_locations snow_simple_loc; + struct gl3_buffer_locations snow_loc; + struct gl3_buffer_locations bokeh_loc; } pipelines; @@ -129,15 +129,15 @@ typedef struct gl_core bool quitting; bool should_resize; bool keep_aspect; -} gl_core_t; +} gl3_t; -void gl_core_bind_scratch_vbo(gl_core_t *gl, const void *data, size_t size); +void gl3_bind_scratch_vbo(gl3_t *gl, const void *data, size_t size); -GLuint gl_core_compile_shader(GLenum stage, const char *source); +GLuint gl3_compile_shader(GLenum stage, const char *source); -void gl_core_framebuffer_clear(GLuint id); +void gl3_framebuffer_clear(GLuint id); -void gl_core_framebuffer_copy( +void gl3_framebuffer_copy( GLuint fb_id, GLuint quad_program, GLuint quad_vbo, @@ -145,7 +145,7 @@ void gl_core_framebuffer_copy( struct Size2D size, GLuint image); -void gl_core_framebuffer_copy_partial( +void gl3_framebuffer_copy_partial( GLuint fb_id, GLuint quad_program, GLint flat_ubo_vertex, @@ -153,9 +153,9 @@ void gl_core_framebuffer_copy_partial( GLuint image, float rx, float ry); -void gl_core_build_default_matrix(float *data); +void gl3_build_default_matrix(float *data); -uint32_t gl_core_get_cross_compiler_target_version(void); +uint32_t gl3_get_cross_compiler_target_version(void); RETRO_END_DECLS diff --git a/gfx/drivers/gl3.c b/gfx/drivers/gl3.c index 470f8ce691..a06b6b26e8 100644 --- a/gfx/drivers/gl3.c +++ b/gfx/drivers/gl3.c @@ -54,9 +54,9 @@ #include "../gfx_widgets.h" #endif -static const struct video_ortho gl_core_default_ortho = {0, 1, 0, 1, -1, 1}; +static const struct video_ortho gl3_default_ortho = {0, 1, 0, 1, -1, 1}; -void gl_core_build_default_matrix(float *data) +void gl3_build_default_matrix(float *data) { data[0] = 2.0f; data[1] = 0.0f; @@ -76,7 +76,7 @@ void gl_core_build_default_matrix(float *data) data[15] = 1.0f; } -void gl_core_framebuffer_copy( +void gl3_framebuffer_copy( GLuint fb_id, GLuint quad_program, GLuint quad_vbo, @@ -98,7 +98,7 @@ void gl_core_framebuffer_copy( if (flat_ubo_vertex >= 0) { float mvp[16]; - gl_core_build_default_matrix(mvp); + gl3_build_default_matrix(mvp); glUniform4fv(flat_ubo_vertex, 4, mvp); } @@ -123,7 +123,7 @@ void gl_core_framebuffer_copy( glBindFramebuffer(GL_FRAMEBUFFER, 0); } -void gl_core_framebuffer_copy_partial( +void gl3_framebuffer_copy_partial( GLuint fb_id, GLuint quad_program, GLint flat_ubo_vertex, @@ -153,7 +153,7 @@ void gl_core_framebuffer_copy_partial( if (flat_ubo_vertex >= 0) { float mvp[16]; - gl_core_build_default_matrix(mvp); + gl3_build_default_matrix(mvp); glUniform4fv(flat_ubo_vertex, 4, mvp); } glDisable(GL_CULL_FACE); @@ -181,7 +181,7 @@ void gl_core_framebuffer_copy_partial( glBindFramebuffer(GL_FRAMEBUFFER, 0); } -static void gl_core_deinit_fences(gl_core_t *gl) +static void gl3_deinit_fences(gl3_t *gl) { unsigned i; for (i = 0; i < gl->fence_count; i++) @@ -193,7 +193,7 @@ static void gl_core_deinit_fences(gl_core_t *gl) memset(gl->fences, 0, sizeof(gl->fences)); } -static bool gl_core_init_pbo_readback(gl_core_t *gl) +static bool gl3_init_pbo_readback(gl3_t *gl) { unsigned i; struct scaler_ctx *scaler = NULL; @@ -231,7 +231,7 @@ static bool gl_core_init_pbo_readback(gl_core_t *gl) return true; } -static void gl_core_deinit_pbo_readback(gl_core_t *gl) +static void gl3_deinit_pbo_readback(gl3_t *gl) { unsigned i; for (i = 0; i < GL_CORE_NUM_PBOS; i++) @@ -241,7 +241,7 @@ static void gl_core_deinit_pbo_readback(gl_core_t *gl) scaler_ctx_gen_reset(&gl->pbo_readback_scaler); } -static void gl_core_slow_readback(gl_core_t *gl, void *buffer) +static void gl3_slow_readback(gl3_t *gl, void *buffer) { glPixelStorei(GL_PACK_ALIGNMENT, 4); glPixelStorei(GL_PACK_ROW_LENGTH, 0); @@ -255,7 +255,7 @@ static void gl_core_slow_readback(gl_core_t *gl, void *buffer) GL_RGBA, GL_UNSIGNED_BYTE, buffer); } -static void gl_core_pbo_async_readback(gl_core_t *gl) +static void gl3_pbo_async_readback(gl3_t *gl) { glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[gl->pbo_readback_index++]); glPixelStorei(GL_PACK_ALIGNMENT, 4); @@ -273,7 +273,7 @@ static void gl_core_pbo_async_readback(gl_core_t *gl) glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); } -static void gl_core_fence_iterate(gl_core_t *gl, unsigned hard_sync_frames) +static void gl3_fence_iterate(gl3_t *gl, unsigned hard_sync_frames) { if (gl->fence_count < GL_CORE_NUM_FENCES) { @@ -299,7 +299,7 @@ static void gl_core_fence_iterate(gl_core_t *gl, unsigned hard_sync_frames) } } -uint32_t gl_core_get_cross_compiler_target_version(void) +uint32_t gl3_get_cross_compiler_target_version(void) { const char *version = (const char*)glGetString(GL_VERSION); unsigned major = 0; @@ -342,7 +342,7 @@ uint32_t gl_core_get_cross_compiler_target_version(void) return 100 * major + 10 * minor; } -GLuint gl_core_compile_shader(GLenum stage, const char *source) +GLuint gl3_compile_shader(GLenum stage, const char *source) { GLint status; GLuint shader = glCreateShader(stage); @@ -376,7 +376,7 @@ GLuint gl_core_compile_shader(GLenum stage, const char *source) } -void gl_core_framebuffer_clear(GLuint id) +void gl3_framebuffer_clear(GLuint id) { glBindFramebuffer(GL_FRAMEBUFFER, id); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); @@ -385,7 +385,7 @@ void gl_core_framebuffer_clear(GLuint id) glBindFramebuffer(GL_FRAMEBUFFER, 0); } -void gl_core_bind_scratch_vbo(gl_core_t *gl, const void *data, size_t size) +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]); @@ -397,7 +397,7 @@ void gl_core_bind_scratch_vbo(gl_core_t *gl, const void *data, size_t size) } #ifdef HAVE_OVERLAY -static void gl_core_free_overlay(gl_core_t *gl) +static void gl3_free_overlay(gl3_t *gl) { if (gl->overlay_tex) glDeleteTextures(gl->overlays, gl->overlay_tex); @@ -413,7 +413,7 @@ static void gl_core_free_overlay(gl_core_t *gl) gl->overlays = 0; } -static void gl_core_free_scratch_vbos(gl_core_t *gl) +static void gl3_free_scratch_vbos(gl3_t *gl) { unsigned i; for (i = 0; i < GL_CORE_NUM_VBOS; i++) @@ -421,13 +421,13 @@ static void gl_core_free_scratch_vbos(gl_core_t *gl) glDeleteBuffers(1, &gl->scratch_vbos[i]); } -static void gl_core_overlay_vertex_geom(void *data, +static void gl3_overlay_vertex_geom(void *data, unsigned image, float x, float y, float w, float h) { GLfloat *vertex = NULL; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; @@ -454,13 +454,13 @@ static void gl_core_overlay_vertex_geom(void *data, vertex[7] = y + h; } -static void gl_core_overlay_tex_geom(void *data, +static void gl3_overlay_tex_geom(void *data, unsigned image, GLfloat x, GLfloat y, GLfloat w, GLfloat h) { GLfloat *tex = NULL; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; @@ -477,7 +477,7 @@ static void gl_core_overlay_tex_geom(void *data, tex[7] = y + h; } -static void gl_core_render_overlay(gl_core_t *gl, +static void gl3_render_overlay(gl3_t *gl, unsigned width, unsigned height) { unsigned i; @@ -500,11 +500,11 @@ static void gl_core_render_overlay(gl_core_t *gl, glEnableVertexAttribArray(1); glEnableVertexAttribArray(2); - gl_core_bind_scratch_vbo(gl, gl->overlay_vertex_coord, 8 * sizeof(float) * gl->overlays); + gl3_bind_scratch_vbo(gl, gl->overlay_vertex_coord, 8 * sizeof(float) * gl->overlays); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void *)(uintptr_t)0); - gl_core_bind_scratch_vbo(gl, gl->overlay_tex_coord, 8 * sizeof(float) * gl->overlays); + gl3_bind_scratch_vbo(gl, gl->overlay_tex_coord, 8 * sizeof(float) * gl->overlays); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void *)(uintptr_t)0); - gl_core_bind_scratch_vbo(gl, gl->overlay_color_coord, 16 * sizeof(float) * gl->overlays); + gl3_bind_scratch_vbo(gl, gl->overlay_color_coord, 16 * sizeof(float) * gl->overlays); glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void *)(uintptr_t)0); for (i = 0; i < gl->overlays; i++) @@ -525,13 +525,13 @@ static void gl_core_render_overlay(gl_core_t *gl, } #endif -#define gl_core_context_bind_hw_render(gl, enable) \ +#define gl3_context_bind_hw_render(gl, enable) \ if (gl->use_shared_context) \ gl->ctx_driver->bind_hw_render(gl->ctx_data, enable) -static void gl_core_deinit_hw_render(gl_core_t *gl) +static void gl3_deinit_hw_render(gl3_t *gl) { - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); if (gl->hw_render_fbo) glDeleteFramebuffers(1, &gl->hw_render_fbo); @@ -543,20 +543,20 @@ static void gl_core_deinit_hw_render(gl_core_t *gl) gl->hw_render_fbo = 0; gl->hw_render_rb_ds = 0; gl->hw_render_texture = 0; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); gl->hw_render_enable = false; } -static void gl_core_destroy_resources(gl_core_t *gl) +static void gl3_destroy_resources(gl3_t *gl) { unsigned i; if (!gl) return; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); if (gl->filter_chain) - gl_core_filter_chain_free(gl->filter_chain); + gl3_filter_chain_free(gl->filter_chain); gl->filter_chain = NULL; glBindVertexArray(0); @@ -589,22 +589,22 @@ static void gl_core_destroy_resources(gl_core_t *gl) glDeleteProgram(gl->pipelines.bokeh); #ifdef HAVE_OVERLAY - gl_core_free_overlay(gl); - gl_core_free_scratch_vbos(gl); + gl3_free_overlay(gl); + gl3_free_scratch_vbos(gl); #endif - gl_core_deinit_fences(gl); - gl_core_deinit_pbo_readback(gl); - gl_core_deinit_hw_render(gl); + gl3_deinit_fences(gl); + gl3_deinit_pbo_readback(gl); + gl3_deinit_hw_render(gl); } -static bool gl_core_init_hw_render(gl_core_t *gl, unsigned width, unsigned height) +static bool gl3_init_hw_render(gl3_t *gl, unsigned width, unsigned height) { GLint max_fbo_size; GLint max_rb_size; GLenum status; struct retro_hw_render_callback *hwr = video_driver_get_hw_context(); - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); RARCH_LOG("[GLCore]: Initializing HW render (%u x %u).\n", width, height); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_fbo_size); @@ -648,7 +648,7 @@ static bool gl_core_init_hw_render(gl_core_t *gl, unsigned width, unsigned heigh if (status != GL_FRAMEBUFFER_COMPLETE) { RARCH_ERR("[GLCore]: Framebuffer is not complete.\n"); - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); return false; } @@ -664,12 +664,12 @@ static bool gl_core_init_hw_render(gl_core_t *gl, unsigned width, unsigned heigh gl->hw_render_max_height = height; glBindTexture(GL_TEXTURE_2D, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0); - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); return true; } -static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl) +static const gfx_ctx_driver_t *gl3_get_context(gl3_t *gl) { unsigned major; unsigned minor; @@ -731,7 +731,7 @@ static const gfx_ctx_driver_t *gl_core_get_context(gl_core_t *gl) return gfx_ctx; } -static void gl_core_set_projection(gl_core_t *gl, +static void gl3_set_projection(gl3_t *gl, const struct video_ortho *ortho, bool allow_rotate) { math_matrix_4x4 rot; @@ -762,7 +762,7 @@ static void gl_core_set_projection(gl_core_t *gl, MAT_ELEM_4X4(gl->mvp_yflip, 1, 3) *= -1.0f; } -static void gl_core_set_viewport(gl_core_t *gl, +static void gl3_set_viewport(gl3_t *gl, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate) @@ -846,7 +846,7 @@ static void gl_core_set_viewport(gl_core_t *gl, #endif glViewport(gl->vp.x, gl->vp.y, gl->vp.width, gl->vp.height); - gl_core_set_projection(gl, &gl_core_default_ortho, allow_rotate); + gl3_set_projection(gl, &gl3_default_ortho, allow_rotate); /* Set last backbuffer viewport. */ if (!force_full) @@ -865,7 +865,7 @@ static void gl_core_set_viewport(gl_core_t *gl, #endif } -static bool gl_core_init_pipelines(gl_core_t *gl) +static bool gl3_init_pipelines(gl3_t *gl) { static const uint32_t alpha_blend_vert[] = #include "vulkan_shaders/alpha_blend.vert.inc" @@ -907,43 +907,43 @@ static bool gl_core_init_pipelines(gl_core_t *gl) #include "vulkan_shaders/pipeline_bokeh.frag.inc" ; - gl->pipelines.alpha_blend = gl_core_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), + gl->pipelines.alpha_blend = gl3_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), alpha_blend_frag, sizeof(alpha_blend_frag), &gl->pipelines.alpha_blend_loc, true); if (!gl->pipelines.alpha_blend) return false; - gl->pipelines.font = gl_core_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), + gl->pipelines.font = gl3_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), font_frag, sizeof(font_frag), &gl->pipelines.font_loc, true); if (!gl->pipelines.font) return false; - gl->pipelines.ribbon_simple = gl_core_cross_compile_program(pipeline_ribbon_simple_vert, sizeof(pipeline_ribbon_simple_vert), + gl->pipelines.ribbon_simple = gl3_cross_compile_program(pipeline_ribbon_simple_vert, sizeof(pipeline_ribbon_simple_vert), pipeline_ribbon_simple_frag, sizeof(pipeline_ribbon_simple_frag), &gl->pipelines.ribbon_simple_loc, true); if (!gl->pipelines.ribbon_simple) return false; - gl->pipelines.ribbon = gl_core_cross_compile_program(pipeline_ribbon_vert, sizeof(pipeline_ribbon_vert), + gl->pipelines.ribbon = gl3_cross_compile_program(pipeline_ribbon_vert, sizeof(pipeline_ribbon_vert), pipeline_ribbon_frag, sizeof(pipeline_ribbon_frag), &gl->pipelines.ribbon_loc, true); if (!gl->pipelines.ribbon) return false; - gl->pipelines.bokeh = gl_core_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), + gl->pipelines.bokeh = gl3_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), pipeline_bokeh_frag, sizeof(pipeline_bokeh_frag), &gl->pipelines.bokeh_loc, true); if (!gl->pipelines.bokeh) return false; - gl->pipelines.snow_simple = gl_core_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), + gl->pipelines.snow_simple = gl3_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), pipeline_snow_simple_frag, sizeof(pipeline_snow_simple_frag), &gl->pipelines.snow_simple_loc, true); if (!gl->pipelines.snow_simple) return false; - gl->pipelines.snow = gl_core_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), + gl->pipelines.snow = gl3_cross_compile_program(alpha_blend_vert, sizeof(alpha_blend_vert), pipeline_snow_frag, sizeof(pipeline_snow_frag), &gl->pipelines.snow_loc, true); if (!gl->pipelines.snow) @@ -952,12 +952,12 @@ static bool gl_core_init_pipelines(gl_core_t *gl) return true; } -static bool gl_core_init_default_filter_chain(gl_core_t *gl) +static bool gl3_init_default_filter_chain(gl3_t *gl) { if (!gl->ctx_driver) return false; - gl->filter_chain = gl_core_filter_chain_create_default( + gl->filter_chain = gl3_filter_chain_create_default( gl->video_info.smooth ? GLSLANG_FILTER_CHAIN_LINEAR : GLSLANG_FILTER_CHAIN_NEAREST); @@ -971,9 +971,9 @@ static bool gl_core_init_default_filter_chain(gl_core_t *gl) return true; } -static bool gl_core_init_filter_chain_preset(gl_core_t *gl, const char *shader_path) +static bool gl3_init_filter_chain_preset(gl3_t *gl, const char *shader_path) { - gl->filter_chain = gl_core_filter_chain_create_from_preset( + gl->filter_chain = gl3_filter_chain_create_from_preset( shader_path, gl->video_info.smooth ? GLSLANG_FILTER_CHAIN_LINEAR @@ -988,7 +988,7 @@ static bool gl_core_init_filter_chain_preset(gl_core_t *gl, const char *shader_p return true; } -static bool gl_core_init_filter_chain(gl_core_t *gl) +static bool gl3_init_filter_chain(gl3_t *gl) { const char *shader_path = retroarch_get_shader_preset(); enum rarch_shader_type type = video_shader_parse_type(shader_path); @@ -996,17 +996,17 @@ static bool gl_core_init_filter_chain(gl_core_t *gl) if (string_is_empty(shader_path)) { RARCH_LOG("[GLCore]: Loading stock shader.\n"); - return gl_core_init_default_filter_chain(gl); + return gl3_init_default_filter_chain(gl); } if (type != RARCH_SHADER_SLANG) { RARCH_WARN("[GLCore]: Only Slang shaders are supported, falling back to stock.\n"); - return gl_core_init_default_filter_chain(gl); + return gl3_init_default_filter_chain(gl); } - if (!gl_core_init_filter_chain_preset(gl, shader_path)) - gl_core_init_default_filter_chain(gl); + if (!gl3_init_filter_chain_preset(gl, shader_path)) + gl3_init_default_filter_chain(gl); return true; } @@ -1035,13 +1035,13 @@ static bool gl_core_init_filter_chain(gl_core_t *gl) #else #define DEBUG_CALLBACK_TYPE APIENTRY #endif -static void DEBUG_CALLBACK_TYPE gl_core_debug_cb(GLenum source, GLenum type, +static void DEBUG_CALLBACK_TYPE gl3_debug_cb(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, void *userParam) { const char *src = NULL; const char *typestr = NULL; - gl_core_t *gl = (gl_core_t*)userParam; /* Useful for debugger. */ + gl3_t *gl = (gl3_t*)userParam; /* Useful for debugger. */ (void)gl; (void)id; @@ -1120,17 +1120,17 @@ static void DEBUG_CALLBACK_TYPE gl_core_debug_cb(GLenum source, GLenum type, } } -static void gl_core_begin_debug(gl_core_t *gl) +static void gl3_begin_debug(gl3_t *gl) { if (gl_check_capability(GL_CAPS_DEBUG)) { #ifdef HAVE_OPENGLES3 - glDebugMessageCallbackKHR(gl_core_debug_cb, gl); + glDebugMessageCallbackKHR(gl3_debug_cb, gl); glDebugMessageControlKHR(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR); glEnable(GL_DEBUG_OUTPUT_KHR); #else - glDebugMessageCallback(gl_core_debug_cb, gl); + glDebugMessageCallback(gl3_debug_cb, gl); glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE); glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); glEnable(GL_DEBUG_OUTPUT); @@ -1141,17 +1141,17 @@ static void gl_core_begin_debug(gl_core_t *gl) } #endif -static void gl_core_set_viewport_wrapper(void *data, +static void gl3_set_viewport_wrapper(void *data, unsigned viewport_width, unsigned viewport_height, bool force_full, bool allow_rotate) { - gl_core_t *gl = (gl_core_t*)data; - gl_core_set_viewport(gl, + gl3_t *gl = (gl3_t*)data; + gl3_set_viewport(gl, viewport_width, viewport_height, force_full, allow_rotate); } -static void *gl_core_init(const video_info_t *video, +static void *gl3_init(const video_info_t *video, input_driver_t **input, void **input_data) { unsigned full_x, full_y; @@ -1168,8 +1168,8 @@ static void *gl_core_init(const video_info_t *video, const char *renderer = NULL; const char *version = NULL; char *error_string = NULL; - gl_core_t *gl = (gl_core_t*)calloc(1, sizeof(gl_core_t)); - const gfx_ctx_driver_t *ctx_driver = gl_core_get_context(gl); + gl3_t *gl = (gl3_t*)calloc(1, sizeof(gl3_t)); + const gfx_ctx_driver_t *ctx_driver = gl3_get_context(gl); struct retro_hw_render_callback *hwr = video_driver_get_hw_context(); if (!gl || !ctx_driver) @@ -1220,19 +1220,19 @@ static void *gl_core_init(const video_info_t *video, win_width, win_height, video->fullscreen)) goto error; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); rglgen_resolve_symbols(ctx_driver->get_proc_address); if (hwr && hwr->context_type != RETRO_HW_CONTEXT_NONE) - gl_core_init_hw_render(gl, RARCH_SCALE_BASE * video->input_scale, RARCH_SCALE_BASE * video->input_scale); + gl3_init_hw_render(gl, RARCH_SCALE_BASE * video->input_scale, RARCH_SCALE_BASE * video->input_scale); #ifdef GL_DEBUG - gl_core_begin_debug(gl); + gl3_begin_debug(gl); if (gl->hw_render_enable) { - gl_core_context_bind_hw_render(gl, true); - gl_core_begin_debug(gl); - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, true); + gl3_begin_debug(gl); + gl3_context_bind_hw_render(gl, false); } #endif @@ -1249,7 +1249,7 @@ static void *gl_core_init(const video_info_t *video, if (string_is_equal(ctx_driver->ident, "null")) goto error; - if (!gl_core_init_pipelines(gl)) + if (!gl3_init_pipelines(gl)) { RARCH_ERR("[GLCore]: Failed to cross-compile menu pipelines.\n"); goto error; @@ -1307,7 +1307,7 @@ static void *gl_core_init(const video_info_t *video, /* Set the viewport to fix recording, since it needs to know * the viewport sizes before we start running. */ - gl_core_set_viewport_wrapper(gl, temp_width, temp_height, false, true); + gl3_set_viewport_wrapper(gl, temp_width, temp_height, false, true); if (gl->ctx_driver->input_driver) { @@ -1317,7 +1317,7 @@ static void *gl_core_init(const video_info_t *video, input, input_data); } - if (!gl_core_init_filter_chain(gl)) + if (!gl3_init_filter_chain(gl)) { RARCH_ERR("[GLCore]: Failed to init filter chain.\n"); goto error; @@ -1335,7 +1335,7 @@ static void *gl_core_init(const video_info_t *video, gl->pbo_readback_enable = video_gpu_record && recording_state_get_ptr()->enable; - if (gl->pbo_readback_enable && gl_core_init_pbo_readback(gl)) + if (gl->pbo_readback_enable && gl3_init_pbo_readback(gl)) { RARCH_LOG("[GLCore]: Async PBO readback enabled.\n"); } @@ -1351,18 +1351,18 @@ static void *gl_core_init(const video_info_t *video, glBindVertexArray(gl->vao); glBindVertexArray(0); - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); return gl; error: video_context_driver_free(); - gl_core_destroy_resources(gl); + gl3_destroy_resources(gl); if (gl) free(gl); return NULL; } -static unsigned gl_core_num_miplevels(unsigned width, unsigned height) +static unsigned gl3_num_miplevels(unsigned width, unsigned height) { unsigned levels = 1; if (width < height) @@ -1375,7 +1375,7 @@ static unsigned gl_core_num_miplevels(unsigned width, unsigned height) return levels; } -static void video_texture_load_gl_core( +static void video_texture_load_gl3( const struct texture_image *ti, enum texture_filter_type filter_type, uintptr_t *idptr) @@ -1391,7 +1391,7 @@ static void video_texture_load_gl_core( levels = 1; if (filter_type == TEXTURE_FILTER_MIPMAP_LINEAR || filter_type == TEXTURE_FILTER_MIPMAP_NEAREST) - levels = gl_core_num_miplevels(ti->width, ti->height); + levels = gl3_num_miplevels(ti->width, ti->height); glTexStorage2D(GL_TEXTURE_2D, levels, GL_RGBA8, ti->width, ti->height); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -1436,19 +1436,19 @@ static void video_texture_load_gl_core( } #ifdef HAVE_OVERLAY -static bool gl_core_overlay_load(void *data, +static bool gl3_overlay_load(void *data, const void *image_data, unsigned num_images) { unsigned i, j; uintptr_t id; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; const struct texture_image *images = (const struct texture_image*)image_data; if (!gl) return false; - gl_core_free_overlay(gl); + gl3_free_overlay(gl); gl->overlay_tex = (GLuint*) calloc(num_images, sizeof(*gl->overlay_tex)); @@ -1472,12 +1472,12 @@ static bool gl_core_overlay_load(void *data, for (i = 0; i < num_images; i++) { - video_texture_load_gl_core(&images[i], TEXTURE_FILTER_LINEAR, &id); + video_texture_load_gl3(&images[i], TEXTURE_FILTER_LINEAR, &id); gl->overlay_tex[i] = id; /* Default. Stretch to whole screen. */ - gl_core_overlay_tex_geom(gl, i, 0, 0, 1, 1); - gl_core_overlay_vertex_geom(gl, i, 0, 0, 1, 1); + gl3_overlay_tex_geom(gl, i, 0, 0, 1, 1); + gl3_overlay_vertex_geom(gl, i, 0, 0, 1, 1); for (j = 0; j < 16; j++) gl->overlay_color_coord[16 * i + j] = 1.0f; @@ -1486,9 +1486,9 @@ static bool gl_core_overlay_load(void *data, return true; } -static void gl_core_overlay_enable(void *data, bool state) +static void gl3_overlay_enable(void *data, bool state) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; @@ -1499,17 +1499,17 @@ static void gl_core_overlay_enable(void *data, bool state) gl->ctx_driver->show_mouse(gl->ctx_data, state); } -static void gl_core_overlay_full_screen(void *data, bool enable) +static void gl3_overlay_full_screen(void *data, bool enable) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl) gl->overlay_full_screen = enable; } -static void gl_core_overlay_set_alpha(void *data, unsigned image, float mod) +static void gl3_overlay_set_alpha(void *data, unsigned image, float mod) { GLfloat *color = NULL; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; @@ -1521,44 +1521,44 @@ static void gl_core_overlay_set_alpha(void *data, unsigned image, float mod) color[12 + 3] = mod; } -static const video_overlay_interface_t gl_core_overlay_interface = { - gl_core_overlay_enable, - gl_core_overlay_load, - gl_core_overlay_tex_geom, - gl_core_overlay_vertex_geom, - gl_core_overlay_full_screen, - gl_core_overlay_set_alpha, +static const video_overlay_interface_t gl3_overlay_interface = { + gl3_overlay_enable, + gl3_overlay_load, + gl3_overlay_tex_geom, + gl3_overlay_vertex_geom, + gl3_overlay_full_screen, + gl3_overlay_set_alpha, }; -static void gl_core_get_overlay_interface(void *data, +static void gl3_get_overlay_interface(void *data, const video_overlay_interface_t **iface) { (void)data; - *iface = &gl_core_overlay_interface; + *iface = &gl3_overlay_interface; } #endif -static void gl_core_free(void *data) +static void gl3_free(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); font_driver_free_osd(); - gl_core_destroy_resources(gl); + gl3_destroy_resources(gl); if (gl->ctx_driver && gl->ctx_driver->destroy) gl->ctx_driver->destroy(gl->ctx_data); video_context_driver_free(); free(gl); } -static bool gl_core_alive(void *data) +static bool gl3_alive(void *data) { bool ret = false; bool quit = false; bool resize = false; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; unsigned temp_width = gl->video_width; unsigned temp_height = gl->video_height; @@ -1582,17 +1582,17 @@ static bool gl_core_alive(void *data) return ret; } -static void gl_core_set_nonblock_state(void *data, bool state, +static void gl3_set_nonblock_state(void *data, bool state, bool adaptive_vsync_enabled, unsigned swap_interval) { int interval = 0; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); if (!state) interval = swap_interval; @@ -1603,29 +1603,29 @@ static void gl_core_set_nonblock_state(void *data, bool state, gl->ctx_driver->swap_interval(gl->ctx_data, interval); } - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); } -static bool gl_core_suppress_screensaver(void *data, bool enable) +static bool gl3_suppress_screensaver(void *data, bool enable) { bool enabled = enable; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl->ctx_data && gl->ctx_driver->suppress_screensaver) return gl->ctx_driver->suppress_screensaver(gl->ctx_data, enabled); return false; } -static bool gl_core_set_shader(void *data, +static bool gl3_set_shader(void *data, enum rarch_shader_type type, const char *path) { - gl_core_t *gl = (gl_core_t *)data; + gl3_t *gl = (gl3_t *)data; if (!gl) return false; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); if (gl->filter_chain) - gl_core_filter_chain_free(gl->filter_chain); + gl3_filter_chain_free(gl->filter_chain); gl->filter_chain = NULL; if (!string_is_empty(path) && type != RARCH_SHADER_SLANG) @@ -1636,38 +1636,38 @@ static bool gl_core_set_shader(void *data, if (string_is_empty(path)) { - gl_core_init_default_filter_chain(gl); - gl_core_context_bind_hw_render(gl, true); + gl3_init_default_filter_chain(gl); + gl3_context_bind_hw_render(gl, true); return true; } - if (!gl_core_init_filter_chain_preset(gl, path)) + if (!gl3_init_filter_chain_preset(gl, path)) { RARCH_ERR("[GLCore]: Failed to create filter chain: \"%s\". Falling back to stock.\n", path); - gl_core_init_default_filter_chain(gl); - gl_core_context_bind_hw_render(gl, true); + gl3_init_default_filter_chain(gl); + gl3_context_bind_hw_render(gl, true); return false; } - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); return true; } -static void gl_core_set_rotation(void *data, unsigned rotation) +static void gl3_set_rotation(void *data, unsigned rotation) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; gl->rotation = video_driver_is_hw_context() && gl->hw_render_bottom_left ? 90 * rotation : 270 * rotation; - gl_core_set_projection(gl, &gl_core_default_ortho, true); + gl3_set_projection(gl, &gl3_default_ortho, true); } -static void gl_core_viewport_info(void *data, struct video_viewport *vp) +static void gl3_viewport_info(void *data, struct video_viewport *vp) { unsigned top_y, top_dist; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; unsigned width = gl->video_width; unsigned height = gl->video_height; @@ -1682,15 +1682,15 @@ static void gl_core_viewport_info(void *data, struct video_viewport *vp) vp->y = top_dist; } -static bool gl_core_read_viewport(void *data, uint8_t *buffer, bool is_idle) +static bool gl3_read_viewport(void *data, uint8_t *buffer, bool is_idle) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; unsigned num_pixels = 0; if (!gl) return false; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); num_pixels = gl->vp.width * gl->vp.height; if (gl->pbo_readback_enable) @@ -1742,16 +1742,16 @@ static bool gl_core_read_viewport(void *data, uint8_t *buffer, bool is_idle) gl->readback_buffer_screenshot = NULL; } - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); return true; error: - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); return false; } -static void gl_core_update_cpu_texture(gl_core_t *gl, - struct gl_core_streamed_texture *streamed, +static void gl3_update_cpu_texture(gl3_t *gl, + struct gl3_streamed_texture *streamed, const void *frame, unsigned width, unsigned height, unsigned pitch) { if (width != streamed->width || height != streamed->height) @@ -1792,7 +1792,7 @@ static void gl_core_update_cpu_texture(gl_core_t *gl, } #if defined(HAVE_MENU) -static void gl_core_draw_menu_texture(gl_core_t *gl, +static void gl3_draw_menu_texture(gl3_t *gl, unsigned width, unsigned height) { const float vbo_data[] = { @@ -1823,7 +1823,7 @@ static void gl_core_draw_menu_texture(gl_core_t *gl, glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glEnableVertexAttribArray(2); - gl_core_bind_scratch_vbo(gl, vbo_data, sizeof(vbo_data)); + gl3_bind_scratch_vbo(gl, vbo_data, sizeof(vbo_data)); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void *)(uintptr_t)0); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void *)(uintptr_t)(2 * sizeof(float))); glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void *)(uintptr_t)(4 * sizeof(float))); @@ -1837,15 +1837,15 @@ static void gl_core_draw_menu_texture(gl_core_t *gl, } #endif -static bool gl_core_frame(void *data, const void *frame, +static bool gl3_frame(void *data, const void *frame, unsigned frame_width, unsigned frame_height, uint64_t frame_count, unsigned pitch, const char *msg, video_frame_info_t *video_info) { - struct gl_core_filter_chain_texture texture; - struct gl_core_streamed_texture *streamed = NULL; - gl_core_t *gl = (gl_core_t*)data; + struct gl3_filter_chain_texture texture; + struct gl3_streamed_texture *streamed = NULL; + gl3_t *gl = (gl3_t*)data; unsigned width = video_info->width; unsigned height = video_info->height; struct font_params *osd_params = (struct font_params*) @@ -1870,7 +1870,7 @@ static bool gl_core_frame(void *data, const void *frame, if (!gl) return false; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); glBindVertexArray(gl->vao); if (frame) @@ -1880,7 +1880,7 @@ static bool gl_core_frame(void *data, const void *frame, if (frame) { if (!gl->hw_render_enable) - gl_core_update_cpu_texture(gl, streamed, frame, frame_width, frame_height, pitch); + gl3_update_cpu_texture(gl, streamed, frame, frame_width, frame_height, pitch); else { streamed->width = frame_width; @@ -1896,7 +1896,7 @@ static bool gl_core_frame(void *data, const void *frame, gl->should_resize = false; } - gl_core_set_viewport(gl, width, height, false, true); + gl3_set_viewport(gl, width, height, false, true); texture.image = 0; texture.width = streamed->width; @@ -1923,28 +1923,28 @@ static bool gl_core_frame(void *data, const void *frame, texture.padded_width = streamed->width; texture.padded_height = streamed->height; } - gl_core_filter_chain_set_frame_count(gl->filter_chain, frame_count); + gl3_filter_chain_set_frame_count(gl->filter_chain, frame_count); #ifdef HAVE_REWIND - gl_core_filter_chain_set_frame_direction(gl->filter_chain, state_manager_frame_is_reversed() ? -1 : 1); + gl3_filter_chain_set_frame_direction(gl->filter_chain, state_manager_frame_is_reversed() ? -1 : 1); #else - gl_core_filter_chain_set_frame_direction(gl->filter_chain, 1); + gl3_filter_chain_set_frame_direction(gl->filter_chain, 1); #endif - gl_core_filter_chain_set_input_texture(gl->filter_chain, &texture); - gl_core_filter_chain_build_offscreen_passes(gl->filter_chain, &gl->filter_chain_vp); + gl3_filter_chain_set_input_texture(gl->filter_chain, &texture); + gl3_filter_chain_build_offscreen_passes(gl->filter_chain, &gl->filter_chain_vp); glBindFramebuffer(GL_FRAMEBUFFER, 0); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); - gl_core_filter_chain_build_viewport_pass(gl->filter_chain, &gl->filter_chain_vp, + gl3_filter_chain_build_viewport_pass(gl->filter_chain, &gl->filter_chain_vp, gl->hw_render_bottom_left ? gl->mvp.data : gl->mvp_yflip.data); - gl_core_filter_chain_end_frame(gl->filter_chain); + gl3_filter_chain_end_frame(gl->filter_chain); #if defined(HAVE_MENU) if (gl->menu_texture_enable) { menu_driver_frame(menu_is_alive, video_info); if (gl->menu_texture_enable && gl->menu_texture) - gl_core_draw_menu_texture(gl, width, height); + gl3_draw_menu_texture(gl, width, height); } else if (statistics_show) { @@ -1956,7 +1956,7 @@ static bool gl_core_frame(void *data, const void *frame, #ifdef HAVE_OVERLAY if (gl->overlay_enable) - gl_core_render_overlay(gl, width, height); + gl3_render_overlay(gl, width, height); #endif #ifdef HAVE_GFX_WIDGETS @@ -1968,7 +1968,7 @@ static bool gl_core_frame(void *data, const void *frame, { #if 0 if (msg_bgcolor_enable) - gl_core_render_osd_background(gl, video_info, msg); + gl3_render_osd_background(gl, video_info, msg); #endif font_driver_render_msg(gl, msg, NULL, NULL); } @@ -1979,7 +1979,7 @@ static bool gl_core_frame(void *data, const void *frame, if (gl->readback_buffer_screenshot) { /* For screenshots, just do the regular slow readback. */ - gl_core_slow_readback(gl, gl->readback_buffer_screenshot); + gl3_slow_readback(gl, gl->readback_buffer_screenshot); } else if (gl->pbo_readback_enable) { @@ -1987,7 +1987,7 @@ static bool gl_core_frame(void *data, const void *frame, /* Don't readback if we're in menu mode. */ if (!gl->menu_texture_enable) #endif - gl_core_pbo_async_readback(gl); + gl3_pbo_async_readback(gl); } @@ -2020,14 +2020,14 @@ static bool gl_core_frame(void *data, const void *frame, if ( hard_sync && !input_driver_nonblock_state ) - gl_core_fence_iterate(gl, hard_sync_frames); + gl3_fence_iterate(gl, hard_sync_frames); glBindVertexArray(0); - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); return true; } -static uint32_t gl_core_get_flags(void *data) +static uint32_t gl3_get_flags(void *data) { uint32_t flags = 0; @@ -2039,7 +2039,7 @@ static uint32_t gl_core_get_flags(void *data) return flags; } -static float gl_core_get_refresh_rate(void *data) +static float gl3_get_refresh_rate(void *data) { float refresh_rate; if (video_context_driver_get_refresh_rate(&refresh_rate)) @@ -2047,9 +2047,9 @@ static float gl_core_get_refresh_rate(void *data) return 0.0f; } -static void gl_core_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) +static void gl3_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; @@ -2058,47 +2058,47 @@ static void gl_core_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) gl->should_resize = true; } -static void gl_core_apply_state_changes(void *data) +static void gl3_apply_state_changes(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl) gl->should_resize = true; } -static struct video_shader *gl_core_get_current_shader(void *data) +static struct video_shader *gl3_get_current_shader(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl || !gl->filter_chain) return NULL; - return gl_core_filter_chain_get_preset(gl->filter_chain); + return gl3_filter_chain_get_preset(gl->filter_chain); } #ifdef HAVE_THREADS -static int video_texture_load_wrap_gl_core_mipmap(void *data) +static int video_texture_load_wrap_gl3_mipmap(void *data) { uintptr_t id = 0; if (!data) return 0; - video_texture_load_gl_core((struct texture_image*)data, + video_texture_load_gl3((struct texture_image*)data, TEXTURE_FILTER_MIPMAP_LINEAR, &id); return (int)id; } -static int video_texture_load_wrap_gl_core(void *data) +static int video_texture_load_wrap_gl3(void *data) { uintptr_t id = 0; if (!data) return 0; - video_texture_load_gl_core((struct texture_image*)data, + video_texture_load_gl3((struct texture_image*)data, TEXTURE_FILTER_LINEAR, &id); return (int)id; } #endif -static uintptr_t gl_core_load_texture(void *video_data, void *data, +static uintptr_t gl3_load_texture(void *video_data, void *data, bool threaded, enum texture_filter_type filter_type) { uintptr_t id = 0; @@ -2106,8 +2106,8 @@ static uintptr_t gl_core_load_texture(void *video_data, void *data, #ifdef HAVE_THREADS if (threaded) { - gl_core_t *gl = (gl_core_t*)video_data; - custom_command_method_t func = video_texture_load_wrap_gl_core; + gl3_t *gl = (gl3_t*)video_data; + custom_command_method_t func = video_texture_load_wrap_gl3; if (gl->ctx_driver->make_current) gl->ctx_driver->make_current(false); @@ -2116,7 +2116,7 @@ static uintptr_t gl_core_load_texture(void *video_data, void *data, { case TEXTURE_FILTER_MIPMAP_LINEAR: case TEXTURE_FILTER_MIPMAP_NEAREST: - func = video_texture_load_wrap_gl_core_mipmap; + func = video_texture_load_wrap_gl3_mipmap; break; default: break; @@ -2125,15 +2125,15 @@ static uintptr_t gl_core_load_texture(void *video_data, void *data, } #endif - video_texture_load_gl_core((struct texture_image*)data, filter_type, &id); + video_texture_load_gl3((struct texture_image*)data, filter_type, &id); return id; } -static void gl_core_unload_texture(void *data, bool threaded, +static void gl3_unload_texture(void *data, bool threaded, uintptr_t id) { GLuint glid; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!id) return; @@ -2149,24 +2149,24 @@ static void gl_core_unload_texture(void *data, bool threaded, glDeleteTextures(1, &glid); } -static void gl_core_set_video_mode(void *data, unsigned width, unsigned height, +static void gl3_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl->ctx_driver->set_video_mode) gl->ctx_driver->set_video_mode(gl->ctx_data, width, height, fullscreen); } -static void gl_core_show_mouse(void *data, bool state) +static void gl3_show_mouse(void *data, bool state) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl && gl->ctx_driver->show_mouse) gl->ctx_driver->show_mouse(gl->ctx_data, state); } -static void gl_core_set_texture_frame(void *data, +static void gl3_set_texture_frame(void *data, const void *frame, bool rgb32, unsigned width, unsigned height, float alpha) { @@ -2174,11 +2174,11 @@ static void gl_core_set_texture_frame(void *data, GLenum menu_filter = settings->bools.menu_linear_filter ? GL_LINEAR : GL_NEAREST; unsigned base_size = rgb32 ? sizeof(uint32_t) : sizeof(uint16_t); - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; - gl_core_context_bind_hw_render(gl, false); + gl3_context_bind_hw_render(gl, false); if (gl->menu_texture) glDeleteTextures(1, &gl->menu_texture); @@ -2206,12 +2206,12 @@ static void gl_core_set_texture_frame(void *data, glBindTexture(GL_TEXTURE_2D, 0); gl->menu_texture_alpha = alpha; - gl_core_context_bind_hw_render(gl, true); + gl3_context_bind_hw_render(gl, true); } -static void gl_core_set_texture_enable(void *data, bool state, bool full_screen) +static void gl3_set_texture_enable(void *data, bool state, bool full_screen) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl) return; @@ -2220,10 +2220,10 @@ static void gl_core_set_texture_enable(void *data, bool state, bool full_screen) gl->menu_texture_full_screen = full_screen; } -static void gl_core_get_video_output_size(void *data, +static void gl3_get_video_output_size(void *data, unsigned *width, unsigned *height, char *desc, size_t desc_len) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl || !gl->ctx_driver || !gl->ctx_driver->get_video_output_size) return; gl->ctx_driver->get_video_output_size( @@ -2231,60 +2231,60 @@ static void gl_core_get_video_output_size(void *data, width, height, desc, desc_len); } -static void gl_core_get_video_output_prev(void *data) +static void gl3_get_video_output_prev(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl || !gl->ctx_driver || !gl->ctx_driver->get_video_output_prev) return; gl->ctx_driver->get_video_output_prev(gl->ctx_data); } -static void gl_core_get_video_output_next(void *data) +static void gl3_get_video_output_next(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl || !gl->ctx_driver || !gl->ctx_driver->get_video_output_next) return; gl->ctx_driver->get_video_output_next(gl->ctx_data); } -static uintptr_t gl_core_get_current_framebuffer(void *data) +static uintptr_t gl3_get_current_framebuffer(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl || !gl->hw_render_enable) return 0; return gl->hw_render_fbo; } -static retro_proc_address_t gl_core_get_proc_address( +static retro_proc_address_t gl3_get_proc_address( void *data, const char *sym) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl && gl->ctx_driver->get_proc_address) return gl->ctx_driver->get_proc_address(sym); return NULL; } -static const video_poke_interface_t gl_core_poke_interface = { - gl_core_get_flags, - gl_core_load_texture, - gl_core_unload_texture, - gl_core_set_video_mode, - gl_core_get_refresh_rate, /* get_refresh_rate */ +static const video_poke_interface_t gl3_poke_interface = { + gl3_get_flags, + gl3_load_texture, + gl3_unload_texture, + gl3_set_video_mode, + gl3_get_refresh_rate, /* get_refresh_rate */ NULL, - gl_core_get_video_output_size, - gl_core_get_video_output_prev, - gl_core_get_video_output_next, - gl_core_get_current_framebuffer, - gl_core_get_proc_address, - gl_core_set_aspect_ratio, - gl_core_apply_state_changes, - gl_core_set_texture_frame, - gl_core_set_texture_enable, + gl3_get_video_output_size, + gl3_get_video_output_prev, + gl3_get_video_output_next, + gl3_get_current_framebuffer, + gl3_get_proc_address, + gl3_set_aspect_ratio, + gl3_apply_state_changes, + gl3_set_texture_frame, + gl3_set_texture_enable, font_driver_render_msg, - gl_core_show_mouse, + gl3_show_mouse, NULL, /* grab_mouse_toggle */ - gl_core_get_current_shader, + gl3_get_current_shader, NULL, NULL, NULL, /* set_hdr_max_nits */ @@ -2293,22 +2293,22 @@ static const video_poke_interface_t gl_core_poke_interface = { NULL /* set_hdr_expand_gamut */ }; -static void gl_core_get_poke_interface(void *data, +static void gl3_get_poke_interface(void *data, const video_poke_interface_t **iface) { (void)data; - *iface = &gl_core_poke_interface; + *iface = &gl3_poke_interface; } #ifdef HAVE_GFX_WIDGETS -static bool gl_core_gfx_widgets_enabled(void *data) +static bool gl3_gfx_widgets_enabled(void *data) { (void)data; return true; } #endif -static unsigned gl_core_wrap_type_to_enum(enum gfx_wrap_type type) +static unsigned gl3_wrap_type_to_enum(enum gfx_wrap_type type) { switch (type) { @@ -2333,57 +2333,57 @@ static unsigned gl_core_wrap_type_to_enum(enum gfx_wrap_type type) return 0; } -static bool gl_core_has_windowed(void *data) +static bool gl3_has_windowed(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl && gl->ctx_driver) return gl->ctx_driver->has_windowed; return false; } -static bool gl_core_focus(void *data) +static bool gl3_focus(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (gl && gl->ctx_driver && gl->ctx_driver->has_focus) return gl->ctx_driver->has_focus(gl->ctx_data); return true; } -video_driver_t video_gl_core = { - gl_core_init, - gl_core_frame, - gl_core_set_nonblock_state, - gl_core_alive, - gl_core_focus, - gl_core_suppress_screensaver, - gl_core_has_windowed, +video_driver_t video_gl3 = { + gl3_init, + gl3_frame, + gl3_set_nonblock_state, + gl3_alive, + gl3_focus, + gl3_suppress_screensaver, + gl3_has_windowed, - gl_core_set_shader, + gl3_set_shader, - gl_core_free, + gl3_free, "glcore", - gl_core_set_viewport_wrapper, - gl_core_set_rotation, + gl3_set_viewport_wrapper, + gl3_set_rotation, - gl_core_viewport_info, + gl3_viewport_info, - gl_core_read_viewport, + gl3_read_viewport, #if defined(READ_RAW_GL_FRAME_TEST) - gl_core_read_frame_raw, + gl3_read_frame_raw, #else NULL, #endif #ifdef HAVE_OVERLAY - gl_core_get_overlay_interface, + gl3_get_overlay_interface, #endif #ifdef HAVE_VIDEO_LAYOUT NULL, #endif - gl_core_get_poke_interface, - gl_core_wrap_type_to_enum, + gl3_get_poke_interface, + gl3_wrap_type_to_enum, #ifdef HAVE_GFX_WIDGETS - gl_core_gfx_widgets_enabled + gl3_gfx_widgets_enabled #endif }; diff --git a/gfx/drivers_display/gfx_display_gl3.c b/gfx/drivers_display/gfx_display_gl3.c index c6f4ab4cc5..00d39e40c7 100644 --- a/gfx/drivers_display/gfx_display_gl3.c +++ b/gfx/drivers_display/gfx_display_gl3.c @@ -27,46 +27,46 @@ #include "../font_driver.h" #include "../../retroarch.h" -static const float gl_core_vertexes[] = { +static const float gl3_vertexes[] = { 0, 0, 1, 0, 0, 1, 1, 1 }; -static const float gl_core_tex_coords[] = { +static const float gl3_tex_coords[] = { 0, 1, 1, 1, 0, 0, 1, 0 }; -static const float gl_core_colors[] = { +static const float gl3_colors[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, }; -static void *gfx_display_gl_core_get_default_mvp(void *data) +static void *gfx_display_gl3_get_default_mvp(void *data) { - gl_core_t *gl_core = (gl_core_t*)data; - if (!gl_core) + gl3_t *gl3 = (gl3_t*)data; + if (!gl3) return NULL; - return &gl_core->mvp_no_rot; + return &gl3->mvp_no_rot; } -static const float *gfx_display_gl_core_get_default_vertices(void) +static const float *gfx_display_gl3_get_default_vertices(void) { - return &gl_core_vertexes[0]; + return &gl3_vertexes[0]; } -static const float *gfx_display_gl_core_get_default_tex_coords(void) +static const float *gfx_display_gl3_get_default_tex_coords(void) { - return &gl_core_tex_coords[0]; + return &gl3_tex_coords[0]; } -static void gfx_display_gl_core_draw_pipeline( +static void gfx_display_gl3_draw_pipeline( gfx_display_ctx_draw_t *draw, gfx_display_t *p_disp, void *data, @@ -80,7 +80,7 @@ static void gfx_display_gl_core_draw_pipeline( static float t = 0.0f; float yflip = 0.0f; video_coord_array_t *ca = NULL; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; if (!gl || !draw) return; @@ -142,16 +142,16 @@ static void gfx_display_gl_core_draw_pipeline( #endif } -static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw, +static void gfx_display_gl3_draw(gfx_display_ctx_draw_t *draw, void *data, unsigned video_width, unsigned video_height) { const float *vertex = NULL; const float *tex_coord = NULL; const float *color = NULL; GLuint texture = 0; - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; const struct - gl_core_buffer_locations + gl3_buffer_locations *loc = NULL; if (!gl || !draw) @@ -163,11 +163,11 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw, color = draw->coords->color; if (!vertex) - vertex = gfx_display_gl_core_get_default_vertices(); + vertex = gfx_display_gl3_get_default_vertices(); if (!tex_coord) - tex_coord = &gl_core_tex_coords[0]; + tex_coord = &gl3_tex_coords[0]; if (!color) - color = &gl_core_colors[0]; + color = &gl3_colors[0]; glViewport(draw->x, draw->y, draw->width, draw->height); @@ -245,15 +245,15 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw, glEnableVertexAttribArray(1); glEnableVertexAttribArray(2); - gl_core_bind_scratch_vbo(gl, vertex, + gl3_bind_scratch_vbo(gl, vertex, 2 * sizeof(float) * draw->coords->vertices); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void *)(uintptr_t)0); - gl_core_bind_scratch_vbo(gl, tex_coord, + gl3_bind_scratch_vbo(gl, tex_coord, 2 * sizeof(float) * draw->coords->vertices); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void *)(uintptr_t)0); - gl_core_bind_scratch_vbo(gl, color, + gl3_bind_scratch_vbo(gl, color, 4 * sizeof(float) * draw->coords->vertices); glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void *)(uintptr_t)0); @@ -279,21 +279,21 @@ static void gfx_display_gl_core_draw(gfx_display_ctx_draw_t *draw, glBindTexture(GL_TEXTURE_2D, 0); } -static void gfx_display_gl_core_blend_begin(void *data) +static void gfx_display_gl3_blend_begin(void *data) { - gl_core_t *gl = (gl_core_t*)data; + gl3_t *gl = (gl3_t*)data; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glUseProgram(gl->pipelines.alpha_blend); } -static void gfx_display_gl_core_blend_end(void *data) +static void gfx_display_gl3_blend_end(void *data) { glDisable(GL_BLEND); } -static bool gfx_display_gl_core_font_init_first( +static bool gfx_display_gl3_font_init_first( void **font_handle, void *video_data, const char *font_path, float menu_font_size, bool is_threaded) { @@ -309,7 +309,7 @@ static bool gfx_display_gl_core_font_init_first( return false; } -static void gfx_display_gl_core_scissor_begin(void *data, +static void gfx_display_gl3_scissor_begin(void *data, unsigned video_width, unsigned video_height, int x, int y, unsigned width, unsigned height) @@ -318,7 +318,7 @@ static void gfx_display_gl_core_scissor_begin(void *data, glEnable(GL_SCISSOR_TEST); } -static void gfx_display_gl_core_scissor_end( +static void gfx_display_gl3_scissor_end( void *data, unsigned video_width, unsigned video_height) @@ -326,18 +326,18 @@ static void gfx_display_gl_core_scissor_end( glDisable(GL_SCISSOR_TEST); } -gfx_display_ctx_driver_t gfx_display_ctx_gl_core = { - gfx_display_gl_core_draw, - gfx_display_gl_core_draw_pipeline, - gfx_display_gl_core_blend_begin, - gfx_display_gl_core_blend_end, - gfx_display_gl_core_get_default_mvp, - gfx_display_gl_core_get_default_vertices, - gfx_display_gl_core_get_default_tex_coords, - gfx_display_gl_core_font_init_first, +gfx_display_ctx_driver_t gfx_display_ctx_gl3 = { + gfx_display_gl3_draw, + gfx_display_gl3_draw_pipeline, + gfx_display_gl3_blend_begin, + gfx_display_gl3_blend_end, + gfx_display_gl3_get_default_mvp, + gfx_display_gl3_get_default_vertices, + gfx_display_gl3_get_default_tex_coords, + gfx_display_gl3_font_init_first, GFX_VIDEO_DRIVER_OPENGL_CORE, "glcore", false, - gfx_display_gl_core_scissor_begin, - gfx_display_gl_core_scissor_end + gfx_display_gl3_scissor_begin, + gfx_display_gl3_scissor_end }; diff --git a/gfx/drivers_font/gl3_raster_font.c b/gfx/drivers_font/gl3_raster_font.c index b71328607c..016462ab39 100644 --- a/gfx/drivers_font/gl3_raster_font.c +++ b/gfx/drivers_font/gl3_raster_font.c @@ -42,7 +42,7 @@ typedef struct { - gl_core_t *gl; + gl3_t *gl; GLuint tex; const font_renderer_driver_t *font_driver; @@ -50,12 +50,12 @@ typedef struct struct font_atlas *atlas; video_font_raster_block_t *block; -} gl_core_raster_t; +} gl3_raster_t; -static void gl_core_raster_font_free_font(void *data, +static void gl3_raster_font_free_font(void *data, bool is_threaded) { - gl_core_raster_t *font = (gl_core_raster_t*)data; + gl3_raster_t *font = (gl3_raster_t*)data; if (!font) return; @@ -74,7 +74,7 @@ static void gl_core_raster_font_free_font(void *data, free(font); } -static bool gl_core_raster_font_upload_atlas(gl_core_raster_t *font) +static bool gl3_raster_font_upload_atlas(gl3_raster_t *font) { if (font->tex) glDeleteTextures(1, &font->tex); @@ -96,16 +96,16 @@ static bool gl_core_raster_font_upload_atlas(gl_core_raster_t *font) return true; } -static void *gl_core_raster_font_init_font(void *data, +static void *gl3_raster_font_init_font(void *data, const char *font_path, float font_size, bool is_threaded) { - gl_core_raster_t *font = (gl_core_raster_t*)calloc(1, sizeof(*font)); + gl3_raster_t *font = (gl3_raster_t*)calloc(1, sizeof(*font)); if (!font) return NULL; - font->gl = (gl_core_t*)data; + font->gl = (gl3_t*)data; if (!font_renderer_create_default( &font->font_driver, @@ -125,21 +125,21 @@ static void *gl_core_raster_font_init_font(void *data, font->atlas = font->font_driver->get_atlas(font->font_data); - if (!gl_core_raster_font_upload_atlas(font)) + if (!gl3_raster_font_upload_atlas(font)) goto error; font->atlas->dirty = false; return font; error: - gl_core_raster_font_free_font(font, is_threaded); + gl3_raster_font_free_font(font, is_threaded); return NULL; } -static int gl_core_get_message_width(void *data, const char *msg, +static int gl3_get_message_width(void *data, const char *msg, unsigned msg_len, float scale) { - gl_core_raster_t *font = (gl_core_raster_t*)data; + gl3_raster_t *font = (gl3_raster_t*)data; const char* msg_end = msg + msg_len; int delta_x = 0; @@ -166,12 +166,12 @@ static int gl_core_get_message_width(void *data, const char *msg, return delta_x * scale; } -static void gl_core_raster_font_draw_vertices(gl_core_raster_t *font, +static void gl3_raster_font_draw_vertices(gl3_raster_t *font, const video_coords_t *coords) { if (font->atlas->dirty) { - gl_core_raster_font_upload_atlas(font); + gl3_raster_font_upload_atlas(font); font->atlas->dirty = false; } @@ -187,13 +187,13 @@ static void gl_core_raster_font_draw_vertices(gl_core_raster_t *font, glEnableVertexAttribArray(1); glEnableVertexAttribArray(2); - gl_core_bind_scratch_vbo(font->gl, coords->vertex, 2 * sizeof(float) * coords->vertices); + gl3_bind_scratch_vbo(font->gl, coords->vertex, 2 * sizeof(float) * coords->vertices); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void *)(uintptr_t)0); - gl_core_bind_scratch_vbo(font->gl, coords->tex_coord, 2 * sizeof(float) * coords->vertices); + gl3_bind_scratch_vbo(font->gl, coords->tex_coord, 2 * sizeof(float) * coords->vertices); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void *)(uintptr_t)0); - gl_core_bind_scratch_vbo(font->gl, coords->color, 4 * sizeof(float) * coords->vertices); + gl3_bind_scratch_vbo(font->gl, coords->color, 4 * sizeof(float) * coords->vertices); glVertexAttribPointer(2, 4, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (void *)(uintptr_t)0); glDrawArrays(GL_TRIANGLES, 0, coords->vertices); @@ -204,8 +204,8 @@ static void gl_core_raster_font_draw_vertices(gl_core_raster_t *font, glBindBuffer(GL_ARRAY_BUFFER, 0); } -static void gl_core_raster_font_render_line( - gl_core_raster_t *font, const char *msg, unsigned msg_len, +static void gl3_raster_font_render_line( + gl3_raster_t *font, const char *msg, unsigned msg_len, GLfloat scale, const GLfloat color[4], GLfloat pos_x, GLfloat pos_y, unsigned text_align) { @@ -214,7 +214,7 @@ static void gl_core_raster_font_render_line( GLfloat font_tex_coords[2 * 6 * MAX_MSG_LEN_CHUNK]; GLfloat font_vertex[2 * 6 * MAX_MSG_LEN_CHUNK]; GLfloat font_color[4 * 6 * MAX_MSG_LEN_CHUNK]; - gl_core_t *gl = font->gl; + gl3_t *gl = font->gl; const char* msg_end = msg + msg_len; int x = roundf(pos_x * gl->vp.width); int y = roundf(pos_y * gl->vp.height); @@ -228,10 +228,10 @@ static void gl_core_raster_font_render_line( switch (text_align) { case TEXT_ALIGN_RIGHT: - x -= gl_core_get_message_width(font, msg, msg_len, scale); + x -= gl3_get_message_width(font, msg, msg_len, scale); break; case TEXT_ALIGN_CENTER: - x -= gl_core_get_message_width(font, msg, msg_len, scale) / 2.0; + x -= gl3_get_message_width(font, msg, msg_len, scale) / 2.0; break; } @@ -281,12 +281,12 @@ static void gl_core_raster_font_render_line( if (font->block) video_coord_array_append(&font->block->carr, &coords, coords.vertices); else - gl_core_raster_font_draw_vertices(font, &coords); + gl3_raster_font_draw_vertices(font, &coords); } } -static void gl_core_raster_font_render_message( - gl_core_raster_t *font, const char *msg, GLfloat scale, +static void gl3_raster_font_render_message( + gl3_raster_t *font, const char *msg, GLfloat scale, const GLfloat color[4], GLfloat pos_x, GLfloat pos_y, unsigned text_align) { @@ -298,7 +298,7 @@ static void gl_core_raster_font_render_message( if (!font->font_driver->get_line_metrics || !font->font_driver->get_line_metrics(font->font_data, &line_metrics)) { - gl_core_raster_font_render_line(font, + gl3_raster_font_render_line(font, msg, (unsigned)strlen(msg), scale, color, pos_x, pos_y, text_align); return; @@ -313,7 +313,7 @@ static void gl_core_raster_font_render_message( ? (unsigned)(delim - msg) : (unsigned)strlen(msg); /* Draw the line */ - gl_core_raster_font_render_line(font, + gl3_raster_font_render_line(font, msg, msg_len, scale, color, pos_x, pos_y - (float)lines*line_height, text_align); @@ -325,8 +325,8 @@ static void gl_core_raster_font_render_message( } } -static void gl_core_raster_font_setup_viewport(unsigned width, unsigned height, - gl_core_raster_t *font, bool full_screen) +static void gl3_raster_font_setup_viewport(unsigned width, unsigned height, + gl3_raster_t *font, bool full_screen) { video_driver_set_viewport(width, height, full_screen, false); @@ -337,7 +337,7 @@ static void gl_core_raster_font_setup_viewport(unsigned width, unsigned height, glUseProgram(font->gl->pipelines.font); } -static void gl_core_raster_font_render_msg( +static void gl3_raster_font_render_msg( void *userdata, void *data, const char *msg, @@ -348,7 +348,7 @@ static void gl_core_raster_font_render_msg( GLfloat x, y, scale, drop_mod, drop_alpha; enum text_alignment text_align = TEXT_ALIGN_LEFT; bool full_screen = false ; - gl_core_raster_t *font = (gl_core_raster_t*)data; + gl3_raster_t *font = (gl3_raster_t*)data; unsigned width = font->gl->video_width; unsigned height = font->gl->video_height; settings_t *settings = config_get_ptr(); @@ -404,7 +404,7 @@ static void gl_core_raster_font_render_msg( if (font->block) font->block->fullscreen = full_screen; else - gl_core_raster_font_setup_viewport(width, height, font, full_screen); + gl3_raster_font_setup_viewport(width, height, font, full_screen); if (font->gl) { @@ -420,12 +420,12 @@ static void gl_core_raster_font_render_msg( color_dark[2] = color[2] * drop_mod; color_dark[3] = color[3] * drop_alpha; - gl_core_raster_font_render_message(font, msg, scale, color_dark, + gl3_raster_font_render_message(font, msg, scale, color_dark, x + scale * drop_x / font->gl->vp.width, y + scale * drop_y / font->gl->vp.height, text_align); } - gl_core_raster_font_render_message(font, msg, scale, color, + gl3_raster_font_render_message(font, msg, scale, color, x, y, text_align); } @@ -437,10 +437,10 @@ static void gl_core_raster_font_render_msg( } } -static const struct font_glyph *gl_core_raster_font_get_glyph( +static const struct font_glyph *gl3_raster_font_get_glyph( void *data, uint32_t code) { - gl_core_raster_t *font = (gl_core_raster_t*)data; + gl3_raster_t *font = (gl3_raster_t*)data; if (!font || !font->font_driver) return NULL; @@ -449,17 +449,17 @@ static const struct font_glyph *gl_core_raster_font_get_glyph( return font->font_driver->get_glyph((void*)font->font_driver, code); } -static void gl_core_raster_font_flush_block(unsigned width, unsigned height, +static void gl3_raster_font_flush_block(unsigned width, unsigned height, void *data) { - gl_core_raster_t *font = (gl_core_raster_t*)data; + gl3_raster_t *font = (gl3_raster_t*)data; video_font_raster_block_t *block = font ? font->block : NULL; if (!font || !block || !block->carr.coords.vertices) return; - gl_core_raster_font_setup_viewport(width, height, font, block->fullscreen); - gl_core_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords); + gl3_raster_font_setup_viewport(width, height, font, block->fullscreen); + gl3_raster_font_draw_vertices(font, (video_coords_t*)&block->carr.coords); if (font->gl) { @@ -468,18 +468,18 @@ static void gl_core_raster_font_flush_block(unsigned width, unsigned height, } } -static void gl_core_raster_font_bind_block(void *data, void *userdata) +static void gl3_raster_font_bind_block(void *data, void *userdata) { - gl_core_raster_t *font = (gl_core_raster_t*)data; + gl3_raster_t *font = (gl3_raster_t*)data; video_font_raster_block_t *block = (video_font_raster_block_t*)userdata; if (font) font->block = block; } -static bool gl_core_get_line_metrics(void* data, struct font_line_metrics **metrics) +static bool gl3_get_line_metrics(void* data, struct font_line_metrics **metrics) { - gl_core_raster_t *font = (gl_core_raster_t*)data; + gl3_raster_t *font = (gl3_raster_t*)data; if (!font || !font->font_driver || !font->font_data) return -1; @@ -487,14 +487,14 @@ static bool gl_core_get_line_metrics(void* data, struct font_line_metrics **metr return font->font_driver->get_line_metrics(font->font_data, metrics); } -font_renderer_t gl_core_raster_font = { - gl_core_raster_font_init_font, - gl_core_raster_font_free_font, - gl_core_raster_font_render_msg, +font_renderer_t gl3_raster_font = { + gl3_raster_font_init_font, + gl3_raster_font_free_font, + gl3_raster_font_render_msg, "GLCore raster", - gl_core_raster_font_get_glyph, - gl_core_raster_font_bind_block, - gl_core_raster_font_flush_block, - gl_core_get_message_width, - gl_core_get_line_metrics + gl3_raster_font_get_glyph, + gl3_raster_font_bind_block, + gl3_raster_font_flush_block, + gl3_get_message_width, + gl3_get_line_metrics }; diff --git a/gfx/drivers_shader/shader_gl3.cpp b/gfx/drivers_shader/shader_gl3.cpp index 2a2245d770..49e9d70d00 100644 --- a/gfx/drivers_shader/shader_gl3.cpp +++ b/gfx/drivers_shader/shader_gl3.cpp @@ -37,10 +37,10 @@ #include "../../verbosity.h" #include "../../msg_hash.h" -GLuint gl_core_cross_compile_program( +GLuint gl3_cross_compile_program( const uint32_t *vertex, size_t vertex_size, const uint32_t *fragment, size_t fragment_size, - gl_core_buffer_locations *loc, bool flatten) + gl3_buffer_locations *loc, bool flatten) { GLuint program = 0; try @@ -55,7 +55,7 @@ GLuint gl_core_cross_compile_program( #else opts.es = false; #endif - opts.version = gl_core_get_cross_compiler_target_version(); + opts.version = gl3_get_cross_compiler_target_version(); opts.fragment.default_float_precision = spirv_cross::CompilerGLSL::Options::Precision::Highp; opts.fragment.default_int_precision = spirv_cross::CompilerGLSL::Options::Precision::Highp; opts.enable_420pack_extension = false; @@ -163,8 +163,8 @@ GLuint gl_core_cross_compile_program( auto vertex_source = vertex_compiler.compile(); auto fragment_source = fragment_compiler.compile(); - GLuint vertex_shader = gl_core_compile_shader(GL_VERTEX_SHADER, vertex_source.c_str()); - GLuint fragment_shader = gl_core_compile_shader(GL_FRAGMENT_SHADER, fragment_source.c_str()); + GLuint vertex_shader = gl3_compile_shader(GL_VERTEX_SHADER, vertex_source.c_str()); + GLuint fragment_shader = gl3_compile_shader(GL_FRAGMENT_SHADER, fragment_source.c_str()); #if 0 RARCH_LOG("[GLCore]: Vertex shader:\n========\n%s\n=======\n", vertex_source.c_str()); @@ -264,7 +264,7 @@ GLuint gl_core_cross_compile_program( return program; } -namespace gl_core_shader +namespace gl3_shader { static const uint32_t opaque_vert[] = #include "../drivers/vulkan_shaders/opaque.vert.inc" @@ -276,7 +276,7 @@ static const uint32_t opaque_frag[] = struct Texture { - gl_core_filter_chain_texture texture; + gl3_filter_chain_texture texture; glslang_filter_chain_filter filter; glslang_filter_chain_filter mip_filter; glslang_filter_chain_address address; @@ -473,7 +473,7 @@ struct CommonResources GLuint quad_program = 0; GLuint quad_vbo = 0; - gl_core_buffer_locations quad_loc = {}; + gl3_buffer_locations quad_loc = {}; }; CommonResources::CommonResources() @@ -490,7 +490,7 @@ CommonResources::CommonResources() glBufferData(GL_ARRAY_BUFFER, sizeof(quad_data), quad_data, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); - quad_program = gl_core_cross_compile_program( + quad_program = gl3_cross_compile_program( opaque_vert, sizeof(opaque_vert), opaque_frag, sizeof(opaque_frag), &quad_loc, true); } @@ -679,7 +679,7 @@ public: return framebuffer_feedback.get(); } - void set_pass_info(const gl_core_filter_chain_pass_info &info); + void set_pass_info(const gl3_filter_chain_pass_info &info); void set_shader(GLenum stage, const uint32_t *spirv, @@ -691,7 +691,7 @@ public: void build_commands( const Texture &original, const Texture &source, - const gl_core_viewport &vp, + const gl3_viewport &vp, const float *mvp); void set_frame_count(uint64_t count) @@ -764,8 +764,8 @@ private: CommonResources *common = nullptr; Size2D current_framebuffer_size = {}; - gl_core_viewport current_viewport; - gl_core_filter_chain_pass_info pass_info; + gl3_viewport current_viewport; + gl3_filter_chain_pass_info pass_info; std::vector vertex_shader; std::vector fragment_shader; @@ -821,7 +821,7 @@ private: std::vector parameters; std::vector filtered_parameters; std::vector push_constant_buffer; - gl_core_buffer_locations locations = {}; + gl3_buffer_locations locations = {}; UBORing ubo_ring; void reflect_parameter(const std::string &name, slang_semantic_meta &meta); @@ -970,7 +970,7 @@ void Pass::reflect_parameter_array(const char *name, std::vector( + gl3_build_default_matrix(reinterpret_cast( buffer + offset)); } @@ -1413,7 +1413,7 @@ void Pass::build_semantics(uint8_t *buffer, memcpy(push_constant_buffer.data() + offset, mvp, sizeof(float) * 16); else - gl_core_build_default_matrix(reinterpret_cast( + gl3_build_default_matrix(reinterpret_cast( push_constant_buffer.data() + offset)); } @@ -1476,7 +1476,7 @@ void Pass::build_semantics(uint8_t *buffer, void Pass::build_commands( const Texture &original, const Texture &source, - const gl_core_viewport &vp, + const gl3_viewport &vp, const float *mvp) { current_viewport = vp; @@ -1597,10 +1597,10 @@ void Pass::build_commands( } -struct gl_core_filter_chain +struct gl3_filter_chain { public: - gl_core_filter_chain(unsigned num_passes) { set_num_passes(num_passes); } + gl3_filter_chain(unsigned num_passes) { set_num_passes(num_passes); } inline void set_shader_preset(std::unique_ptr shader) { @@ -1613,15 +1613,15 @@ public: } void set_pass_info(unsigned pass, - const gl_core_filter_chain_pass_info &info); + const gl3_filter_chain_pass_info &info); void set_shader(unsigned pass, GLenum stage, const uint32_t *spirv, size_t spirv_words); bool init(); - void set_input_texture(const gl_core_filter_chain_texture &texture); - void build_offscreen_passes(const gl_core_viewport &vp); - void build_viewport_pass(const gl_core_viewport &vp, const float *mvp); + void set_input_texture(const gl3_filter_chain_texture &texture); + void build_offscreen_passes(const gl3_viewport &vp); + void build_viewport_pass(const gl3_viewport &vp, const float *mvp); void end_frame(); void set_frame_count(uint64_t count); @@ -1629,23 +1629,23 @@ public: void set_frame_direction(int32_t direction); void set_pass_name(unsigned pass, const char *name); - void add_static_texture(std::unique_ptr texture); + void add_static_texture(std::unique_ptr texture); void add_parameter(unsigned pass, unsigned parameter_index, const std::string &id); void set_num_passes(unsigned passes); private: - std::vector> passes; - std::vector pass_info; + std::vector> passes; + std::vector pass_info; std::vector>> deferred_calls; - std::unique_ptr copy_framebuffer; - gl_core_shader::CommonResources common; + std::unique_ptr copy_framebuffer; + gl3_shader::CommonResources common; - gl_core_filter_chain_texture input_texture = {}; + gl3_filter_chain_texture input_texture = {}; bool init_history(); bool init_feedback(); bool init_alias(); - std::vector> original_history; + std::vector> original_history; bool require_clear = false; void clear_history_and_feedback(); void update_feedback_info(); @@ -1653,13 +1653,13 @@ private: }; -void gl_core_filter_chain::update_history_info() +void gl3_filter_chain::update_history_info() { unsigned i; for (i = 0; i < original_history.size(); i++) { - gl_core_shader::Texture *source = (gl_core_shader::Texture*) + gl3_shader::Texture *source = (gl3_shader::Texture*) &common.original_history[i]; if (!source) @@ -1674,17 +1674,17 @@ void gl_core_filter_chain::update_history_info() } } -void gl_core_filter_chain::update_feedback_info() +void gl3_filter_chain::update_feedback_info() { unsigned i; for (i = 0; i < passes.size() - 1; i++) { - gl_core_shader::Framebuffer *fb = passes[i]->get_feedback_framebuffer(); + gl3_shader::Framebuffer *fb = passes[i]->get_feedback_framebuffer(); if (!fb) continue; - gl_core_shader::Texture *source = (gl_core_shader::Texture*) + gl3_shader::Texture *source = (gl3_shader::Texture*) &common.framebuffer_feedback[i]; if (!source) @@ -1699,7 +1699,7 @@ void gl_core_filter_chain::update_feedback_info() } } -void gl_core_filter_chain::build_offscreen_passes(const gl_core_viewport &vp) +void gl3_filter_chain::build_offscreen_passes(const gl3_viewport &vp) { unsigned i; @@ -1715,19 +1715,19 @@ void gl_core_filter_chain::build_offscreen_passes(const gl_core_viewport &vp) if (!common.framebuffer_feedback.empty()) update_feedback_info(); - const gl_core_shader::Texture original = { + const gl3_shader::Texture original = { input_texture, passes.front()->get_source_filter(), passes.front()->get_mip_filter(), passes.front()->get_address_mode(), }; - gl_core_shader::Texture source = original; + gl3_shader::Texture source = original; for (i = 0; i < passes.size() - 1; i++) { passes[i]->build_commands(original, source, vp, nullptr); - const gl_core_shader::Framebuffer &fb = passes[i]->get_framebuffer(); + const gl3_shader::Framebuffer &fb = passes[i]->get_framebuffer(); source.texture.image = fb.get_image(); source.texture.width = fb.get_size().width; @@ -1740,7 +1740,7 @@ void gl_core_filter_chain::build_offscreen_passes(const gl_core_viewport &vp) } } -void gl_core_filter_chain::end_frame() +void gl3_filter_chain::end_frame() { /* If we need to keep old frames, copy it after fragment is complete. * TODO: We can improve pipelining by figuring out which @@ -1749,8 +1749,8 @@ void gl_core_filter_chain::end_frame() if (!original_history.empty()) { /* Update history */ - std::unique_ptr tmp; - std::unique_ptr &back = original_history.back(); + std::unique_ptr tmp; + std::unique_ptr &back = original_history.back(); swap(back, tmp); if (input_texture.width != tmp->get_size().width || @@ -1760,7 +1760,7 @@ void gl_core_filter_chain::end_frame() tmp->set_size({ input_texture.width, input_texture.height }, input_texture.format); if (tmp->is_complete()) - gl_core_framebuffer_copy( + gl3_framebuffer_copy( tmp->get_framebuffer(), common.quad_program, common.quad_vbo, @@ -1774,8 +1774,8 @@ void gl_core_filter_chain::end_frame() } } -void gl_core_filter_chain::build_viewport_pass( - const gl_core_viewport &vp, const float *mvp) +void gl3_filter_chain::build_viewport_pass( + const gl3_viewport &vp, const float *mvp) { unsigned i; /* First frame, make sure our history and @@ -1786,8 +1786,8 @@ void gl_core_filter_chain::build_viewport_pass( require_clear = false; } - gl_core_shader::Texture source; - const gl_core_shader::Texture original = { + gl3_shader::Texture source; + const gl3_shader::Texture original = { input_texture, passes.front()->get_source_filter(), passes.front()->get_mip_filter(), @@ -1805,7 +1805,7 @@ void gl_core_filter_chain::build_viewport_pass( } else { - const gl_core_shader::Framebuffer &fb = passes[passes.size() - 2] + const gl3_shader::Framebuffer &fb = passes[passes.size() - 2] ->get_framebuffer(); source.texture.image = fb.get_image(); source.texture.width = fb.get_size().width; @@ -1820,13 +1820,13 @@ void gl_core_filter_chain::build_viewport_pass( /* For feedback FBOs, swap current and previous. */ for (i = 0; i < passes.size(); i++) { - gl_core_shader::Framebuffer *fb = passes[i]->get_feedback_framebuffer(); + gl3_shader::Framebuffer *fb = passes[i]->get_feedback_framebuffer(); if (fb) passes[i]->end_frame(); } } -bool gl_core_filter_chain::init_history() +bool gl3_filter_chain::init_history() { unsigned i; size_t required_images = 0; @@ -1853,7 +1853,7 @@ bool gl_core_filter_chain::init_history() common.original_history.resize(required_images); for (i = 0; i < required_images; i++) - original_history.emplace_back(new gl_core_shader::Framebuffer(0, 1)); + original_history.emplace_back(new gl3_shader::Framebuffer(0, 1)); RARCH_LOG("[GLCore]: Using history of %u frames.\n", unsigned(required_images)); @@ -1865,7 +1865,7 @@ bool gl_core_filter_chain::init_history() return true; } -bool gl_core_filter_chain::init_feedback() +bool gl3_filter_chain::init_feedback() { unsigned i; bool use_feedbacks = false; @@ -1907,7 +1907,7 @@ bool gl_core_filter_chain::init_feedback() return true; } -bool gl_core_filter_chain::init_alias() +bool gl3_filter_chain::init_alias() { unsigned i, j; common.texture_semantic_map.clear(); @@ -1958,14 +1958,14 @@ bool gl_core_filter_chain::init_alias() return true; } -void gl_core_filter_chain::set_pass_info(unsigned pass, const gl_core_filter_chain_pass_info &info) +void gl3_filter_chain::set_pass_info(unsigned pass, const gl3_filter_chain_pass_info &info) { if (pass >= pass_info.size()) pass_info.resize(pass + 1); pass_info[pass] = info; } -void gl_core_filter_chain::set_num_passes(unsigned num_passes) +void gl3_filter_chain::set_num_passes(unsigned num_passes) { unsigned i; @@ -1974,24 +1974,24 @@ void gl_core_filter_chain::set_num_passes(unsigned num_passes) for (i = 0; i < num_passes; i++) { - passes.emplace_back(new gl_core_shader::Pass(i + 1 == num_passes)); + passes.emplace_back(new gl3_shader::Pass(i + 1 == num_passes)); passes.back()->set_common_resources(&common); passes.back()->set_pass_number(i); } } -void gl_core_filter_chain::set_shader(unsigned pass, GLenum stage, const uint32_t *spirv, size_t spirv_words) +void gl3_filter_chain::set_shader(unsigned pass, GLenum stage, const uint32_t *spirv, size_t spirv_words) { passes[pass]->set_shader(stage, spirv, spirv_words); } -void gl_core_filter_chain::add_parameter(unsigned pass, +void gl3_filter_chain::add_parameter(unsigned pass, unsigned index, const std::string &id) { passes[pass]->add_parameter(index, id); } -bool gl_core_filter_chain::init() +bool gl3_filter_chain::init() { unsigned i; @@ -2019,24 +2019,24 @@ bool gl_core_filter_chain::init() return true; } -void gl_core_filter_chain::clear_history_and_feedback() +void gl3_filter_chain::clear_history_and_feedback() { unsigned i; for (i = 0; i < original_history.size(); i++) { if (original_history[i]->is_complete()) - gl_core_framebuffer_clear(original_history[i]->get_framebuffer()); + gl3_framebuffer_clear(original_history[i]->get_framebuffer()); } for (i = 0; i < passes.size(); i++) { - gl_core_shader::Framebuffer *fb = passes[i]->get_feedback_framebuffer(); + gl3_shader::Framebuffer *fb = passes[i]->get_feedback_framebuffer(); if (fb && fb->is_complete()) - gl_core_framebuffer_clear(fb->get_framebuffer()); + gl3_framebuffer_clear(fb->get_framebuffer()); } } -void gl_core_filter_chain::set_input_texture( - const gl_core_filter_chain_texture &texture) +void gl3_filter_chain::set_input_texture( + const gl3_filter_chain_texture &texture) { input_texture = texture; @@ -2046,7 +2046,7 @@ void gl_core_filter_chain::set_input_texture( input_texture.padded_height != input_texture.height) { if (!copy_framebuffer) - copy_framebuffer.reset(new gl_core_shader::Framebuffer(texture.format, 1)); + copy_framebuffer.reset(new gl3_shader::Framebuffer(texture.format, 1)); if (input_texture.width != copy_framebuffer->get_size().width || input_texture.height != copy_framebuffer->get_size().height || @@ -2055,7 +2055,7 @@ void gl_core_filter_chain::set_input_texture( copy_framebuffer->set_size({ input_texture.width, input_texture.height }, input_texture.format); if (copy_framebuffer->is_complete()) - gl_core_framebuffer_copy_partial( + gl3_framebuffer_copy_partial( copy_framebuffer->get_framebuffer(), common.quad_program, common.quad_loc.flat_ubo_vertex, @@ -2069,37 +2069,37 @@ void gl_core_filter_chain::set_input_texture( } } -void gl_core_filter_chain::add_static_texture(std::unique_ptr texture) +void gl3_filter_chain::add_static_texture(std::unique_ptr texture) { common.luts.push_back(std::move(texture)); } -void gl_core_filter_chain::set_frame_count(uint64_t count) +void gl3_filter_chain::set_frame_count(uint64_t count) { unsigned i; for (i = 0; i < passes.size(); i++) passes[i]->set_frame_count(count); } -void gl_core_filter_chain::set_frame_count_period(unsigned pass, unsigned period) +void gl3_filter_chain::set_frame_count_period(unsigned pass, unsigned period) { passes[pass]->set_frame_count_period(period); } -void gl_core_filter_chain::set_frame_direction(int32_t direction) +void gl3_filter_chain::set_frame_direction(int32_t direction) { unsigned i; for (i = 0; i < passes.size(); i++) passes[i]->set_frame_direction(direction); } -void gl_core_filter_chain::set_pass_name(unsigned pass, const char *name) +void gl3_filter_chain::set_pass_name(unsigned pass, const char *name) { passes[pass]->set_name(name); } -static std::unique_ptr gl_core_filter_chain_load_lut( - gl_core_filter_chain *chain, +static std::unique_ptr gl3_filter_chain_load_lut( + gl3_filter_chain *chain, const video_shader_lut *shader) { texture_image image; @@ -2134,21 +2134,21 @@ static std::unique_ptr gl_core_filter_chain_load_ if (image.pixels) image_texture_free(&image); - return std::unique_ptr(new gl_core_shader::StaticTexture(shader->id, + return std::unique_ptr(new gl3_shader::StaticTexture(shader->id, tex, image.width, image.height, shader->filter != RARCH_FILTER_NEAREST, levels > 1, rarch_wrap_to_address(shader->wrap))); } -static bool gl_core_filter_chain_load_luts( - gl_core_filter_chain *chain, +static bool gl3_filter_chain_load_luts( + gl3_filter_chain *chain, video_shader *shader) { unsigned i; for (i = 0; i < shader->luts; i++) { - std::unique_ptr image = gl_core_filter_chain_load_lut(chain, &shader->lut[i]); + std::unique_ptr image = gl3_filter_chain_load_lut(chain, &shader->lut[i]); if (!image) { RARCH_ERR("[GLCore]: Failed to load LUT \"%s\".\n", shader->lut[i].path); @@ -2161,12 +2161,12 @@ static bool gl_core_filter_chain_load_luts( return true; } -gl_core_filter_chain_t *gl_core_filter_chain_create_default( +gl3_filter_chain_t *gl3_filter_chain_create_default( glslang_filter_chain_filter filter) { - struct gl_core_filter_chain_pass_info pass_info; + struct gl3_filter_chain_pass_info pass_info; - std::unique_ptr chain{ new gl_core_filter_chain(1) }; + std::unique_ptr chain{ new gl3_filter_chain(1) }; if (!chain) return nullptr; @@ -2183,11 +2183,11 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_default( chain->set_pass_info(0, pass_info); chain->set_shader(0, GL_VERTEX_SHADER, - gl_core_shader::opaque_vert, - sizeof(gl_core_shader::opaque_vert) / sizeof(uint32_t)); + gl3_shader::opaque_vert, + sizeof(gl3_shader::opaque_vert) / sizeof(uint32_t)); chain->set_shader(0, GL_FRAGMENT_SHADER, - gl_core_shader::opaque_frag, - sizeof(gl_core_shader::opaque_frag) / sizeof(uint32_t)); + gl3_shader::opaque_frag, + sizeof(gl3_shader::opaque_frag) / sizeof(uint32_t)); if (!chain->init()) return nullptr; @@ -2195,7 +2195,7 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_default( return chain.release(); } -gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( +gl3_filter_chain_t *gl3_filter_chain_create_from_preset( const char *path, glslang_filter_chain_filter filter) { unsigned i; @@ -2208,12 +2208,12 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( bool last_pass_is_fbo = shader->pass[shader->passes - 1].fbo.valid; - std::unique_ptr chain{ new gl_core_filter_chain(shader->passes + (last_pass_is_fbo ? 1 : 0)) }; + std::unique_ptr chain{ new gl3_filter_chain(shader->passes + (last_pass_is_fbo ? 1 : 0)) }; if (!chain) return nullptr; if ( shader->luts - && !gl_core_filter_chain_load_luts(chain.get(), shader.get())) + && !gl3_filter_chain_load_luts(chain.get(), shader.get())) return nullptr; shader->num_parameters = 0; @@ -2221,7 +2221,7 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( for (i = 0; i < shader->passes; i++) { glslang_output output; - struct gl_core_filter_chain_pass_info pass_info; + struct gl3_filter_chain_pass_info pass_info; const video_shader_pass *pass = &shader->pass[i]; const video_shader_pass *next_pass = i + 1 < shader->passes ? &shader->pass[i + 1] : nullptr; @@ -2361,7 +2361,7 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( } else { - pass_info.rt_format = gl_core_shader::convert_glslang_format(output.meta.rt_format); + pass_info.rt_format = gl3_shader::convert_glslang_format(output.meta.rt_format); RARCH_LOG("[slang]: Using render target format %s for pass output #%u.\n", glslang_format_to_string(output.meta.rt_format), i); } @@ -2375,7 +2375,7 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( else if (pass->fbo.fp_fbo) output.meta.rt_format = SLANG_FORMAT_R16G16B16A16_SFLOAT; - pass_info.rt_format = gl_core_shader::convert_glslang_format(output.meta.rt_format); + pass_info.rt_format = gl3_shader::convert_glslang_format(output.meta.rt_format); RARCH_LOG("[slang]: Using render target format %s for pass output #%u.\n", glslang_format_to_string(output.meta.rt_format), i); @@ -2421,7 +2421,7 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( if (last_pass_is_fbo) { - struct gl_core_filter_chain_pass_info pass_info; + struct gl3_filter_chain_pass_info pass_info; pass_info.scale_type_x = GLSLANG_FILTER_CHAIN_SCALE_VIEWPORT; pass_info.scale_type_y = GLSLANG_FILTER_CHAIN_SCALE_VIEWPORT; @@ -2440,13 +2440,13 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( chain->set_shader(shader->passes, GL_VERTEX_SHADER, - gl_core_shader::opaque_vert, - sizeof(gl_core_shader::opaque_vert) / sizeof(uint32_t)); + gl3_shader::opaque_vert, + sizeof(gl3_shader::opaque_vert) / sizeof(uint32_t)); chain->set_shader(shader->passes, GL_FRAGMENT_SHADER, - gl_core_shader::opaque_frag, - sizeof(gl_core_shader::opaque_frag) / sizeof(uint32_t)); + gl3_shader::opaque_frag, + sizeof(gl3_shader::opaque_frag) / sizeof(uint32_t)); } chain->set_shader_preset(std::move(shader)); @@ -2457,12 +2457,12 @@ gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( return chain.release(); } -struct video_shader *gl_core_filter_chain_get_preset( - gl_core_filter_chain_t *chain) { return chain->get_shader_preset(); } -void gl_core_filter_chain_free(gl_core_filter_chain_t *chain) { delete chain; } +struct video_shader *gl3_filter_chain_get_preset( + gl3_filter_chain_t *chain) { return chain->get_shader_preset(); } +void gl3_filter_chain_free(gl3_filter_chain_t *chain) { delete chain; } -void gl_core_filter_chain_set_shader( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_shader( + gl3_filter_chain_t *chain, unsigned pass, GLenum shader_stage, const uint32_t *spirv, @@ -2471,71 +2471,71 @@ void gl_core_filter_chain_set_shader( chain->set_shader(pass, shader_stage, spirv, spirv_words); } -void gl_core_filter_chain_set_pass_info( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_pass_info( + gl3_filter_chain_t *chain, unsigned pass, - const struct gl_core_filter_chain_pass_info *info) + const struct gl3_filter_chain_pass_info *info) { chain->set_pass_info(pass, *info); } -bool gl_core_filter_chain_init(gl_core_filter_chain_t *chain) +bool gl3_filter_chain_init(gl3_filter_chain_t *chain) { return chain->init(); } -void gl_core_filter_chain_set_input_texture( - gl_core_filter_chain_t *chain, - const struct gl_core_filter_chain_texture *texture) +void gl3_filter_chain_set_input_texture( + gl3_filter_chain_t *chain, + const struct gl3_filter_chain_texture *texture) { chain->set_input_texture(*texture); } -void gl_core_filter_chain_set_frame_count( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_frame_count( + gl3_filter_chain_t *chain, uint64_t count) { chain->set_frame_count(count); } -void gl_core_filter_chain_set_frame_direction( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_frame_direction( + gl3_filter_chain_t *chain, int32_t direction) { chain->set_frame_direction(direction); } -void gl_core_filter_chain_set_frame_count_period( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_frame_count_period( + gl3_filter_chain_t *chain, unsigned pass, unsigned period) { chain->set_frame_count_period(pass, period); } -void gl_core_filter_chain_set_pass_name( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_pass_name( + gl3_filter_chain_t *chain, unsigned pass, const char *name) { chain->set_pass_name(pass, name); } -void gl_core_filter_chain_build_offscreen_passes( - gl_core_filter_chain_t *chain, - const gl_core_viewport *vp) +void gl3_filter_chain_build_offscreen_passes( + gl3_filter_chain_t *chain, + const gl3_viewport *vp) { chain->build_offscreen_passes(*vp); } -void gl_core_filter_chain_build_viewport_pass( - gl_core_filter_chain_t *chain, - const gl_core_viewport *vp, const float *mvp) +void gl3_filter_chain_build_viewport_pass( + gl3_filter_chain_t *chain, + const gl3_viewport *vp, const float *mvp) { chain->build_viewport_pass(*vp, mvp); } -void gl_core_filter_chain_end_frame(gl_core_filter_chain_t *chain) +void gl3_filter_chain_end_frame(gl3_filter_chain_t *chain) { chain->end_frame(); } diff --git a/gfx/drivers_shader/shader_gl3.h b/gfx/drivers_shader/shader_gl3.h index 942f5c4158..011058d6b6 100644 --- a/gfx/drivers_shader/shader_gl3.h +++ b/gfx/drivers_shader/shader_gl3.h @@ -27,9 +27,9 @@ RETRO_BEGIN_DECLS -typedef struct gl_core_filter_chain gl_core_filter_chain_t; +typedef struct gl3_filter_chain gl3_filter_chain_t; -struct gl_core_filter_chain_texture +struct gl3_filter_chain_texture { GLuint image; unsigned width; @@ -39,7 +39,7 @@ struct gl_core_filter_chain_texture GLenum format; }; -struct gl_core_viewport +struct gl3_viewport { GLint x; GLint y; @@ -47,7 +47,7 @@ struct gl_core_viewport GLsizei height; }; -struct gl_core_filter_chain_pass_info +struct gl3_filter_chain_pass_info { /* Maximum number of mip-levels to use. */ unsigned max_levels; @@ -67,7 +67,7 @@ struct gl_core_filter_chain_pass_info enum glslang_filter_chain_address address; }; -struct gl_core_buffer_locations +struct gl3_buffer_locations { GLint flat_ubo_vertex; GLint flat_ubo_fragment; @@ -77,74 +77,74 @@ struct gl_core_buffer_locations GLuint buffer_index_ubo_fragment; }; -gl_core_filter_chain_t *gl_core_filter_chain_new(void); +gl3_filter_chain_t *gl3_filter_chain_new(void); -void gl_core_filter_chain_free( - gl_core_filter_chain_t *chain); +void gl3_filter_chain_free( + gl3_filter_chain_t *chain); -void gl_core_filter_chain_set_shader( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_shader( + gl3_filter_chain_t *chain, unsigned pass, GLenum shader_type, const uint32_t *spirv, size_t spirv_words); -void gl_core_filter_chain_set_pass_info( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_pass_info( + gl3_filter_chain_t *chain, unsigned pass, - const struct gl_core_filter_chain_pass_info *info); + const struct gl3_filter_chain_pass_info *info); -bool gl_core_filter_chain_init(gl_core_filter_chain_t *chain); +bool gl3_filter_chain_init(gl3_filter_chain_t *chain); -void gl_core_filter_chain_set_input_texture( - gl_core_filter_chain_t *chain, - const struct gl_core_filter_chain_texture *texture); +void gl3_filter_chain_set_input_texture( + gl3_filter_chain_t *chain, + const struct gl3_filter_chain_texture *texture); -void gl_core_filter_chain_set_frame_count( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_frame_count( + gl3_filter_chain_t *chain, uint64_t count); -void gl_core_filter_chain_set_frame_count_period( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_frame_count_period( + gl3_filter_chain_t *chain, unsigned pass, unsigned period); -void gl_core_filter_chain_set_frame_direction( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_frame_direction( + gl3_filter_chain_t *chain, int32_t direction); -void gl_core_filter_chain_set_pass_name( - gl_core_filter_chain_t *chain, +void gl3_filter_chain_set_pass_name( + gl3_filter_chain_t *chain, unsigned pass, const char *name); -void gl_core_filter_chain_build_offscreen_passes( - gl_core_filter_chain_t *chain, - const struct gl_core_viewport *vp); +void gl3_filter_chain_build_offscreen_passes( + gl3_filter_chain_t *chain, + const struct gl3_viewport *vp); -void gl_core_filter_chain_build_viewport_pass( - gl_core_filter_chain_t *chain, - const struct gl_core_viewport *vp, +void gl3_filter_chain_build_viewport_pass( + gl3_filter_chain_t *chain, + const struct gl3_viewport *vp, const float *mvp); -gl_core_filter_chain_t *gl_core_filter_chain_create_default( +gl3_filter_chain_t *gl3_filter_chain_create_default( enum glslang_filter_chain_filter filter); -gl_core_filter_chain_t *gl_core_filter_chain_create_from_preset( +gl3_filter_chain_t *gl3_filter_chain_create_from_preset( const char *path, enum glslang_filter_chain_filter filter); -struct video_shader *gl_core_filter_chain_get_preset( - gl_core_filter_chain_t *chain); +struct video_shader *gl3_filter_chain_get_preset( + gl3_filter_chain_t *chain); -void gl_core_filter_chain_end_frame(gl_core_filter_chain_t *chain); +void gl3_filter_chain_end_frame(gl3_filter_chain_t *chain); -GLuint gl_core_cross_compile_program( +GLuint gl3_cross_compile_program( const uint32_t *vertex, size_t vertex_size, const uint32_t *fragment, size_t fragment_size, - struct gl_core_buffer_locations *loc, + struct gl3_buffer_locations *loc, bool flatten); RETRO_END_DECLS diff --git a/gfx/font_driver.c b/gfx/font_driver.c index daa11ecdec..96d4a9de55 100644 --- a/gfx/font_driver.c +++ b/gfx/font_driver.c @@ -214,28 +214,28 @@ static bool gl_font_init_first( #endif #ifdef HAVE_OPENGL_CORE -static const font_renderer_t *gl_core_font_backends[] = { - &gl_core_raster_font, +static const font_renderer_t *gl3_font_backends[] = { + &gl3_raster_font, NULL, }; -static bool gl_core_font_init_first( +static bool gl3_font_init_first( const void **font_driver, void **font_handle, void *video_data, const char *font_path, float font_size, bool is_threaded) { unsigned i; - for (i = 0; gl_core_font_backends[i]; i++) + for (i = 0; gl3_font_backends[i]; i++) { - void *data = gl_core_font_backends[i]->init( + void *data = gl3_font_backends[i]->init( video_data, font_path, font_size, is_threaded); if (!data) continue; - *font_driver = gl_core_font_backends[i]; + *font_driver = gl3_font_backends[i]; *font_handle = data; return true; } @@ -699,7 +699,7 @@ static bool font_init_first( #endif #ifdef HAVE_OPENGL_CORE case FONT_DRIVER_RENDER_OPENGL_CORE_API: - return gl_core_font_init_first(font_driver, font_handle, + return gl3_font_init_first(font_driver, font_handle, video_data, font_path, font_size, is_threaded); #endif #ifdef HAVE_VULKAN diff --git a/gfx/font_driver.h b/gfx/font_driver.h index ef70de66b4..26f657460a 100644 --- a/gfx/font_driver.h +++ b/gfx/font_driver.h @@ -175,7 +175,7 @@ int font_driver_get_line_descender(void *font_data, float scale); int font_driver_get_line_centre_offset(void *font_data, float scale); extern font_renderer_t gl_raster_font; -extern font_renderer_t gl_core_raster_font; +extern font_renderer_t gl3_raster_font; extern font_renderer_t gl1_raster_font; extern font_renderer_t d3d_xdk1_font; extern font_renderer_t d3d_win32_font; diff --git a/gfx/gfx_display.c b/gfx/gfx_display.c index 2e2c82148d..753c52ea68 100644 --- a/gfx/gfx_display.c +++ b/gfx/gfx_display.c @@ -99,7 +99,7 @@ static gfx_display_ctx_driver_t *gfx_display_ctx_drivers[] = { &gfx_display_ctx_gl1, #endif #ifdef HAVE_OPENGL_CORE - &gfx_display_ctx_gl_core, + &gfx_display_ctx_gl3, #endif #ifdef HAVE_VULKAN &gfx_display_ctx_vulkan, diff --git a/gfx/gfx_display.h b/gfx/gfx_display.h index 9804d231ef..589c11f734 100644 --- a/gfx/gfx_display.h +++ b/gfx/gfx_display.h @@ -344,7 +344,7 @@ bool gfx_display_init_first_driver(gfx_display_t *p_disp, bool video_is_threaded); extern gfx_display_ctx_driver_t gfx_display_ctx_gl; -extern gfx_display_ctx_driver_t gfx_display_ctx_gl_core; +extern gfx_display_ctx_driver_t gfx_display_ctx_gl3; extern gfx_display_ctx_driver_t gfx_display_ctx_gl1; extern gfx_display_ctx_driver_t gfx_display_ctx_vulkan; extern gfx_display_ctx_driver_t gfx_display_ctx_metal; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 728f4e2f7c..80f436f226 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -276,9 +276,9 @@ const video_driver_t *video_drivers[] = { #ifdef HAVE_OPENGL &video_gl2, #endif -#if defined(HAVE_OPENGL_CORE) - &video_gl_core, -#endif +#if defined(HAVE_OPENGL_CORE) + &video_gl3, +#endif #ifdef HAVE_OPENGL1 &video_gl1, #endif @@ -434,11 +434,11 @@ video_driver_t *hw_render_context_driver( switch (type) { case RETRO_HW_CONTEXT_OPENGL_CORE: -#ifdef HAVE_OPENGL_CORE - return &video_gl_core; -#else - break; -#endif +#ifdef HAVE_OPENGL_CORE + return &video_gl3; +#else + break; +#endif case RETRO_HW_CONTEXT_OPENGL: #ifdef HAVE_OPENGL return &video_gl2; @@ -2278,7 +2278,7 @@ bool video_driver_find_driver( "glcore"); RARCH_LOG("[Video]: \"%s\" saved as cached driver.\n", settings->arrays.video_driver); - video_st->current_video = &video_gl_core; + video_st->current_video = &video_gl3; return true; } #else diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 6c1163132d..911c473b55 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -1413,7 +1413,7 @@ void video_driver_frame(const void *data, unsigned width, extern const video_driver_t *video_drivers[]; -extern video_driver_t video_gl_core; +extern video_driver_t video_gl3; extern video_driver_t video_gl2; extern video_driver_t video_gl1; extern video_driver_t video_vulkan;