Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I get a gpu Message = "HRESULT: [0x887A0005], Module: [Vortice.DXGI], ApiCode: [/DeviceRemoved] #485

Open
KnewHow opened this issue Feb 6, 2025 · 1 comment

Comments

@KnewHow
Copy link

KnewHow commented Feb 6, 2025

I run my Application in "AMD Radeon 780M " display card, when I mouse click some region, I will create vertex Buffer and index buffer, But I get a runtime error: "Message = "HRESULT: [0x887A0005], Module: [Vortice.DXGI], ApiCode: [DXGI_ERROR_DEVICE_REMOVED/DeviceRemoved], Message: [GPU 设备实例已经暂停。使用 GetDeviceRemovedReason 以确定相应的措施。\r\n]" with ResultCode "887A0005". But some time is ok, some time is get this error! I try to get removed reason by device.DeviceRemovedReason, it tell me: "Description = "GPU 不响应更多的命令,最为可能的原因是调用应用程序传递了无效的命令。\r\n", and NativeApiCode = "DXGI_ERROR_DEVICE_HUNG". My create vertex buffer and index buffer code is follow:

 unsafe public static ID3D11Buffer createVertexBuffer(ID3D11Device device, float[] vs)
 {
     BufferDescription description = new BufferDescription();
     description.StructureByteStride = sizeof(float);
     description.ByteWidth = (uint)vs.Length * sizeof(float);
     description.BindFlags = BindFlags.VertexBuffer;
     description.CPUAccessFlags = CpuAccessFlags.None;
     description.MiscFlags = ResourceOptionFlags.None;
     description.Usage = ResourceUsage.Default;
     //DataStream ds = DataStream.Create(vs, true, true);
     //ID3D11Buffer buffer = device.CreateBuffer(description, ds);
     //ds.Dispose();
     fixed (float* dataPointer = vs)
     {
         return device.CreateBuffer(in description, new SubresourceData((nint)dataPointer));
     }

     //return buffer;
 }

 unsafe public static ID3D11Buffer createIndexBuffer(ID3D11Device device, uint[] indices) {
     BufferDescription description = new BufferDescription();
     description.StructureByteStride = sizeof(float);
     description.ByteWidth = (uint)indices.Length * sizeof(float);
     description.BindFlags = BindFlags.IndexBuffer;
     description.CPUAccessFlags = CpuAccessFlags.None;
     description.MiscFlags = ResourceOptionFlags.None;
     description.Usage = ResourceUsage.Default;
     //DataStream ds = DataStream.Create(indices, true, true);
     //ID3D11Buffer buffer = device.CreateBuffer(description, ds);
     //ds.Dispose();
     //return buffer;
     fixed (uint* dataPointer = indices)
     {
         return device.CreateBuffer(in description, new SubresourceData((nint)dataPointer));
     }

My System is Windows11 and CPU is "AMD Ryzen 7 7840H", display card is "AMD Radeon 780M Graphics". I try use Sharp.Dx run same logic code, it is ok, but use Vortice, it get error. Can you help me solve this problem?

@KnewHow
Copy link
Author

KnewHow commented Feb 6, 2025

My C# Nuget package Vortice.Direct3D11 version is: 3.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant