summaryrefslogtreecommitdiff
path: root/ui/console-gl.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-10-10 15:54:49 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-10-17 10:25:42 +0200
commit46e19e149f3b129a22c440caba853188df67deab (patch)
tree4c3b53e551e8f69b3762f5961551594ca72ee9d7 /ui/console-gl.c
parent4133fa711f37f0db303bf5aac03ea31b5be6ac1d (diff)
downloadqemu-46e19e149f3b129a22c440caba853188df67deab.tar.gz
opengl: move shader init from console-gl.c to shader.c
With the upcoming dmabuf support in qemu there will be more users of the shaders than just console-gl.c. So rename ConsoleGLState to QemuGLShader, rename some functions too, move code from console-gl.c to shaders.c. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20171010135453.6704-3-kraxel@redhat.com
Diffstat (limited to 'ui/console-gl.c')
-rw-r--r--ui/console-gl.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/ui/console-gl.c b/ui/console-gl.c
index 5165e21646..9b50daedbd 100644
--- a/ui/console-gl.c
+++ b/ui/console-gl.c
@@ -29,40 +29,8 @@
#include "ui/console.h"
#include "ui/shader.h"
-#include "shader/texture-blit-vert.h"
-#include "shader/texture-blit-frag.h"
-
-struct ConsoleGLState {
- GLint texture_blit_prog;
- GLint texture_blit_vao;
-};
-
/* ---------------------------------------------------------------------- */
-ConsoleGLState *console_gl_init_context(void)
-{
- ConsoleGLState *gls = g_new0(ConsoleGLState, 1);
-
- gls->texture_blit_prog = qemu_gl_create_compile_link_program
- (texture_blit_vert_src, texture_blit_frag_src);
- if (!gls->texture_blit_prog) {
- exit(1);
- }
-
- gls->texture_blit_vao =
- qemu_gl_init_texture_blit(gls->texture_blit_prog);
-
- return gls;
-}
-
-void console_gl_fini_context(ConsoleGLState *gls)
-{
- if (!gls) {
- return;
- }
- g_free(gls);
-}
-
bool console_gl_check_format(DisplayChangeListener *dcl,
pixman_format_code_t format)
{
@@ -76,7 +44,7 @@ bool console_gl_check_format(DisplayChangeListener *dcl,
}
}
-void surface_gl_create_texture(ConsoleGLState *gls,
+void surface_gl_create_texture(QemuGLShader *gls,
DisplaySurface *surface)
{
assert(gls);
@@ -116,7 +84,7 @@ void surface_gl_create_texture(ConsoleGLState *gls,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
-void surface_gl_update_texture(ConsoleGLState *gls,
+void surface_gl_update_texture(QemuGLShader *gls,
DisplaySurface *surface,
int x, int y, int w, int h)
{
@@ -133,7 +101,7 @@ void surface_gl_update_texture(ConsoleGLState *gls,
+ surface_bytes_per_pixel(surface) * x);
}
-void surface_gl_render_texture(ConsoleGLState *gls,
+void surface_gl_render_texture(QemuGLShader *gls,
DisplaySurface *surface)
{
assert(gls);
@@ -141,11 +109,10 @@ void surface_gl_render_texture(ConsoleGLState *gls,
glClearColor(0.1f, 0.1f, 0.1f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
- qemu_gl_run_texture_blit(gls->texture_blit_prog,
- gls->texture_blit_vao);
+ qemu_gl_run_texture_blit(gls);
}
-void surface_gl_destroy_texture(ConsoleGLState *gls,
+void surface_gl_destroy_texture(QemuGLShader *gls,
DisplaySurface *surface)
{
if (!surface || !surface->texture) {
@@ -155,7 +122,7 @@ void surface_gl_destroy_texture(ConsoleGLState *gls,
surface->texture = 0;
}
-void surface_gl_setup_viewport(ConsoleGLState *gls,
+void surface_gl_setup_viewport(QemuGLShader *gls,
DisplaySurface *surface,
int ww, int wh)
{