!(texImage->TexObject->Target == GL_TEXTURE_2D ||
texImage->TexObject->Target == GL_TEXTURE_RECTANGLE) ||
pixels == NULL ||
- _mesa_is_bufferobj(packing->BufferObj) ||
+ packing->BufferObj ||
packing->Alignment > 4 ||
packing->SkipPixels > 0 ||
packing->SkipRows > 0 ||
bool ok;
/* Check that there is actually data to store. */
- if (pixels == NULL && !_mesa_is_bufferobj(packing->BufferObj))
+ if (pixels == NULL && !packing->BufferObj)
return;
- bool tex_busy = mt && brw_bo_busy(mt->bo);
+ bool tex_busy = mt &&
+ (brw_batch_references(&brw->batch, mt->bo) || brw_bo_busy(mt->bo));
- if (_mesa_is_bufferobj(packing->BufferObj) || tex_busy ||
+ if (packing->BufferObj || tex_busy ||
mt->aux_usage == ISL_AUX_USAGE_CCS_E) {
ok = intel_texsubimage_blorp(brw, dims, texImage,
xoffset, yoffset, zoffset,
}
static void
-intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *texObj,
- struct gl_texture_image *texImage,
- GLeglImageOES image_handle)
+intel_image_target_texture(struct gl_context *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ GLeglImageOES image_handle,
+ bool storage)
{
struct brw_context *brw = brw_context(ctx);
struct intel_mipmap_tree *mt;
struct intel_texture_object *intel_texobj = intel_texture_object(texObj);
intel_texobj->planar_format = image->planar_format;
+ intel_texobj->yuv_color_space = image->yuv_color_space;
GLenum internal_format =
image->internal_format != 0 ?
image->internal_format : _mesa_get_format_base_format(mt->format);
- /* Setup a sized internal format for MESA_FORMAT_R10G10B10[X2|A2]_UNORM. */
+ /* Fix the internal format when _mesa_get_format_base_format(mt->format)
+ * isn't a valid one for that particular format.
+ */
if (brw->mesa_format_supports_render[image->format]) {
if (image->format == MESA_FORMAT_R10G10B10A2_UNORM ||
- image->format == MESA_FORMAT_R10G10B10X2_UNORM)
+ image->format == MESA_FORMAT_R10G10B10X2_UNORM ||
+ image->format == MESA_FORMAT_B10G10R10A2_UNORM ||
+ image->format == MESA_FORMAT_B10G10R10X2_UNORM)
internal_format = GL_RGB10_A2;
}
+ /* Guess sized internal format for dma-bufs, as specified by
+ * EXT_EGL_image_storage.
+ */
+ if (storage && target == GL_TEXTURE_2D && image->imported_dmabuf) {
+ internal_format = driGLFormatToSizedInternalGLFormat(image->format);
+ if (internal_format == GL_NONE) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, __func__);
+ return;
+ }
+ }
+
intel_set_texture_image_mt(brw, texImage, internal_format, mt->format, mt);
intel_miptree_release(&mt);
}
+static void
+intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ GLeglImageOES image_handle)
+{
+ intel_image_target_texture(ctx, target, texObj, texImage, image_handle,
+ false);
+}
+
+static void
+intel_image_target_tex_storage(struct gl_context *ctx, GLenum target,
+ struct gl_texture_object *texObj,
+ struct gl_texture_image *texImage,
+ GLeglImageOES image_handle)
+{
+ struct intel_texture_object *intel_texobj = intel_texture_object(texObj);
+ intel_image_target_texture(ctx, target, texObj, texImage, image_handle,
+ true);
+
+ /* The miptree is in a validated state, so no need to check later. */
+ intel_texobj->needs_validate = false;
+ intel_texobj->validated_first_level = 0;
+ intel_texobj->validated_last_level = 0;
+ intel_texobj->_Format = texImage->TexFormat;
+}
+
static bool
intel_gettexsubimage_blorp(struct brw_context *brw,
struct gl_texture_image *tex_image,
!(texImage->TexObject->Target == GL_TEXTURE_2D ||
texImage->TexObject->Target == GL_TEXTURE_RECTANGLE) ||
pixels == NULL ||
- _mesa_is_bufferobj(packing->BufferObj) ||
+ packing->BufferObj ||
packing->Alignment > 4 ||
packing->SkipPixels > 0 ||
packing->SkipRows > 0 ||
DBG("%s\n", __func__);
- if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) {
+ if (ctx->Pack.BufferObj) {
if (intel_gettexsubimage_blorp(brw, texImage,
xoffset, yoffset, zoffset,
width, height, depth, format, type,
functions->TexSubImage = intelTexSubImage;
functions->CompressedTexSubImage = intelCompressedTexSubImage;
functions->EGLImageTargetTexture2D = intel_image_target_texture_2d;
+ functions->EGLImageTargetTexStorage = intel_image_target_tex_storage;
functions->BindRenderbufferTexImage = intel_bind_renderbuffer_tex_image;
functions->GetTexSubImage = intel_get_tex_sub_image;
}