render: Move logging and struct to headers

shader-damage
Andri Yngvason 2019-10-06 18:50:47 +00:00
parent f4e9169b66
commit a52ff52fcf
3 changed files with 27 additions and 17 deletions

11
include/logging.h 100644
View File

@ -0,0 +1,11 @@
#pragma once
#include <stdio.h>
#ifdef NDEBUG
#define log_debug(...)
#else
#define log_debug(...) fprintf(stderr, "DEBUG: " __VA_ARGS__)
#endif
#define log_error(...) fprintf(stderr, "ERROR: " __VA_ARGS__)

View File

@ -1,7 +1,21 @@
#pragma once
#include <GLES2/gl2.h>
#include <EGL/egl.h>
struct dmabuf_frame;
struct renderer {
EGLDisplay display;
EGLSurface surface;
EGLContext context;
GLuint shader_program;
uint32_t width;
uint32_t height;
GLint read_format;
GLint read_type;
};
int render_dmabuf_frame(struct renderer* self, struct dmabuf_frame* frame);
/* Copy a horizontal stripe from the GL frame into a pixel buffer */

View File

@ -10,16 +10,12 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include "logging.h"
#include "render.h"
#include "dmabuf.h"
#define MAYBE_UNUSED __attribute__((unused))
#ifdef NDEBUG
#define log_debug(...)
#else
#define log_debug(...) fprintf(stderr, __VA_ARGS__)
#endif
#define XSTR(s) STR(s)
#define STR(s) #s
@ -41,17 +37,6 @@
X_GL_EXTENSIONS
#undef X
struct renderer {
EGLDisplay display;
EGLSurface surface;
EGLContext context;
GLuint shader_program;
uint32_t width;
uint32_t height;
GLint read_format;
GLint read_type;
};
static inline void* gl_load_single_extension(const char* name)
{
void* ext = eglGetProcAddress(name);