@@ -99,34 +99,42 @@ float4 GetStreamingMipColor(uint mipCount, float4 mipInfo)
9999 // w = 0
100100 uint originalTextureMipCount = uint (mipInfo.y);
101101
102+ float4 res = 0.0 ;
103+
102104 // If material/shader mip info (original mip level) has not been set its not a streamed texture
103105 if (originalTextureMipCount == 0 )
104- return float4 (1.0 , 1.0 , 1.0 , 0.0 );
105-
106- uint desiredMipLevel = uint (mipInfo.z);
107- uint mipCountDesired = uint (originalTextureMipCount)-uint (desiredMipLevel);
108- if (mipCount == 0 )
109- {
110- // Magenta if mip count invalid
111- return float4 (1.0 , 0.0 , 1.0 , 1.0 );
112- }
113- else if (mipCount < mipCountDesired)
114106 {
115- // red tones when not at the desired mip level (reduction due to budget). Brighter is further from original, alpha 0 when at desired
116- float ratioToDesired = float (mipCount) / float (mipCountDesired);
117- return float4 (1.0 , 0.0 , 0.0 , 1.0 - ratioToDesired);
118- }
119- else if (mipCount >= originalTextureMipCount)
120- {
121- // original color when at (or beyond) original mip count
122- return float4 (1.0 , 1.0 , 1.0 , 0.0 );
107+ res = float4 (1.0 , 1.0 , 1.0 , 0.0 );
123108 }
124109 else
125110 {
126- // green tones when not at the original mip level. Brighter is closer to original, alpha 0 when at original
127- float ratioToOriginal = float (mipCount) / float (originalTextureMipCount);
128- return float4 (0.0 , 1.0 , 0.0 , 1.0 - ratioToOriginal);
111+ uint desiredMipLevel = uint (mipInfo.z);
112+ uint mipCountDesired = uint (originalTextureMipCount)-uint (desiredMipLevel);
113+ if (mipCount == 0 )
114+ {
115+ // Magenta if mip count invalid
116+ res = float4 (1.0 , 0.0 , 1.0 , 1.0 );
117+ }
118+ else if (mipCount < mipCountDesired)
119+ {
120+ // red tones when not at the desired mip level (reduction due to budget). Brighter is further from original, alpha 0 when at desired
121+ float ratioToDesired = float (mipCount) / float (mipCountDesired);
122+ res = float4 (1.0 , 0.0 , 0.0 , 1.0 - ratioToDesired);
123+ }
124+ else if (mipCount >= originalTextureMipCount)
125+ {
126+ // original color when at (or beyond) original mip count
127+ res = float4 (1.0 , 1.0 , 1.0 , 0.0 );
128+ }
129+ else
130+ {
131+ // green tones when not at the original mip level. Brighter is closer to original, alpha 0 when at original
132+ float ratioToOriginal = float (mipCount) / float (originalTextureMipCount);
133+ res = float4 (0.0 , 1.0 , 0.0 , 1.0 - ratioToOriginal);
134+ }
129135 }
136+
137+ return res;
130138}
131139
132140float4 GetSimpleMipCountColor (uint mipCount)
0 commit comments