(a) If after an informal inquiry the court determines that evidence exists to support a finding of incompetency, the court shall order an examination under Subchapter B to determine whether the defendant is incompetent to stand trial in a criminal case.
(b) Except as provided by Subsection (c), the court shall hold a trial under Subchapter C before determining whether the defendant is incompetent to stand trial on the merits.
(c) A trial under this chapter is not required if:
(1) neither party’s counsel requests a trial on the issue of incompetency;
(2) neither party’s counsel opposes a finding of incompetency; and
(3) the court does not, on its own motion, determine that a trial is necessary to determine incompetency.
(d) If the issue of the defendant’s incompetency to stand trial is raised after the trial on the merits begins, the court may determine the issue at any time before the sentence is pronounced. If the determination is delayed until after the return of a verdict, the court shall make the determination as soon as reasonably possible after the return. If a verdict of not guilty is returned, the court may not determine the issue of incompetency.