Commit cd2bc889 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

console-gl: add opengl rendering helper functions

parent 985e1c9b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -455,6 +455,9 @@ ui/shader/%-frag.h: $(SRC_PATH)/ui/shader/%.frag $(SRC_PATH)/scripts/shaderinclu
		perl $(SRC_PATH)/scripts/shaderinclude.pl $< > $@,\
		"  FRAG  $@")

ui/console-gl.o: $(SRC_PATH)/ui/console-gl.c \
	ui/shader/texture-blit-vert.h ui/shader/texture-blit-frag.h

# documentation
MAKEINFO=makeinfo
MAKEINFOFLAGS=--no-headers --no-split --number-sections
+1 −1
Original line number Diff line number Diff line
@@ -3142,7 +3142,7 @@ else
fi

if test "$opengl" != "no" ; then
  opengl_pkgs="gl"
  opengl_pkgs="gl glesv2"
  if $pkg_config $opengl_pkgs x11 && test "$have_glx" = "yes"; then
    opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags"
    opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs"
+31 −0
Original line number Diff line number Diff line
@@ -9,6 +9,11 @@
#include "qapi-types.h"
#include "qapi/error.h"

#ifdef CONFIG_OPENGL
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
#endif

/* keyboard/mouse support */

#define MOUSE_EVENT_LBUTTON 0x01
@@ -117,6 +122,11 @@ struct DisplaySurface {
    pixman_format_code_t format;
    pixman_image_t *image;
    uint8_t flags;
#ifdef CONFIG_OPENGL
    GLenum glformat;
    GLenum gltype;
    GLuint texture;
#endif
};

typedef struct QemuUIInfo {
@@ -322,6 +332,27 @@ void qemu_console_copy(QemuConsole *con, int src_x, int src_y,
                       int dst_x, int dst_y, int w, int h);
DisplaySurface *qemu_console_surface(QemuConsole *con);

/* console-gl.c */
typedef struct ConsoleGLState ConsoleGLState;
#ifdef CONFIG_OPENGL
ConsoleGLState *console_gl_init_context(void);
void console_gl_fini_context(ConsoleGLState *gls);
bool console_gl_check_format(DisplayChangeListener *dcl,
                             pixman_format_code_t format);
void surface_gl_create_texture(ConsoleGLState *gls,
                               DisplaySurface *surface);
void surface_gl_update_texture(ConsoleGLState *gls,
                               DisplaySurface *surface,
                               int x, int y, int w, int h);
void surface_gl_render_texture(ConsoleGLState *gls,
                               DisplaySurface *surface);
void surface_gl_destroy_texture(ConsoleGLState *gls,
                               DisplaySurface *surface);
void surface_gl_setup_viewport(ConsoleGLState *gls,
                               DisplaySurface *surface,
                               int ww, int wh);
#endif

/* sdl.c */
void sdl_display_init(DisplayState *ds, int full_screen, int no_frame);

+2 −0
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
# include <GLES2/gl2ext.h>
#endif

void qemu_gl_run_texture_blit(GLint texture_blit_prog);

GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src);
GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag);
GLuint qemu_gl_create_compile_link_program(const GLchar *vert_src,
+3 −0
Original line number Diff line number Diff line
@@ -26,9 +26,12 @@ sdl.mo-cflags := $(SDL_CFLAGS)

ifeq ($(CONFIG_OPENGL),y)
common-obj-y += shader.o
common-obj-y += console-gl.o
endif

gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
shader.o-cflags += $(OPENGL_CFLAGS)
console-gl.o-cflags += $(OPENGL_CFLAGS)

shader.o-libs += $(OPENGL_LIBS)
console-gl.o-libs += $(OPENGL_LIBS)
Loading