mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
(FFT/GLSL) Start moving shaders to separate files
This commit is contained in:
parent
c05f873dff
commit
38ab9c8003
@ -150,16 +150,7 @@ static const char fragment_program_heightmap[] =
|
||||
" FragColor = vec4(color, 1.0);\n"
|
||||
"}";
|
||||
|
||||
static const char vertex_program[] =
|
||||
"#version 300 es\n"
|
||||
"layout(location = 0) in vec2 aVertex;\n"
|
||||
"layout(location = 1) in vec2 aTexCoord;\n"
|
||||
"uniform vec4 uOffsetScale;\n"
|
||||
"out vec2 vTex;\n"
|
||||
"void main() {\n"
|
||||
" vTex = uOffsetScale.xy + aTexCoord * uOffsetScale.zw;\n"
|
||||
" gl_Position = vec4(aVertex, 0.0, 1.0);\n"
|
||||
"}";
|
||||
#include "gl_shaders/fft_vertex_program.glsl.vert.h"
|
||||
|
||||
static const char fragment_program_resolve[] =
|
||||
"#version 300 es\n"
|
||||
@ -614,10 +605,10 @@ static void fft_init(glfft_t *fft)
|
||||
GLushort *window;
|
||||
static const GLfloat unity[] = { 0.0f, 0.0f, 1.0f, 1.0f };
|
||||
|
||||
fft->prog_real = fft_compile_program(fft, vertex_program, fragment_program_real);
|
||||
fft->prog_complex = fft_compile_program(fft, vertex_program, fragment_program_complex);
|
||||
fft->prog_resolve = fft_compile_program(fft, vertex_program, fragment_program_resolve);
|
||||
fft->prog_blur = fft_compile_program(fft, vertex_program, fragment_program_blur);
|
||||
fft->prog_real = fft_compile_program(fft, fft_vertex_program, fragment_program_real);
|
||||
fft->prog_complex = fft_compile_program(fft, fft_vertex_program, fragment_program_complex);
|
||||
fft->prog_resolve = fft_compile_program(fft, fft_vertex_program, fragment_program_resolve);
|
||||
fft->prog_blur = fft_compile_program(fft, fft_vertex_program, fragment_program_blur);
|
||||
GL_CHECK_ERROR();
|
||||
|
||||
glUseProgram(fft->prog_real);
|
||||
|
@ -0,0 +1,12 @@
|
||||
#include "shaders_common.h"
|
||||
|
||||
static const char *fft_vertex_program = GLSL_300(
|
||||
layout(location = 0) in vec2 aVertex;
|
||||
layout(location = 1) in vec2 aTexCoord;
|
||||
uniform vec4 uOffsetScale;
|
||||
out vec2 vTex;
|
||||
void main() {
|
||||
vTex = uOffsetScale.xy + aTexCoord * uOffsetScale.zw;
|
||||
gl_Position = vec4(aVertex, 0.0, 1.0);
|
||||
}
|
||||
);
|
16
cores/libretro-ffmpeg/fft/gl_shaders/shaders_common.h
Normal file
16
cores/libretro-ffmpeg/fft/gl_shaders/shaders_common.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef _SHADERS_COMMON
|
||||
#define _SHADERS_COMMON
|
||||
|
||||
#if defined(HAVE_OPENGLES)
|
||||
#define CG(src) "" #src
|
||||
#define GLSL(src) "precision mediump float;\n" #src
|
||||
#define GLSL_330(src) "#version 330 es\nprecision mediump float;\n" #src
|
||||
#define GLSL_300(src) "#version 300 es\nprecision mediump float;\n" #src
|
||||
#else
|
||||
#define CG(src) "" #src
|
||||
#define GLSL(src) "" #src
|
||||
#define GLSL_300(src) "#version 300 es\n" #src
|
||||
#define GLSL_330(src) "#version 330 core\n" #src
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user