renderer: Add u_tex1 to shaders
parent
49c584f80d
commit
13216fa507
|
@ -50,7 +50,8 @@ struct renderer {
|
|||
|
||||
struct {
|
||||
GLuint program;
|
||||
GLint u_tex;
|
||||
GLint u_tex0;
|
||||
GLint u_tex1;
|
||||
GLint u_proj;
|
||||
} shader;
|
||||
};
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
precision mediump float;
|
||||
|
||||
uniform samplerExternalOES u_tex;
|
||||
uniform samplerExternalOES u_tex0;
|
||||
|
||||
varying vec2 v_texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(u_tex, v_texture);
|
||||
gl_FragColor = texture2D(u_tex0, v_texture);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
precision mediump float;
|
||||
|
||||
uniform sampler2D u_tex;
|
||||
uniform sampler2D u_tex0;
|
||||
|
||||
varying vec2 v_texture;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_FragColor = texture2D(u_tex, v_texture);
|
||||
gl_FragColor = texture2D(u_tex0, v_texture);
|
||||
}
|
||||
|
|
14
src/render.c
14
src/render.c
|
@ -332,7 +332,7 @@ GLuint renderer_next_tex(struct renderer* self)
|
|||
GLuint renderer_last_tex(const struct renderer* self)
|
||||
{
|
||||
size_t len = ARRAY_LEN(self->tex);
|
||||
size_t index = (len + self->tex_index - 1) % len;
|
||||
size_t index = (len + self->tex_index - 2) % len;
|
||||
return self->tex[index];
|
||||
}
|
||||
|
||||
|
@ -346,7 +346,8 @@ void render(struct renderer* self)
|
|||
{
|
||||
glUseProgram(self->shader.program);
|
||||
|
||||
glUniform1i(self->shader.u_tex, 0);
|
||||
glUniform1i(self->shader.u_tex0, 0);
|
||||
glUniform1i(self->shader.u_tex1, 1);
|
||||
|
||||
const float* proj = transforms[self->output->transform];
|
||||
glUniformMatrix2fv(self->shader.u_proj, 1, GL_FALSE, proj);
|
||||
|
@ -505,7 +506,8 @@ int renderer_init(struct renderer* self, const struct output* output,
|
|||
break;
|
||||
}
|
||||
|
||||
self->shader.u_tex = glGetUniformLocation(self->shader.program, "u_tex");
|
||||
self->shader.u_tex0 = glGetUniformLocation(self->shader.program, "u_tex0");
|
||||
self->shader.u_tex1 = glGetUniformLocation(self->shader.program, "u_tex1");
|
||||
self->shader.u_proj = glGetUniformLocation(self->shader.program, "u_proj");
|
||||
|
||||
self->output = output;
|
||||
|
@ -583,6 +585,9 @@ int renderer_import_dmabuf_frame(struct renderer* self, GLuint tex,
|
|||
glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, image);
|
||||
eglDestroyImageKHR(self->display, image);
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, renderer_last_tex(self));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -604,6 +609,9 @@ int renderer_import_framebuffer(struct renderer* self, GLuint tex,
|
|||
glGenerateMipmap(GL_TEXTURE_2D);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, renderer_last_tex(self));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue