[D3D9]Cannot recreate streaming texture

There’s a bug with recreating texture with SDL_TEXTURE ACCESS STREAMING flag.
It occurs in D3D_RecreateTextureRep() after resizing a window (SDL_WINDOW_RESIZABLE), just because ‘texture’ argument is null.
Dunno, if i properly loads textures or miss something important: http://wklej.org/hash/2357a4b3ee5/
Obviously, when i use static textures all is working without any problems.

Hi,

(Just trying to help the SDL development team) Would you please file a bug report at http://bugzilla.libsdl.org ?

Nothing out of the ordinary jumps out at me after looking at your sample. I’ll see if I can reproduce the bug on my end and report back!

Jeffrey Carpenter
@Jeffrey_Carpenter> On Nov 5, 2014, at 4:42, “Flash” wrote:

There’s a bug with recreating texture with SDL_TEXTURE ACCESS STREAMING flag.
It occurs in D3D_RecreateTextureRep() after resizing a window (SDL_WINDOW_RESIZABLE), just because ‘texture’ argument is null.
Dunno, if i properly loads textures or miss something important: http://wklej.org/hash/2357a4b3ee5/
Obviously, when i use static textures all is working without any problems.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

After taking another look at your code … are you freeing the current texture before you recreate the texture with a new source? If not, you could run into problems …

I’m fairly certain that I’ve ran into invalid memory problems before upon resizing existing textures if I do not free the source before re-purposing with new dimensions. (My memory is really fuzzy at the moment … just had couple teeth pulled…) In these cases, the “bug” is not a bug at all, but rather improper usage of memory on your end.

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>

are you freeing the current texture before you recreate the texture with a new source?

Well, i don’t even want to recreate texture, but this process is forced by directx renderer in SDL after window resizing. If i remember correctly this should be the lost device problem of dx9 (D3DERR_DEVICELOST).

The simplest way to reproduce it, it’s to download lesson 42 from lazy foo’s SDL2 tutorials and add SDL_WINDOW_RESIZABLE flag.

Thanks for giving me an easy route for trying to reproduce the bug! Unfortunately, I wasn?t able to reproduce the issue with using the code from lesson 42 what I presume to be SDL2 using the DX11 API on my system.

I?m not at all familiar with how I?d go about telling SDL2 to use DX9 instead, but something tells me I?d have to rebuild SDL2 for that ? I?m not really setup for going that far to continue testing. I might give it a try sometime soon but no promises! If somebody that was familiar with the process could give me any tips, I might well be more motivated in trying…

The SDL thread "[SDL] Need to re-construct all the textures after resizing window?? might either be related to your problem or may at least be worth taking a look at: https://forums.libsdl.org/viewtopic.php?p=42106&sid=c1192563085b63c68d5f4440e1778878

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>

I was poking around ? where does D3D_RecreateTextureRep exist in the SDL source tree? I wasn?t able to find it with a grep …

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>

Thanks for giving me an easy route for trying to reproduce the bug! Unfortunately, I wasn?t able to reproduce the issue with using the code from lesson 42 what I presume to be SDL2 using the DX11 API on my system.

It’s interesting, because i also should have forced DX11.

The SDL thread "[SDL] Need to re-construct all the textures after resizing window?? might either be related to your problem or may at least be worth taking a look at: https://forums.libsdl.org/viewtopic.php?p=42106&sid=c1192563085b63c68d5f4440e1778878

It’s related but the difference is huge. Just because it’s much easier to create a render target texture and re-render to it.

That’s stupid if i need to keep data manually for recreating texture.

I was poking around
where does D3D_RecreateTextureRep exist in the SDL source tree? I wasn?t able to find it with a grep … Cheers,

src/render/direct3d/SDL_render_d3d.c
line 884
I’m using the lastest SDL from HG.

Thx for investigation, but you don’t need to be hurry.
It’s not something that much important for me :slight_smile:

What do you mean by forcing DX11?

Yeah, it would amount to being a huge pain in the ass ? sometimes it cannot be helped, but it seems as though in this case, it is a potential bug. In any regard, it wouldn?t be a bad idea to file a bug report, Sam & friends would likely know the details surrounding this.

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>

Jeffrey Carpenter wrote:

What do you mean by forcing DX11?

I mean, my hardware supports DX11, so SDL should enable DX11 rather than DX9.

Jeffrey Carpenter wrote:

Yeah, it would amount to being a huge pain in the ass
sometimes it cannot be helped, but it seems as though in this case, it is a potential bug. In any regard, it wouldn?t be a bad idea to file a bug report, Sam & friends would likely know the details surrounding this.

So, shall I post a bug report on bugzilla, huh?