// Native NeedsExposureControl doesn't work for RenderTextures (they are hardcoded to return kTexFormatUnknown). protected bool NeedsExposureControl(Texture t) { TextureUsageMode usageMode = TextureUtil.GetUsageMode(t); return(GraphicsFormatUtility.IsHDRFormat(t.graphicsFormat) || TextureUtil.IsRGBMUsageMode(usageMode) || TextureUtil.IsDoubleLDRUsageMode(usageMode)); }
public override string GetInfoString() { // TextureInspector code is reused for RenderTexture and Cubemap inspectors. // Make sure we can handle the situation where target is just a Texture and // not a Texture2D. Texture t = target as Texture; Texture2D t2 = target as Texture2D; TextureImporter textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(t)) as TextureImporter; string info = t.width + "x" + t.height; bool showSize = true; bool isPackedSprite = textureImporter && textureImporter.qualifiesForSpritePacking; bool isNormalmap = IsNormalMap(t); bool stillNeedsCompression = textureImporter && textureImporter.textureStillNeedsToBeCompressed; bool isNPOT = t2 != null && TextureUtil.IsNonPowerOfTwo(t2); GraphicsFormat format = t.graphicsFormat; showSize = !stillNeedsCompression; if (isNPOT) { info += " (NPOT)"; } if (stillNeedsCompression) { info += " (Not yet compressed)"; } else { if (isNormalmap) { switch (format) { case GraphicsFormat.RGBA_DXT5_SRGB: case GraphicsFormat.RGBA_DXT5_UNorm: info += " DXTnm"; break; case GraphicsFormat.R8G8B8A8_SRGB: case GraphicsFormat.R8G8B8A8_UNorm: case GraphicsFormat.B8G8R8A8_SRGB: case GraphicsFormat.B8G8R8A8_UNorm: info += " Nm 32 bit"; break; case GraphicsFormat.R4G4B4A4_UNormPack16: case GraphicsFormat.B4G4R4A4_UNormPack16: info += " Nm 16 bit"; break; default: info += " " + GraphicsFormatUtility.GetFormatString(format); break; } } else if (isPackedSprite) { TextureFormat desiredFormat; ColorSpace dummyColorSpace; int dummyComressionQuality; textureImporter.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out desiredFormat, out dummyColorSpace, out dummyComressionQuality); info += "\n " + GraphicsFormatUtility.GetFormatString(format) + "(Original) " + GraphicsFormatUtility.GetFormatString(desiredFormat) + "(Atlas)"; } else { info += " " + GraphicsFormatUtility.GetFormatString(format); } } if (showSize) { info += "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySizeLong(t)); } TextureUsageMode mode = TextureUtil.GetUsageMode(t); if (mode == TextureUsageMode.AlwaysPadded) { var glWidth = TextureUtil.GetGPUWidth(t); var glHeight = TextureUtil.GetGPUHeight(t); if (t.width != glWidth || t.height != glHeight) { info += UnityString.Format("\nPadded to {0}x{1}", glWidth, glHeight); } } else if (TextureUtil.IsRGBMUsageMode(mode)) { info += "\nRGBM encoded"; } else if (TextureUtil.IsDoubleLDRUsageMode(mode)) { info += "\ndLDR encoded"; } return(info); }