aboutsummaryrefslogtreecommitdiff
path: root/include/render/gles2.h
diff options
context:
space:
mode:
authorRose Hudson <rose@krx.sh>2023-06-02 11:10:35 +0100
committerSimon Ser <contact@emersion.fr>2023-06-05 19:50:07 +0000
commit45ca284eeee7790663a10cc3b8af5ccf00ebb059 (patch)
tree62e5e47f40fa2573b0f64e3574a90accf21b7f21 /include/render/gles2.h
parent9e8947e4d51ddafb40887b8a8ebfb1873615f9b6 (diff)
render/gles2: implement timer API
Diffstat (limited to 'include/render/gles2.h')
-rw-r--r--include/render/gles2.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/include/render/gles2.h b/include/render/gles2.h
index 619566fb..930cf07d 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -6,6 +6,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
+#include <time.h>
#include <wlr/render/egl.h>
#include <wlr/render/gles2.h>
#include <wlr/render/interface.h>
@@ -14,6 +15,11 @@
#include <wlr/util/addon.h>
#include <wlr/util/log.h>
+// mesa ships old GL headers that don't include this type, so for distros that use headers from
+// mesa we need to def it ourselves until they update.
+// https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23144
+typedef void (GL_APIENTRYP PFNGLGETINTEGER64VEXTPROC) (GLenum pname, GLint64 *data);
+
struct wlr_gles2_pixel_format {
uint32_t drm_format;
// optional field, if empty then internalformat = format
@@ -47,6 +53,7 @@ struct wlr_gles2_renderer {
bool EXT_texture_type_2_10_10_10_REV;
bool OES_texture_half_float_linear;
bool EXT_texture_norm16;
+ bool EXT_disjoint_timer_query;
} exts;
struct {
@@ -57,6 +64,12 @@ struct wlr_gles2_renderer {
PFNGLPUSHDEBUGGROUPKHRPROC glPushDebugGroupKHR;
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEGLImageTargetRenderbufferStorageOES;
PFNGLGETGRAPHICSRESETSTATUSKHRPROC glGetGraphicsResetStatusKHR;
+ PFNGLGENQUERIESEXTPROC glGenQueriesEXT;
+ PFNGLDELETEQUERIESEXTPROC glDeleteQueriesEXT;
+ PFNGLQUERYCOUNTEREXTPROC glQueryCounterEXT;
+ PFNGLGETQUERYOBJECTIVEXTPROC glGetQueryObjectivEXT;
+ PFNGLGETQUERYOBJECTUI64VEXTPROC glGetQueryObjectui64vEXT;
+ PFNGLGETINTEGER64VEXTPROC glGetInteger64vEXT;
} procs;
struct {
@@ -78,6 +91,15 @@ struct wlr_gles2_renderer {
uint32_t viewport_width, viewport_height;
};
+struct wlr_gles2_render_timer {
+ struct wlr_render_timer base;
+ struct wlr_gles2_renderer *renderer;
+ struct timespec cpu_start;
+ struct timespec cpu_end;
+ GLuint id;
+ GLint64 gl_cpu_end;
+};
+
struct wlr_gles2_buffer {
struct wlr_buffer *buffer;
struct wlr_gles2_renderer *renderer;
@@ -116,6 +138,7 @@ struct wlr_gles2_render_pass {
struct wlr_render_pass base;
struct wlr_gles2_buffer *buffer;
float projection_matrix[9];
+ struct wlr_gles2_render_timer *timer;
};
bool is_gles2_pixel_format_supported(const struct wlr_gles2_renderer *renderer,
@@ -128,6 +151,8 @@ const uint32_t *get_gles2_shm_formats(const struct wlr_gles2_renderer *renderer,
struct wlr_gles2_renderer *gles2_get_renderer(
struct wlr_renderer *wlr_renderer);
+struct wlr_gles2_render_timer *gles2_get_render_timer(
+ struct wlr_render_timer *timer);
struct wlr_gles2_texture *gles2_get_texture(
struct wlr_texture *wlr_texture);
@@ -140,6 +165,7 @@ void push_gles2_debug_(struct wlr_gles2_renderer *renderer,
#define push_gles2_debug(renderer) push_gles2_debug_(renderer, _WLR_FILENAME, __func__)
void pop_gles2_debug(struct wlr_gles2_renderer *renderer);
-struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *buffer);
+struct wlr_gles2_render_pass *begin_gles2_buffer_pass(struct wlr_gles2_buffer *buffer,
+ struct wlr_gles2_render_timer *timer);
#endif