Cleanup shadres in ffmpeg core

This commit is contained in:
twinaphex 2016-09-03 17:36:47 +02:00
parent e2cfb594f8
commit 3d47e1d813
13 changed files with 54 additions and 26 deletions

View File

@ -1372,29 +1372,19 @@ static void context_destroy(void)
#endif
}
static void context_reset(void)
{
static const char *vertex_source =
"attribute vec2 aVertex;\n"
"attribute vec2 aTexCoord;\n"
"varying vec2 vTex;\n"
"void main() { gl_Position = vec4(aVertex, 0.0, 1.0); vTex = aTexCoord; }\n";
#include "gl_shaders/ffmpeg.glsl.vert.h"
static const char *fragment_source =
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"varying vec2 vTex;\n"
"uniform sampler2D sTex0;\n"
"uniform sampler2D sTex1;\n"
"uniform float uMix;\n"
#if defined(HAVE_OPENGLES)
"void main() { gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).bgr, vec3(2.2)), pow(texture2D(sTex1, vTex).bgr, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0); }\n";
// Get format as GL_RGBA/GL_UNSIGNED_BYTE. Assume little endian, so we get ARGB -> BGRA byte order, and we have to swizzle to .BGR.
/* OpenGL ES note about main() - Get format as GL_RGBA/GL_UNSIGNED_BYTE.
* Assume little endian, so we get ARGB -> BGRA byte order, and
* we have to swizzle to .BGR. */
#ifdef HAVE_OPENGLES
#include "gl_shaders/ffmpeg_es.glsl.frag.h"
#else
"void main() { gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).rgb, vec3(2.2)), pow(texture2D(sTex1, vTex).rgb, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0); }\n";
#include "gl_shaders/ffmpeg.glsl.frag.h"
#endif
static void context_reset(void)
{
static const GLfloat vertex_data[] = {
-1, -1, 0, 0,
1, -1, 1, 0,

View File

@ -90,13 +90,13 @@ typedef struct GLFFT
unsigned depth;
} glfft_t;
#include "gl_shaders/fft_heightmap.glsl.vert.h"
#include "gl_shaders/fft_heightmap.glsl.frag.h"
#include "gl_shaders/fft_vertex_program.glsl.vert.h"
#include "gl_shaders/fft_fragment_program_resolve.glsl.frag.h"
#include "gl_shaders/fft_fragment_program_real.glsl.frag.h"
#include "gl_shaders/fft_fragment_program_complex.glsl.frag.h"
#include "gl_shaders/fft_fragment_program_blur.glsl.frag.h"
#include "../gl_shaders/fft_heightmap.glsl.vert.h"
#include "../gl_shaders/fft_heightmap.glsl.frag.h"
#include "../gl_shaders/fft_vertex_program.glsl.vert.h"
#include "../gl_shaders/fft_fragment_program_resolve.glsl.frag.h"
#include "../gl_shaders/fft_fragment_program_real.glsl.frag.h"
#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)
{

View File

@ -0,0 +1,13 @@
#include "shaders_common.h"
static const char *fragment_source = GLSL(
varying vec2 vTex;
uniform sampler2D sTex0;
uniform sampler2D sTex1;
uniform float uMix;
void main() {
gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).rgb, vec3(2.2)), pow(texture2D(sTex1, vTex).rgb, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0);
}
);

View File

@ -0,0 +1,12 @@
#include "shaders_common.h"
static const char *vertex_source = GLSL(
attribute vec2 aVertex;
attribute vec2 aTexCoord;
varying vec2 vTex;
void main() {
gl_Position = vec4(aVertex, 0.0, 1.0); vTex = aTexCoord;
}
);

View File

@ -0,0 +1,13 @@
#include "shaders_common.h"
static const char *fragment_source = GLSL(
varying vec2 vTex;
uniform sampler2D sTex0;
uniform sampler2D sTex1;
uniform float uMix;
void main() {
gl_FragColor = vec4(pow(mix(pow(texture2D(sTex0, vTex).bgr, vec3(2.2)), pow(texture2D(sTex1, vTex).bgr, vec3(2.2)), uMix), vec3(1.0 / 2.2)), 1.0);
}
);