[SDL3] Text offset and resetting LogicalPresentation mid rendering

Hello,

I started playing recently with the SDL3 API, and puzzled by the following behavior.

I imported a JPG image in a texture using SDL_image, and set my renderer logical presentation to
SDL_LOGICAL_PRESENTATION_LETTERBOX, so that the image aspect ratio stays the same whatever the size of the window. This works just fine.
Now the thing is I am also trying to overlay the current fps on the window using SDL_RenderDebugTextFormat(). I’d like it to always be displayed at the top left of the window - however, even if I reset the LogicalPresentation mode to SDL_LOGICAL_PRESENTATION_DISABLED, the FPS overlay appear on top of the image. It looks like the coordinates are still relative to the texture.

The SDL_SetRenderLogicalPresentation doc says it is OK to change the logical presentation mode mid rendering, and actually, if I do not disable the LogicalPresentation mode before displaying the text, the text ends up scaled, which makes total sense. However the text offset still puzzles me.

What could I be missing ?

Relevant code below, as well as screenshot. I would have assumed the fps to be displayed in the vertical black band on the left (top left of the window, not top left of the rendered texture).

Thanks,

Seb

SDL_AppResult SDL_AppIterate(void *appstate) {
    const int charsize = SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE;
    struct app_context_s *ctx = (struct app_context_s *)appstate;
    float w, h;

    SDL_GetTextureSize(ctx->texture, &w, &h);
    if (!SDL_SetRenderLogicalPresentation(ctx->renderer, (int)w, (int)h, SDL_LOGICAL_PRESENTATION_LETTERBOX)) {
        SDL_Log("Couldn't set logical presentation mode: %s", SDL_GetError());
        return SDL_APP_FAILURE;
    }
    SDL_SetRenderDrawColor(ctx->renderer, 0, 0, 0, SDL_ALPHA_OPAQUE);
    SDL_RenderClear(ctx->renderer);
    SDL_RenderTexture(ctx->renderer, ctx->texture, NULL, NULL);

    if (!SDL_SetRenderLogicalPresentation(ctx->renderer, 0, 0, SDL_LOGICAL_PRESENTATION_DISABLED)) {
        SDL_Log("Couldn't set logical presentation mode: %s", SDL_GetError());
        return SDL_APP_FAILURE;
    }
    /* Display fps */
    SDL_SetRenderDrawColor(ctx->renderer, 255, 0, 0, SDL_ALPHA_OPAQUE);
    SDL_RenderDebugTextFormat(ctx->renderer, 5, charsize, "FPS: %.2f",
                              get_fps(SDL_GetTicks()));
    /* Push to screen. */
    SDL_RenderPresent(ctx->renderer);

    return SDL_APP_CONTINUE; /* carry on with the program! */
}