From 217ae9688818ceb8c4329c033db21e5e17de373d Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Mon, 11 Mar 2024 16:11:12 -0700 Subject: [PATCH] Debug Naming API --- lib/RefreshCS | 2 +- src/Graphics/Resources/GpuBuffer.cs | 17 +++++++++++++++++ src/Graphics/Resources/Texture.cs | 17 +++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/RefreshCS b/lib/RefreshCS index 1bf28f4..995a54f 160000 --- a/lib/RefreshCS +++ b/lib/RefreshCS @@ -1 +1 @@ -Subproject commit 1bf28f4397d1a8bc19a75d608f4022541af2080d +Subproject commit 995a54fa2df82946441c9ec6446d7cd12236f8f7 diff --git a/src/Graphics/Resources/GpuBuffer.cs b/src/Graphics/Resources/GpuBuffer.cs index e517412..ad87e58 100644 --- a/src/Graphics/Resources/GpuBuffer.cs +++ b/src/Graphics/Resources/GpuBuffer.cs @@ -16,6 +16,22 @@ namespace MoonWorks.Graphics /// public uint Size { get; } + private string name; + public string Name + { + get => name; + + set + { + Refresh.Refresh_SetGpuBufferName( + Device.Handle, + Handle, + value + ); + name = value; + } + } + /// /// Creates a buffer of appropriate size given a type and element count. /// @@ -55,6 +71,7 @@ namespace MoonWorks.Graphics sizeInBytes ); Size = sizeInBytes; + name = ""; } public static implicit operator BufferBinding(GpuBuffer b) diff --git a/src/Graphics/Resources/Texture.cs b/src/Graphics/Resources/Texture.cs index a1f23c0..9a26c39 100644 --- a/src/Graphics/Resources/Texture.cs +++ b/src/Graphics/Resources/Texture.cs @@ -20,6 +20,22 @@ namespace MoonWorks.Graphics public TextureUsageFlags UsageFlags { get; } public uint Size { get; } + private string name; + public string Name + { + get => name; + + set + { + Refresh.Refresh_SetTextureName( + Device.Handle, + Handle, + value + ); + name = value; + } + } + // FIXME: this allocates a delegate instance protected override Action QueueDestroyFunction => Refresh.Refresh_QueueDestroyTexture; @@ -174,6 +190,7 @@ namespace MoonWorks.Graphics SampleCount = textureCreateInfo.SampleCount; UsageFlags = textureCreateInfo.UsageFlags; Size = Width * Height * BytesPerPixel(Format) / BlockSizeSquared(Format); + name = ""; } // Used by Window. Swapchain texture handles are managed by the driver backend.