[client] egl: remove texture->ops indirection

This commit is contained in:
Geoffrey McRae 2021-08-08 17:31:52 +10:00
parent 2141046da9
commit baf9661530
2 changed files with 19 additions and 19 deletions

View File

@ -22,6 +22,7 @@
#include <stdbool.h>
#include <assert.h>
#include <string.h>
#include "shader.h"
#include "common/framebuffer.h"
@ -64,13 +65,13 @@ bool egl_textureInit(EGL_Texture ** texture, EGLDisplay * display,
if (!ops->init(texture, display))
return false;
(*texture)->ops = ops;
memcpy(&(*texture)->ops, ops, sizeof(*ops));
return true;
}
void egl_texture_free(EGL_Texture ** tex)
{
(*tex)->ops->free(*tex);
(*tex)->ops.free(*tex);
*tex = NULL;
}
@ -85,7 +86,7 @@ bool egl_textureSetup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt,
.stride = stride
};
texture->size = height * stride;
return texture->ops->setup(texture, &setup);
return texture->ops.setup(texture, &setup);
}
bool egl_textureUpdate(EGL_Texture * texture, const uint8_t * buffer)
@ -95,7 +96,7 @@ bool egl_textureUpdate(EGL_Texture * texture, const uint8_t * buffer)
.type = EGL_TEXTYPE_BUFFER,
.buffer = buffer
};
return texture->ops->update(texture, &update);
return texture->ops.update(texture, &update);
}
bool egl_textureUpdateFromFrame(EGL_Texture * texture,
@ -109,7 +110,7 @@ bool egl_textureUpdateFromFrame(EGL_Texture * texture,
.rects = damageRects,
.rectCount = damageRectsCount,
};
return texture->ops->update(texture, &update);
return texture->ops.update(texture, &update);
}
bool egl_textureUpdateFromDMA(EGL_Texture * texture,
@ -124,15 +125,15 @@ bool egl_textureUpdateFromDMA(EGL_Texture * texture,
/* wait for completion */
framebuffer_wait(frame, texture->size);
return texture->ops->update(texture, &update);
return texture->ops.update(texture, &update);
}
enum EGL_TexStatus egl_textureProcess(EGL_Texture * texture)
{
return texture->ops->process(texture);
return texture->ops.process(texture);
}
enum EGL_TexStatus egl_textureBind(EGL_Texture * texture)
{
return texture->ops->bind(texture);
return texture->ops.bind(texture);
}

View File

@ -29,17 +29,6 @@
#include <EGL/egl.h>
#include <EGL/eglext.h>
struct EGL_TextureOps;
typedef struct EGL_Texture
{
const struct EGL_TextureOps * ops;
// needed for dmabuf
size_t size;
}
EGL_Texture;
typedef enum EGL_TexType
{
EGL_TEXTYPE_BUFFER,
@ -105,6 +94,8 @@ typedef struct EGL_TexUpdate
}
EGL_TexUpdate;
typedef struct EGL_Texture EGL_Texture;
typedef struct EGL_TextureOps
{
/* allocate & initialize an EGL_Texture */
@ -127,6 +118,14 @@ typedef struct EGL_TextureOps
}
EGL_TextureOps;
struct EGL_Texture
{
struct EGL_TextureOps ops;
// needed for dmabuf
size_t size;
};
bool egl_textureInit(EGL_Texture ** texture, EGLDisplay * display,
EGL_TexType type, bool streaming);
void egl_texture_free(EGL_Texture ** tex);