e]$bytesBudget = $pTotalVideoMemory * $script:allowedMemoryBudgetFraction;

    return $bytesNeeded -le $bytesBudget
}

#Compute the lowest passing memory size
function ComputeForLowestPassingMemSize([bool]$transparency)
{
    [int]$top = 1024;
    [int]$bottom = 0

    do {
	    [double]$douVal = ($bottom + ($top - $bottom) / 2) * 1024 * 1024
        if (CheckVideoMemory $transparency $douVal)
        {
            $top = $top - (($top - $bottom) / 2)
        }
        else
        {
            $bottom = $bottom + (($top - $bottom) / 2)
        }
    } while(($top - $bottom) -gt 1);

    return $top
}
