return;
}
+ /* Buffers originating from outside are for read-only. */
+ if (image->dma_buf_imported) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glEGLImageTargetRenderbufferStorage(dma buffers are read-only)");
+ return;
+ }
+
/* __DRIimage is opaque to the core so it has to be checked here */
switch (image->format) {
case MESA_FORMAT_RGBA8888_REV:
GLuint tile_y;
bool has_depthstencil;
- /* Provided by EGL_EXT_image_dma_buf_import */
+ /**
+ * Provided by EGL_EXT_image_dma_buf_import.
+ *
+ * The flag is set in order to restrict the use of the image later on.
+ *
+ * See intel_image_target_texture_2d()
+ */
+ bool dma_buf_imported;
enum __DRIYUVColorSpace yuv_color_space;
enum __DRISampleRange sample_range;
enum __DRIChromaSiting horizontal_siting;
return NULL;
}
+ image->dma_buf_imported = true;
image->yuv_color_space = yuv_color_space;
image->sample_range = sample_range;
image->horizontal_siting = horizontal_siting;
if (image == NULL)
return;
+ /**
+ * Images originating via EGL_EXT_image_dma_buf_import can be used only
+ * with GL_OES_EGL_image_external only.
+ */
+ if (image->dma_buf_imported && target != GL_TEXTURE_EXTERNAL_OES) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glEGLImageTargetTexture2DOES(dma buffers can be used with "
+ "GL_OES_EGL_image_external only");
+ return;
+ }
+
/* Disallow depth/stencil textures: we don't have a way to pass the
* separate stencil miptree of a GL_DEPTH_STENCIL texture through.
*/