mesa: Drop some version checking around ValidateEGLImage
We can just have the screen check if the loader exports it, and take the path we would otherwise. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30245>
This commit is contained in:
@@ -276,7 +276,10 @@ dri2_validate_egl_image(struct dri_screen *screen, void *handle)
|
|||||||
{
|
{
|
||||||
const __DRIimageLookupExtension *loader = screen->dri2.image;
|
const __DRIimageLookupExtension *loader = screen->dri2.image;
|
||||||
|
|
||||||
return loader->validateEGLImage(handle, screen->loaderPrivate);
|
if (loader)
|
||||||
|
return loader->validateEGLImage(handle, screen->loaderPrivate);
|
||||||
|
else
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
__DRIimage *
|
__DRIimage *
|
||||||
|
@@ -620,17 +620,15 @@ dri_init_screen(struct dri_screen *screen,
|
|||||||
screen->base.get_egl_image = dri_get_egl_image;
|
screen->base.get_egl_image = dri_get_egl_image;
|
||||||
screen->base.get_param = dri_get_param;
|
screen->base.get_param = dri_get_param;
|
||||||
screen->base.set_background_context = dri_set_background_context;
|
screen->base.set_background_context = dri_set_background_context;
|
||||||
|
screen->base.validate_egl_image = dri_validate_egl_image;
|
||||||
if (screen->validate_egl_image)
|
|
||||||
screen->base.validate_egl_image = dri_validate_egl_image;
|
|
||||||
|
|
||||||
screen->lookup_egl_image = dri2_lookup_egl_image;
|
screen->lookup_egl_image = dri2_lookup_egl_image;
|
||||||
|
screen->validate_egl_image = dri2_validate_egl_image;
|
||||||
const __DRIimageLookupExtension *image = screen->dri2.image;
|
const __DRIimageLookupExtension *image = screen->dri2.image;
|
||||||
if (image &&
|
if (image &&
|
||||||
image->base.version >= 2 &&
|
image->base.version >= 2 &&
|
||||||
image->validateEGLImage &&
|
image->validateEGLImage &&
|
||||||
image->lookupEGLImageValidated) {
|
image->lookupEGLImageValidated) {
|
||||||
screen->validate_egl_image = dri2_validate_egl_image;
|
|
||||||
screen->lookup_egl_image_validated = dri2_lookup_egl_image_validated;
|
screen->lookup_egl_image_validated = dri2_lookup_egl_image_validated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -247,8 +247,6 @@ struct dd_function_table {
|
|||||||
void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
|
void (*ShaderCacheSerializeDriverBlob)(struct gl_context *ctx,
|
||||||
struct gl_program *prog);
|
struct gl_program *prog);
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
GLboolean (*ValidateEGLImage)(struct gl_context *ctx, GLeglImageOES image_handle);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* DD_INCLUDED */
|
#endif /* DD_INCLUDED */
|
||||||
|
@@ -2934,8 +2934,7 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!image || (ctx->Driver.ValidateEGLImage &&
|
if (!image || !st_validate_egl_image(ctx, image)) {
|
||||||
!ctx->Driver.ValidateEGLImage(ctx, image))) {
|
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||||
"EGLImageTargetRenderbufferStorageOES");
|
"EGLImageTargetRenderbufferStorageOES");
|
||||||
return;
|
return;
|
||||||
|
@@ -3554,8 +3554,7 @@ egl_image_target_texture(struct gl_context *ctx,
|
|||||||
if (!texObj)
|
if (!texObj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!image || (ctx->Driver.ValidateEGLImage &&
|
if (!image || !st_validate_egl_image(ctx, image)) {
|
||||||
!ctx->Driver.ValidateEGLImage(ctx, image))) {
|
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "%s(image=%p)", caller, image);
|
_mesa_error(ctx, GL_INVALID_VALUE, "%s(image=%p)", caller, image);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -507,7 +507,7 @@ st_bind_egl_image(struct gl_context *ctx,
|
|||||||
_mesa_dirty_texobj(ctx, texObj);
|
_mesa_dirty_texobj(ctx, texObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLboolean
|
bool
|
||||||
st_validate_egl_image(struct gl_context *ctx, GLeglImageOES image_handle)
|
st_validate_egl_image(struct gl_context *ctx, GLeglImageOES image_handle)
|
||||||
{
|
{
|
||||||
struct st_context *st = st_context(ctx);
|
struct st_context *st = st_context(ctx);
|
||||||
@@ -515,11 +515,3 @@ st_validate_egl_image(struct gl_context *ctx, GLeglImageOES image_handle)
|
|||||||
|
|
||||||
return fscreen->validate_egl_image(fscreen, (void *)image_handle);
|
return fscreen->validate_egl_image(fscreen, (void *)image_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
st_init_eglimage_functions(struct dd_function_table *functions,
|
|
||||||
bool has_egl_image_validate)
|
|
||||||
{
|
|
||||||
if (has_egl_image_validate)
|
|
||||||
functions->ValidateEGLImage = st_validate_egl_image;
|
|
||||||
}
|
|
||||||
|
@@ -31,9 +31,8 @@
|
|||||||
|
|
||||||
struct dd_function_table;
|
struct dd_function_table;
|
||||||
|
|
||||||
extern void
|
bool
|
||||||
st_init_eglimage_functions(struct dd_function_table *functions,
|
st_validate_egl_image(struct gl_context *ctx, GLeglImageOES image_handle);
|
||||||
bool has_egl_image_validate);
|
|
||||||
|
|
||||||
bool st_get_egl_image(struct gl_context *ctx, GLeglImageOES image_handle,
|
bool st_get_egl_image(struct gl_context *ctx, GLeglImageOES image_handle,
|
||||||
unsigned usage, bool tex_compression, const char *error,
|
unsigned usage, bool tex_compression, const char *error,
|
||||||
|
@@ -806,8 +806,6 @@ st_init_driver_functions(struct pipe_screen *screen,
|
|||||||
{
|
{
|
||||||
st_init_draw_functions(screen, functions);
|
st_init_draw_functions(screen, functions);
|
||||||
|
|
||||||
st_init_eglimage_functions(functions, has_egl_image_validate);
|
|
||||||
|
|
||||||
functions->NewProgram = _mesa_new_program;
|
functions->NewProgram = _mesa_new_program;
|
||||||
st_init_flush_functions(screen, functions);
|
st_init_flush_functions(screen, functions);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user