Converted entire Solution from using SharpDX to Silk.NET#1141
Converted entire Solution from using SharpDX to Silk.NET#1141
Conversation
There was a problem hiding this comment.
Pull request overview
This PR converts the entire solution from using SharpDX (an archived, no-longer-maintained DirectX binding) to Silk.NET, a modern .NET DirectX 11 binding. It does this by introducing a new TombLib.Graphics.Dx11Toolkit namespace that provides an API-compatible wrapper layer over Silk.NET's raw COM pointer API, replacing SharpDX's managed wrapper classes. The PR is marked "WIP."
Changes:
- All SharpDX DLL references are removed from
.csprojfiles;Silk.NET.Direct3D11NuGet packages are added. - A new
TombLib.Graphics.Dx11Toolkitnamespace is introduced with custom implementations ofGraphicsDevice,Buffer,Texture2D,Effect,EffectCompiler,VertexInputLayout, render states, etc. using Silk.NET COM pointer API. - All consumer code across
TombEditor,WadTool,TombLib.Forms, andTombLib.Renderingis updated to useTombLib.Graphics.Dx11Toolkittypes instead ofSharpDX.Toolkit.Graphicstypes, and.ToSharpDX()conversion calls are removed.
Reviewed changes
Copilot reviewed 69 out of 69 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
TombLib/TombLib/TombLib.csproj |
Removes SharpDX references, adds Silk.NET.Direct3D11 |
TombLib/TombLib.Rendering/TombLib.Rendering.csproj |
Same reference swap |
TombLib/TombLib.Forms/TombLib.Forms.csproj |
Same reference swap |
TombEditor/TombEditor.csproj |
Same reference swap |
WadTool/WadTool.csproj |
Same reference swap |
TombLib/TombLib/Graphics/Dx11Toolkit/GraphicsDevice.cs |
New: wraps ID3D11Device/ID3D11DeviceContext in Silk.NET |
TombLib/TombLib/Graphics/Dx11Toolkit/Buffer.cs |
New: GPU buffer creation/update using Silk.NET |
TombLib/TombLib/Graphics/Dx11Toolkit/Effect.cs |
New: effect/parameter/cbuffer system |
TombLib/TombLib/Graphics/Dx11Toolkit/EffectCompiler.cs |
New: HLSL .fx file parsing and compilation via D3DCompile |
TombLib/TombLib/Graphics/Dx11Toolkit/NativeD3DCompiler.cs |
New: P/Invoke wrapper for d3dcompiler_47.dll with manual COM vtable access |
TombLib/TombLib/Graphics/Dx11Toolkit/Texture2D.cs |
New: D3D11 Texture2D + SRV wrapper |
TombLib/TombLib/Graphics/Dx11Toolkit/VertexInputLayout.cs |
New: vertex layout creation/reflection |
TombLib/TombLib/Graphics/Dx11Toolkit/States.cs |
New: rasterizer/blend/depth/sampler state wrappers |
TombLib/TombLib/Graphics/Dx11Toolkit/Enums.cs |
New: facade enums replacing SharpDX enums |
TombLib/TombLib/Graphics/Frustum.cs |
Frustum rewritten using custom plane extraction instead of BoundingFrustum |
TombLib/TombLib/Graphics/SharpDxConversions.cs |
Deleted: .ToSharpDX() extensions no longer needed |
TombLib/TombLib.Rendering/Rendering/DirectX11/Dx11RenderingDevice.cs |
All SharpDX calls replaced with Silk.NET raw pointer API |
TombLib/TombLib.Rendering/Rendering/DirectX11/Dx11RenderingSwapChain.cs |
Swap chain creation and management ported to Silk.NET |
TombLib/TombLib.Rendering/Rendering/DirectX11/Dx11RenderingTextureAllocator.cs |
Texture allocator ported |
TombLib/TombLib.Rendering/Rendering/DirectX11/Dx11RenderingStateBuffer.cs |
State buffer ported |
TombLib/TombLib.Rendering/Rendering/DirectX11/Dx11RenderingDrawingRoom.cs |
Room drawing ported |
TombLib/TombLib.Rendering/Rendering/DirectX11/Dx11PipelineState.cs |
Pipeline state ported |
TombLib/TombLib.Rendering/Graphics/DeviceManager.cs |
Device manager updated for new device pointer bridging |
TombEditor/Effects.cs |
Effect loading updated for new compiler API |
TombEditor/Controls/Panel3D/*.cs |
SharpDX → Dx11Toolkit type references updated |
WadTool/Controls/Panel*.cs |
SharpDX → Dx11Toolkit type references updated |
All GeometricPrimitive*.cs, *Mesh.cs, *Vertex.cs, etc. |
Import updates only |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 77 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 77 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 69 out of 77 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
TombLib/TombLib.Rendering/Rendering/DirectX11/Dx11RenderingTextureAllocator.cs
Outdated
Show resolved
Hide resolved
|
@copilot code review[agent] Could you have a look at this PR and verify our Silk.NET port is production ready? |
|
@Nickelony I've opened a new pull request, #1142, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Nickelony <20436882+Nickelony@users.noreply.github.com>
Fix Texture2D resource leak when SRV creation fails
Stranger1992
left a comment
There was a problem hiding this comment.
I cannot give a code review, but I can leave a functionality review instead.
Functionally: I am not seeing anything out of the ordinary that isnt working. I have tried:
- Loading an existing project (passed)
- Placing static meshes (passed)
- Static mesh compiled in-engine (tested with Tomb Engine) (passed)
- Moveables placed and compiled in-game (passed)
- Imported Geo , and compiled in-game (passed)
- Animated Texture window works, animation ranges set and applied in game (passed)
- Node Editor window works (also slightly quicker than the
masterbranch). - Point, Spot, Effect and Shadow bulb visible in-editor (fog bulb still not though ;) )
- Level Settings window works and settings persist properly when closed -> reopened.
- Flyby Cameras work, and trigger in game correctly.
- Special floor flags (death / non-walkable / ghostblocks) render and operate as normal.
I cannot think of anything else to test, so I dont have any objection to this.
All functionality
No description provided.