1

rsSample() seems intended for sampling from mipmapped textures across multiple levels of detail to avoid aliasing. The fisheye example would be a good use case.

The implementation simply samples 8 pixels from the underlying mipmap and does a linear blend of them.

It seems I can only get 15 Mpixels/second on a Google Pixel with this simple kernel:

uchar4 __attribute__((kernel)) rescaletest(uint32_t x, uint32_t y) {
  float2 location = {x,y};

  return convert_uchar4(rsSample(gInput8888, gWrapLinearMipLinear, location/2000.f, 1.5f)*255.f);
}

Considering all composited graphics presumably use mipmaps, and to composite even one texture at 60fps needs 120Mpixels/sec, what am I doing wrong?

  • It is notable that the actual result of rsSample() also appears wrong when using RS_SAMPLER_LINEAR_MIP_LINEAR. There is an off by one on the calculation of which map to read from, meaning the image gets blended with another image of half the size. There also seems to be no test coverage for this option. How do other people use mipmaps in renderscript then? – Oliver Mattos Aug 20 '17 at 14:57
  • Do you have #pragma rs_fp_relaxed in your code? Also make sure your floating point literals have f at the end, so 2000.f, 1.5f, etc. – sakridge Aug 20 '17 at 18:29
  • Done. No change in performance :-( – Oliver Mattos Aug 21 '17 at 10:33
  • Non mip-mapped perf? – sakridge Aug 22 '17 at 01:22

0 Answers0