Unified model of necking and shear banding in amorphous and semicrystalline polymers