HeavenWu / slimdx

Automatically exported from code.google.com/p/slimdx
MIT License
0 stars 0 forks source link

Textures cannot be written to an empty stream #638

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In Direct3D11::Texture2D::ToStream, there is a check:

if( static_cast<SIZE_T>( stream->Length - stream->Position ) < blob-
>GetBufferSize() )
            throw gcnew InvalidOperationException( "The 
specified stream does not have sufficient capacity for the specified 
texture." );

This means you can't write the texture to a new memory or file stream, for 
example.  The same check exists in Texture1D and Texture3D.

Original issue reported on code.google.com by corng...@gmail.com on 19 Mar 2010 at 12:59

GoogleCodeExporter commented 8 years ago
I'm pretty sure you can call SetLength to resize the stream appropriately:
http://msdn.microsoft.com/en-us/library/system.io.filestream.setlength.aspx

Original comment by promit....@gmail.com on 19 Mar 2010 at 10:48

GoogleCodeExporter commented 8 years ago
Looks like there's no sane way to know what the correct stream size is before
calling, so we'll go ahead and drop the checks.

Original comment by promit....@gmail.com on 22 Mar 2010 at 3:57

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r1463.

Original comment by promit....@gmail.com on 22 Mar 2010 at 10:41