[Mesa-dev] [PATCH 4/6] i965: Add blorp-based texture upload path

Chris Wilson chris at chris-wilson.co.uk
Wed Oct 11 16:43:57 UTC 2017


Quoting Kenneth Graunke (2017-10-10 23:14:17)
> +bool
> +brw_blorp_download_miptree(struct brw_context *brw,
> +                           struct intel_mipmap_tree *src_mt,
> +                           mesa_format src_format, uint32_t src_swizzle,
> +                           uint32_t level, uint32_t x, uint32_t y, uint32_t z,
> +                           uint32_t width, uint32_t height, uint32_t depth,
> +                           GLenum target, GLenum format, GLenum type,
> +                           bool y_flip, const void *pixels,
> +                           const struct gl_pixelstore_attrib *packing)
> +{
> +   const mesa_format dst_format =
> +      blorp_get_client_format(brw, format, type, packing);
> +   if (dst_format == MESA_FORMAT_NONE)
> +      return false;
> +
> +   if (!brw->mesa_format_supports_render[dst_format]) {
> +      perf_debug("intel_texsubimage: can't use %s as render target\n",
> +                 _mesa_get_format_name(dst_format));
> +      return false;
> +   }
> +
> +   /* This function relies on blorp_blit to download the pixel data from the
> +    * miptree. But, blorp_blit doesn't support signed to unsigned or unsigned
> +    * to signed integer conversions.
> +    */
> +   if (need_signed_unsigned_int_conversion(src_format, dst_format))
> +      return false;
> +
> +   /* We can't fetch from LUMINANCE or intensity as that would require a
> +    * non-trivial swizzle.
> +    */
> +   switch (_mesa_get_format_base_format(src_format)) {
> +   case GL_LUMINANCE:
> +   case GL_LUMINANCE_ALPHA:
> +   case GL_INTENSITY:
> +      return false;
> +   default:
> +      break;
> +   }
> +
> +   /* This pass only works for PBOs */
> +   assert(_mesa_is_bufferobj(packing->BufferObj));
> +
> +   uint32_t dst_offset, dst_row_stride, dst_image_stride;
> +   struct brw_bo *dst_bo =
> +      blorp_get_client_bo(brw, width, height, depth,
> +                          target, format, type, pixels, packing,
> +                          &dst_offset, &dst_row_stride,
> +                          &dst_image_stride, true);

s/true/false/ (read_only = false for a dst_bo).
-Chris


More information about the mesa-dev mailing list