mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 18:28:12 +02:00
egl/wgl: Hook up image validate/get in smapi
Acked-by: Daniel Stone <daniels@collabora.com> Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Acked-by: Sidney Just <justsid@x-plane.com> Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com> Tested-by: Yonggang Luo <luoyonggang@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12964>
This commit is contained in:
parent
c512b68816
commit
52e663959e
4 changed files with 43 additions and 0 deletions
|
|
@ -211,6 +211,33 @@ wgl_egl_st_get_param(struct st_manager *smapi, enum st_manager_param param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
wgl_get_egl_image(struct st_manager *smapi, void *image, struct st_egl_image *out)
|
||||
{
|
||||
struct wgl_egl_image *wgl_img = (struct wgl_egl_image *)image;
|
||||
stw_translate_image(wgl_img->img, out);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
wgl_validate_egl_image(struct st_manager *smapi, void *image)
|
||||
{
|
||||
struct wgl_egl_display *wgl_dpy = (struct wgl_egl_display *)smapi;
|
||||
_EGLDisplay *disp = wgl_dpy->parent;
|
||||
_EGLImage *img;
|
||||
|
||||
mtx_lock(&disp->Mutex);
|
||||
img = _eglLookupImage(image, disp);
|
||||
mtx_unlock(&disp->Mutex);
|
||||
|
||||
if (img == NULL) {
|
||||
_eglError(EGL_BAD_PARAMETER, "wgl_validate_egl_image");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
wgl_initialize_impl(_EGLDisplay *disp, HDC hdc)
|
||||
{
|
||||
|
|
@ -234,6 +261,8 @@ wgl_initialize_impl(_EGLDisplay *disp, HDC hdc)
|
|||
|
||||
wgl_dpy->base.screen = stw_dev->screen;
|
||||
wgl_dpy->base.get_param = wgl_egl_st_get_param;
|
||||
wgl_dpy->base.get_egl_image = wgl_get_egl_image;
|
||||
wgl_dpy->base.validate_egl_image = wgl_validate_egl_image;
|
||||
|
||||
disp->ClientAPIs = 0;
|
||||
if (_eglIsApiValid(EGL_OPENGL_API))
|
||||
|
|
|
|||
|
|
@ -133,3 +133,11 @@ stw_destroy_image(struct stw_image *img)
|
|||
free(img);
|
||||
}
|
||||
|
||||
void
|
||||
stw_translate_image(struct stw_image *in, struct st_egl_image *out)
|
||||
{
|
||||
pipe_resource_reference(&out->texture, in->pres);
|
||||
out->format = in->format;
|
||||
out->layer = in->layer;
|
||||
out->level = in->level;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <GL/gl.h>
|
||||
|
||||
struct st_egl_image;
|
||||
|
||||
enum stw_image_error
|
||||
{
|
||||
STW_IMAGE_ERROR_SUCCESS,
|
||||
|
|
@ -55,3 +57,6 @@ stw_create_image_from_renderbuffer(struct stw_context *ctx, GLuint renderbuffer,
|
|||
|
||||
void
|
||||
stw_destroy_image(struct stw_image *img);
|
||||
|
||||
void
|
||||
stw_translate_image(struct stw_image *in, struct st_egl_image *out);
|
||||
|
|
|
|||
|
|
@ -42,3 +42,4 @@ stw_pbuffer_create
|
|||
stw_create_image_from_texture
|
||||
stw_create_image_from_renderbuffer
|
||||
stw_destroy_image
|
||||
stw_translate_image
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue