ID3D11ShaderResourceView save to file

Started by
16 comments, last by unbird 10 years, 7 months ago

Strange. That function should work fine even for non-staging textures (IIRC it will create a temporary automatically). Fire up PIX and see what's going on.

Edit: How do you actually populate the texture in the first place ? Load it ? Fill it manually with Map/Update or at creation ? Is it also a render target ?

It is a render target(2048x2048).

As for PIX I can't get it to work for some reason.

Advertisement
Read here and especially here. Use at your own risk, but uninstalling that platform update worked fine for me.

Edit: Ah yeah, what did you mean by "empty file" ? All zeroes (so no valid dds file at all) ? Black texture ? How did you check that ?

if i open the dds file with a text editor the first line is this


DDS |             0                                                            DX10                                          
 

and after that it is filled with spaces until the end of the file. (size16MB for a 2048x2048 render target)

of course I can not open the file in any photo/paint editor, it says error etc

That doesn't mean it's a bad file. Maybe your tools just can't cope with half-floats.

Try to load it in the DirectX texture tool: You find it in the SDK folder under \Utilities\bin\x86\DxTex.exe.

That tool won't load it. The D3DX11 functions will save out DDS files using the newer DX10 DDS format, and there's almost no applications that will open it. In fact the only one I know of is Visual Studio 2012.

Strange. I tried something similar before suggesting: I saved (using SlimDX, which uses the above function under the hood) the backbuffer texture 1920x1080 with four channel half-floats. DxTex - both the 32 and 64 bit - load them fine. I don't see such a DX10 marker with a raw/hex viewer though. Is there some trigger (say, size) which "makes" it a DX10 DDS only?

Anyway: xlope01, could you upload this file somewhere, please ?

Also: you can "test" it with the corresponding loading function D3DX11CreateTextureFromFile and render it. Maybe first try a non-DDS format.

Edit: Update: Could go up to 4096^2 and again both DxTex load them fine. @xlope: Something is still off at your side I think. A 2048^2 texture should be 32 MB in size (2048*2048*4*2 = 33'554'432). And another Edit: Wait, maybe I'm silly now, I don't know if DDS does support compression. But a 2048^2 texture saves to approximately 32 MB on my side.

IT is actually working if I load with D3DX11CreateShaderResourceViewFromFile from the dds file that I make with D3DX11SaveTextureToFile (not sure why i can not open it with any photo/paint editor or DxTex)

2048^2 is 32MB with R16G16B16A16, and with R11G11B10 is 16MB

Aaaah, there's the problem. R11G11B10_FLOAT is a newer format. Tried it, suddenly I've got this DX10 marker. Jep, DxTex doesn't cope with that.

Pity that. I think you have to live with it, unfortunately. Neither can I name you a tool which supports it, sorry.

Just as an aside: Make sure to get PIX working. Here's a screenshot from the image save call.
82a105274537842.gif

One can see clearly what's happening, namely the exact sequence Zaoshi Kaba described (the last couple of events in the list). The temporary texture also gets a nice debug name.

This topic is closed to new replies.

Advertisement