check for correct graphics state