title: How to downsample a texture
body: <p>(I'm doing this in Apple Metal, but I think the question applies to OpenGL and DirectX too. Code examples from Metal or OpenGL are highly welcome.)</p>
  
  <p>I have one texture <code>smallTex</code> whose size is a multiple of the size of another texture <code>bigTex</code>.</p>
  
  <p>For example, <code>smallTex</code> has dimensions <code>32x32</code> and <code>bigTex</code> has <code>128x128</code>.</p>
  
  <p>I need to downsample the contents of <code>bigTex</code> into <code>smallTex</code> so that every pixel in <code>smallTex</code> contains the average values of the corresponding pixels in <code>bigTex</code>.</p>
  
  <p>First I thought I could create a fragment shader which samples from <code>bigTex</code> and renders to <code>smallTex</code>. However, this way I would lose much information, since the sampling reads from at most four pixels and interpolates between them.</p>
  
  <p>What I need is real downsampling, where every pixel in the source has the same influence on the result.</p>
  
  <p>I read that this could be done using mipmaps (which essentially are downsampled copies of the original texture). But then I would have to enable mipmapping  on <code>bigTex</code>, which will have a negative performance impact since I'm doing many rendering (compute) steps on <code>bigTex</code>, which would result in a lot of work for the GPU to update the mipmaps.</p>
  
  <p><strong>What I need is a direct GPU command to downsample the texture.</strong></p>
  
  <p>Is that possible? Any hints?</p>