Remove trailing whitespace

This commit is contained in:
Higor Eurípedes 2016-09-17 20:57:17 -03:00
parent d4305d65d9
commit c08650f1f9
4 changed files with 101 additions and 101 deletions

View File

@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis * Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2012-2015 - Michael Lelli * Copyright (C) 2012-2015 - Michael Lelli
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found- * of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version. * ation, either version 3 of the License, or (at your option) any later version.
@ -104,7 +104,7 @@ static const GLfloat vertexes_flipped[] = {
}; };
/* Used when rendering to an FBO. /* Used when rendering to an FBO.
* Texture coords have to be aligned * Texture coords have to be aligned
* with vertex coordinates. */ * with vertex coordinates. */
static const GLfloat vertexes[] = { static const GLfloat vertexes[] = {
0, 0, 0, 0,
@ -341,8 +341,8 @@ void gl_set_viewport(void *data, unsigned viewport_width,
if (fabsf(device_aspect - desired_aspect) < 0.0001f) if (fabsf(device_aspect - desired_aspect) < 0.0001f)
{ {
/* If the aspect ratios of screen and desired aspect /* If the aspect ratios of screen and desired aspect
* ratio are sufficiently equal (floating point stuff), * ratio are sufficiently equal (floating point stuff),
* assume they are actually equal. * assume they are actually equal.
*/ */
} }
@ -401,7 +401,7 @@ static bool gl_shader_init(gl_t *gl)
video_shader_ctx_init_t init_data; video_shader_ctx_init_t init_data;
enum rarch_shader_type type; enum rarch_shader_type type;
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
const char *shader_path = (settings->video.shader_enable const char *shader_path = (settings->video.shader_enable
&& *settings->path.shader) ? settings->path.shader : NULL; && *settings->path.shader) ? settings->path.shader : NULL;
if (!gl) if (!gl)
@ -411,7 +411,7 @@ static bool gl_shader_init(gl_t *gl)
} }
type = video_shader_parse_type(shader_path, type = video_shader_parse_type(shader_path,
gl_query_core_context_in_use() gl_query_core_context_in_use()
? RARCH_SHADER_GLSL : DEFAULT_SHADER_TYPE); ? RARCH_SHADER_GLSL : DEFAULT_SHADER_TYPE);
switch (type) switch (type)
@ -521,7 +521,7 @@ static void gl_update_input_size(gl_t *gl, unsigned width,
bool set_coords = false; bool set_coords = false;
if ((width != gl->last_width[gl->tex_index] || if ((width != gl->last_width[gl->tex_index] ||
height != gl->last_height[gl->tex_index]) && gl->empty_buf) height != gl->last_height[gl->tex_index]) && gl->empty_buf)
{ {
/* Resolution change. Need to clear out texture. */ /* Resolution change. Need to clear out texture. */
@ -547,12 +547,12 @@ static void gl_update_input_size(gl_t *gl, unsigned width,
set_coords = true; set_coords = true;
} }
else if ((width != else if ((width !=
gl->last_width[(gl->tex_index + gl->textures - 1) % gl->textures]) || gl->last_width[(gl->tex_index + gl->textures - 1) % gl->textures]) ||
(height != (height !=
gl->last_height[(gl->tex_index + gl->textures - 1) % gl->textures])) gl->last_height[(gl->tex_index + gl->textures - 1) % gl->textures]))
{ {
/* We might have used different texture coordinates /* We might have used different texture coordinates
* last frame. Edge case if resolution changes very rapidly. */ * last frame. Edge case if resolution changes very rapidly. */
set_coords = true; set_coords = true;
} }
@ -582,7 +582,7 @@ static void gl_init_textures_data(gl_t *gl)
gl->prev_info[i].tex_size[0] = gl->tex_w; gl->prev_info[i].tex_size[0] = gl->tex_w;
gl->prev_info[i].input_size[1] = gl->tex_h; gl->prev_info[i].input_size[1] = gl->tex_h;
gl->prev_info[i].tex_size[1] = gl->tex_h; gl->prev_info[i].tex_size[1] = gl->tex_h;
memcpy(gl->prev_info[i].coord, tex_coords, sizeof(tex_coords)); memcpy(gl->prev_info[i].coord, tex_coords, sizeof(tex_coords));
} }
} }
@ -598,7 +598,7 @@ static void gl_init_textures_reference(gl_t *gl, unsigned i,
#ifdef HAVE_PSGL #ifdef HAVE_PSGL
glTextureReferenceSCE(GL_TEXTURE_2D, 1, glTextureReferenceSCE(GL_TEXTURE_2D, 1,
gl->tex_w, gl->tex_h, 0, gl->tex_w, gl->tex_h, 0,
internal_fmt, internal_fmt,
gl->tex_w * gl->base_size, gl->tex_w * gl->base_size,
gl->tex_w * gl->tex_h * i * gl->base_size); gl->tex_w * gl->tex_h * i * gl->base_size);
@ -632,7 +632,7 @@ static void gl_init_textures(gl_t *gl, const video_info_t *video)
glBindBuffer(GL_TEXTURE_REFERENCE_BUFFER_SCE, gl->pbo); glBindBuffer(GL_TEXTURE_REFERENCE_BUFFER_SCE, gl->pbo);
glBufferData(GL_TEXTURE_REFERENCE_BUFFER_SCE, glBufferData(GL_TEXTURE_REFERENCE_BUFFER_SCE,
gl->tex_w * gl->tex_h * gl->base_size * gl->textures, gl->tex_w * gl->tex_h * gl->base_size * gl->textures,
NULL, GL_STREAM_DRAW); NULL, GL_STREAM_DRAW);
#endif #endif
@ -684,7 +684,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
#if defined(HAVE_PSGL) #if defined(HAVE_PSGL)
{ {
unsigned h; unsigned h;
size_t buffer_addr = gl->tex_w * gl->tex_h * size_t buffer_addr = gl->tex_w * gl->tex_h *
gl->tex_index * gl->base_size; gl->tex_index * gl->base_size;
size_t buffer_stride = gl->tex_w * gl->base_size; size_t buffer_stride = gl->tex_w * gl->base_size;
const uint8_t *frame_copy = frame; const uint8_t *frame_copy = frame;
@ -729,7 +729,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
{ {
bool use_rgba = video_driver_supports_rgba(); bool use_rgba = video_driver_supports_rgba();
glPixelStorei(GL_UNPACK_ALIGNMENT, glPixelStorei(GL_UNPACK_ALIGNMENT,
video_pixel_get_alignment(width * gl->base_size)); video_pixel_get_alignment(width * gl->base_size));
/* Fallback for GLES devices without GL_BGRA_EXT. */ /* Fallback for GLES devices without GL_BGRA_EXT. */
@ -761,7 +761,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
if (width != pitch_width) if (width != pitch_width)
{ {
/* Slow path - conv_buffer is preallocated /* Slow path - conv_buffer is preallocated
* just in case we hit this path. */ * just in case we hit this path. */
unsigned h; unsigned h;
@ -777,7 +777,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
glTexSubImage2D(GL_TEXTURE_2D, glTexSubImage2D(GL_TEXTURE_2D,
0, 0, 0, width, height, gl->texture_type, 0, 0, 0, width, height, gl->texture_type,
gl->texture_fmt, data_buf); gl->texture_fmt, data_buf);
} }
} }
#else #else
@ -790,7 +790,7 @@ static INLINE void gl_copy_frame(gl_t *gl, const void *frame,
/* Convert to 32-bit textures on desktop GL. /* Convert to 32-bit textures on desktop GL.
* *
* It is *much* faster (order of magnitude on my setup) * It is *much* faster (order of magnitude on my setup)
* to use a custom SIMD-optimized conversion routine * to use a custom SIMD-optimized conversion routine
* than letting GL do it. */ * than letting GL do it. */
video_frame_convert_rgb16_to_rgb32( video_frame_convert_rgb16_to_rgb32(
&gl->scaler, &gl->scaler,
@ -847,7 +847,7 @@ void gl_load_texture_data(
glBindTexture(GL_TEXTURE_2D, id); glBindTexture(GL_TEXTURE_2D, id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap);
if (!gl_check_capability(GL_CAPS_MIPMAP)) if (!gl_check_capability(GL_CAPS_MIPMAP))
{ {
/* Assume no mipmapping support. */ /* Assume no mipmapping support. */
@ -1141,7 +1141,7 @@ static bool gl_frame(void *data, const void *frame,
{ {
gl_check_fbo_dimensions(gl); gl_check_fbo_dimensions(gl);
/* Go back to what we're supposed to do, /* Go back to what we're supposed to do,
* render to FBO #0. */ * render to FBO #0. */
gl_renderchain_start_render(gl); gl_renderchain_start_render(gl);
} }
@ -1156,7 +1156,7 @@ static bool gl_frame(void *data, const void *frame,
glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]); glBindTexture(GL_TEXTURE_2D, gl->texture[gl->tex_index]);
/* Can be NULL for frame dupe / NULL render. */ /* Can be NULL for frame dupe / NULL render. */
if (frame) if (frame)
{ {
#ifdef HAVE_FBO #ifdef HAVE_FBO
if (!gl->hw_render_fbo_init) if (!gl->hw_render_fbo_init)
@ -1166,13 +1166,13 @@ static bool gl_frame(void *data, const void *frame,
gl_copy_frame(gl, frame, frame_width, frame_height, pitch); gl_copy_frame(gl, frame, frame_width, frame_height, pitch);
} }
/* No point regenerating mipmaps /* No point regenerating mipmaps
* if there are no new frames. */ * if there are no new frames. */
if (gl->tex_mipmap && gl_check_capability(GL_CAPS_MIPMAP)) if (gl->tex_mipmap && gl_check_capability(GL_CAPS_MIPMAP))
glGenerateMipmap(GL_TEXTURE_2D); glGenerateMipmap(GL_TEXTURE_2D);
} }
/* Have to reset rendering state which libretro core /* Have to reset rendering state which libretro core
* could easily have overridden. */ * could easily have overridden. */
#ifdef HAVE_FBO #ifdef HAVE_FBO
if (gl->hw_render_fbo_init) if (gl->hw_render_fbo_init)
@ -1345,7 +1345,7 @@ static bool gl_frame(void *data, const void *frame,
performance_counter_init(&gl_fence, "gl_fence"); performance_counter_init(&gl_fence, "gl_fence");
performance_counter_start(&gl_fence); performance_counter_start(&gl_fence);
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
gl->fences[gl->fence_count++] = gl->fences[gl->fence_count++] =
glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
while (gl->fence_count > settings->video.hard_sync_frames) while (gl->fence_count > settings->video.hard_sync_frames)
@ -1491,7 +1491,7 @@ static bool resolve_extensions(gl_t *gl, const char *context_ident)
video_driver_get_hw_context(); video_driver_get_hw_context();
gl_query_core_context_set(hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE); gl_query_core_context_set(hwr->context_type == RETRO_HW_CONTEXT_OPENGL_CORE);
if (gl_query_core_context_in_use()) if (gl_query_core_context_in_use())
{ {
RARCH_LOG("[GL]: Using Core GL context.\n"); RARCH_LOG("[GL]: Using Core GL context.\n");
@ -1504,10 +1504,10 @@ static bool resolve_extensions(gl_t *gl, const char *context_ident)
} }
/* GL_RGB565 internal format support. /* GL_RGB565 internal format support.
* Even though ES2 support is claimed, the format * Even though ES2 support is claimed, the format
* is not supported on older ATI catalyst drivers. * is not supported on older ATI catalyst drivers.
* *
* The speed gain from using GL_RGB565 is worth * The speed gain from using GL_RGB565 is worth
* adding some workarounds for. * adding some workarounds for.
*/ */
gl->have_es2_compat = gl_check_capability(GL_CAPS_ES2_COMPAT); gl->have_es2_compat = gl_check_capability(GL_CAPS_ES2_COMPAT);
@ -1624,11 +1624,11 @@ static void gl_init_pbo_readback(gl_t *gl)
#endif #endif
/* Only bother with this if we're doing GPU recording. /* Only bother with this if we're doing GPU recording.
* Check recording_is_enabled() and not * Check recording_is_enabled() and not
* driver.recording_data, because recording is * driver.recording_data, because recording is
* not initialized yet. * not initialized yet.
*/ */
gl->pbo_readback_enable = settings->video.gpu_record gl->pbo_readback_enable = settings->video.gpu_record
&& *recording_enabled; && *recording_enabled;
if (!gl->pbo_readback_enable) if (!gl->pbo_readback_enable)
@ -1640,7 +1640,7 @@ static void gl_init_pbo_readback(gl_t *gl)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[i]); glBindBuffer(GL_PIXEL_PACK_BUFFER, gl->pbo_readback[i]);
glBufferData(GL_PIXEL_PACK_BUFFER, gl->vp.width * glBufferData(GL_PIXEL_PACK_BUFFER, gl->vp.width *
gl->vp.height * sizeof(uint32_t), gl->vp.height * sizeof(uint32_t),
NULL, GL_STREAM_READ); NULL, GL_STREAM_READ);
} }
@ -1693,7 +1693,7 @@ static const gfx_ctx_driver_t *gl_get_context(gl_t *gl)
api = GFX_CTX_OPENGL_API; api = GFX_CTX_OPENGL_API;
api_name = "OpenGL"; api_name = "OpenGL";
#endif #endif
(void)api_name; (void)api_name;
gl_shared_context_use = settings->video.shared_context gl_shared_context_use = settings->video.shared_context
@ -1896,7 +1896,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
goto error; goto error;
/* Clear out potential error flags in case we use cached context. */ /* Clear out potential error flags in case we use cached context. */
glGetError(); glGetError();
vendor = (const char*)glGetString(GL_VENDOR); vendor = (const char*)glGetString(GL_VENDOR);
renderer = (const char*)glGetString(GL_RENDERER); renderer = (const char*)glGetString(GL_RENDERER);
@ -1934,7 +1934,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
temp_height = mode.height; temp_height = mode.height;
mode.width = 0; mode.width = 0;
mode.height = 0; mode.height = 0;
/* Get real known video size, which might have been altered by context. */ /* Get real known video size, which might have been altered by context. */
if (temp_width != 0 && temp_height != 0) if (temp_width != 0 && temp_height != 0)
@ -1946,7 +1946,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
hwr = video_driver_get_hw_context(); hwr = video_driver_get_hw_context();
gl->vertex_ptr = hwr->bottom_left_origin gl->vertex_ptr = hwr->bottom_left_origin
? vertexes : vertexes_flipped; ? vertexes : vertexes_flipped;
/* Better pipelining with GPU due to synchronous glSubTexImage. /* Better pipelining with GPU due to synchronous glSubTexImage.
@ -2010,7 +2010,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
gl->tex_w = gl->tex_h = (RARCH_SCALE_BASE * video->input_scale); gl->tex_w = gl->tex_h = (RARCH_SCALE_BASE * video->input_scale);
gl->keep_aspect = video->force_aspect; gl->keep_aspect = video->force_aspect;
/* Apparently need to set viewport for passes /* Apparently need to set viewport for passes
* when we aren't using FBOs. */ * when we aren't using FBOs. */
gl_set_shader_viewport(gl, 0); gl_set_shader_viewport(gl, 0);
gl_set_shader_viewport(gl, 1); gl_set_shader_viewport(gl, 1);
@ -2021,14 +2021,14 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
shader_filter.smooth = &force_smooth; shader_filter.smooth = &force_smooth;
if (video_shader_driver_filter_type(&shader_filter)) if (video_shader_driver_filter_type(&shader_filter))
gl->tex_min_filter = gl->tex_mipmap ? (force_smooth ? gl->tex_min_filter = gl->tex_mipmap ? (force_smooth ?
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST) GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST)
: (force_smooth ? GL_LINEAR : GL_NEAREST); : (force_smooth ? GL_LINEAR : GL_NEAREST);
else else
gl->tex_min_filter = gl->tex_mipmap ? gl->tex_min_filter = gl->tex_mipmap ?
(video->smooth ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST) (video->smooth ? GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST)
: (video->smooth ? GL_LINEAR : GL_NEAREST); : (video->smooth ? GL_LINEAR : GL_NEAREST);
gl->tex_mag_filter = min_filter_to_mag(gl->tex_min_filter); gl->tex_mag_filter = min_filter_to_mag(gl->tex_min_filter);
wrap_info.idx = 1; wrap_info.idx = 1;
@ -2055,7 +2055,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
gl->coords.lut_tex_coord = tex_coords; gl->coords.lut_tex_coord = tex_coords;
gl->coords.vertices = 4; gl->coords.vertices = 4;
/* Empty buffer that we use to clear out /* Empty buffer that we use to clear out
* the texture with on res change. */ * the texture with on res change. */
gl->empty_buf = calloc(sizeof(uint32_t), gl->tex_w * gl->tex_h); gl->empty_buf = calloc(sizeof(uint32_t), gl->tex_w * gl->tex_h);
@ -2072,7 +2072,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
#ifdef HAVE_FBO #ifdef HAVE_FBO
gl_renderchain_init(gl, gl->tex_w, gl->tex_h); gl_renderchain_init(gl, gl->tex_w, gl->tex_h);
if (gl->hw_render_use && if (gl->hw_render_use &&
!gl_init_hw_render(gl, gl->tex_w, gl->tex_h)) !gl_init_hw_render(gl, gl->tex_w, gl->tex_h))
goto error; goto error;
#endif #endif
@ -2081,10 +2081,10 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
inp.input_data = input_data; inp.input_data = input_data;
video_context_driver_input_driver(&inp); video_context_driver_input_driver(&inp);
if (settings->video.font_enable) if (settings->video.font_enable)
{ {
if (!font_driver_init_first(NULL, NULL, gl, *settings->path.font if (!font_driver_init_first(NULL, NULL, gl, *settings->path.font
? settings->path.font : NULL, settings->video.font_size, false, ? settings->path.font : NULL, settings->video.font_size, false,
FONT_DRIVER_RENDER_OPENGL_API)) FONT_DRIVER_RENDER_OPENGL_API))
RARCH_ERR("[GL]: Failed to initialize font renderer.\n"); RARCH_ERR("[GL]: Failed to initialize font renderer.\n");
@ -2190,8 +2190,8 @@ static void gl_update_tex_filter_frame(gl_t *gl)
gl->tex_mipmap = video_shader_driver_mipmap_input(&mip_level); gl->tex_mipmap = video_shader_driver_mipmap_input(&mip_level);
gl->video_info.smooth = smooth; gl->video_info.smooth = smooth;
new_filt = gl->tex_mipmap ? (smooth ? new_filt = gl->tex_mipmap ? (smooth ?
GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST) GL_LINEAR_MIPMAP_LINEAR : GL_NEAREST_MIPMAP_NEAREST)
: (smooth ? GL_LINEAR : GL_NEAREST); : (smooth ? GL_LINEAR : GL_NEAREST);
if (new_filt == gl->tex_min_filter && wrap_mode == gl->wrap_mode) if (new_filt == gl->tex_min_filter && wrap_mode == gl->wrap_mode)
@ -2366,7 +2366,7 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
/* Don't readback if we're in menu mode. /* Don't readback if we're in menu mode.
* We haven't buffered up enough frames yet, come back later. */ * We haven't buffered up enough frames yet, come back later. */
if (!gl->pbo_readback_valid[gl->pbo_readback_index]) if (!gl->pbo_readback_valid[gl->pbo_readback_index])
goto error; goto error;
gl->pbo_readback_valid[gl->pbo_readback_index] = false; gl->pbo_readback_valid[gl->pbo_readback_index] = false;
@ -2404,15 +2404,15 @@ static bool gl_read_viewport(void *data, uint8_t *buffer)
glUnmapBuffer(GL_PIXEL_PACK_BUFFER); glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
} }
else /* Use slow synchronous readbacks. Use this with plain screenshots else /* Use slow synchronous readbacks. Use this with plain screenshots
as we don't really care about performance in this case. */ as we don't really care about performance in this case. */
#endif #endif
{ {
/* GLES2 only guarantees GL_RGBA/GL_UNSIGNED_BYTE /* GLES2 only guarantees GL_RGBA/GL_UNSIGNED_BYTE
* readbacks so do just that. * readbacks so do just that.
* GLES2 also doesn't support reading back data * GLES2 also doesn't support reading back data
* from front buffer, so render a cached frame * from front buffer, so render a cached frame
* and have gl_frame() do the readback while it's * and have gl_frame() do the readback while it's
* in the back buffer. * in the back buffer.
* *
* Keep codepath similar for GLES and desktop GL. * Keep codepath similar for GLES and desktop GL.
@ -2528,12 +2528,12 @@ bool gl_load_luts(const struct video_shader *shader,
} }
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
static bool gl_overlay_load(void *data, static bool gl_overlay_load(void *data,
const void *image_data, unsigned num_images) const void *image_data, unsigned num_images)
{ {
unsigned i, j; unsigned i, j;
gl_t *gl = (gl_t*)data; gl_t *gl = (gl_t*)data;
const struct texture_image *images = const struct texture_image *images =
(const struct texture_image*)image_data; (const struct texture_image*)image_data;
if (!gl) if (!gl)
@ -2557,8 +2557,8 @@ static bool gl_overlay_load(void *data,
gl->overlay_color_coord = (GLfloat*) gl->overlay_color_coord = (GLfloat*)
calloc(4 * 4 * num_images, sizeof(GLfloat)); calloc(4 * 4 * num_images, sizeof(GLfloat));
if ( !gl->overlay_vertex_coord if ( !gl->overlay_vertex_coord
|| !gl->overlay_tex_coord || !gl->overlay_tex_coord
|| !gl->overlay_color_coord) || !gl->overlay_color_coord)
return false; return false;
@ -2567,7 +2567,7 @@ static bool gl_overlay_load(void *data,
for (i = 0; i < num_images; i++) for (i = 0; i < num_images; i++)
{ {
unsigned alignment = video_pixel_get_alignment(images[i].width unsigned alignment = video_pixel_get_alignment(images[i].width
* sizeof(uint32_t)); * sizeof(uint32_t));
gl_load_texture_data(gl->overlay_tex[i], gl_load_texture_data(gl->overlay_tex[i],
@ -2724,7 +2724,7 @@ static void video_texture_load_gl(
{ {
/* Generate the OpenGL texture object */ /* Generate the OpenGL texture object */
glGenTextures(1, (GLuint*)id); glGenTextures(1, (GLuint*)id);
gl_load_texture_data((GLuint)*id, gl_load_texture_data((GLuint)*id,
RARCH_WRAP_EDGE, filter_type, RARCH_WRAP_EDGE, filter_type,
4 /* TODO/FIXME - dehardcode */, 4 /* TODO/FIXME - dehardcode */,
ti->width, ti->height, ti->pixels, ti->width, ti->height, ti->pixels,

View File

@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis * Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2012-2015 - Michael Lelli * Copyright (C) 2012-2015 - Michael Lelli
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found- * of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version. * ation, either version 3 of the License, or (at your option) any later version.
@ -112,7 +112,7 @@ bool gl_check_capability(enum gl_capability_enum enum_idx)
if (version && sscanf(version, "%u.%u", &major, &minor) != 2) if (version && sscanf(version, "%u.%u", &major, &minor) != 2)
#endif #endif
major = minor = 0; major = minor = 0;
(void)vendor; (void)vendor;
switch (enum_idx) switch (enum_idx)
@ -165,15 +165,15 @@ bool gl_check_capability(enum gl_capability_enum enum_idx)
&& !gl_query_extension("EXT_framebuffer_object")) && !gl_query_extension("EXT_framebuffer_object"))
return false; return false;
if (glGenFramebuffers if (glGenFramebuffers
&& glBindFramebuffer && glBindFramebuffer
&& glFramebufferTexture2D && glFramebufferTexture2D
&& glCheckFramebufferStatus && glCheckFramebufferStatus
&& glDeleteFramebuffers && glDeleteFramebuffers
&& glGenRenderbuffers && glGenRenderbuffers
&& glBindRenderbuffer && glBindRenderbuffer
&& glFramebufferRenderbuffer && glFramebufferRenderbuffer
&& glRenderbufferStorage && glRenderbufferStorage
&& glDeleteRenderbuffers) && glDeleteRenderbuffers)
return true; return true;
break; break;
@ -203,7 +203,7 @@ bool gl_check_capability(enum gl_capability_enum enum_idx)
video_driver_get_hw_context(); video_driver_get_hw_context();
if (major >= 3) if (major >= 3)
return true; return true;
if (hwr->stencil if (hwr->stencil
&& !gl_query_extension("OES_packed_depth_stencil") && !gl_query_extension("OES_packed_depth_stencil")
&& !gl_query_extension("EXT_packed_depth_stencil")) && !gl_query_extension("EXT_packed_depth_stencil"))
return false; return false;
@ -271,7 +271,7 @@ bool gl_check_capability(enum gl_capability_enum enum_idx)
if (major >= 3 || gl_query_extension("EXT_sRGB")) if (major >= 3 || gl_query_extension("EXT_sRGB"))
return true; return true;
#elif defined(HAVE_FBO) #elif defined(HAVE_FBO)
if (gl_query_core_context_in_use() || if (gl_query_core_context_in_use() ||
(gl_query_extension("EXT_texture_sRGB") (gl_query_extension("EXT_texture_sRGB")
&& gl_query_extension("ARB_framebuffer_sRGB"))) && gl_query_extension("ARB_framebuffer_sRGB")))
return true; return true;

View File

@ -2,7 +2,7 @@
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis * Copyright (C) 2011-2016 - Daniel De Matteis
* Copyright (C) 2012-2015 - Michael Lelli * Copyright (C) 2012-2015 - Michael Lelli
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found- * of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version. * ation, either version 3 of the License, or (at your option) any later version.
@ -138,7 +138,7 @@
#define RARCH_GL_FORMAT32 GL_UNSIGNED_INT_8_8_8_8_REV #define RARCH_GL_FORMAT32 GL_UNSIGNED_INT_8_8_8_8_REV
#define RARCH_GL_FORMAT16 GL_UNSIGNED_INT_8_8_8_8_REV #define RARCH_GL_FORMAT16 GL_UNSIGNED_INT_8_8_8_8_REV
/* GL_RGB565 internal format isn't in desktop GL /* GL_RGB565 internal format isn't in desktop GL
* until 4.1 core (ARB_ES2_compatibility). * until 4.1 core (ARB_ES2_compatibility).
* Check for this. */ * Check for this. */
#ifndef GL_RGB565 #ifndef GL_RGB565

View File

@ -1,6 +1,6 @@
/* RetroArch - A frontend for libretro. /* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* *
* RetroArch is free software: you can redistribute it and/or modify it under the terms * RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found- * of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version. * ation, either version 3 of the License, or (at your option) any later version.
@ -93,7 +93,7 @@ struct shader_uniforms
int frame_direction; int frame_direction;
int lut_texture[GFX_MAX_TEXTURES]; int lut_texture[GFX_MAX_TEXTURES];
struct shader_uniforms_frame orig; struct shader_uniforms_frame orig;
struct shader_uniforms_frame feedback; struct shader_uniforms_frame feedback;
struct shader_uniforms_frame pass[GFX_MAX_SHADERS]; struct shader_uniforms_frame pass[GFX_MAX_SHADERS];
@ -290,7 +290,7 @@ static bool gl_glsl_compile_shader(glsl_shader_data_t *glsl,
static bool gl_glsl_link_program(GLuint prog) static bool gl_glsl_link_program(GLuint prog)
{ {
GLint status; GLint status;
glLinkProgram(prog); glLinkProgram(prog);
glGetProgramiv(prog, GL_LINK_STATUS, &status); glGetProgramiv(prog, GL_LINK_STATUS, &status);
@ -358,7 +358,7 @@ static bool gl_glsl_compile_program(
goto error; goto error;
/* Clean up dead memory. We're not going to relink the program. /* Clean up dead memory. We're not going to relink the program.
* Detaching first seems to kill some mobile drivers * Detaching first seems to kill some mobile drivers
* (according to the intertubes anyways). */ * (according to the intertubes anyways). */
if (program->vprg) if (program->vprg)
glDeleteShader(program->vprg); glDeleteShader(program->vprg);
@ -445,8 +445,8 @@ static bool gl_glsl_compile_programs(
shader_prog_info.fragment = fragment; shader_prog_info.fragment = fragment;
shader_prog_info.is_file = false; shader_prog_info.is_file = false;
if (!gl_glsl_compile_program(glsl, i, if (!gl_glsl_compile_program(glsl, i,
&program[i], &program[i],
&shader_prog_info)) &shader_prog_info))
{ {
RARCH_ERR("Failed to create GL program #%u.\n", i); RARCH_ERR("Failed to create GL program #%u.\n", i);
@ -472,7 +472,7 @@ static void gl_glsl_reset_attrib(glsl_shader_data_t *glsl)
static void gl_glsl_set_vbo(GLfloat **buffer, size_t *buffer_elems, static void gl_glsl_set_vbo(GLfloat **buffer, size_t *buffer_elems,
const GLfloat *data, size_t elems) const GLfloat *data, size_t elems)
{ {
if (elems != *buffer_elems || if (elems != *buffer_elems ||
memcmp(data, *buffer, elems * sizeof(GLfloat))) memcmp(data, *buffer, elems * sizeof(GLfloat)))
{ {
if (elems > *buffer_elems) if (elems > *buffer_elems)
@ -712,12 +712,12 @@ static void *gl_glsl_init(void *data, const char *path)
shader_support = glCreateProgram && glUseProgram && glCreateShader shader_support = glCreateProgram && glUseProgram && glCreateShader
&& glDeleteShader && glShaderSource && glCompileShader && glAttachShader && glDeleteShader && glShaderSource && glCompileShader && glAttachShader
&& glDetachShader && glLinkProgram && glGetUniformLocation && glDetachShader && glLinkProgram && glGetUniformLocation
&& glUniform1i && glUniform1f && glUniform2fv && glUniform4fv && glUniform1i && glUniform1f && glUniform2fv && glUniform4fv
&& glUniformMatrix4fv && glUniformMatrix4fv
&& glGetShaderiv && glGetShaderInfoLog && glGetProgramiv && glGetShaderiv && glGetShaderInfoLog && glGetProgramiv
&& glGetProgramInfoLog && glGetProgramInfoLog
&& glDeleteProgram && glGetAttachedShaders && glDeleteProgram && glGetAttachedShaders
&& glGetAttribLocation && glEnableVertexAttribArray && glGetAttribLocation && glEnableVertexAttribArray
&& glDisableVertexAttribArray && glDisableVertexAttribArray
&& glVertexAttribPointer && glVertexAttribPointer
&& glGenBuffers && glBufferData && glDeleteBuffers && glBindBuffer; && glGenBuffers && glBufferData && glDeleteBuffers && glBindBuffer;
@ -766,9 +766,9 @@ static void *gl_glsl_init(void *data, const char *path)
{ {
RARCH_WARN("[GL]: Stock GLSL shaders will be used.\n"); RARCH_WARN("[GL]: Stock GLSL shaders will be used.\n");
glsl->shader->passes = 1; glsl->shader->passes = 1;
glsl->shader->pass[0].source.string.vertex = glsl->shader->pass[0].source.string.vertex =
strdup(glsl_core ? stock_vertex_core : stock_vertex_modern); strdup(glsl_core ? stock_vertex_core : stock_vertex_modern);
glsl->shader->pass[0].source.string.fragment = glsl->shader->pass[0].source.string.fragment =
strdup(glsl_core ? stock_fragment_core : stock_fragment_modern); strdup(glsl_core ? stock_fragment_core : stock_fragment_modern);
glsl->shader->modern = true; glsl->shader->modern = true;
} }
@ -877,17 +877,17 @@ static void *gl_glsl_init(void *data, const char *path)
if (!glsl->state_tracker) if (!glsl->state_tracker)
RARCH_WARN("Failed to init state tracker.\n"); RARCH_WARN("Failed to init state tracker.\n");
} }
glsl->prg[glsl->shader->passes + 1] = glsl->prg[0]; glsl->prg[glsl->shader->passes + 1] = glsl->prg[0];
glsl->uniforms[glsl->shader->passes + 1] = glsl->uniforms[0]; glsl->uniforms[glsl->shader->passes + 1] = glsl->uniforms[0];
if (glsl->shader->modern) if (glsl->shader->modern)
{ {
shader_prog_info.vertex = shader_prog_info.vertex =
glsl_core ? glsl_core ?
stock_vertex_core_blend : stock_vertex_modern_blend; stock_vertex_core_blend : stock_vertex_modern_blend;
shader_prog_info.fragment = shader_prog_info.fragment =
glsl_core ? glsl_core ?
stock_fragment_core_blend : stock_fragment_modern_blend; stock_fragment_core_blend : stock_fragment_modern_blend;
shader_prog_info.is_file = false; shader_prog_info.is_file = false;
@ -1011,12 +1011,12 @@ static void gl_glsl_set_uniform_parameter(
} }
static void gl_glsl_set_params(void *data, void *shader_data, static void gl_glsl_set_params(void *data, void *shader_data,
unsigned width, unsigned height, unsigned width, unsigned height,
unsigned tex_width, unsigned tex_height, unsigned tex_width, unsigned tex_height,
unsigned out_width, unsigned out_height, unsigned out_width, unsigned out_height,
unsigned frame_count, unsigned frame_count,
const void *_info, const void *_info,
const void *_prev_info, const void *_prev_info,
const void *_feedback_info, const void *_feedback_info,
const void *_fbo_info, unsigned fbo_info_cnt) const void *_fbo_info, unsigned fbo_info_cnt)
{ {
@ -1186,7 +1186,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
texunit++; texunit++;
} }
if (uni->prev[i].texture_size >= 0) if (uni->prev[i].texture_size >= 0)
glUniform2fv(uni->prev[i].texture_size, 1, prev_info[i].tex_size); glUniform2fv(uni->prev[i].texture_size, 1, prev_info[i].tex_size);
@ -1218,7 +1218,7 @@ static void gl_glsl_set_params(void *data, void *shader_data,
/* #pragma parameters. */ /* #pragma parameters. */
for (i = 0; i < glsl->shader->num_parameters; i++) for (i = 0; i < glsl->shader->num_parameters; i++)
{ {
int location = glGetUniformLocation( int location = glGetUniformLocation(
glsl->prg[glsl->active_idx].id, glsl->prg[glsl->active_idx].id,
glsl->shader->parameters[i].id); glsl->shader->parameters[i].id);
@ -1294,7 +1294,7 @@ static bool gl_glsl_set_coords(void *handle_data, void *shader_data, const struc
buffer = short_buffer; buffer = short_buffer;
if (coords->vertices > 4) if (coords->vertices > 4)
buffer = (GLfloat*)calloc(coords->vertices * buffer = (GLfloat*)calloc(coords->vertices *
(2 + 2 + 4 + 2), sizeof(*buffer)); (2 + 2 + 4 + 2), sizeof(*buffer));
if (!buffer) if (!buffer)
@ -1348,7 +1348,7 @@ static void gl_glsl_use(void *data, void *shader_data, unsigned idx, bool set_ac
glsl->active_idx = idx; glsl->active_idx = idx;
id = glsl->prg[idx].id; id = glsl->prg[idx].id;
} }
else else
id = (GLuint)idx; id = (GLuint)idx;
glUseProgram(id); glUseProgram(id);
@ -1365,7 +1365,7 @@ static unsigned gl_glsl_num(void *data)
static bool gl_glsl_filter_type(void *data, unsigned idx, bool *smooth) static bool gl_glsl_filter_type(void *data, unsigned idx, bool *smooth)
{ {
glsl_shader_data_t *glsl = (glsl_shader_data_t*)data; glsl_shader_data_t *glsl = (glsl_shader_data_t*)data;
if (glsl && idx if (glsl && idx
&& (glsl->shader->pass[idx - 1].filter != RARCH_FILTER_UNSPEC) && (glsl->shader->pass[idx - 1].filter != RARCH_FILTER_UNSPEC)
) )
{ {