render: Move logging and struct to headers
parent
f4e9169b66
commit
a52ff52fcf
|
@ -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__)
|
|
@ -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 */
|
||||
|
|
19
src/render.c
19
src/render.c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue