我正在尝试从内存数据创建SharpDX.Direct3D11.Texture2D但总是得到SharpDXException(HRESULT:0x80070057,"参数不正确.").我为此目的使用了Texture1D,之前可以毫无问题地创建它.
我已将代码减少到此样本,但仍会产生异常:
using (var device = new Device(DriverType.Hardware, DeviceCreationFlags.Debug)) {
// empty stream sufficient for example
var stream = new DataStream(16 * 4, true, true);
var description1D = new Texture1DDescription() {
Width = 16,
ArraySize = 1,
Format = Format.R8G8B8A8_UNorm,
MipLevels = 1,
};
using (var texture1D = new Texture1D(device, description1D, new[] { new DataBox(stream.DataPointer) })) {
// no exception on Texture1D
}
var description2D = new Texture2DDescription() {
Width = 8,
Height = 2,
ArraySize = 1,
MipLevels = …
Run Code Online (Sandbox Code Playgroud)