@@ -8,65 +8,65 @@ namespace UnityEngine.Rendering.PostProcessing
8
8
// Temporary code dump until the texture format refactor goes into trunk...
9
9
public static class TextureFormatUtilities
10
10
{
11
- static Dictionary < TextureFormat , RenderTextureFormat > s_FormatAliasMap ;
11
+ static Dictionary < int , RenderTextureFormat > s_FormatAliasMap ;
12
12
static Dictionary < int , bool > s_SupportedRenderTextureFormats ;
13
13
14
14
static TextureFormatUtilities ( )
15
15
{
16
- s_FormatAliasMap = new Dictionary < TextureFormat , RenderTextureFormat >
16
+ s_FormatAliasMap = new Dictionary < int , RenderTextureFormat >
17
17
{
18
- { TextureFormat . Alpha8 , RenderTextureFormat . ARGB32 } ,
19
- { TextureFormat . ARGB4444 , RenderTextureFormat . ARGB4444 } ,
20
- { TextureFormat . RGB24 , RenderTextureFormat . ARGB32 } ,
21
- { TextureFormat . RGBA32 , RenderTextureFormat . ARGB32 } ,
22
- { TextureFormat . ARGB32 , RenderTextureFormat . ARGB32 } ,
23
- { TextureFormat . RGB565 , RenderTextureFormat . RGB565 } ,
24
- { TextureFormat . R16 , RenderTextureFormat . RHalf } ,
25
- { TextureFormat . DXT1 , RenderTextureFormat . ARGB32 } ,
26
- { TextureFormat . DXT5 , RenderTextureFormat . ARGB32 } ,
27
- { TextureFormat . RGBA4444 , RenderTextureFormat . ARGB4444 } ,
28
- { TextureFormat . BGRA32 , RenderTextureFormat . ARGB32 } ,
29
- { TextureFormat . RHalf , RenderTextureFormat . RHalf } ,
30
- { TextureFormat . RGHalf , RenderTextureFormat . RGHalf } ,
31
- { TextureFormat . RGBAHalf , RenderTextureFormat . ARGBHalf } ,
32
- { TextureFormat . RFloat , RenderTextureFormat . RFloat } ,
33
- { TextureFormat . RGFloat , RenderTextureFormat . RGFloat } ,
34
- { TextureFormat . RGBAFloat , RenderTextureFormat . ARGBFloat } ,
35
- { TextureFormat . RGB9e5Float , RenderTextureFormat . ARGBHalf } ,
36
- { TextureFormat . BC4 , RenderTextureFormat . R8 } ,
37
- { TextureFormat . BC5 , RenderTextureFormat . RGHalf } ,
38
- { TextureFormat . BC6H , RenderTextureFormat . ARGBHalf } ,
39
- { TextureFormat . BC7 , RenderTextureFormat . ARGB32 } ,
18
+ { ( int ) TextureFormat . Alpha8 , RenderTextureFormat . ARGB32 } ,
19
+ { ( int ) TextureFormat . ARGB4444 , RenderTextureFormat . ARGB4444 } ,
20
+ { ( int ) TextureFormat . RGB24 , RenderTextureFormat . ARGB32 } ,
21
+ { ( int ) TextureFormat . RGBA32 , RenderTextureFormat . ARGB32 } ,
22
+ { ( int ) TextureFormat . ARGB32 , RenderTextureFormat . ARGB32 } ,
23
+ { ( int ) TextureFormat . RGB565 , RenderTextureFormat . RGB565 } ,
24
+ { ( int ) TextureFormat . R16 , RenderTextureFormat . RHalf } ,
25
+ { ( int ) TextureFormat . DXT1 , RenderTextureFormat . ARGB32 } ,
26
+ { ( int ) TextureFormat . DXT5 , RenderTextureFormat . ARGB32 } ,
27
+ { ( int ) TextureFormat . RGBA4444 , RenderTextureFormat . ARGB4444 } ,
28
+ { ( int ) TextureFormat . BGRA32 , RenderTextureFormat . ARGB32 } ,
29
+ { ( int ) TextureFormat . RHalf , RenderTextureFormat . RHalf } ,
30
+ { ( int ) TextureFormat . RGHalf , RenderTextureFormat . RGHalf } ,
31
+ { ( int ) TextureFormat . RGBAHalf , RenderTextureFormat . ARGBHalf } ,
32
+ { ( int ) TextureFormat . RFloat , RenderTextureFormat . RFloat } ,
33
+ { ( int ) TextureFormat . RGFloat , RenderTextureFormat . RGFloat } ,
34
+ { ( int ) TextureFormat . RGBAFloat , RenderTextureFormat . ARGBFloat } ,
35
+ { ( int ) TextureFormat . RGB9e5Float , RenderTextureFormat . ARGBHalf } ,
36
+ { ( int ) TextureFormat . BC4 , RenderTextureFormat . R8 } ,
37
+ { ( int ) TextureFormat . BC5 , RenderTextureFormat . RGHalf } ,
38
+ { ( int ) TextureFormat . BC6H , RenderTextureFormat . ARGBHalf } ,
39
+ { ( int ) TextureFormat . BC7 , RenderTextureFormat . ARGB32 } ,
40
40
#if ! UNITY_IOS && ! UNITY_TVOS
41
- { TextureFormat . DXT1Crunched , RenderTextureFormat . ARGB32 } ,
42
- { TextureFormat . DXT5Crunched , RenderTextureFormat . ARGB32 } ,
41
+ { ( int ) TextureFormat . DXT1Crunched , RenderTextureFormat . ARGB32 } ,
42
+ { ( int ) TextureFormat . DXT5Crunched , RenderTextureFormat . ARGB32 } ,
43
43
#endif
44
- { TextureFormat . PVRTC_RGB2 , RenderTextureFormat . ARGB32 } ,
45
- { TextureFormat . PVRTC_RGBA2 , RenderTextureFormat . ARGB32 } ,
46
- { TextureFormat . PVRTC_RGB4 , RenderTextureFormat . ARGB32 } ,
47
- { TextureFormat . PVRTC_RGBA4 , RenderTextureFormat . ARGB32 } ,
44
+ { ( int ) TextureFormat . PVRTC_RGB2 , RenderTextureFormat . ARGB32 } ,
45
+ { ( int ) TextureFormat . PVRTC_RGBA2 , RenderTextureFormat . ARGB32 } ,
46
+ { ( int ) TextureFormat . PVRTC_RGB4 , RenderTextureFormat . ARGB32 } ,
47
+ { ( int ) TextureFormat . PVRTC_RGBA4 , RenderTextureFormat . ARGB32 } ,
48
48
#if ! UNITY_2018_1_OR_NEWER
49
- { TextureFormat . ATC_RGB4 , RenderTextureFormat . ARGB32 } ,
50
- { TextureFormat . ATC_RGBA8 , RenderTextureFormat . ARGB32 } ,
49
+ { ( int ) TextureFormat . ATC_RGB4 , RenderTextureFormat . ARGB32 } ,
50
+ { ( int ) TextureFormat . ATC_RGBA8 , RenderTextureFormat . ARGB32 } ,
51
51
#endif
52
- { TextureFormat . ETC_RGB4 , RenderTextureFormat . ARGB32 } ,
53
- { TextureFormat . ETC2_RGB , RenderTextureFormat . ARGB32 } ,
54
- { TextureFormat . ETC2_RGBA1 , RenderTextureFormat . ARGB32 } ,
55
- { TextureFormat . ETC2_RGBA8 , RenderTextureFormat . ARGB32 } ,
56
- { TextureFormat . ASTC_RGB_4x4 , RenderTextureFormat . ARGB32 } ,
57
- { TextureFormat . ASTC_RGB_5x5 , RenderTextureFormat . ARGB32 } ,
58
- { TextureFormat . ASTC_RGB_6x6 , RenderTextureFormat . ARGB32 } ,
59
- { TextureFormat . ASTC_RGB_8x8 , RenderTextureFormat . ARGB32 } ,
60
- { TextureFormat . ASTC_RGB_10x10 , RenderTextureFormat . ARGB32 } ,
61
- { TextureFormat . ASTC_RGB_12x12 , RenderTextureFormat . ARGB32 } ,
62
- { TextureFormat . ASTC_RGBA_4x4 , RenderTextureFormat . ARGB32 } ,
63
- { TextureFormat . ASTC_RGBA_5x5 , RenderTextureFormat . ARGB32 } ,
64
- { TextureFormat . ASTC_RGBA_6x6 , RenderTextureFormat . ARGB32 } ,
65
- { TextureFormat . ASTC_RGBA_8x8 , RenderTextureFormat . ARGB32 } ,
66
- { TextureFormat . ASTC_RGBA_10x10 , RenderTextureFormat . ARGB32 } ,
67
- { TextureFormat . ASTC_RGBA_12x12 , RenderTextureFormat . ARGB32 } ,
68
- { TextureFormat . ETC_RGB4_3DS , RenderTextureFormat . ARGB32 } ,
69
- { TextureFormat . ETC_RGBA8_3DS , RenderTextureFormat . ARGB32 }
52
+ { ( int ) TextureFormat . ETC_RGB4 , RenderTextureFormat . ARGB32 } ,
53
+ { ( int ) TextureFormat . ETC2_RGB , RenderTextureFormat . ARGB32 } ,
54
+ { ( int ) TextureFormat . ETC2_RGBA1 , RenderTextureFormat . ARGB32 } ,
55
+ { ( int ) TextureFormat . ETC2_RGBA8 , RenderTextureFormat . ARGB32 } ,
56
+ { ( int ) TextureFormat . ASTC_RGB_4x4 , RenderTextureFormat . ARGB32 } ,
57
+ { ( int ) TextureFormat . ASTC_RGB_5x5 , RenderTextureFormat . ARGB32 } ,
58
+ { ( int ) TextureFormat . ASTC_RGB_6x6 , RenderTextureFormat . ARGB32 } ,
59
+ { ( int ) TextureFormat . ASTC_RGB_8x8 , RenderTextureFormat . ARGB32 } ,
60
+ { ( int ) TextureFormat . ASTC_RGB_10x10 , RenderTextureFormat . ARGB32 } ,
61
+ { ( int ) TextureFormat . ASTC_RGB_12x12 , RenderTextureFormat . ARGB32 } ,
62
+ { ( int ) TextureFormat . ASTC_RGBA_4x4 , RenderTextureFormat . ARGB32 } ,
63
+ { ( int ) TextureFormat . ASTC_RGBA_5x5 , RenderTextureFormat . ARGB32 } ,
64
+ { ( int ) TextureFormat . ASTC_RGBA_6x6 , RenderTextureFormat . ARGB32 } ,
65
+ { ( int ) TextureFormat . ASTC_RGBA_8x8 , RenderTextureFormat . ARGB32 } ,
66
+ { ( int ) TextureFormat . ASTC_RGBA_10x10 , RenderTextureFormat . ARGB32 } ,
67
+ { ( int ) TextureFormat . ASTC_RGBA_12x12 , RenderTextureFormat . ARGB32 } ,
68
+ { ( int ) TextureFormat . ETC_RGB4_3DS , RenderTextureFormat . ARGB32 } ,
69
+ { ( int ) TextureFormat . ETC_RGBA8_3DS , RenderTextureFormat . ARGB32 }
70
70
} ;
71
71
72
72
// In 2018.1 SystemInfo.SupportsRenderTextureFormat() generates garbage so we need to
@@ -93,7 +93,7 @@ public static RenderTextureFormat GetUncompressedRenderTextureFormat(Texture tex
93
93
var inFormat = ( ( Texture2D ) texture ) . format ;
94
94
RenderTextureFormat outFormat ;
95
95
96
- if ( ! s_FormatAliasMap . TryGetValue ( inFormat , out outFormat ) )
96
+ if ( ! s_FormatAliasMap . TryGetValue ( ( int ) inFormat , out outFormat ) )
97
97
throw new NotSupportedException ( "Texture format not supported" ) ;
98
98
99
99
return outFormat ;
0 commit comments