Superfluous "Requested RenderTexture format is not supported on this platform" warnings

We recently upgraded our Unity project from 2018 to 2020.3.11f1 and now on startup we constantly get the warning “Requested RenderTexture format R8 sRGB (1) is not supported on this platform, using R8 UNorm (5) fallback format” filling up the console window on startup. The warnings themselves seem to be harmless but they really increase the noise in the console. There’s no callstack or anything to indicate where the warnings are coming from. Is there somehow we can pinpoint the cause of the warnings and fix them?

Our project does use a couple custom effects that use single 8-bit channel RenderTextures that we create with RenderTextureFormat.R8 but I see nowhere to specify whether it’s sRGB or UNorm.
Unity - Scripting API: RenderTextureFormat (unity3d.com)

I tried deleting Library\ShaderCache as suggested in some other forum posts with similar warnings but no luck.

Hey !

You might want to create your RenderTexture using a GraphicsFormat instead (Unity - Scripting API: GraphicsFormat), you will be able to easily specify if you want it sRGB or UNorm.

Edit : I believe you can also try this :
new RenderTexture(width, height, depth, RenderTextureFormat.R8, RenderTextureReadWrite.Linear)

Let me know if that works for you :slight_smile:

Thanks for the tip! I’ve just been inundated with other tasks but I’ll try it out when I get the chance.

A couple quick questions though:

  1. Rendering.GraphicsFormat is listed under “Experimental” - is that still safe to use in production?
  2. The warning message makes me think this is platform dependent; our game is for Android and iOS, so will we need to test both sRGB and UNorm and then choose the one that’s supported?

We’ve been working on getting GraphicsFormat out of experimental. It’s not fully there yet but it is the format to use if you want to know what format is being used by the graphics hardware.
Higher level formats like RenderTextureFormat are less specific and have some more automatic fallback options.
That does tend to lead to issues where you unknowingly end up with a format that doesn’t exactly do what you expect it to.
GraphicsFormat indeed requires you to manually test for a suitable format that the current platform supports. You can then adapt your code’s behavior to the supported format. There should be quite a few functions to help in the GraphicsFormatUtility class.