Villacaleb / slimdx

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

MapSubresource shouldnt have a sizeInBytes parameter #801

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This parameter is passed to MapSubresource() and used to set the length of the 
DataStream returned. However knowing the proper value for this before the call 
is impossible before the D3D MapSubresource() call.

In principle the pitch returned by MapSubresource() could be arbitary for 
textures, hence the size of the data stream cannot be determined in advance(ie 
there is no size in bytes member in the description).

I propose that the MapSubresource() call should compute the size of the 
DataStream based upon the subresource dimensions and the pitch/slice pitch 
provided by D3D for textures. Use the buffer SizeInBytes for buffers etc.

A workaround is to pass in int.MaxValue(zero does not work since the DataStream 
throws an ArgumentOutOfRangeException). However this means that there is no 
possibility for the DataStream to validate the range written to and it returns 
a meaningless length.

Original issue reported on code.google.com by dbl...@fastmail.fm on 31 May 2011 at 12:49

GoogleCodeExporter commented 9 years ago

Original comment by Mike.Popoloski on 8 Jul 2011 at 4:41

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2113.

Original comment by Mike.Popoloski on 17 Jul 2011 at 7:04