E_INVALIDARG: An invalid parameter was passed to the returning function

我们两清 提交于 2019-12-02 07:55:07

I just noticed your comment on my other answer. Here is the creation function I use:

    public static Texture2D CreateRenderTexture(this RenderHelper helper, int width, int height)
    {
        Texture2DDescription description = new Texture2DDescription
        {
            ArraySize = 1,
            BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
            CpuAccessFlags = CpuAccessFlags.None,
            Format = SlimDX.DXGI.Format.B8G8R8A8_UNorm,
            Width = width,
            Height = height,
            MipLevels = 1,
            OptionFlags = ResourceOptionFlags.None,
            SampleDescription = new SlimDX.DXGI.SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
        };

        return new Texture2D(helper.Device, description);
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!