From 266ad279986b79616aefbbd81b241cbb085c6b7e Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 8 Aug 2021 17:16:10 +1000 Subject: [PATCH] [client] egl: refactor to use project naming standard --- client/renderers/EGL/cursor.c | 68 +++++++++++----------- client/renderers/EGL/cursor.h | 14 ++--- client/renderers/EGL/damage.c | 22 +++---- client/renderers/EGL/damage.h | 12 ++-- client/renderers/EGL/desktop.c | 52 ++++++++--------- client/renderers/EGL/desktop.h | 12 ++-- client/renderers/EGL/draw.c | 12 ++-- client/renderers/EGL/draw.h | 7 ++- client/renderers/EGL/egl.c | 48 +++++++-------- client/renderers/EGL/model.c | 22 +++---- client/renderers/EGL/model.h | 14 ++--- client/renderers/EGL/shader.c | 17 +++--- client/renderers/EGL/shader.h | 19 +++--- client/renderers/EGL/splash.c | 58 +++++++++--------- client/renderers/EGL/splash.h | 6 +- client/renderers/EGL/texture.c | 14 ++--- client/renderers/EGL/texture.h | 16 +++-- client/renderers/EGL/texture_buffer.c | 62 ++++++++++---------- client/renderers/EGL/texture_buffer.h | 18 +++--- client/renderers/EGL/texture_dmabuf.c | 36 ++++++------ client/renderers/EGL/texture_framebuffer.c | 22 +++---- client/renderers/EGL/texture_util.c | 14 ++--- client/renderers/EGL/texture_util.h | 10 ++-- 23 files changed, 292 insertions(+), 283 deletions(-) diff --git a/client/renderers/EGL/cursor.c b/client/renderers/EGL/cursor.c index 4d2b608e..d4c8f366 100644 --- a/client/renderers/EGL/cursor.c +++ b/client/renderers/EGL/cursor.c @@ -84,28 +84,28 @@ static bool egl_cursor_tex_init(struct CursorTex * t, const char * vertex_code , size_t vertex_size, const char * fragment_code, size_t fragment_size) { - if (!egl_texture_init(&t->texture, NULL, EGL_TEXTYPE_BUFFER, false)) + if (!egl_textureInit(&t->texture, NULL, EGL_TEXTYPE_BUFFER, false)) { DEBUG_ERROR("Failed to initialize the cursor texture"); return false; } - if (!egl_shader_init(&t->shader)) + if (!egl_shaderInit(&t->shader)) { DEBUG_ERROR("Failed to initialize the cursor shader"); return false; } - if (!egl_shader_compile(t->shader, + if (!egl_shaderCompile(t->shader, vertex_code, vertex_size, fragment_code, fragment_size)) { DEBUG_ERROR("Failed to compile the cursor shader"); return false; } - t->uMousePos = egl_shader_get_uniform_location(t->shader, "mouse" ); - t->uRotate = egl_shader_get_uniform_location(t->shader, "rotate"); - t->uCBMode = egl_shader_get_uniform_location(t->shader, "cbMode"); + t->uMousePos = egl_shaderGetUniform(t->shader, "mouse" ); + t->uRotate = egl_shaderGetUniform(t->shader, "rotate"); + t->uCBMode = egl_shaderGetUniform(t->shader, "cbMode"); return true; } @@ -130,10 +130,10 @@ static inline void egl_cursor_tex_uniforms(EGL_Cursor * cursor, struct CursorTex static void egl_cursor_tex_free(struct CursorTex * t) { egl_texture_free(&t->texture); - egl_shader_free (&t->shader ); + egl_shaderFree (&t->shader ); }; -bool egl_cursor_init(EGL_Cursor ** cursor) +bool egl_cursorInit(EGL_Cursor ** cursor) { *cursor = (EGL_Cursor *)malloc(sizeof(EGL_Cursor)); if (!*cursor) @@ -155,13 +155,13 @@ bool egl_cursor_init(EGL_Cursor ** cursor) b_shader_cursor_mono_frag, b_shader_cursor_mono_frag_size)) return false; - if (!egl_model_init(&(*cursor)->model)) + if (!egl_modelInit(&(*cursor)->model)) { DEBUG_ERROR("Failed to initialize the cursor model"); return false; } - egl_model_set_default((*cursor)->model); + egl_modelSetDefault((*cursor)->model); (*cursor)->cbMode = option_get_int("egl", "cbMode"); @@ -173,7 +173,7 @@ bool egl_cursor_init(EGL_Cursor ** cursor) return true; } -void egl_cursor_free(EGL_Cursor ** cursor) +void egl_cursorFree(EGL_Cursor ** cursor) { if (!*cursor) return; @@ -184,13 +184,13 @@ void egl_cursor_free(EGL_Cursor ** cursor) egl_cursor_tex_free(&(*cursor)->norm); egl_cursor_tex_free(&(*cursor)->mono); - egl_model_free(&(*cursor)->model); + egl_modelFree(&(*cursor)->model); free(*cursor); *cursor = NULL; } -bool egl_cursor_set_shape(EGL_Cursor * cursor, const LG_RendererCursor type, +bool egl_cursorSetShape(EGL_Cursor * cursor, const LG_RendererCursor type, const int width, const int height, const int stride, const uint8_t * data) { LG_LOCK(cursor->lock); @@ -223,21 +223,21 @@ bool egl_cursor_set_shape(EGL_Cursor * cursor, const LG_RendererCursor type, return true; } -void egl_cursor_set_size(EGL_Cursor * cursor, const float w, const float h) +void egl_cursorSetSize(EGL_Cursor * cursor, const float w, const float h) { struct CursorSize size = { .w = w, .h = h }; atomic_store(&cursor->size, size); } -void egl_cursor_set_state(EGL_Cursor * cursor, const bool visible, const float x, const float y) +void egl_cursorSetState(EGL_Cursor * cursor, const bool visible, const float x, const float y) { cursor->visible = visible; struct CursorPos pos = { .x = x, .y = y}; atomic_store(&cursor->pos, pos); } -struct CursorState egl_cursor_render(EGL_Cursor * cursor, LG_RendererRotate rotate, - int width, int height) +struct CursorState egl_cursorRender(EGL_Cursor * cursor, + LG_RendererRotate rotate, int width, int height) { if (!cursor->visible) return (struct CursorState) { .visible = false }; @@ -256,9 +256,9 @@ struct CursorState egl_cursor_render(EGL_Cursor * cursor, LG_RendererRotate rota case LG_CURSOR_COLOR: { - egl_texture_setup(cursor->norm.texture, EGL_PF_BGRA, cursor->width, cursor->height, cursor->stride); - egl_texture_update(cursor->norm.texture, data); - egl_model_set_texture(cursor->model, cursor->norm.texture); + egl_textureSetup(cursor->norm.texture, EGL_PF_BGRA, cursor->width, cursor->height, cursor->stride); + egl_textureUpdate(cursor->norm.texture, data); + egl_modelSetTexture(cursor->model, cursor->norm.texture); break; } @@ -280,10 +280,10 @@ struct CursorState egl_cursor_render(EGL_Cursor * cursor, LG_RendererRotate rota xor[y * cursor->width + x] = xorMask; } - egl_texture_setup (cursor->norm.texture, EGL_PF_BGRA, cursor->width, cursor->height, cursor->width * 4); - egl_texture_setup (cursor->mono.texture, EGL_PF_BGRA, cursor->width, cursor->height, cursor->width * 4); - egl_texture_update(cursor->norm.texture, (uint8_t *)and); - egl_texture_update(cursor->mono.texture, (uint8_t *)xor); + egl_textureSetup (cursor->norm.texture, EGL_PF_BGRA, cursor->width, cursor->height, cursor->width * 4); + egl_textureSetup (cursor->mono.texture, EGL_PF_BGRA, cursor->width, cursor->height, cursor->width * 4); + egl_textureUpdate(cursor->norm.texture, (uint8_t *)and); + egl_textureUpdate(cursor->mono.texture, (uint8_t *)xor); break; } } @@ -341,35 +341,35 @@ struct CursorState egl_cursor_render(EGL_Cursor * cursor, LG_RendererRotate rota { case LG_CURSOR_MONOCHROME: { - egl_shader_use(cursor->norm.shader); + egl_shaderUse(cursor->norm.shader); egl_cursor_tex_uniforms(cursor, &cursor->norm, true, pos.x, pos.y, size.w, size.h); glBlendFunc(GL_ZERO, GL_SRC_COLOR); - egl_model_set_texture(cursor->model, cursor->norm.texture); - egl_model_render(cursor->model); + egl_modelSetTexture(cursor->model, cursor->norm.texture); + egl_modelRender(cursor->model); - egl_shader_use(cursor->mono.shader); + egl_shaderUse(cursor->mono.shader); egl_cursor_tex_uniforms(cursor, &cursor->mono, true, pos.x, pos.y, size.w, size.h); glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); - egl_model_set_texture(cursor->model, cursor->mono.texture); - egl_model_render(cursor->model); + egl_modelSetTexture(cursor->model, cursor->mono.texture); + egl_modelRender(cursor->model); break; } case LG_CURSOR_COLOR: { - egl_shader_use(cursor->norm.shader); + egl_shaderUse(cursor->norm.shader); egl_cursor_tex_uniforms(cursor, &cursor->norm, false, pos.x, pos.y, size.w, size.h); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - egl_model_render(cursor->model); + egl_modelRender(cursor->model); break; } case LG_CURSOR_MASKED_COLOR: { - egl_shader_use(cursor->mono.shader); + egl_shaderUse(cursor->mono.shader); egl_cursor_tex_uniforms(cursor, &cursor->mono, false, pos.x, pos.y, size.w, size.h); glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); - egl_model_render(cursor->model); + egl_modelRender(cursor->model); break; } } diff --git a/client/renderers/EGL/cursor.h b/client/renderers/EGL/cursor.h index 41833e01..c76ddb9c 100644 --- a/client/renderers/EGL/cursor.h +++ b/client/renderers/EGL/cursor.h @@ -31,10 +31,10 @@ struct CursorState { struct Rect rect; }; -bool egl_cursor_init(EGL_Cursor ** cursor); -void egl_cursor_free(EGL_Cursor ** cursor); +bool egl_cursorInit(EGL_Cursor ** cursor); +void egl_cursorFree(EGL_Cursor ** cursor); -bool egl_cursor_set_shape( +bool egl_cursorSetShape( EGL_Cursor * cursor, const LG_RendererCursor type, const int width, @@ -42,10 +42,10 @@ bool egl_cursor_set_shape( const int stride, const uint8_t * data); -void egl_cursor_set_size(EGL_Cursor * cursor, const float x, const float y); +void egl_cursorSetSize(EGL_Cursor * cursor, const float x, const float y); -void egl_cursor_set_state(EGL_Cursor * cursor, const bool visible, +void egl_cursorSetState(EGL_Cursor * cursor, const bool visible, const float x, const float y); -struct CursorState egl_cursor_render(EGL_Cursor * cursor, LG_RendererRotate rotate, - int width, int height); +struct CursorState egl_cursorRender(EGL_Cursor * cursor, + LG_RendererRotate rotate, int width, int height); diff --git a/client/renderers/EGL/damage.c b/client/renderers/EGL/damage.c index e88f8c07..a5128b94 100644 --- a/client/renderers/EGL/damage.c +++ b/client/renderers/EGL/damage.c @@ -52,12 +52,12 @@ struct EGL_Damage GLint uTransform; }; -void egl_damage_config_ui(EGL_Damage * damage) +void egl_damageConfigUI(EGL_Damage * damage) { igCheckbox("Show damage overlay", &damage->show); } -bool egl_damage_init(EGL_Damage ** damage) +bool egl_damageInit(EGL_Damage ** damage) { *damage = (EGL_Damage *)malloc(sizeof(EGL_Damage)); if (!*damage) @@ -68,13 +68,13 @@ bool egl_damage_init(EGL_Damage ** damage) memset(*damage, 0, sizeof(EGL_Damage)); - if (!egl_shader_init(&(*damage)->shader)) + if (!egl_shaderInit(&(*damage)->shader)) { DEBUG_ERROR("Failed to initialize the damage shader"); return false; } - if (!egl_shader_compile((*damage)->shader, + if (!egl_shaderCompile((*damage)->shader, b_shader_damage_vert, b_shader_damage_vert_size, b_shader_damage_frag, b_shader_damage_frag_size)) { @@ -88,18 +88,18 @@ bool egl_damage_init(EGL_Damage ** damage) return false; } - (*damage)->uTransform = egl_shader_get_uniform_location((*damage)->shader, "transform"); + (*damage)->uTransform = egl_shaderGetUniform((*damage)->shader, "transform"); return true; } -void egl_damage_free(EGL_Damage ** damage) +void egl_damageFree(EGL_Damage ** damage) { if (!*damage) return; egl_desktopRectsFree(&(*damage)->mesh); - egl_shader_free(&(*damage)->shader); + egl_shaderFree(&(*damage)->shader); free(*damage); *damage = NULL; @@ -111,14 +111,14 @@ static void update_matrix(EGL_Damage * damage) damage->translateX, damage->translateY, damage->scaleX, damage->scaleY, damage->rotate); } -void egl_damage_setup(EGL_Damage * damage, int width, int height) +void egl_damageSetup(EGL_Damage * damage, int width, int height) { damage->width = width; damage->height = height; update_matrix(damage); } -void egl_damage_resize(EGL_Damage * damage, float translateX, float translateY, +void egl_damageResize(EGL_Damage * damage, float translateX, float translateY, float scaleX, float scaleY) { damage->translateX = translateX; @@ -128,7 +128,7 @@ void egl_damage_resize(EGL_Damage * damage, float translateX, float translateY, update_matrix(damage); } -bool egl_damage_render(EGL_Damage * damage, LG_RendererRotate rotate, const struct DesktopDamage * data) +bool egl_damageRender(EGL_Damage * damage, LG_RendererRotate rotate, const struct DesktopDamage * data) { if (!damage->show) return false; @@ -142,7 +142,7 @@ bool egl_damage_render(EGL_Damage * damage, LG_RendererRotate rotate, const stru glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - egl_shader_use(damage->shader); + egl_shaderUse(damage->shader); glUniformMatrix3x2fv(damage->uTransform, 1, GL_FALSE, damage->transform); if (data && data->count != 0) diff --git a/client/renderers/EGL/damage.h b/client/renderers/EGL/damage.h index 4d5880d2..eedaa10e 100644 --- a/client/renderers/EGL/damage.h +++ b/client/renderers/EGL/damage.h @@ -33,12 +33,12 @@ struct DesktopDamage typedef struct EGL_Damage EGL_Damage; -bool egl_damage_init(EGL_Damage ** damage); -void egl_damage_free(EGL_Damage ** damage); +bool egl_damageInit(EGL_Damage ** damage); +void egl_damageFree(EGL_Damage ** damage); -void egl_damage_config_ui(EGL_Damage * damage); -void egl_damage_setup(EGL_Damage * damage, int width, int height); -void egl_damage_resize(EGL_Damage * damage, float translateX, float translateY, +void egl_damageConfigUI(EGL_Damage * damage); +void egl_damageSetup(EGL_Damage * damage, int width, int height); +void egl_damageResize(EGL_Damage * damage, float translateX, float translateY, float scaleX, float scaleY); -bool egl_damage_render(EGL_Damage * damage, LG_RendererRotate rotate, +bool egl_damageRender(EGL_Damage * damage, LG_RendererRotate rotate, const struct DesktopDamage * data); diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index 75b01ba6..45504141 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -86,30 +86,30 @@ static bool egl_init_desktop_shader( const char * fragment_code, size_t fragment_size ) { - if (!egl_shader_init(&shader->shader)) + if (!egl_shaderInit(&shader->shader)) return false; - if (!egl_shader_compile(shader->shader, + if (!egl_shaderCompile(shader->shader, vertex_code , vertex_size, fragment_code, fragment_size)) { return false; } - egl_shader_associate_textures(shader->shader, 1); + egl_shaderAssocTextures(shader->shader, 1); - shader->uTransform = egl_shader_get_uniform_location(shader->shader, "transform"); - shader->uUVScale = egl_shader_get_uniform_location(shader->shader, "uvScale" ); - shader->uDesktopSize = egl_shader_get_uniform_location(shader->shader, "size" ); - shader->uScaleAlgo = egl_shader_get_uniform_location(shader->shader, "scaleAlgo"); - shader->uNV = egl_shader_get_uniform_location(shader->shader, "nv" ); - shader->uNVGain = egl_shader_get_uniform_location(shader->shader, "nvGain" ); - shader->uCBMode = egl_shader_get_uniform_location(shader->shader, "cbMode" ); + shader->uTransform = egl_shaderGetUniform(shader->shader, "transform"); + shader->uUVScale = egl_shaderGetUniform(shader->shader, "uvScale" ); + shader->uDesktopSize = egl_shaderGetUniform(shader->shader, "size" ); + shader->uScaleAlgo = egl_shaderGetUniform(shader->shader, "scaleAlgo"); + shader->uNV = egl_shaderGetUniform(shader->shader, "nv" ); + shader->uNVGain = egl_shaderGetUniform(shader->shader, "nvGain" ); + shader->uCBMode = egl_shaderGetUniform(shader->shader, "cbMode" ); return true; } -bool egl_desktop_init(EGL_Desktop ** desktop, EGLDisplay * display, bool useDMA, int maxRects) +bool egl_desktopInit(EGL_Desktop ** desktop, EGLDisplay * display, bool useDMA, int maxRects) { *desktop = (EGL_Desktop *)malloc(sizeof(EGL_Desktop)); if (!*desktop) @@ -121,7 +121,7 @@ bool egl_desktop_init(EGL_Desktop ** desktop, EGLDisplay * display, bool useDMA, memset(*desktop, 0, sizeof(EGL_Desktop)); (*desktop)->display = display; - if (!egl_texture_init(&(*desktop)->texture, display, + if (!egl_textureInit(&(*desktop)->texture, display, useDMA ? EGL_TEXTYPE_DMABUF : EGL_TEXTYPE_FRAMEBUFFER, true)) { DEBUG_ERROR("Failed to initialize the desktop texture"); @@ -167,7 +167,7 @@ void egl_desktop_toggle_nv(int key, void * opaque) app_invalidateWindow(true); } -bool egl_desktop_scale_validate(struct Option * opt, const char ** error) +bool egl_desktopScaleValidate(struct Option * opt, const char ** error) { if (opt->value.x_int >= 0 && opt->value.x_int < EGL_SCALE_MAX) return true; @@ -176,13 +176,13 @@ bool egl_desktop_scale_validate(struct Option * opt, const char ** error) return false; } -void egl_desktop_free(EGL_Desktop ** desktop) +void egl_desktopFree(EGL_Desktop ** desktop) { if (!*desktop) return; egl_texture_free (&(*desktop)->texture ); - egl_shader_free (&(*desktop)->shader_generic.shader); + egl_shaderFree (&(*desktop)->shader_generic.shader); egl_desktopRectsFree(&(*desktop)->mesh ); free(*desktop); @@ -195,7 +195,7 @@ static const char * algorithmNames[EGL_SCALE_MAX] = { [EGL_SCALE_LINEAR] = "Linear", }; -void egl_desktop_config_ui(EGL_Desktop * desktop) +void egl_desktopConfigUI(EGL_Desktop * desktop) { igText("Scale algorithm:"); igPushItemWidth(igGetWindowWidth() - igGetStyle()->WindowPadding.x * 2); @@ -228,7 +228,7 @@ void egl_desktop_config_ui(EGL_Desktop * desktop) igPopItemWidth(); } -bool egl_desktop_setup(EGL_Desktop * desktop, const LG_RendererFormat format) +bool egl_desktopSetup(EGL_Desktop * desktop, const LG_RendererFormat format) { memcpy(&desktop->format, &format, sizeof(LG_RendererFormat)); @@ -263,7 +263,7 @@ bool egl_desktop_setup(EGL_Desktop * desktop, const LG_RendererFormat format) desktop->width = format.width; desktop->height = format.height; - if (!egl_texture_setup( + if (!egl_textureSetup( desktop->texture, pixFmt, format.width, @@ -283,27 +283,27 @@ bool egl_desktop_update(EGL_Desktop * desktop, const FrameBuffer * frame, int dm { if (desktop->useDMA && dmaFd >= 0) { - if (egl_texture_update_from_dma(desktop->texture, frame, dmaFd)) + if (egl_textureUpdateFromDMA(desktop->texture, frame, dmaFd)) return true; DEBUG_WARN("DMA update failed, disabling DMABUF imports"); desktop->useDMA = false; egl_texture_free(&desktop->texture); - if (!egl_texture_init(&desktop->texture, desktop->display, EGL_TEXTYPE_FRAMEBUFFER, true)) + if (!egl_textureInit(&desktop->texture, desktop->display, EGL_TEXTYPE_FRAMEBUFFER, true)) { DEBUG_ERROR("Failed to initialize the desktop texture"); return false; } - if (!egl_desktop_setup(desktop, desktop->format)) + if (!egl_desktopSetup(desktop, desktop->format)) return false; } - return egl_texture_update_from_frame(desktop->texture, frame, damageRects, damageRectsCount); + return egl_textureUpdateFromFrame(desktop->texture, frame, damageRects, damageRectsCount); } -bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, +bool egl_desktopRender(EGL_Desktop * desktop, const float x, const float y, const float scaleX, const float scaleY, enum EGL_DesktopScaleType scaleType, LG_RendererRotate rotate, const struct DamageRects * rects) { @@ -311,7 +311,7 @@ bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, return false; enum EGL_TexStatus status; - if ((status = egl_texture_process(desktop->texture)) != EGL_TEX_STATUS_OK) + if ((status = egl_textureProcess(desktop->texture)) != EGL_TEX_STATUS_OK) { if (status != EGL_TEX_STATUS_NOTREADY) DEBUG_ERROR("Failed to process the desktop texture"); @@ -344,7 +344,7 @@ bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, egl_desktopRectsUpdate(desktop->mesh, rects, desktop->width, desktop->height); const struct DesktopShader * shader = desktop->shader; - egl_shader_use(shader->shader); + egl_shaderUse(shader->shader); glUniform1i(shader->uScaleAlgo , scaleAlgo); glUniform2f(shader->uDesktopSize, desktop->width, desktop->height); glUniform2f(shader->uUVScale , 1.0f / desktop->width, 1.0f / desktop->height); @@ -360,7 +360,7 @@ bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, glUniform1i(shader->uCBMode, desktop->cbMode); - egl_texture_bind(desktop->texture); + egl_textureBind(desktop->texture); egl_desktopRectsRender(desktop->mesh); glBindTexture(GL_TEXTURE_2D, 0); return true; diff --git a/client/renderers/EGL/desktop.h b/client/renderers/EGL/desktop.h index a6af953b..ed6e4d6d 100644 --- a/client/renderers/EGL/desktop.h +++ b/client/renderers/EGL/desktop.h @@ -35,15 +35,15 @@ enum EGL_DesktopScaleType }; struct Option; -bool egl_desktop_scale_validate(struct Option * opt, const char ** error); +bool egl_desktopScaleValidate(struct Option * opt, const char ** error); -bool egl_desktop_init(EGL_Desktop ** desktop, EGLDisplay * display, bool useDMA, int maxRects); -void egl_desktop_free(EGL_Desktop ** desktop); +bool egl_desktopInit(EGL_Desktop ** desktop, EGLDisplay * display, bool useDMA, int maxRects); +void egl_desktopFree(EGL_Desktop ** desktop); -void egl_desktop_config_ui(EGL_Desktop * desktop); -bool egl_desktop_setup (EGL_Desktop * desktop, const LG_RendererFormat format); +void egl_desktopConfigUI(EGL_Desktop * desktop); +bool egl_desktopSetup (EGL_Desktop * desktop, const LG_RendererFormat format); bool egl_desktop_update(EGL_Desktop * desktop, const FrameBuffer * frame, int dmaFd, const FrameDamageRect * damageRects, int damageRectsCount); -bool egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, +bool egl_desktopRender(EGL_Desktop * desktop, const float x, const float y, const float scaleX, const float scaleY, enum EGL_DesktopScaleType scaleType, LG_RendererRotate rotate, const struct DamageRects * rects); diff --git a/client/renderers/EGL/draw.c b/client/renderers/EGL/draw.c index a45f0b90..265eacbf 100644 --- a/client/renderers/EGL/draw.c +++ b/client/renderers/EGL/draw.c @@ -22,7 +22,8 @@ #include #include -void egl_draw_torus(EGL_Model * model, unsigned int pts, float x, float y, float inner, float outer) +void egl_drawTorus(EGL_Model * model, unsigned int pts, float x, float y, + float inner, float outer) { GLfloat * v = (GLfloat *)malloc(sizeof(GLfloat) * (pts + 1) * 6); GLfloat * dst = v; @@ -40,11 +41,12 @@ void egl_draw_torus(EGL_Model * model, unsigned int pts, float x, float y, float *dst = 0.0f; ++dst; } - egl_model_add_verticies(model, v, NULL, (pts + 1) * 2); + egl_modelAddVerts(model, v, NULL, (pts + 1) * 2); free(v); } -void egl_draw_torus_arc(EGL_Model * model, unsigned int pts, float x, float y, float inner, float outer, float s, float e) +void egl_drawTorusArc(EGL_Model * model, unsigned int pts, float x, float y, + float inner, float outer, float s, float e) { GLfloat * v = (GLfloat *)malloc(sizeof(GLfloat) * (pts + 1) * 6); GLfloat * dst = v; @@ -62,6 +64,6 @@ void egl_draw_torus_arc(EGL_Model * model, unsigned int pts, float x, float y, f *dst = 0.0f; ++dst; } - egl_model_add_verticies(model, v, NULL, (pts + 1) * 2); + egl_modelAddVerts(model, v, NULL, (pts + 1) * 2); free(v); -} \ No newline at end of file +} diff --git a/client/renderers/EGL/draw.h b/client/renderers/EGL/draw.h index 570a415a..9e4b278b 100644 --- a/client/renderers/EGL/draw.h +++ b/client/renderers/EGL/draw.h @@ -22,5 +22,8 @@ #include "model.h" -void egl_draw_torus (EGL_Model * model, unsigned int pts, float x, float y, float inner, float outer); -void egl_draw_torus_arc(EGL_Model * model, unsigned int pts, float x, float y, float inner, float outer, float s, float e); \ No newline at end of file +void egl_drawTorus(EGL_Model * model, unsigned int pts, float x, float y, + float inner, float outer); + +void egl_drawTorusArc(EGL_Model * model, unsigned int pts, float x, float y, + float inner, float outer, float s, float e); diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 07e4d042..785fe91a 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -171,7 +171,7 @@ static struct Option egl_options[] = .name = "scale", .description = "Set the scale algorithm (0 = auto, 1 = nearest, 2 = linear)", .type = OPTION_TYPE_INT, - .validator = egl_desktop_scale_validate, + .validator = egl_desktopScaleValidate, .value.x_int = 0 }, { @@ -251,10 +251,10 @@ static void egl_deinitialize(LG_Renderer * renderer) app_unregisterGraph(this->importGraph); ringbuffer_free(&this->importTimings); - egl_desktop_free(&this->desktop); - egl_cursor_free (&this->cursor); - egl_splash_free (&this->splash); - egl_damage_free (&this->damage); + egl_desktopFree(&this->desktop); + egl_cursorFree (&this->cursor); + egl_splashFree (&this->splash); + egl_damageFree (&this->damage); LG_LOCK_FREE(this->lock); LG_LOCK_FREE(this->desktopDamageLock); @@ -328,7 +328,7 @@ static void egl_calc_mouse_size(struct Inst * this) { case LG_ROTATE_0: case LG_ROTATE_180: - egl_cursor_set_size(this->cursor, + egl_cursorSetSize(this->cursor, (this->mouseWidth * (1.0f / w)) * this->scaleX, (this->mouseHeight * (1.0f / h)) * this->scaleY ); @@ -336,7 +336,7 @@ static void egl_calc_mouse_size(struct Inst * this) case LG_ROTATE_90: case LG_ROTATE_270: - egl_cursor_set_size(this->cursor, + egl_cursorSetSize(this->cursor, (this->mouseWidth * (1.0f / w)) * this->scaleY, (this->mouseHeight * (1.0f / h)) * this->scaleX ); @@ -353,7 +353,7 @@ static void egl_calc_mouse_state(struct Inst * this) { case LG_ROTATE_0: case LG_ROTATE_180: - egl_cursor_set_state( + egl_cursorSetState( this->cursor, this->cursorVisible, (((float)this->cursorX * this->mouseScaleX) - 1.0f) * this->scaleX, @@ -363,7 +363,7 @@ static void egl_calc_mouse_state(struct Inst * this) case LG_ROTATE_90: case LG_ROTATE_270: - egl_cursor_set_state( + egl_cursorSetState( this->cursor, this->cursorVisible, (((float)this->cursorX * this->mouseScaleX) - 1.0f) * this->scaleY, @@ -444,7 +444,7 @@ static void egl_onResize(LG_Renderer * renderer, const int width, const int heig ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplOpenGL3_NewFrame(); - egl_damage_resize(this->damage, this->translateX, this->translateY, this->scaleX, this->scaleY); + egl_damageResize(this->damage, this->translateX, this->translateY, this->scaleX, this->scaleY); } static bool egl_onMouseShape(LG_Renderer * renderer, const LG_RendererCursor cursor, @@ -453,7 +453,7 @@ static bool egl_onMouseShape(LG_Renderer * renderer, const LG_RendererCursor cur { struct Inst * this = UPCAST(struct Inst, renderer); - if (!egl_cursor_set_shape(this->cursor, cursor, width, height, pitch, data)) + if (!egl_cursorSetShape(this->cursor, cursor, width, height, pitch, data)) { DEBUG_ERROR("Failed to update the cursor shape"); return false; @@ -504,9 +504,9 @@ static bool egl_onFrameFormat(LG_Renderer * renderer, const LG_RendererFormat fo } egl_update_scale_type(this); - egl_damage_setup(this->damage, format.width, format.height); + egl_damageSetup(this->damage, format.width, format.height); - return egl_desktop_setup(this->desktop, format); + return egl_desktopSetup(this->desktop, format); } static bool egl_onFrame(LG_Renderer * renderer, const FrameBuffer * frame, int dmaFd, @@ -619,9 +619,9 @@ static void debugCallback(GLenum source, GLenum type, GLuint id, static void egl_config_ui(void * opaque) { struct Inst * this = opaque; - egl_damage_config_ui(this->damage); + egl_damageConfigUI(this->damage); igSeparator(); - egl_desktop_config_ui(this->desktop); + egl_desktopConfigUI(this->desktop); } static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA) @@ -782,25 +782,25 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA) eglSwapInterval(this->display, this->opt.vsync ? 1 : 0); - if (!egl_desktop_init(&this->desktop, this->display, useDMA, MAX_ACCUMULATED_DAMAGE)) + if (!egl_desktopInit(&this->desktop, this->display, useDMA, MAX_ACCUMULATED_DAMAGE)) { DEBUG_ERROR("Failed to initialize the desktop"); return false; } - if (!egl_cursor_init(&this->cursor)) + if (!egl_cursorInit(&this->cursor)) { DEBUG_ERROR("Failed to initialize the cursor"); return false; } - if (!egl_splash_init(&this->splash)) + if (!egl_splashInit(&this->splash)) { DEBUG_ERROR("Failed to initialize the splash screen"); return false; } - if (!egl_damage_init(&this->damage)) + if (!egl_damageInit(&this->damage)) { DEBUG_ERROR("Failed to initialize the damage display"); return false; @@ -952,7 +952,7 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate, if (this->start) { - if (egl_desktop_render(this->desktop, + if (egl_desktopRender(this->desktop, this->translateX, this->translateY, this->scaleX , this->scaleY , this->scaleType , rotate, renderAll ? NULL : accumulated)) @@ -965,7 +965,7 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate, this->waitDone = true; } - cursorState = egl_cursor_render(this->cursor, + cursorState = egl_cursorRender(this->cursor, (this->format.rotate + rotate) % LG_ROTATE_MAX, this->width, this->height); } @@ -994,17 +994,17 @@ static bool egl_render(LG_Renderer * renderer, LG_RendererRotate rotate, if (!this->waitDone) { - egl_splash_render(this->splash, a, this->splashRatio); + egl_splashRender(this->splash, a, this->splashRatio); hasOverlay = true; } } else if (!this->start) { - egl_splash_render(this->splash, 1.0f, this->splashRatio); + egl_splashRender(this->splash, 1.0f, this->splashRatio); hasOverlay = true; } - hasOverlay |= egl_damage_render(this->damage, rotate, newFrame ? desktopDamage : NULL); + hasOverlay |= egl_damageRender(this->damage, rotate, newFrame ? desktopDamage : NULL); hasOverlay |= invalidateWindow; struct Rect damage[KVMFR_MAX_DAMAGE_RECTS + MAX_OVERLAY_RECTS + 2]; diff --git a/client/renderers/EGL/model.c b/client/renderers/EGL/model.c index acc58bd5..952b9b62 100644 --- a/client/renderers/EGL/model.c +++ b/client/renderers/EGL/model.c @@ -53,7 +53,7 @@ struct FloatList void update_uniform_bindings(EGL_Model * model); -bool egl_model_init(EGL_Model ** model) +bool egl_modelInit(EGL_Model ** model) { *model = (EGL_Model *)malloc(sizeof(EGL_Model)); if (!*model) @@ -69,7 +69,7 @@ bool egl_model_init(EGL_Model ** model) return true; } -void egl_model_free(EGL_Model ** model) +void egl_modelFree(EGL_Model ** model) { if (!*model) return; @@ -93,7 +93,7 @@ void egl_model_free(EGL_Model ** model) *model = NULL; } -void egl_model_set_default(EGL_Model * model) +void egl_modelSetDefault(EGL_Model * model) { static const GLfloat square[] = { @@ -111,10 +111,10 @@ void egl_model_set_default(EGL_Model * model) 1.0f, 0.0f }; - egl_model_add_verticies(model, square, uvs, 4); + egl_modelAddVerts(model, square, uvs, 4); } -void egl_model_add_verticies(EGL_Model * model, const GLfloat * verticies, const GLfloat * uvs, const size_t count) +void egl_modelAddVerts(EGL_Model * model, const GLfloat * verticies, const GLfloat * uvs, const size_t count) { struct FloatList * fl = (struct FloatList *)malloc(sizeof(struct FloatList)); @@ -133,7 +133,7 @@ void egl_model_add_verticies(EGL_Model * model, const GLfloat * verticies, const model->vertexCount += count; } -void egl_model_render(EGL_Model * model) +void egl_modelRender(EGL_Model * model) { if (!model->vertexCount) return; @@ -184,10 +184,10 @@ void egl_model_render(EGL_Model * model) glBindVertexArray(model->vao); if (model->shader) - egl_shader_use(model->shader); + egl_shaderUse(model->shader); if (model->texture) - egl_texture_bind(model->texture); + egl_textureBind(model->texture); /* draw the arrays */ GLint offset = 0; @@ -204,13 +204,13 @@ void egl_model_render(EGL_Model * model) glUseProgram(0); } -void egl_model_set_shader(EGL_Model * model, EGL_Shader * shader) +void egl_modelSetShader(EGL_Model * model, EGL_Shader * shader) { model->shader = shader; update_uniform_bindings(model); } -void egl_model_set_texture(EGL_Model * model, EGL_Texture * texture) +void egl_modelSetTexture(EGL_Model * model, EGL_Texture * texture) { model->texture = texture; update_uniform_bindings(model); @@ -221,5 +221,5 @@ void update_uniform_bindings(EGL_Model * model) if (!model->shader || !model->texture) return; - egl_shader_associate_textures(model->shader, 1); + egl_shaderAssocTextures(model->shader, 1); } diff --git a/client/renderers/EGL/model.h b/client/renderers/EGL/model.h index 2f45c8e8..02577843 100644 --- a/client/renderers/EGL/model.h +++ b/client/renderers/EGL/model.h @@ -28,12 +28,12 @@ typedef struct EGL_Model EGL_Model; -bool egl_model_init(EGL_Model ** model); -void egl_model_free(EGL_Model ** model); +bool egl_modelInit(EGL_Model ** model); +void egl_modelFree(EGL_Model ** model); -void egl_model_set_default (EGL_Model * model); -void egl_model_add_verticies(EGL_Model * model, const GLfloat * verticies, const GLfloat * uvs, const size_t count); -void egl_model_set_shader (EGL_Model * model, EGL_Shader * shader); -void egl_model_set_texture (EGL_Model * model, EGL_Texture * texture); +void egl_modelSetDefault (EGL_Model * model); +void egl_modelAddVerts(EGL_Model * model, const GLfloat * verticies, const GLfloat * uvs, const size_t count); +void egl_modelSetShader (EGL_Model * model, EGL_Shader * shader); +void egl_modelSetTexture (EGL_Model * model, EGL_Texture * texture); -void egl_model_render(EGL_Model * model); \ No newline at end of file +void egl_modelRender(EGL_Model * model); diff --git a/client/renderers/EGL/shader.c b/client/renderers/EGL/shader.c index 9d12de29..f1242e24 100644 --- a/client/renderers/EGL/shader.c +++ b/client/renderers/EGL/shader.c @@ -32,7 +32,7 @@ struct EGL_Shader GLuint shader; }; -bool egl_shader_init(EGL_Shader ** this) +bool egl_shaderInit(EGL_Shader ** this) { *this = (EGL_Shader *)malloc(sizeof(EGL_Shader)); if (!*this) @@ -45,7 +45,7 @@ bool egl_shader_init(EGL_Shader ** this) return true; } -void egl_shader_free(EGL_Shader ** this) +void egl_shaderFree(EGL_Shader ** this) { if (!*this) return; @@ -57,7 +57,7 @@ void egl_shader_free(EGL_Shader ** this) *this = NULL; } -bool egl_shader_load(EGL_Shader * this, const char * vertex_file, const char * fragment_file) +bool egl_shaderLoad(EGL_Shader * this, const char * vertex_file, const char * fragment_file) { char * vertex_code, * fragment_code; size_t vertex_size, fragment_size; @@ -79,13 +79,14 @@ bool egl_shader_load(EGL_Shader * this, const char * vertex_file, const char * f DEBUG_INFO("Loaded fragment shader: %s", fragment_file); - bool ret = egl_shader_compile(this, vertex_code, vertex_size, fragment_code, fragment_size); + bool ret = egl_shaderCompile(this, vertex_code, vertex_size, fragment_code, fragment_size); free(vertex_code); free(fragment_code); return ret; } -bool egl_shader_compile(EGL_Shader * this, const char * vertex_code, size_t vertex_size, const char * fragment_code, size_t fragment_size) +bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code, + size_t vertex_size, const char * fragment_code, size_t fragment_size) { if (this->hasShader) { @@ -186,7 +187,7 @@ bool egl_shader_compile(EGL_Shader * this, const char * vertex_code, size_t vert return true; } -void egl_shader_use(EGL_Shader * this) +void egl_shaderUse(EGL_Shader * this) { if (this->hasShader) glUseProgram(this->shader); @@ -194,7 +195,7 @@ void egl_shader_use(EGL_Shader * this) DEBUG_ERROR("Shader program has not been compiled"); } -void egl_shader_associate_textures(EGL_Shader * this, const int count) +void egl_shaderAssocTextures(EGL_Shader * this, const int count) { char name[] = "sampler1"; glUseProgram(this->shader); @@ -212,7 +213,7 @@ void egl_shader_associate_textures(EGL_Shader * this, const int count) glUseProgram(0); } -GLint egl_shader_get_uniform_location(EGL_Shader * this, const char * name) +GLint egl_shaderGetUniform(EGL_Shader * this, const char * name) { if (!this->shader) { diff --git a/client/renderers/EGL/shader.h b/client/renderers/EGL/shader.h index 0c35c305..f0b90334 100644 --- a/client/renderers/EGL/shader.h +++ b/client/renderers/EGL/shader.h @@ -27,12 +27,17 @@ typedef struct EGL_Shader EGL_Shader; -bool egl_shader_init(EGL_Shader ** shader); -void egl_shader_free(EGL_Shader ** shader); +bool egl_shaderInit(EGL_Shader ** shader); +void egl_shaderFree(EGL_Shader ** shader); -bool egl_shader_load (EGL_Shader * model, const char * vertex_file, const char * fragment_file); -bool egl_shader_compile(EGL_Shader * model, const char * vertex_code, size_t vertex_size, const char * fragment_code, size_t fragment_size); -void egl_shader_use (EGL_Shader * shader); +bool egl_shaderLoad(EGL_Shader * model, const char * vertex_file, + const char * fragment_file); -void egl_shader_associate_textures(EGL_Shader * shader, const int count); -GLint egl_shader_get_uniform_location(EGL_Shader * shader, const char * name); \ No newline at end of file +bool egl_shaderCompile(EGL_Shader * model, const char * vertex_code, + size_t vertex_size, const char * fragment_code, size_t fragment_size); + +void egl_shaderUse(EGL_Shader * shader); + +void egl_shaderAssocTextures(EGL_Shader * shader, const int count); + +GLint egl_shaderGetUniform(EGL_Shader * shader, const char * name); diff --git a/client/renderers/EGL/splash.c b/client/renderers/EGL/splash.c index 3de72f59..43a762e3 100644 --- a/client/renderers/EGL/splash.c +++ b/client/renderers/EGL/splash.c @@ -49,7 +49,7 @@ struct EGL_Splash GLint uScale; }; -bool egl_splash_init(EGL_Splash ** splash) +bool egl_splashInit(EGL_Splash ** splash) { *splash = (EGL_Splash *)malloc(sizeof(EGL_Splash)); if (!*splash) @@ -60,13 +60,13 @@ bool egl_splash_init(EGL_Splash ** splash) memset(*splash, 0, sizeof(EGL_Splash)); - if (!egl_shader_init(&(*splash)->bgShader)) + if (!egl_shaderInit(&(*splash)->bgShader)) { DEBUG_ERROR("Failed to initialize the splash bgShader"); return false; } - if (!egl_shader_compile((*splash)->bgShader, + if (!egl_shaderCompile((*splash)->bgShader, b_shader_splash_bg_vert, b_shader_splash_bg_vert_size, b_shader_splash_bg_frag, b_shader_splash_bg_frag_size)) { @@ -74,21 +74,21 @@ bool egl_splash_init(EGL_Splash ** splash) return false; } - if (!egl_model_init(&(*splash)->bg)) + if (!egl_modelInit(&(*splash)->bg)) { DEBUG_ERROR("Failed to intiailize the splash bg model"); return false; } - egl_model_set_default((*splash)->bg); + egl_modelSetDefault((*splash)->bg); - if (!egl_shader_init(&(*splash)->logoShader)) + if (!egl_shaderInit(&(*splash)->logoShader)) { DEBUG_ERROR("Failed to initialize the splash logoShader"); return false; } - if (!egl_shader_compile((*splash)->logoShader, + if (!egl_shaderCompile((*splash)->logoShader, b_shader_splash_logo_vert, b_shader_splash_logo_vert_size, b_shader_splash_logo_frag, b_shader_splash_logo_frag_size)) { @@ -96,9 +96,9 @@ bool egl_splash_init(EGL_Splash ** splash) return false; } - (*splash)->uScale = egl_shader_get_uniform_location((*splash)->logoShader, "scale"); + (*splash)->uScale = egl_shaderGetUniform((*splash)->logoShader, "scale"); - if (!egl_model_init(&(*splash)->logo)) + if (!egl_modelInit(&(*splash)->logo)) { DEBUG_ERROR("Failed to intiailize the splash model"); return false; @@ -106,12 +106,12 @@ bool egl_splash_init(EGL_Splash ** splash) /* build the splash model */ #define P(x) ((1.0f/800.0f)*(float)(x)) - egl_draw_torus_arc((*splash)->logo, 30, P( 0 ), P(0), P(102), P(98), 0.0f, -M_PI); - egl_draw_torus ((*splash)->logo, 30, P(-100), P(8), P(8 ), P(4 )); - egl_draw_torus ((*splash)->logo, 30, P( 100), P(8), P(8 ), P(4 )); + egl_drawTorusArc((*splash)->logo, 30, P( 0 ), P(0), P(102), P(98), 0.0f, -M_PI); + egl_drawTorus ((*splash)->logo, 30, P(-100), P(8), P(8 ), P(4 )); + egl_drawTorus ((*splash)->logo, 30, P( 100), P(8), P(8 ), P(4 )); - egl_draw_torus ((*splash)->logo, 60, P(0), P(0), P(83), P(79)); - egl_draw_torus ((*splash)->logo, 60, P(0), P(0), P(67), P(63)); + egl_drawTorus ((*splash)->logo, 60, P(0), P(0), P(83), P(79)); + egl_drawTorus ((*splash)->logo, 60, P(0), P(0), P(67), P(63)); static const GLfloat lines[][12] = { @@ -135,44 +135,44 @@ bool egl_splash_init(EGL_Splash ** splash) } }; - egl_model_add_verticies((*splash)->logo, lines[0], NULL, 4); - egl_model_add_verticies((*splash)->logo, lines[1], NULL, 4); - egl_model_add_verticies((*splash)->logo, lines[2], NULL, 4); + egl_modelAddVerts((*splash)->logo, lines[0], NULL, 4); + egl_modelAddVerts((*splash)->logo, lines[1], NULL, 4); + egl_modelAddVerts((*splash)->logo, lines[2], NULL, 4); - egl_draw_torus_arc((*splash)->logo, 10, P(-26), P(-154), P(10), P(14), M_PI , -M_PI / 2.0); - egl_draw_torus_arc((*splash)->logo, 10, P( 26), P(-154), P(10), P(14), M_PI / 2.0f, -M_PI / 2.0); + egl_drawTorusArc((*splash)->logo, 10, P(-26), P(-154), P(10), P(14), M_PI , -M_PI / 2.0); + egl_drawTorusArc((*splash)->logo, 10, P( 26), P(-154), P(10), P(14), M_PI / 2.0f, -M_PI / 2.0); #undef P return true; } -void egl_splash_free(EGL_Splash ** splash) +void egl_splashFree(EGL_Splash ** splash) { if (!*splash) return; - egl_model_free(&(*splash)->bg ); - egl_model_free(&(*splash)->logo); + egl_modelFree(&(*splash)->bg ); + egl_modelFree(&(*splash)->logo); - egl_shader_free(&(*splash)->bgShader ); - egl_shader_free(&(*splash)->logoShader); + egl_shaderFree(&(*splash)->bgShader ); + egl_shaderFree(&(*splash)->logoShader); free(*splash); *splash = NULL; } -void egl_splash_render(EGL_Splash * splash, float alpha, float scaleY) +void egl_splashRender(EGL_Splash * splash, float alpha, float scaleY) { glEnable(GL_BLEND); glBlendColor(0, 0, 0, alpha); glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); - egl_shader_use(splash->bgShader); - egl_model_render(splash->bg); + egl_shaderUse(splash->bgShader); + egl_modelRender(splash->bg); - egl_shader_use(splash->logoShader); + egl_shaderUse(splash->logoShader); glUniform1f(splash->uScale, scaleY); - egl_model_render(splash->logo); + egl_modelRender(splash->logo); glDisable(GL_BLEND); } diff --git a/client/renderers/EGL/splash.h b/client/renderers/EGL/splash.h index 6f13cac7..4a573661 100644 --- a/client/renderers/EGL/splash.h +++ b/client/renderers/EGL/splash.h @@ -24,7 +24,7 @@ typedef struct EGL_Splash EGL_Splash; -bool egl_splash_init(EGL_Splash ** splash); -void egl_splash_free(EGL_Splash ** splash); +bool egl_splashInit(EGL_Splash ** splash); +void egl_splashFree(EGL_Splash ** splash); -void egl_splash_render(EGL_Splash * splash, float alpha, float scaleY); \ No newline at end of file +void egl_splashRender(EGL_Splash * splash, float alpha, float scaleY); diff --git a/client/renderers/EGL/texture.c b/client/renderers/EGL/texture.c index 9f3e4c46..60fca4ef 100644 --- a/client/renderers/EGL/texture.c +++ b/client/renderers/EGL/texture.c @@ -35,7 +35,7 @@ extern const EGL_TextureOps EGL_TextureBufferStream; extern const EGL_TextureOps EGL_TextureFrameBuffer; extern const EGL_TextureOps EGL_TextureDMABUF; -bool egl_texture_init(EGL_Texture ** texture, EGLDisplay * display, +bool egl_textureInit(EGL_Texture ** texture, EGLDisplay * display, EGL_TexType type, bool streaming) { const EGL_TextureOps * ops; @@ -74,7 +74,7 @@ void egl_texture_free(EGL_Texture ** tex) *tex = NULL; } -bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, +bool egl_textureSetup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_t width, size_t height, size_t stride) { const struct EGL_TexSetup setup = @@ -88,7 +88,7 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, return texture->ops->setup(texture, &setup); } -bool egl_texture_update(EGL_Texture * texture, const uint8_t * buffer) +bool egl_textureUpdate(EGL_Texture * texture, const uint8_t * buffer) { const struct EGL_TexUpdate update = { @@ -98,7 +98,7 @@ bool egl_texture_update(EGL_Texture * texture, const uint8_t * buffer) return texture->ops->update(texture, &update); } -bool egl_texture_update_from_frame(EGL_Texture * texture, +bool egl_textureUpdateFromFrame(EGL_Texture * texture, const FrameBuffer * frame, const FrameDamageRect * damageRects, int damageRectsCount) { @@ -112,7 +112,7 @@ bool egl_texture_update_from_frame(EGL_Texture * texture, return texture->ops->update(texture, &update); } -bool egl_texture_update_from_dma(EGL_Texture * texture, +bool egl_textureUpdateFromDMA(EGL_Texture * texture, const FrameBuffer * frame, const int dmaFd) { const struct EGL_TexUpdate update = @@ -127,12 +127,12 @@ bool egl_texture_update_from_dma(EGL_Texture * texture, return texture->ops->update(texture, &update); } -enum EGL_TexStatus egl_texture_process(EGL_Texture * texture) +enum EGL_TexStatus egl_textureProcess(EGL_Texture * texture) { return texture->ops->process(texture); } -enum EGL_TexStatus egl_texture_bind(EGL_Texture * texture) +enum EGL_TexStatus egl_textureBind(EGL_Texture * texture) { return texture->ops->bind(texture); } diff --git a/client/renderers/EGL/texture.h b/client/renderers/EGL/texture.h index c1849bb2..9f14038a 100644 --- a/client/renderers/EGL/texture.h +++ b/client/renderers/EGL/texture.h @@ -127,24 +127,22 @@ typedef struct EGL_TextureOps } EGL_TextureOps; -bool egl_texture_init(EGL_Texture ** texture, EGLDisplay * display, +bool egl_textureInit(EGL_Texture ** texture, EGLDisplay * display, EGL_TexType type, bool streaming); void egl_texture_free(EGL_Texture ** tex); -bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, +bool egl_textureSetup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_t width, size_t height, size_t stride); -bool egl_texture_update (EGL_Texture * texture, const uint8_t * buffer); +bool egl_textureUpdate(EGL_Texture * texture, const uint8_t * buffer); -bool egl_texture_update_from_frame(EGL_Texture * texture, +bool egl_textureUpdateFromFrame(EGL_Texture * texture, const FrameBuffer * frame, const FrameDamageRect * damageRects, int damageRectsCount); -bool egl_texture_update_from_dma(EGL_Texture * texture, +bool egl_textureUpdateFromDMA(EGL_Texture * texture, const FrameBuffer * frame, const int dmaFd); -enum EGL_TexStatus egl_texture_process(EGL_Texture * texture); +enum EGL_TexStatus egl_textureProcess(EGL_Texture * texture); -enum EGL_TexStatus egl_texture_bind(EGL_Texture * texture); - -int egl_texture_count(EGL_Texture * texture); +enum EGL_TexStatus egl_textureBind(EGL_Texture * texture); diff --git a/client/renderers/EGL/texture_buffer.c b/client/renderers/EGL/texture_buffer.c index 04e9c10f..cba87e17 100644 --- a/client/renderers/EGL/texture_buffer.c +++ b/client/renderers/EGL/texture_buffer.c @@ -31,9 +31,9 @@ extern const EGL_TextureOps EGL_TextureBufferStream; // internal functions -static void eglTexBuffer_cleanup(TextureBuffer * this) +static void egl_texBuffer_cleanup(TextureBuffer * this) { - eglTexUtilFreeBuffers(this->buf, this->texCount); + egl_texUtilFreeBuffers(this->buf, this->texCount); if (this->tex[0]) glDeleteTextures(this->texCount, this->tex); @@ -50,7 +50,7 @@ static void eglTexBuffer_cleanup(TextureBuffer * this) // common functions -bool eglTexBuffer_init(EGL_Texture ** texture, EGLDisplay * display) +bool egl_texBufferInit(EGL_Texture ** texture, EGLDisplay * display) { TextureBuffer * this; if (!*texture) @@ -71,24 +71,24 @@ bool eglTexBuffer_init(EGL_Texture ** texture, EGLDisplay * display) return true; } -void eglTexBuffer_free(EGL_Texture * texture) +void egl_texBufferFree(EGL_Texture * texture) { TextureBuffer * this = UPCAST(TextureBuffer, texture); - eglTexBuffer_cleanup(this); + egl_texBuffer_cleanup(this); LG_LOCK_FREE(this->copyLock); if (this->free) free(this); } -bool eglTexBuffer_setup(EGL_Texture * texture, const EGL_TexSetup * setup) +bool egl_texBufferSetup(EGL_Texture * texture, const EGL_TexSetup * setup) { TextureBuffer * this = UPCAST(TextureBuffer, texture); - eglTexBuffer_cleanup(this); + egl_texBuffer_cleanup(this); - if (!eglTexUtilGetFormat(setup, &this->format)) + if (!egl_texUtilGetFormat(setup, &this->format)) return false; glGenSamplers(1, &this->sampler); @@ -118,7 +118,7 @@ bool eglTexBuffer_setup(EGL_Texture * texture, const EGL_TexSetup * setup) return true; } -static bool eglTexBuffer_update(EGL_Texture * texture, const EGL_TexUpdate * update) +static bool egl_texBuffer_update(EGL_Texture * texture, const EGL_TexUpdate * update) { TextureBuffer * this = UPCAST(TextureBuffer, texture); assert(update->type == EGL_TEXTYPE_BUFFER); @@ -137,12 +137,12 @@ static bool eglTexBuffer_update(EGL_Texture * texture, const EGL_TexUpdate * upd return true; } -EGL_TexStatus eglTexBuffer_process(EGL_Texture * texture) +EGL_TexStatus egl_texBufferProcess(EGL_Texture * texture) { return EGL_TEX_STATUS_OK; } -EGL_TexStatus eglTexBuffer_bind(EGL_Texture * texture) +EGL_TexStatus egl_texBufferBind(EGL_Texture * texture) { TextureBuffer * this = UPCAST(TextureBuffer, texture); @@ -155,9 +155,9 @@ EGL_TexStatus eglTexBuffer_bind(EGL_Texture * texture) // streaming functions -bool eglTexBuffer_stream_init(EGL_Texture ** texture, EGLDisplay * display) +bool egl_texBufferStreamInit(EGL_Texture ** texture, EGLDisplay * display) { - if (!eglTexBuffer_init(texture, display)) + if (!egl_texBufferInit(texture, display)) return false; TextureBuffer * this = UPCAST(TextureBuffer, *texture); @@ -167,16 +167,16 @@ bool eglTexBuffer_stream_init(EGL_Texture ** texture, EGLDisplay * display) return true; } -bool eglTexBuffer_stream_setup(EGL_Texture * texture, const EGL_TexSetup * setup) +bool egl_texBufferStreamSetup(EGL_Texture * texture, const EGL_TexSetup * setup) { - if (!eglTexBuffer_setup(texture, setup)) + if (!egl_texBufferSetup(texture, setup)) return false; TextureBuffer * this = UPCAST(TextureBuffer, texture); - return eglTexUtilGenBuffers(&this->format, this->buf, this->texCount); + return egl_texUtilGenBuffers(&this->format, this->buf, this->texCount); } -static bool eglTexBuffer_stream_update(EGL_Texture * texture, +static bool egl_texBufferStreamUpdate(EGL_Texture * texture, const EGL_TexUpdate * update) { TextureBuffer * this = UPCAST(TextureBuffer, texture); @@ -191,7 +191,7 @@ static bool eglTexBuffer_stream_update(EGL_Texture * texture, return true; } -EGL_TexStatus eglTexBuffer_stream_process(EGL_Texture * texture) +EGL_TexStatus egl_texBufferStreamProcess(EGL_Texture * texture) { TextureBuffer * this = UPCAST(TextureBuffer, texture); @@ -233,7 +233,7 @@ EGL_TexStatus eglTexBuffer_stream_process(EGL_Texture * texture) return EGL_TEX_STATUS_OK; } -EGL_TexStatus eglTexBuffer_stream_bind(EGL_Texture * texture) +EGL_TexStatus egl_texBufferStreamBind(EGL_Texture * texture) { TextureBuffer * this = UPCAST(TextureBuffer, texture); @@ -271,20 +271,20 @@ EGL_TexStatus eglTexBuffer_stream_bind(EGL_Texture * texture) const EGL_TextureOps EGL_TextureBuffer = { - .init = eglTexBuffer_init, - .free = eglTexBuffer_free, - .setup = eglTexBuffer_setup, - .update = eglTexBuffer_update, - .process = eglTexBuffer_process, - .bind = eglTexBuffer_bind + .init = egl_texBufferInit, + .free = egl_texBufferFree, + .setup = egl_texBufferSetup, + .update = egl_texBuffer_update, + .process = egl_texBufferProcess, + .bind = egl_texBufferBind }; const EGL_TextureOps EGL_TextureBufferStream = { - .init = eglTexBuffer_stream_init, - .free = eglTexBuffer_free, - .setup = eglTexBuffer_stream_setup, - .update = eglTexBuffer_stream_update, - .process = eglTexBuffer_stream_process, - .bind = eglTexBuffer_stream_bind + .init = egl_texBufferStreamInit, + .free = egl_texBufferFree, + .setup = egl_texBufferStreamSetup, + .update = egl_texBufferStreamUpdate, + .process = egl_texBufferStreamProcess, + .bind = egl_texBufferStreamBind }; diff --git a/client/renderers/EGL/texture_buffer.h b/client/renderers/EGL/texture_buffer.h index e40eb814..c5c03d2d 100644 --- a/client/renderers/EGL/texture_buffer.h +++ b/client/renderers/EGL/texture_buffer.h @@ -44,14 +44,14 @@ typedef struct TextureBuffer } TextureBuffer; -bool eglTexBuffer_init(EGL_Texture ** texture_, EGLDisplay * display); -void eglTexBuffer_free(EGL_Texture * texture_); -bool eglTexBuffer_setup(EGL_Texture * texture_, const EGL_TexSetup * setup); -EGL_TexStatus eglTexBuffer_process(EGL_Texture * texture_); -EGL_TexStatus eglTexBuffer_bind(EGL_Texture * texture_); +bool egl_texBufferInit(EGL_Texture ** texture_, EGLDisplay * display); +void egl_texBufferFree(EGL_Texture * texture_); +bool egl_texBufferSetup(EGL_Texture * texture_, const EGL_TexSetup * setup); +EGL_TexStatus egl_texBufferProcess(EGL_Texture * texture_); +EGL_TexStatus egl_texBufferBind(EGL_Texture * texture_); -bool eglTexBuffer_stream_init(EGL_Texture ** texture_, EGLDisplay * display); -bool eglTexBuffer_stream_setup(EGL_Texture * texture_, +bool egl_texBufferStreamInit(EGL_Texture ** texture_, EGLDisplay * display); +bool egl_texBufferStreamSetup(EGL_Texture * texture_, const EGL_TexSetup * setup); -EGL_TexStatus eglTexBuffer_stream_process(EGL_Texture * texture_); -EGL_TexStatus eglTexBuffer_stream_bind(EGL_Texture * texture_); +EGL_TexStatus egl_texBufferStreamProcess(EGL_Texture * texture_); +EGL_TexStatus egl_texBufferStreamBind(EGL_Texture * texture_); diff --git a/client/renderers/EGL/texture_dmabuf.c b/client/renderers/EGL/texture_dmabuf.c index 04336769..f752e36b 100644 --- a/client/renderers/EGL/texture_dmabuf.c +++ b/client/renderers/EGL/texture_dmabuf.c @@ -47,7 +47,7 @@ EGL_TextureOps EGL_TextureDMABUF; // internal functions -static void eglTexDMABUF_cleanup(TexDMABUF * this) +static void egl_texDMABUFCleanup(TexDMABUF * this) { for (size_t i = 0; i < this->imageUsed; ++i) eglDestroyImage(this->display, this->images[i].image); @@ -57,13 +57,13 @@ static void eglTexDMABUF_cleanup(TexDMABUF * this) // dmabuf functions -static bool eglTexDMABUF_init(EGL_Texture ** texture, EGLDisplay * display) +static bool egl_texDMABUFInit(EGL_Texture ** texture, EGLDisplay * display) { TexDMABUF * this = (TexDMABUF *)calloc(sizeof(*this), 1); *texture = &this->base.base; EGL_Texture * parent = &this->base.base; - if (!eglTexBuffer_init(&parent, display)) + if (!egl_texBufferInit(&parent, display)) { free(this); *texture = NULL; @@ -74,26 +74,26 @@ static bool eglTexDMABUF_init(EGL_Texture ** texture, EGLDisplay * display) return true; } -static void eglTexDMABUF_free(EGL_Texture * texture) +static void egl_texDMABUFFree(EGL_Texture * texture) { TextureBuffer * parent = UPCAST(TextureBuffer, texture); TexDMABUF * this = UPCAST(TexDMABUF , parent); - eglTexDMABUF_cleanup(this); + egl_texDMABUFCleanup(this); free(this->images); - eglTexBuffer_free(&parent->base); + egl_texBufferFree(&parent->base); free(this); } -static bool eglTexDMABUF_setup(EGL_Texture * texture, const EGL_TexSetup * setup) +static bool egl_texDMABUFSetup(EGL_Texture * texture, const EGL_TexSetup * setup) { TextureBuffer * parent = UPCAST(TextureBuffer, texture); TexDMABUF * this = UPCAST(TexDMABUF , parent); - eglTexDMABUF_cleanup(this); + egl_texDMABUFCleanup(this); - if (!eglTexBuffer_setup(&parent->base, setup)) + if (!egl_texBufferSetup(&parent->base, setup)) return false; glBindTexture(GL_TEXTURE_2D, parent->tex[0]); @@ -110,7 +110,7 @@ static bool eglTexDMABUF_setup(EGL_Texture * texture, const EGL_TexSetup * setup return true; } -static bool eglTexDMABUF_update(EGL_Texture * texture, +static bool egl_texDMABUFUpdate(EGL_Texture * texture, const EGL_TexUpdate * update) { TextureBuffer * parent = UPCAST(TextureBuffer, texture); @@ -177,12 +177,12 @@ static bool eglTexDMABUF_update(EGL_Texture * texture, return true; } -static EGL_TexStatus eglTexDMABUF_process(EGL_Texture * texture) +static EGL_TexStatus egl_texDMABUFProcess(EGL_Texture * texture) { return EGL_TEX_STATUS_OK; } -static EGL_TexStatus eglTexDMABUF_bind(EGL_Texture * texture) +static EGL_TexStatus egl_texDMABUFBind(EGL_Texture * texture) { TextureBuffer * parent = UPCAST(TextureBuffer, texture); @@ -195,10 +195,10 @@ static EGL_TexStatus eglTexDMABUF_bind(EGL_Texture * texture) EGL_TextureOps EGL_TextureDMABUF = { - .init = eglTexDMABUF_init, - .free = eglTexDMABUF_free, - .setup = eglTexDMABUF_setup, - .update = eglTexDMABUF_update, - .process = eglTexDMABUF_process, - .bind = eglTexDMABUF_bind + .init = egl_texDMABUFInit, + .free = egl_texDMABUFFree, + .setup = egl_texDMABUFSetup, + .update = egl_texDMABUFUpdate, + .process = egl_texDMABUFProcess, + .bind = egl_texDMABUFBind }; diff --git a/client/renderers/EGL/texture_framebuffer.c b/client/renderers/EGL/texture_framebuffer.c index ea361190..420a5194 100644 --- a/client/renderers/EGL/texture_framebuffer.c +++ b/client/renderers/EGL/texture_framebuffer.c @@ -40,13 +40,13 @@ typedef struct TexFB } TexFB; -static bool eglTexFB_init(EGL_Texture ** texture, EGLDisplay * display) +static bool egl_texFBInit(EGL_Texture ** texture, EGLDisplay * display) { TexFB * this = calloc(sizeof(*this), 1); *texture = &this->base.base; EGL_Texture * parent = &this->base.base; - if (!eglTexBuffer_stream_init(&parent, display)) + if (!egl_texBufferStreamInit(&parent, display)) { free(this); *texture = NULL; @@ -59,16 +59,16 @@ static bool eglTexFB_init(EGL_Texture ** texture, EGLDisplay * display) return true; } -void eglTexFB_free(EGL_Texture * texture) +void egl_texFBFree(EGL_Texture * texture) { TextureBuffer * parent = UPCAST(TextureBuffer, texture); TexFB * this = UPCAST(TexFB , parent ); - eglTexBuffer_free(texture); + egl_texBufferFree(texture); free(this); } -static bool eglTexFB_update(EGL_Texture * texture, const EGL_TexUpdate * update) +static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update) { TextureBuffer * parent = UPCAST(TextureBuffer, texture); TexFB * this = UPCAST(TexFB , parent ); @@ -132,10 +132,10 @@ static bool eglTexFB_update(EGL_Texture * texture, const EGL_TexUpdate * update) EGL_TextureOps EGL_TextureFrameBuffer = { - .init = eglTexFB_init, - .free = eglTexFB_free, - .setup = eglTexBuffer_stream_setup, - .update = eglTexFB_update, - .process = eglTexBuffer_stream_process, - .bind = eglTexBuffer_stream_bind + .init = egl_texFBInit, + .free = egl_texFBFree, + .setup = egl_texBufferStreamSetup, + .update = egl_texFBUpdate, + .process = egl_texBufferStreamProcess, + .bind = egl_texBufferStreamBind }; diff --git a/client/renderers/EGL/texture_util.c b/client/renderers/EGL/texture_util.c index 91df22f2..c0e02f6b 100644 --- a/client/renderers/EGL/texture_util.c +++ b/client/renderers/EGL/texture_util.c @@ -37,7 +37,7 @@ #define DRM_FORMAT_BGRA1010102 fourcc_code('B', 'A', '3', '0') #define DRM_FORMAT_ABGR16161616F fourcc_code('A', 'B', '4', 'H') -bool eglTexUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt) +bool egl_texUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt) { switch(setup->pixFmt) { @@ -87,7 +87,7 @@ bool eglTexUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt) return true; } -bool eglTexUtilGenBuffers(const EGL_TexFormat * fmt, EGL_TexBuffer * buffers, +bool egl_texUtilGenBuffers(const EGL_TexFormat * fmt, EGL_TexBuffer * buffers, int count) { for(int i = 0; i < count; ++i) @@ -106,14 +106,14 @@ bool eglTexUtilGenBuffers(const EGL_TexFormat * fmt, EGL_TexBuffer * buffers, GL_MAP_COHERENT_BIT_EXT ); - if (!eglTexUtilMapBuffer(buffer)) + if (!egl_texUtilMapBuffer(buffer)) return false; } return true; } -void eglTexUtilFreeBuffers(EGL_TexBuffer * buffers, int count) +void egl_texUtilFreeBuffers(EGL_TexBuffer * buffers, int count) { for(int i = 0; i < count; ++i) { @@ -122,13 +122,13 @@ void eglTexUtilFreeBuffers(EGL_TexBuffer * buffers, int count) if (!buffer->pbo) continue; - eglTexUtilUnmapBuffer(buffer); + egl_texUtilUnmapBuffer(buffer); glDeleteBuffers(1, &buffer->pbo); buffer->pbo = 0; } } -bool eglTexUtilMapBuffer(EGL_TexBuffer * buffer) +bool egl_texUtilMapBuffer(EGL_TexBuffer * buffer) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, buffer->pbo); buffer->map = glMapBufferRange( @@ -148,7 +148,7 @@ bool eglTexUtilMapBuffer(EGL_TexBuffer * buffer) return buffer->map; } -void eglTexUtilUnmapBuffer(EGL_TexBuffer * buffer) +void egl_texUtilUnmapBuffer(EGL_TexBuffer * buffer) { if (!buffer->map) return; diff --git a/client/renderers/EGL/texture_util.h b/client/renderers/EGL/texture_util.h index b95e0320..31378fcc 100644 --- a/client/renderers/EGL/texture_util.h +++ b/client/renderers/EGL/texture_util.h @@ -45,9 +45,9 @@ typedef struct EGL_TexBuffer } EGL_TexBuffer; -bool eglTexUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt); -bool eglTexUtilGenBuffers(const EGL_TexFormat * fmt, EGL_TexBuffer * buffers, +bool egl_texUtilGetFormat(const EGL_TexSetup * setup, EGL_TexFormat * fmt); +bool egl_texUtilGenBuffers(const EGL_TexFormat * fmt, EGL_TexBuffer * buffers, int count); -void eglTexUtilFreeBuffers(EGL_TexBuffer * buffers, int count); -bool eglTexUtilMapBuffer(EGL_TexBuffer * buffer); -void eglTexUtilUnmapBuffer(EGL_TexBuffer * buffer); +void egl_texUtilFreeBuffers(EGL_TexBuffer * buffers, int count); +bool egl_texUtilMapBuffer(EGL_TexBuffer * buffer); +void egl_texUtilUnmapBuffer(EGL_TexBuffer * buffer);