Fix nothing rendering, oops

This commit is contained in:
goaaats 2025-04-06 21:50:55 +02:00
parent b5a8bfe399
commit 5ddf473450
2 changed files with 1 additions and 51 deletions

View file

@ -71,57 +71,7 @@ internal sealed unsafe class Dx11Win32Backend : IWin32Backend
this.WindowHandle = desc.OutputWindow;
var ctx = ImGui.CreateContext();
Debug.Assert(!ctx.IsNull);
var windowOff = Marshal.OffsetOf<ImGuiContext>("CurrentWindow");
//Debug.Assert(windowOff == 16368);
/*
void ShowOffset<T>(string name)
{
// var off = Marshal.OffsetOf<T>(name);
var fieldInfo = typeof(T).GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
var off = fieldInfo?.GetFieldOffset();
Log.Information($"{name} {typeof(T).Name} {off}");
}
//Util.Fatal($"{Marshal.SizeOf<Test>()} - {sizeof(Test)}", "", false);
ShowOffset<ImGuiIO>("ClipboardUserData");
ShowOffset<ImGuiIO>("MouseDrawCursor");
ShowOffset<ImGuiIO>("MouseDelta");
ShowOffset<ImGuiIO>("KeysDown_0");
ShowOffset<ImGuiIO>("MousePos");
ShowOffset<ImGuiIO>("KeyMods");
*/
void ShowAllFields<T>()
{
var fields = typeof(T).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (var field in fields)
{
var off = field.GetFieldOffset();
Log.Information($"{field.Name} {typeof(T).Name} {off}");
}
}
ShowAllFields<ImGuiIO>();
var contextSize = Unsafe.SizeOf<ImGuiContext>();
var ioSize = Unsafe.SizeOf<ImGuiIO>();
var platformIoSize = Unsafe.SizeOf<ImGuiPlatformIO>();
//Debug.Assert(contextSize == 22688);
//Debug.Assert(ioSize == 14352);
//Debug.Assert(platformIoSize == 216);
//var platformIoOff = Unsafe.OffsetOf<ImGuiContext>("PlatformIO");
//Debug.Assert(platformIoOff == 14360);
Util.Fatal("bleh", "bleh", false);
ImGuizmo.SetImGuiContext(ctx);
ImPlot.SetImGuiContext(ctx);

View file

@ -359,7 +359,7 @@ internal unsafe partial class Dx11Renderer : IImGuiRenderer
this.context.Get()->RSSetScissorRects(1, &clipRect);
if (cmd.UserCallback != null)
if (cmd.UserCallback == null)
{
// Bind texture and draw
var srv = (ID3D11ShaderResourceView*)cmd.TextureId.Handle;