We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4678

Summary: [PATCH] Updated YUV texture is never drawn
Product: SDL Reporter: Cameron Gutman <cameron.gutman>
Component: renderAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: Windows 10   
Attachments: Patch to address the issue

Description Cameron Gutman 2019-06-21 02:52:17 UTC
My code implements a basic video rendering loop with the following code:

    SDL_UpdateYUVTexture(m_Texture, nullptr,
                         frame->data[0],
                         frame->linesize[0],
                         frame->data[1],
                         frame->linesize[1],
                         frame->data[2],
                         frame->linesize[2]);
    SDL_RenderClear(m_Renderer);
    SDL_RenderCopy(m_Renderer, m_Texture, nullptr, nullptr);
    SDL_RenderPresent(m_Renderer);


This is broken in the latest HG (and 2.0.10 prerelease). It now only renders the first frame of video and nothing more. It continues to successfully present frames, but they are copies of the initial YUV texture.

The problem is that the D3D renderer's SetDrawState() tries avoid making D3D calls if the texture is still in the same state as before. However, the texture's dirty status is not taken into account. As a result, UpdateDirtyTexture() is never called and the texture retains its original contents forever.
Comment 1 Cameron Gutman 2019-06-21 02:52:46 UTC
Created attachment 3836 [details]
Patch to address the issue
Comment 2 Sam Lantinga 2019-06-21 03:21:13 UTC
Patch added, thanks!
https://hg.libsdl.org/SDL/rev/89b3e1e9839c