Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL3 multiviewport fix for non-shared textures (for fonts only) #7678

Open
wants to merge 10 commits into
base: features/sdl_renderer3_multiviewports
Choose a base branch
from

Conversation

HDAKFD
Copy link

@HDAKFD HDAKFD commented Jun 9, 2024

Very nasty fix for SDL3 not being able to share fonts between renderers, but it works.

Though i think this needs better solution, pointer comparing isn't the best approach

SDL_Texture * tex = (SDL_Texture*)pcmd->GetTexID();

if (tex == bd->FontTexture)
{
    if (texture != nullptr)
    {
        tex = texture;
    }
}

@HDAKFD HDAKFD changed the title Features/sdl renderer3 multiviewports FONTS fix Broken SDL3 multiviewport fix caused by fonts Jun 9, 2024
@ocornut
Copy link
Owner

ocornut commented Jun 9, 2024

This is probably reliant on certain backend and os and is unlikely to work with all of them supported by SDL.

@HDAKFD
Copy link
Author

HDAKFD commented Jun 9, 2024

This is probably reliant on certain backend and os and is unlikely to work with all of them supported by SDL.

It might be, also after doing some research i found out that there is ways to copy the textures between renderers rather than recreating them.

Though SDL3 still to this date does not support sharing textures between 2 different SDL_Renderer instances without any extra code. So something needs to be done about it.

@ocornut
Copy link
Owner

ocornut commented Jun 9, 2024

It’s well known what needs to be done, but SDL Renderer for some backends creates one device per renderer making the textures non sharable.
See my link #7675 (comment)
I can tell your PR isn’t going to work accross multiple renderers.

@ocornut ocornut closed this Jun 9, 2024
@ocornut ocornut reopened this Jun 9, 2024
@ocornut ocornut changed the title Broken SDL3 multiviewport fix caused by fonts SDL3 multiviewport fix for non-shared textures (for fonts only) Jun 12, 2024
@ocornut ocornut force-pushed the features/sdl_renderer3_multiviewports branch from b834972 to bae7f8f Compare July 1, 2024 15:25
@ocornut ocornut force-pushed the features/sdl_renderer3_multiviewports branch from bae7f8f to ee14dfd Compare July 18, 2024 16:31
@ocornut ocornut force-pushed the features/sdl_renderer3_multiviewports branch from ee14dfd to b02532f Compare July 30, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants