SharpDX 2D窗口调整大小

时间:2016-03-19 10:25:32

标签: c# sharpdx

我想要渲染调整大小

CODE

mSwapChainDesc = new dx.SwapChainDescription()
{
    BufferCount = 1,
    IsWindowed = true,
    OutputHandle = Target.Handle,
    SwapEffect = dx.SwapEffect.Discard,
    Usage = dx.Usage.RenderTargetOutput | dx.Usage.ShaderInput,
    Flags = dx.SwapChainFlags.None,
    ModeDescription = new dx.ModeDescription(Target.ClientSize.Width, Target.ClientSize.Height, dx.Rational.Empty, dx.Format.B8G8R8A8_UNorm),
    SampleDescription = new dx.SampleDescription(1, 0)
};

d3.Device.CreateWithSwapChain(d3d.DriverType.Hardware, d3.DeviceCreationFlags.BgraSupport, mSwapChainDesc, out mD3Device, out mSwapChain);
mSurface = dx.Surface.FromSwapChain(mSwapChain, 0);

Factory = new d2.Factory();
DWFactory = new dWrite.Factory();
mDevice = new d2.DeviceContext(mSurface);

mRenderCallback = new dWin.RenderLoop.RenderCallback(Render);

Tryied

mSwapChain.ResizeBuffers(
    mSwapChain.Description.BufferCount, 
    renderSize.Value.Width, 
    renderSize.Value.Height, 
    mSwapChain.Description.ModeDescription.Format, 
    mSwapChain.Description.Flags);

错误

  

HRESULT:[0x887A0001],模块:[SharpDX.DXGI],ApiCode:   [DXGI_ERROR_INVALID_CALL / InvalidCall]

1 个答案:

答案 0 :(得分:0)

查看备注here on the MSDN

如果这没有帮助,我认为有一个标志或者你需要能够使用resize方法的东西。这可以解释你的痛苦

HRESULT: 0x887A0001 : The application provided invalid parameter data; this must be debugged and fixed before the application is released.

DXGI_ERROR Codes

我认为表面正在绊倒你。在调用resize之前释放它。