aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-25 23:24:58 +0100
committeremersion <contact@emersion.fr>2018-04-25 23:24:58 +0100
commit71ca45e2c0cbecf8fb24f0cab019646d92cce14b (patch)
tree001f93657d3de3d7baafa280dc7eb13abc9dd3a9 /render
parentf9f75a13623726ec56810eb89b60ca43462e1ca2 (diff)
Make sure we don't use others' prefixes
Diffstat (limited to 'render')
-rw-r--r--render/gles2/pixel_format.c7
-rw-r--r--render/gles2/renderer.c60
-rw-r--r--render/gles2/texture.c28
3 files changed, 48 insertions, 47 deletions
diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c
index 89ba762f..6f42e72e 100644
--- a/render/gles2/pixel_format.c
+++ b/render/gles2/pixel_format.c
@@ -6,7 +6,7 @@
* The wayland formats are little endian while the GL formats are big endian,
* so WL_SHM_FORMAT_ARGB8888 is actually compatible with GL_BGRA_EXT.
*/
-static const struct gles2_pixel_format formats[] = {
+static const struct wlr_gles2_pixel_format formats[] = {
{
.wl_format = WL_SHM_FORMAT_ARGB8888,
.depth = 32,
@@ -50,7 +50,8 @@ static const enum wl_shm_format wl_formats[] = {
// TODO: more pixel formats
-const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) {
+const struct wlr_gles2_pixel_format *get_gles2_format_from_wl(
+ enum wl_shm_format fmt) {
for (size_t i = 0; i < sizeof(formats) / sizeof(*formats); ++i) {
if (formats[i].wl_format == fmt) {
return &formats[i];
@@ -59,7 +60,7 @@ const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) {
return NULL;
}
-const enum wl_shm_format *gles2_formats(size_t *len) {
+const enum wl_shm_format *get_gles2_formats(size_t *len) {
*len = sizeof(wl_formats) / sizeof(wl_formats[0]);
return wl_formats;
}
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 97401010..c10493c4 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -34,7 +34,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glViewport(0, 0, width, height);
renderer->viewport_width = width;
@@ -47,7 +47,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
// XXX: maybe we should save output projection and remove some of the need
// for users to sling matricies themselves
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void gles2_end(struct wlr_renderer *wlr_renderer) {
@@ -59,10 +59,10 @@ static void gles2_clear(struct wlr_renderer *wlr_renderer,
const float color[static 4]) {
gles2_get_renderer_in_context(wlr_renderer);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glClearColor(color[0], color[1], color[2], color[3]);
glClear(GL_COLOR_BUFFER_BIT);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void gles2_scissor(struct wlr_renderer *wlr_renderer,
@@ -70,7 +70,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
if (box != NULL) {
struct wlr_box gl_box;
wlr_box_transform(box, WL_OUTPUT_TRANSFORM_FLIPPED_180,
@@ -81,7 +81,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer,
} else {
glDisable(GL_SCISSOR_TEST);
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void draw_quad() {
@@ -116,7 +116,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
struct wlr_gles2_texture *texture =
- gles2_get_texture_in_context(wlr_texture);
+ get_gles2_texture_in_context(wlr_texture);
GLuint prog = 0;
GLenum target = 0;
@@ -139,7 +139,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
float transposition[9];
wlr_matrix_transpose(transposition, matrix);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
GLuint tex_id = texture->type == WLR_GLES2_TEXTURE_GLTEX ?
texture->gl_tex : texture->image_tex;
@@ -157,7 +157,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
draw_quad();
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return true;
}
@@ -172,12 +172,12 @@ static void gles2_render_quad_with_matrix(struct wlr_renderer *wlr_renderer,
float transposition[9];
wlr_matrix_transpose(transposition, matrix);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glUseProgram(renderer->shaders.quad);
glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
glUniform4f(1, color[0], color[1], color[2], color[3]);
draw_quad();
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer,
@@ -190,17 +190,17 @@ static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer,
float transposition[9];
wlr_matrix_transpose(transposition, matrix);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glUseProgram(renderer->shaders.ellipse);
glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
glUniform4f(1, color[0], color[1], color[2], color[3]);
draw_quad();
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static const enum wl_shm_format *gles2_renderer_formats(
struct wlr_renderer *wlr_renderer, size_t *len) {
- return gles2_formats(len);
+ return get_gles2_formats(len);
}
static bool gles2_resource_is_wl_drm_buffer(struct wlr_renderer *wlr_renderer,
@@ -254,13 +254,13 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
uint32_t dst_y, void *data) {
gles2_get_renderer_in_context(wlr_renderer);
- const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
+ const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Cannot read pixels: unsupported pixel format");
return false;
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
// Make sure any pending drawing is finished before we try to read it
glFinish();
@@ -273,14 +273,14 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
fmt->gl_type, p + i * stride + dst_x * fmt->bpp / 8);
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return true;
}
static bool gles2_format_supported(struct wlr_renderer *wlr_renderer,
enum wl_shm_format wl_fmt) {
- return gles2_format_from_wl(wl_fmt) != NULL;
+ return get_gles2_format_from_wl(wl_fmt) != NULL;
}
static struct wlr_texture *gles2_texture_from_pixels(
@@ -309,13 +309,13 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glDeleteProgram(renderer->shaders.quad);
glDeleteProgram(renderer->shaders.ellipse);
glDeleteProgram(renderer->shaders.tex_rgba);
glDeleteProgram(renderer->shaders.tex_rgbx);
glDeleteProgram(renderer->shaders.tex_ext);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
if (glDebugMessageCallbackKHR) {
glDisable(GL_DEBUG_OUTPUT_KHR);
@@ -347,7 +347,7 @@ static const struct wlr_renderer_impl renderer_impl = {
.texture_from_dmabuf = gles2_texture_from_dmabuf,
};
-void gles2_push_marker(const char *file, const char *func) {
+void push_gles2_marker(const char *file, const char *func) {
if (!glPushDebugGroupKHR) {
return;
}
@@ -358,7 +358,7 @@ void gles2_push_marker(const char *file, const char *func) {
glPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, 1, -1, str);
}
-void gles2_pop_marker(void) {
+void pop_gles2_marker(void) {
if (glPopDebugGroupKHR) {
glPopDebugGroupKHR();
}
@@ -385,7 +385,7 @@ static void gles2_log(GLenum src, GLenum type, GLuint id, GLenum severity,
}
static GLuint compile_shader(GLuint type, const GLchar *src) {
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
GLuint shader = glCreateShader(type);
glShaderSource(shader, 1, &src, NULL);
@@ -398,12 +398,12 @@ static GLuint compile_shader(GLuint type, const GLchar *src) {
shader = 0;
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return shader;
}
static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) {
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
GLuint vert = compile_shader(GL_VERTEX_SHADER, vert_src);
if (!vert) {
@@ -433,11 +433,11 @@ static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) {
goto error;
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return prog;
error:
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return 0;
}
@@ -481,7 +481,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
GL_DONT_CARE, 0, NULL, GL_FALSE);
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
renderer->shaders.quad = link_program(quad_vertex_src, quad_fragment_src);
if (!renderer->shaders.quad) {
@@ -510,7 +510,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
}
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &renderer->wlr_renderer;
@@ -521,7 +521,7 @@ error:
glDeleteProgram(renderer->shaders.tex_rgbx);
glDeleteProgram(renderer->shaders.tex_ext);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
if (glDebugMessageCallbackKHR) {
glDisable(GL_DEBUG_OUTPUT_KHR);
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 45425fbf..37424802 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -22,7 +22,7 @@ static struct wlr_gles2_texture *gles2_get_texture(
return (struct wlr_gles2_texture *)wlr_texture;
}
-struct wlr_gles2_texture *gles2_get_texture_in_context(
+struct wlr_gles2_texture *get_gles2_texture_in_context(
struct wlr_texture *wlr_texture) {
struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
assert(wlr_egl_is_current(texture->egl));
@@ -41,21 +41,21 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x,
uint32_t dst_y, const void *data) {
struct wlr_gles2_texture *texture =
- gles2_get_texture_in_context(wlr_texture);
+ get_gles2_texture_in_context(wlr_texture);
if (texture->type != WLR_GLES2_TEXTURE_GLTEX) {
wlr_log(L_ERROR, "Cannot write pixels to immutable texture");
return false;
}
- const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
+ const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
return false;
}
// TODO: what if the unpack subimage extension isn't supported?
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
@@ -70,7 +70,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return true;
}
@@ -83,7 +83,7 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) {
wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
if (texture->image_tex) {
glDeleteTextures(1, &texture->image_tex);
@@ -94,7 +94,7 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) {
glDeleteTextures(1, &texture->gl_tex);
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
free(texture);
}
@@ -110,7 +110,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
uint32_t height, const void *data) {
assert(wlr_egl_is_current(egl));
- const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
+ const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
return NULL;
@@ -129,7 +129,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
texture->type = WLR_GLES2_TEXTURE_GLTEX;
texture->has_alpha = fmt->has_alpha;
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glGenTextures(1, &texture->gl_tex);
glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
@@ -139,7 +139,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
fmt->gl_format, fmt->gl_type, data);
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &texture->wlr_texture;
}
@@ -188,13 +188,13 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
return NULL;
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glGenTextures(1, &texture->image_tex);
glBindTexture(target, texture->image_tex);
glEGLImageTargetTexture2DOES(target, texture->image);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &texture->wlr_texture;
}
@@ -233,12 +233,12 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
return NULL;
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glGenTextures(1, &texture->image_tex);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->image_tex);
glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, texture->image);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &texture->wlr_texture;
}