Singles matrix input for Screen('MakeTexture')

Hi all,

I’ve been generating custom full-screen images in Matlab and using Screen(‘MakeTexture’) to display them. I found that using singles data type significantly reduce my image generation time, but since Screen(‘MakeTexture’) does not take singles as input, I lost most of the gained time converting my singles matrix to doubles.

Knowing what Screen(‘MakeTexture’) does, I think there’s no reason why it cannot take singles as its image input to make the process more efficient.

So, I took a look at the PTB source code for Screen(‘MakeTexture’). As far as I can tell, to make it accept singles (floats), it is the exact same operations as for doubles with the data type swapped – basically all the sections that deals with doubles needs to be copied and repeated to instead deal with floats. Besides it being a chore and eyesore of a code, does anyone see any issues? Hidden catchas? Is there a more succinct way to approach this?

Blessings,
Spencer

Please provide way more detail. What’s the use case? Sizes of textures? Performance numbers? Sample code? Do you need floating point precision for your textures, or just standard 8 bit per color channel? How many layers do the images have? Have you looked into MakeTextureTimingTest2? Maybe use of MakeTexture optional parameter specialFlags == 4 for internal storage as planar textures is possible and much faster?

While taking double input instead of single (float) input may have some performance impact in your case, going from single() to double() and then back inside MakeTexture, that is usually not the biggest determinant for conversion performance. Things like converting from Matlab’s planar format to OpenGL’s packed format are more expensive, or remapping of color range etc.