Bragg thickness criterion for intracavity diffraction gratings