|
|
|
|
|
|
public static int s_MaxWidthMSAAA { get { return s_MaxWidths[(int)RTCategory.MSAA]; } } |
|
|
|
public static int s_MaxHeightMSAA { get { return s_MaxHeights[(int)RTCategory.MSAA]; } } |
|
|
|
|
|
|
|
private static int GetMaxWith(RTCategory category) { return s_MaxWidths[(int)category]; } |
|
|
|
private static int GetMaxWidth(RTCategory category) { return s_MaxWidths[(int)category]; } |
|
|
|
private static int GetMaxHeight(RTCategory category) { return s_MaxHeights[(int)category]; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int[] s_MaxWidths = new int[(int)RTCategory.Count]; |
|
|
|
static int[] s_MaxHeights = new int[(int)RTCategory.Count]; |
|
|
|
|
|
|
|
public static int maxWidth { get { return GetMaxWith(s_ScaledRTCurrentCategory); } } |
|
|
|
public static int maxWidth { get { return GetMaxWidth(s_ScaledRTCurrentCategory); } } |
|
|
|
public static int maxHeight { get { return GetMaxHeight(s_ScaledRTCurrentCategory); } } |
|
|
|
|
|
|
|
static RTHandle() |
|
|
|
|
|
|
height = Mathf.Max(height, 1); |
|
|
|
|
|
|
|
bool msaaSamplesChanged = msaa && (msaaSamples != s_ScaledRTCurrentMSAASamples); |
|
|
|
if (width > GetMaxWith(category) || height > GetMaxHeight(category) || msaaSamplesChanged) |
|
|
|
if (width > GetMaxWidth(category) || height > GetMaxHeight(category) || msaaSamplesChanged) |
|
|
|
Resize(width, height, category, msaaSamples); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
height = Mathf.Max(height, 1); |
|
|
|
|
|
|
|
bool msaaSamplesChanged = msaa && (msaaSamples != s_ScaledRTCurrentMSAASamples); |
|
|
|
if (width != GetMaxWith(category) || height != GetMaxHeight(category) || msaaSamplesChanged) |
|
|
|
if (width != GetMaxWidth(category) || height != GetMaxHeight(category) || msaaSamplesChanged) |
|
|
|
Resize(width, height, category, msaaSamples); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
bool allocForMSAA = s_ScaledRTSupportsMSAA ? enableMSAA : false; |
|
|
|
RTCategory category = allocForMSAA ? RTCategory.MSAA : RTCategory.Regular; |
|
|
|
|
|
|
|
int width = Mathf.Max(Mathf.RoundToInt(scaleFactor.x * GetMaxWith(category)), 1); |
|
|
|
int width = Mathf.Max(Mathf.RoundToInt(scaleFactor.x * GetMaxWidth(category)), 1); |
|
|
|
int height = Mathf.Max(Mathf.RoundToInt(scaleFactor.y * GetMaxHeight(category)), 1); |
|
|
|
|
|
|
|
var rth = AllocAutoSizedRenderTexture(width, |
|
|
|
|
|
|
bool allocForMSAA = s_ScaledRTSupportsMSAA ? enableMSAA : false; |
|
|
|
RTCategory category = allocForMSAA ? RTCategory.MSAA : RTCategory.Regular; |
|
|
|
|
|
|
|
var scaleFactor = scaleFunc(new Vector2Int(GetMaxWith(category), GetMaxHeight(category))); |
|
|
|
var scaleFactor = scaleFunc(new Vector2Int(GetMaxWidth(category), GetMaxHeight(category))); |
|
|
|
int width = Mathf.Max(scaleFactor.x, 1); |
|
|
|
int height = Mathf.Max(scaleFactor.y, 1); |
|
|
|
|
|
|
|