mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 21:46:25 +00:00
ui/surface: Avoid including epoxy/gl.h in header files
include/ui/shader.h and include/ui/surface.h are included by files that do not depend on Epoxy so they shouldn't include epoxy/gl.h. Otherwise, compilations of these files can fail because the path to the directory containing epoxy/gl.h may not be passed to the compiler. Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20260303-gl-v1-3-d90f0a237a52@rsg.ci.i.u-tokyo.ac.jp>
This commit is contained in:
committed by
Marc-André Lureau
parent
633c529416
commit
cc47123440
@@ -423,8 +423,8 @@ bool console_gl_check_format(DisplayChangeListener *dcl,
|
||||
void surface_gl_create_texture(QemuGLShader *gls,
|
||||
DisplaySurface *surface);
|
||||
bool surface_gl_create_texture_from_fd(DisplaySurface *surface,
|
||||
int fd, GLuint *texture,
|
||||
GLuint *mem_obj);
|
||||
int fd, uint32_t *texture,
|
||||
uint32_t *mem_obj);
|
||||
void surface_gl_update_texture(QemuGLShader *gls,
|
||||
DisplaySurface *surface,
|
||||
int x, int y, int w, int h);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef QEMU_SHADER_H
|
||||
#define QEMU_SHADER_H
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
typedef struct QemuGLShader QemuGLShader;
|
||||
|
||||
void qemu_gl_run_texture_blit(QemuGLShader *gls, bool flip);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "ui/qemu-pixman.h"
|
||||
|
||||
#ifdef CONFIG_OPENGL
|
||||
# include <epoxy/gl.h>
|
||||
# include "ui/shader.h"
|
||||
#endif
|
||||
|
||||
@@ -19,9 +18,7 @@ typedef struct DisplaySurface {
|
||||
pixman_image_t *image;
|
||||
uint8_t flags;
|
||||
#ifdef CONFIG_OPENGL
|
||||
GLenum glformat;
|
||||
GLenum gltype;
|
||||
GLuint texture;
|
||||
uint32_t texture;
|
||||
#endif
|
||||
qemu_pixman_shareable share_handle;
|
||||
uint32_t share_handle_offset;
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include <epoxy/gl.h>
|
||||
#include "qemu/error-report.h"
|
||||
#include "ui/console.h"
|
||||
#include "ui/shader.h"
|
||||
@@ -66,6 +67,9 @@ bool console_gl_check_format(DisplayChangeListener *dcl,
|
||||
void surface_gl_create_texture(QemuGLShader *gls,
|
||||
DisplaySurface *surface)
|
||||
{
|
||||
GLenum glformat;
|
||||
GLenum gltype;
|
||||
|
||||
assert(gls);
|
||||
assert(QEMU_IS_ALIGNED(surface_stride(surface), surface_bytes_per_pixel(surface)));
|
||||
|
||||
@@ -73,7 +77,7 @@ void surface_gl_create_texture(QemuGLShader *gls,
|
||||
return;
|
||||
}
|
||||
|
||||
assert(map_format(surface_format(surface), &surface->glformat, &surface->gltype));
|
||||
assert(map_format(surface_format(surface), &glformat, &gltype));
|
||||
glGenTextures(1, &surface->texture);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBindTexture(GL_TEXTURE_2D, surface->texture);
|
||||
@@ -81,16 +85,12 @@ void surface_gl_create_texture(QemuGLShader *gls,
|
||||
surface_stride(surface) / surface_bytes_per_pixel(surface));
|
||||
if (epoxy_is_desktop_gl()) {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
|
||||
surface_width(surface),
|
||||
surface_height(surface),
|
||||
0, surface->glformat, surface->gltype,
|
||||
surface_data(surface));
|
||||
surface_width(surface), surface_height(surface), 0,
|
||||
glformat, gltype, surface_data(surface));
|
||||
} else {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, surface->glformat,
|
||||
surface_width(surface),
|
||||
surface_height(surface),
|
||||
0, surface->glformat, surface->gltype,
|
||||
surface_data(surface));
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, glformat,
|
||||
surface_width(surface), surface_height(surface), 0,
|
||||
glformat, gltype, surface_data(surface));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE);
|
||||
}
|
||||
|
||||
@@ -150,17 +150,18 @@ void surface_gl_update_texture(QemuGLShader *gls,
|
||||
int x, int y, int w, int h)
|
||||
{
|
||||
uint8_t *data = (void *)surface_data(surface);
|
||||
GLenum glformat;
|
||||
GLenum gltype;
|
||||
|
||||
assert(gls);
|
||||
assert(map_format(surface_format(surface), &glformat, &gltype));
|
||||
|
||||
if (surface->texture) {
|
||||
glBindTexture(GL_TEXTURE_2D, surface->texture);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT,
|
||||
surface_stride(surface)
|
||||
/ surface_bytes_per_pixel(surface));
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0,
|
||||
x, y, w, h,
|
||||
surface->glformat, surface->gltype,
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, w, h, glformat, gltype,
|
||||
data + surface_stride(surface) * y
|
||||
+ surface_bytes_per_pixel(surface) * x);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "qemu/osdep.h"
|
||||
#include <epoxy/gl.h>
|
||||
#include "ui/shader.h"
|
||||
|
||||
#include "ui/shader/texture-blit-vert.h"
|
||||
|
||||
Reference in New Issue
Block a user