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 - [PATCH] Updated YUV texture is never drawn
Summary: [PATCH] Updated YUV texture is never drawn
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.0
Hardware: x86_64 Windows 10
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-21 02:52 UTC by Cameron Gutman
Modified: 2019-06-21 03:21 UTC (History)
0 users

See Also:


Attachments
Patch to address the issue (1.06 KB, patch)
2019-06-21 02:52 UTC, Cameron Gutman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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