Skip to content

Commit

Permalink
(ffmpeg core) Take out gl prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
inactive123 committed May 27, 2017
1 parent 94e2570 commit 08bed1b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 42 deletions.
34 changes: 17 additions & 17 deletions cores/libretro-ffmpeg/ffmpeg_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static struct attachment *attachments;
static size_t attachments_size;

#ifdef HAVE_GL_FFT
static glfft_t *fft;
static fft_t *fft;
unsigned fft_width;
unsigned fft_height;
unsigned fft_multisample;
Expand Down Expand Up @@ -274,8 +274,8 @@ void CORE_PREFIX(retro_set_environment)(retro_environment_t cb)
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
{ "ffmpeg_temporal_interp", "Temporal Interpolation; enabled|disabled" },
#ifdef HAVE_GL_FFT
{ "ffmpeg_fft_resolution", "GLFFT Resolution; 1280x720|1920x1080|2560x1440|3840x2160|640x360|320x180" },
{ "ffmpeg_fft_multisample", "GLFFT Multisample; 1x|2x|4x" },
{ "ffmpeg_fft_resolution", "FFT Resolution; 1280x720|1920x1080|2560x1440|3840x2160|640x360|320x180" },
{ "ffmpeg_fft_multisample", "FFT Multisample; 1x|2x|4x" },
#endif
#endif
{ "ffmpeg_color_space", "Colorspace; auto|BT.709|BT.601|FCC|SMPTE240M" },
Expand Down Expand Up @@ -462,7 +462,7 @@ void CORE_PREFIX(retro_run)(void)
}

if (fft && (old_fft_multisample != fft_multisample))
glfft_init_multisample(fft, fft_width, fft_height, fft_multisample);
fft_init_multisample(fft, fft_width, fft_height, fft_multisample);
#endif

CORE_PREFIX(input_poll_cb)();
Expand Down Expand Up @@ -737,11 +737,11 @@ void CORE_PREFIX(retro_run)(void)
if (to_read > (1 << 11))
to_read = 1 << 11;

glfft_step_fft(fft, buffer, to_read);
fft_step_fft(fft, buffer, to_read);
buffer += to_read * 2;
frames -= to_read;
}
glfft_render(fft, hw_render.get_current_framebuffer(), fft_width, fft_height);
fft_render(fft, hw_render.get_current_framebuffer(), fft_width, fft_height);
CORE_PREFIX(video_cb)(RETRO_HW_FRAME_BUFFER_VALID,
fft_width, fft_height, fft_width * sizeof(uint32_t));
}
Expand Down Expand Up @@ -1369,7 +1369,7 @@ static void context_destroy(void)
#ifdef HAVE_GL_FFT
if (fft)
{
glfft_free(fft);
fft_free(fft);
fft = NULL;
}
#endif
Expand Down Expand Up @@ -1400,9 +1400,9 @@ static void context_reset(void)
#ifdef HAVE_GL_FFT
if (audio_streams_num > 0 && video_stream < 0)
{
fft = glfft_new(11, hw_render.get_proc_address);
fft = fft_new(11, hw_render.get_proc_address);
if (fft)
glfft_init_multisample(fft, fft_width, fft_height, fft_multisample);
fft_init_multisample(fft, fft_width, fft_height, fft_multisample);
}

/* Already inits symbols. */
Expand Down Expand Up @@ -1555,7 +1555,7 @@ void CORE_PREFIX(retro_unload_game)(void)

bool CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
{
bool is_glfft = false;
bool is_fft = false;
enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;
struct retro_input_descriptor desc[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "Seek -10 seconds" },
Expand Down Expand Up @@ -1606,21 +1606,21 @@ bool CORE_PREFIX(retro_load_game)(const struct retro_game_info *info)
}

#ifdef HAVE_GL_FFT
is_glfft = video_stream < 0 && audio_streams_num > 0;
is_fft = video_stream < 0 && audio_streams_num > 0;
#endif

if (video_stream >= 0 || is_glfft)
if (video_stream >= 0 || is_fft)
{
video_decode_fifo = fifo_new(media.width
* media.height * sizeof(uint32_t) * 32);

#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
use_gl = true;
hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy;
hw_render.bottom_left_origin = is_glfft;
hw_render.depth = is_glfft;
hw_render.stencil = is_glfft;
hw_render.context_reset = context_reset;
hw_render.context_destroy = context_destroy;
hw_render.bottom_left_origin = is_fft;
hw_render.depth = is_fft;
hw_render.stencil = is_fft;
#if defined(HAVE_OPENGLES)
hw_render.context_type = RETRO_HW_CONTEXT_OPENGLES2;
#else
Expand Down
38 changes: 19 additions & 19 deletions cores/libretro-ffmpeg/ffmpeg_fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct GLFFT
#include "gl_shaders/fft_fragment_program_complex.glsl.frag.h"
#include "gl_shaders/fft_fragment_program_blur.glsl.frag.h"

static GLuint fft_compile_shader(glfft_t *fft, GLenum type, const char *source)
static GLuint fft_compile_shader(fft_t *fft, GLenum type, const char *source)
{
GLint status = 0;
GLuint shader = glCreateShader(type);
Expand All @@ -119,7 +119,7 @@ static GLuint fft_compile_shader(glfft_t *fft, GLenum type, const char *source)
return shader;
}

static GLuint fft_compile_program(glfft_t *fft,
static GLuint fft_compile_program(fft_t *fft,
const char *vertex_source, const char *fragment_source)
{
GLint status = 0;
Expand Down Expand Up @@ -178,7 +178,7 @@ static fft_complex_t exp_imag(float phase)
return out;
}

void fft_build_params(glfft_t *fft, GLuint *buffer,
void fft_build_params(fft_t *fft, GLuint *buffer,
unsigned step, unsigned size)
{
unsigned i, j;
Expand Down Expand Up @@ -209,7 +209,7 @@ void fft_build_params(glfft_t *fft, GLuint *buffer,
}
}

static void fft_init_quad_vao(glfft_t *fft)
static void fft_init_quad_vao(fft_t *fft)
{
static const GLbyte quad_buffer[] = {
-1, -1, 1, -1, -1, 1, 1, 1,
Expand All @@ -233,7 +233,7 @@ static void fft_init_quad_vao(glfft_t *fft)
glBindBuffer(GL_ARRAY_BUFFER, 0);
}

static void fft_init_texture(glfft_t *fft, GLuint *tex, GLenum format,
static void fft_init_texture(fft_t *fft, GLuint *tex, GLenum format,
unsigned width, unsigned height, unsigned levels, GLenum mag, GLenum min)
{
glGenTextures(1, tex);
Expand All @@ -244,7 +244,7 @@ static void fft_init_texture(glfft_t *fft, GLuint *tex, GLenum format,
glBindTexture(GL_TEXTURE_2D, 0);
}

static void fft_init_target(glfft_t *fft, struct target *target, GLenum format,
static void fft_init_target(fft_t *fft, struct target *target, GLenum format,
unsigned width, unsigned height, unsigned levels, GLenum mag, GLenum min)
{
fft_init_texture(fft, &target->tex, format, width, height, levels, mag, min);
Expand Down Expand Up @@ -274,7 +274,7 @@ static void fft_init_target(glfft_t *fft, struct target *target, GLenum format,

#define KAISER_BETA 12.0

static void fft_init(glfft_t *fft)
static void fft_init(fft_t *fft)
{
unsigned i;
double window_mod;
Expand Down Expand Up @@ -371,7 +371,7 @@ static void fft_init(glfft_t *fft)
free(window);
}

static void fft_init_block(glfft_t *fft)
static void fft_init_block(fft_t *fft)
{
unsigned x, y;
unsigned block_vertices_size = 0;
Expand Down Expand Up @@ -445,7 +445,7 @@ static void fft_init_block(glfft_t *fft)
free(block_indices);
}

static bool fft_context_reset(glfft_t *fft, unsigned fft_steps,
static bool fft_context_reset(fft_t *fft, unsigned fft_steps,
rglgen_proc_address_t proc, unsigned fft_depth)
{
rglgen_resolve_symbols(proc);
Expand Down Expand Up @@ -480,9 +480,9 @@ static bool fft_context_reset(glfft_t *fft, unsigned fft_steps,

/* GLFFT requires either GLES3 or
* desktop GL with ES3_compat (supported by MESA on Linux) extension. */
glfft_t *glfft_new(unsigned fft_steps, rglgen_proc_address_t proc)
fft_t *fft_new(unsigned fft_steps, rglgen_proc_address_t proc)
{
glfft_t *fft = NULL;
fft_t *fft = NULL;
#ifdef HAVE_OPENGLES3
const char *ver = (const char*)(glGetString(GL_VERSION));
if (ver)
Expand All @@ -498,7 +498,7 @@ glfft_t *glfft_new(unsigned fft_steps, rglgen_proc_address_t proc)
if (!exts || !strstr(exts, "ARB_ES3_compatibility"))
return NULL;
#endif
fft = (glfft_t*)calloc(1, sizeof(*fft));
fft = (fft_t*)calloc(1, sizeof(*fft));

if (!fft)
return NULL;
Expand All @@ -514,7 +514,7 @@ glfft_t *glfft_new(unsigned fft_steps, rglgen_proc_address_t proc)
return NULL;
}

void glfft_init_multisample(glfft_t *fft, unsigned width, unsigned height, unsigned samples)
void fft_init_multisample(fft_t *fft, unsigned width, unsigned height, unsigned samples)
{
if (fft->ms_rb_color)
glDeleteRenderbuffers(1, &fft->ms_rb_color);
Expand Down Expand Up @@ -546,15 +546,15 @@ void glfft_init_multisample(glfft_t *fft, unsigned width, unsigned height, unsig
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
GL_RENDERBUFFER, fft->ms_rb_ds);
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
glfft_init_multisample(fft, 0, 0, 0);
fft_init_multisample(fft, 0, 0, 0);
}

glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

static void fft_context_destroy(glfft_t *fft)
static void fft_context_destroy(fft_t *fft)
{
glfft_init_multisample(fft, 0, 0, 0);
fft_init_multisample(fft, 0, 0, 0);
if (fft->passes)
free(fft->passes);
fft->passes = NULL;
Expand All @@ -563,7 +563,7 @@ static void fft_context_destroy(glfft_t *fft)
fft->sliding = NULL;
}

void glfft_free(glfft_t *fft)
void fft_free(fft_t *fft)
{
if (!fft)
return;
Expand All @@ -574,7 +574,7 @@ void glfft_free(glfft_t *fft)
fft = NULL;
}

void glfft_step_fft(glfft_t *fft, const GLshort *audio_buffer, unsigned frames)
void fft_step_fft(fft_t *fft, const GLshort *audio_buffer, unsigned frames)
{
unsigned i;
GLfloat resolve_offset[4];
Expand Down Expand Up @@ -683,7 +683,7 @@ void glfft_step_fft(glfft_t *fft, const GLshort *audio_buffer, unsigned frames)
GL_CHECK_ERROR();
}

void glfft_render(glfft_t *fft, GLuint backbuffer, unsigned width, unsigned height)
void fft_render(fft_t *fft, GLuint backbuffer, unsigned width, unsigned height)
{
vec3_t eye, center, up;
stub_matrix4x4 mvp_real;
Expand Down
12 changes: 6 additions & 6 deletions cores/libretro-ffmpeg/ffmpeg_fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

RETRO_BEGIN_DECLS

typedef struct GLFFT glfft_t;
typedef struct GLFFT fft_t;

glfft_t *glfft_new(unsigned fft_steps, rglgen_proc_address_t proc);
fft_t *fft_new(unsigned fft_steps, rglgen_proc_address_t proc);

void glfft_free(glfft_t *fft);
void fft_free(fft_t *fft);

void glfft_init_multisample(glfft_t *fft, unsigned width, unsigned height, unsigned samples);
void fft_init_multisample(fft_t *fft, unsigned width, unsigned height, unsigned samples);

void glfft_step_fft(glfft_t *fft, const GLshort *buffer, unsigned frames);
void fft_step_fft(fft_t *fft, const GLshort *buffer, unsigned frames);

void glfft_render(glfft_t *fft, GLuint backbuffer, unsigned width, unsigned height);
void fft_render(fft_t *fft, GLuint backbuffer, unsigned width, unsigned height);

RETRO_END_DECLS

Expand Down

0 comments on commit 08bed1b

Please sign in to comment.