Module webrender::renderer::upload

source ·
Expand description

This module contains the convoluted logic that goes into uploading content into the texture cache’s textures.

We need to support various combinations of code paths depending on the quirks of each hardware/driver configuration:

  • direct upload,
  • staged upload via a pixel buffer object,
  • staged upload via a direct upload to a staging texture where PBO’s aren’t supported,
  • copy from the staging to destination textures, either via blits or batched draw calls.

Conceptually a lot of this logic should probably be in the device module, but some code here relies on submitting draw calls via the renderer.





  • Copy from the staging PBOs or textures to texture cache textures using blit commands.
  • Generate and submit composite shader batches to copy from the staging textures to the destination cache textures.
  • Copy an item into a batched upload staging buffer.
  • Take this code path instead of copying into a staging CPU buffer when the image we would copy is large enough that it’s unlikely anything else would fit in the buffer, therefore we might as well copy directly from the source image’s pixels.
  • Upload a number of items to texture cache textures.