Be more defensive in getting max texture slot count.