Skip to content

Converted entire Solution from using SharpDX to Silk.NET#1141

Open
Nickelony wants to merge 11 commits intodevelopfrom
Nickelony/SharpDX-To-Silk
Open

Converted entire Solution from using SharpDX to Silk.NET#1141
Nickelony wants to merge 11 commits intodevelopfrom
Nickelony/SharpDX-To-Silk

Conversation

@Nickelony
Copy link
Collaborator

No description provided.

@Nickelony Nickelony requested a review from Copilot February 28, 2026 13:23
@Nickelony Nickelony added the work in progress The Pull Request is not finished yet or needs some extra work done to it. label Feb 28, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 .csproj files; Silk.NET.Direct3D11 NuGet packages are added.
  • A new TombLib.Graphics.Dx11Toolkit namespace is introduced with custom implementations of GraphicsDevice, Buffer, Texture2D, Effect, EffectCompiler, VertexInputLayout, render states, etc. using Silk.NET COM pointer API.
  • All consumer code across TombEditor, WadTool, TombLib.Forms, and TombLib.Rendering is updated to use TombLib.Graphics.Dx11Toolkit types instead of SharpDX.Toolkit.Graphics types, 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Nickelony Nickelony marked this pull request as ready for review February 28, 2026 20:56
@Nickelony Nickelony changed the title WIP: Converted entire Solution from using SharpDX to Silk.NET Converted entire Solution from using SharpDX to Silk.NET Feb 28, 2026
@Nickelony Nickelony added ready for review The Pull Request is finished and ready for review. and removed work in progress The Pull Request is not finished yet or needs some extra work done to it. labels Feb 28, 2026
@Nickelony
Copy link
Collaborator Author

@copilot code review[agent] Could you have a look at this PR and verify our Silk.NET port is production ready?

Copy link

Copilot AI commented Mar 1, 2026

@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 Stranger1992 self-requested a review March 4, 2026 03:26
Copy link
Member

@Stranger1992 Stranger1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 master branch).
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review The Pull Request is finished and ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants