gl-renderer: Convert extension pseudo-bools to real bool

Use the actual boolean type instead of an integer for variables which
only hold true or false.

Signed-off-by: Daniel Stone <daniels@collabora.com>
dev
Daniel Stone 6 years ago
parent bc4ccc2085
commit d83c1eca92
  1. 50
      libweston/renderer-gl/gl-renderer.c

@ -221,27 +221,27 @@ struct gl_renderer {
PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage; PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC swap_buffers_with_damage;
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window; PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC create_platform_window;
int has_unpack_subimage; bool has_unpack_subimage;
PFNEGLBINDWAYLANDDISPLAYWL bind_display; PFNEGLBINDWAYLANDDISPLAYWL bind_display;
PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display; PFNEGLUNBINDWAYLANDDISPLAYWL unbind_display;
PFNEGLQUERYWAYLANDBUFFERWL query_buffer; PFNEGLQUERYWAYLANDBUFFERWL query_buffer;
int has_bind_display; bool has_bind_display;
int has_context_priority; bool has_context_priority;
int has_egl_image_external; bool has_egl_image_external;
int has_egl_buffer_age; bool has_egl_buffer_age;
int has_configless_context; bool has_configless_context;
int has_surfaceless_context; bool has_surfaceless_context;
int has_dmabuf_import; bool has_dmabuf_import;
struct wl_list dmabuf_images; struct wl_list dmabuf_images;
int has_gl_texture_rg; bool has_gl_texture_rg;
struct gl_shader texture_shader_rgba; struct gl_shader texture_shader_rgba;
struct gl_shader texture_shader_rgbx; struct gl_shader texture_shader_rgbx;
@ -257,16 +257,16 @@ struct gl_renderer {
struct wl_listener output_destroy_listener; struct wl_listener output_destroy_listener;
int has_dmabuf_import_modifiers; bool has_dmabuf_import_modifiers;
PFNEGLQUERYDMABUFFORMATSEXTPROC query_dmabuf_formats; PFNEGLQUERYDMABUFFORMATSEXTPROC query_dmabuf_formats;
PFNEGLQUERYDMABUFMODIFIERSEXTPROC query_dmabuf_modifiers; PFNEGLQUERYDMABUFMODIFIERSEXTPROC query_dmabuf_modifiers;
int has_native_fence_sync; bool has_native_fence_sync;
PFNEGLCREATESYNCKHRPROC create_sync; PFNEGLCREATESYNCKHRPROC create_sync;
PFNEGLDESTROYSYNCKHRPROC destroy_sync; PFNEGLDESTROYSYNCKHRPROC destroy_sync;
PFNEGLDUPNATIVEFENCEFDANDROIDPROC dup_native_fence_fd; PFNEGLDUPNATIVEFENCEFDANDROIDPROC dup_native_fence_fd;
int has_wait_sync; bool has_wait_sync;
PFNEGLWAITSYNCKHRPROC wait_sync; PFNEGLWAITSYNCKHRPROC wait_sync;
}; };
@ -3403,18 +3403,18 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
} }
if (weston_check_egl_extension(extensions, "EGL_IMG_context_priority")) if (weston_check_egl_extension(extensions, "EGL_IMG_context_priority"))
gr->has_context_priority = 1; gr->has_context_priority = true;
if (weston_check_egl_extension(extensions, "EGL_WL_bind_wayland_display")) if (weston_check_egl_extension(extensions, "EGL_WL_bind_wayland_display"))
gr->has_bind_display = 1; gr->has_bind_display = true;
if (gr->has_bind_display) { if (gr->has_bind_display) {
ret = gr->bind_display(gr->egl_display, ec->wl_display); ret = gr->bind_display(gr->egl_display, ec->wl_display);
if (!ret) if (!ret)
gr->has_bind_display = 0; gr->has_bind_display = false;
} }
if (weston_check_egl_extension(extensions, "EGL_EXT_buffer_age")) if (weston_check_egl_extension(extensions, "EGL_EXT_buffer_age"))
gr->has_egl_buffer_age = 1; gr->has_egl_buffer_age = true;
for (i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint); i++) { for (i = 0; i < ARRAY_LENGTH(swap_damage_ext_to_entrypoint); i++) {
if (weston_check_egl_extension(extensions, if (weston_check_egl_extension(extensions,
@ -3428,13 +3428,13 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
if (weston_check_egl_extension(extensions, "EGL_KHR_no_config_context") || if (weston_check_egl_extension(extensions, "EGL_KHR_no_config_context") ||
weston_check_egl_extension(extensions, "EGL_MESA_configless_context")) weston_check_egl_extension(extensions, "EGL_MESA_configless_context"))
gr->has_configless_context = 1; gr->has_configless_context = true;
if (weston_check_egl_extension(extensions, "EGL_KHR_surfaceless_context")) if (weston_check_egl_extension(extensions, "EGL_KHR_surfaceless_context"))
gr->has_surfaceless_context = 1; gr->has_surfaceless_context = true;
if (weston_check_egl_extension(extensions, "EGL_EXT_image_dma_buf_import")) if (weston_check_egl_extension(extensions, "EGL_EXT_image_dma_buf_import"))
gr->has_dmabuf_import = 1; gr->has_dmabuf_import = true;
if (weston_check_egl_extension(extensions, if (weston_check_egl_extension(extensions,
"EGL_EXT_image_dma_buf_import_modifiers")) { "EGL_EXT_image_dma_buf_import_modifiers")) {
@ -3442,7 +3442,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
(void *) eglGetProcAddress("eglQueryDmaBufFormatsEXT"); (void *) eglGetProcAddress("eglQueryDmaBufFormatsEXT");
gr->query_dmabuf_modifiers = gr->query_dmabuf_modifiers =
(void *) eglGetProcAddress("eglQueryDmaBufModifiersEXT"); (void *) eglGetProcAddress("eglQueryDmaBufModifiersEXT");
gr->has_dmabuf_import_modifiers = 1; gr->has_dmabuf_import_modifiers = true;
} }
if (weston_check_egl_extension(extensions, "EGL_KHR_fence_sync") && if (weston_check_egl_extension(extensions, "EGL_KHR_fence_sync") &&
@ -3453,7 +3453,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
(void *) eglGetProcAddress("eglDestroySyncKHR"); (void *) eglGetProcAddress("eglDestroySyncKHR");
gr->dup_native_fence_fd = gr->dup_native_fence_fd =
(void *) eglGetProcAddress("eglDupNativeFenceFDANDROID"); (void *) eglGetProcAddress("eglDupNativeFenceFDANDROID");
gr->has_native_fence_sync = 1; gr->has_native_fence_sync = true;
} else { } else {
weston_log("warning: Disabling render GPU timeline and explicit " weston_log("warning: Disabling render GPU timeline and explicit "
"synchronization due to missing " "synchronization due to missing "
@ -3462,7 +3462,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
if (weston_check_egl_extension(extensions, "EGL_KHR_wait_sync")) { if (weston_check_egl_extension(extensions, "EGL_KHR_wait_sync")) {
gr->wait_sync = (void *) eglGetProcAddress("eglWaitSyncKHR"); gr->wait_sync = (void *) eglGetProcAddress("eglWaitSyncKHR");
gr->has_wait_sync = 1; gr->has_wait_sync = true;
} else { } else {
weston_log("warning: Disabling explicit synchronization due" weston_log("warning: Disabling explicit synchronization due"
"to missing EGL_KHR_wait_sync extension\n"); "to missing EGL_KHR_wait_sync extension\n");
@ -3952,14 +3952,14 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
if (gr->gl_version >= GR_GL_VERSION(3, 0) || if (gr->gl_version >= GR_GL_VERSION(3, 0) ||
weston_check_egl_extension(extensions, "GL_EXT_unpack_subimage")) weston_check_egl_extension(extensions, "GL_EXT_unpack_subimage"))
gr->has_unpack_subimage = 1; gr->has_unpack_subimage = true;
if (gr->gl_version >= GR_GL_VERSION(3, 0) || if (gr->gl_version >= GR_GL_VERSION(3, 0) ||
weston_check_egl_extension(extensions, "GL_EXT_texture_rg")) weston_check_egl_extension(extensions, "GL_EXT_texture_rg"))
gr->has_gl_texture_rg = 1; gr->has_gl_texture_rg = true;
if (weston_check_egl_extension(extensions, "GL_OES_EGL_image_external")) if (weston_check_egl_extension(extensions, "GL_OES_EGL_image_external"))
gr->has_egl_image_external = 1; gr->has_egl_image_external = true;
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);

Loading…
Cancel
Save