Vulkan: Add several command buffer label-scopes

This commit is contained in:
Wunkolo 2022-12-18 10:34:21 -08:00
parent 9d1d564993
commit 580c1cfb45
11 changed files with 92 additions and 1 deletions

View file

@ -819,6 +819,8 @@ namespace Ryujinx.Graphics.Vulkan
endRenderPass?.Invoke(); endRenderPass?.Invoke();
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"BufferHolder.TryPushData: {data.Length} bytes -> {dstOffset:X}", new ColorF(1, 1, 0, 1));
var dstBuffer = GetBuffer(cbs.CommandBuffer, dstOffset, data.Length, true).Get(cbs, dstOffset, data.Length, true).Value; var dstBuffer = GetBuffer(cbs.CommandBuffer, dstOffset, data.Length, true).Get(cbs, dstOffset, data.Length, true).Value;
_writeCount--; _writeCount--;
@ -868,6 +870,8 @@ namespace Ryujinx.Graphics.Vulkan
int size, int size,
bool registerSrcUsage = true) bool registerSrcUsage = true)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"BufferHolder.Copy: {srcOffset:X}->{dstOffset:X} {size} bytes", new ColorF(1, 1, 0, 1));
var srcBuffer = registerSrcUsage ? src.Get(cbs, srcOffset, size).Value : src.GetUnsafe().Value; var srcBuffer = registerSrcUsage ? src.Get(cbs, srcOffset, size).Value : src.GetUnsafe().Value;
var dstBuffer = dst.Get(cbs, dstOffset, size, true).Value; var dstBuffer = dst.Get(cbs, dstOffset, size, true).Value;

View file

@ -414,6 +414,8 @@ namespace Ryujinx.Graphics.Vulkan
return; return;
} }
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"DescriptorSetUpdater.UpdateAndBindDescriptorSets({pbp})", new ColorF(1, 0, 1, 1));
if (_dirty.HasFlag(DirtyFlags.Uniform)) if (_dirty.HasFlag(DirtyFlags.Uniform))
{ {
if (_program.UsePushDescriptors) if (_program.UsePushDescriptors)
@ -488,6 +490,8 @@ namespace Ryujinx.Graphics.Vulkan
return; return;
} }
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"DescriptorSetUpdater.UpdateAndBind({pbp}): set:{setIndex}", new ColorF(1, 0, 1, 1));
var dummyBuffer = _dummyBuffer?.GetBuffer(); var dummyBuffer = _dummyBuffer?.GetBuffer();
var dsc = program.GetNewDescriptorSetCollection(_gd, cbs.CommandBufferIndex, setIndex, out var isNew).Get(cbs); var dsc = program.GetNewDescriptorSetCollection(_gd, cbs.CommandBufferIndex, setIndex, out var isNew).Get(cbs);
@ -649,6 +653,8 @@ namespace Ryujinx.Graphics.Vulkan
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private void UpdateAndBindUniformBufferPd(CommandBufferScoped cbs, PipelineBindPoint pbp) private void UpdateAndBindUniformBufferPd(CommandBufferScoped cbs, PipelineBindPoint pbp)
{ {
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"DescriptorSetUpdater.UpdateAndBindUniformBufferPd({pbp})", new ColorF(1, 0, 1, 1));
var bindingSegments = _program.BindingSegments[PipelineBase.UniformSetIndex]; var bindingSegments = _program.BindingSegments[PipelineBase.UniformSetIndex];
var dummyBuffer = _dummyBuffer?.GetBuffer(); var dummyBuffer = _dummyBuffer?.GetBuffer();

View file

@ -255,6 +255,7 @@ namespace Ryujinx.Graphics.Vulkan
gd.FlushAllCommands(); gd.FlushAllCommands();
using var cbs = gd.CommandBufferPool.Rent(); using var cbs = gd.CommandBufferPool.Rent();
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.Blit: {src.Info.Format}:{srcRegion} -> {dst.Info.Format}:{dstRegion}", new ColorF(0, 1, 1, 1));
var dstFormat = dst.VkFormat; var dstFormat = dst.VkFormat;
var dstSamples = dst.Info.Samples; var dstSamples = dst.Info.Samples;
@ -341,6 +342,8 @@ namespace Ryujinx.Graphics.Vulkan
int depth, int depth,
int levels) int levels)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.CopyColor: {src.Info.Format}:{srcLayer}:{srcLevel} -> {dst.Info.Format}:{dstLayer}:{dstLevel}", new ColorF(0, 1, 1, 1));
for (int l = 0; l < levels; l++) for (int l = 0; l < levels; l++)
{ {
int mipSrcLevel = srcLevel + l; int mipSrcLevel = srcLevel + l;
@ -405,6 +408,8 @@ namespace Ryujinx.Graphics.Vulkan
bool linearFilter, bool linearFilter,
bool clearAlpha = false) bool clearAlpha = false)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.BlitColor: {src.Info.Format}:{srcRegion} -> {dstFormat}:{dstRegion}", new ColorF(0, 1, 1, 1));
_pipeline.SetCommandBuffer(cbs); _pipeline.SetCommandBuffer(cbs);
const int RegionBufferSize = 16; const int RegionBufferSize = 16;
@ -506,6 +511,8 @@ namespace Ryujinx.Graphics.Vulkan
Extents2D srcRegion, Extents2D srcRegion,
Extents2D dstRegion) Extents2D dstRegion)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.BlitDepthStencil: {src.Info.Format}:{srcRegion} -> {dstFormat}:{dstRegion}", new ColorF(0, 1, 1, 1));
_pipeline.SetCommandBuffer(cbs); _pipeline.SetCommandBuffer(cbs);
const int RegionBufferSize = 16; const int RegionBufferSize = 16;
@ -679,6 +686,8 @@ namespace Ryujinx.Graphics.Vulkan
using var cbs = gd.CommandBufferPool.Rent(); using var cbs = gd.CommandBufferPool.Rent();
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.Clear: {dstWidth}x{dstHeight} {clearColor.ToString()}", new ColorF(0, 1, 1, 1));
_pipeline.SetCommandBuffer(cbs); _pipeline.SetCommandBuffer(cbs);
var bufferHandle = gd.BufferManager.CreateWithHandle(gd, ClearColorBufferSize); var bufferHandle = gd.BufferManager.CreateWithHandle(gd, ClearColorBufferSize);
@ -785,6 +794,8 @@ namespace Ryujinx.Graphics.Vulkan
{ {
const int RegionBufferSize = 16; const int RegionBufferSize = 16;
using var debugScope = gd.CreateLabelScope(pipeline.CurrentCommandBuffer.CommandBuffer, $"HelperShader.DrawTexture: {srcRegion}->{dstRegion}", new ColorF(0, 1, 1, 1));
pipeline.SetTextureAndSampler(ShaderStage.Fragment, 0, src, srcSampler); pipeline.SetTextureAndSampler(ShaderStage.Fragment, 0, src, srcSampler);
Span<float> region = stackalloc float[RegionBufferSize / sizeof(float)]; Span<float> region = stackalloc float[RegionBufferSize / sizeof(float)];
@ -837,11 +848,15 @@ namespace Ryujinx.Graphics.Vulkan
public void ConvertI8ToI16(VulkanRenderer gd, CommandBufferScoped cbs, BufferHolder src, BufferHolder dst, int srcOffset, int size) public void ConvertI8ToI16(VulkanRenderer gd, CommandBufferScoped cbs, BufferHolder src, BufferHolder dst, int srcOffset, int size)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.ConvertI8ToI16: 0x{srcOffset:X} {size} bytes", new ColorF(0, 1, 1, 1));
ChangeStride(gd, cbs, src, dst, srcOffset, size, 1, 2); ChangeStride(gd, cbs, src, dst, srcOffset, size, 1, 2);
} }
public unsafe void ChangeStride(VulkanRenderer gd, CommandBufferScoped cbs, BufferHolder src, BufferHolder dst, int srcOffset, int size, int stride, int newStride) public unsafe void ChangeStride(VulkanRenderer gd, CommandBufferScoped cbs, BufferHolder src, BufferHolder dst, int srcOffset, int size, int stride, int newStride)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.ChangeStride: 0x{srcOffset:X}#{size} {stride}->{newStride}", new ColorF(0, 1, 1, 1));
bool supportsUint8 = gd.Capabilities.SupportsShaderInt8; bool supportsUint8 = gd.Capabilities.SupportsShaderInt8;
int elems = size / stride; int elems = size / stride;
@ -938,6 +953,8 @@ namespace Ryujinx.Graphics.Vulkan
int srcOffset, int srcOffset,
int indexCount) int indexCount)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.ConvertIndexBuffer: 0x{srcOffset:X} uint{indexSize * 8}x{indexCount}", new ColorF(0, 1, 1, 1));
// TODO: Support conversion with primitive restart enabled. // TODO: Support conversion with primitive restart enabled.
// TODO: Convert with a compute shader? // TODO: Convert with a compute shader?
@ -1023,6 +1040,8 @@ namespace Ryujinx.Graphics.Vulkan
int depth, int depth,
int levels) int levels)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.CopyIncompatibleFormats: {src.VkFormat}:{srcLayer}:{srcLevel} -> {dst.VkFormat}:{dstLayer}:{dstLevel}", new ColorF(0, 1, 1, 1));
const int ParamsBufferSize = 4; const int ParamsBufferSize = 4;
Span<int> shaderParams = stackalloc int[sizeof(int)]; Span<int> shaderParams = stackalloc int[sizeof(int)];
@ -1114,6 +1133,8 @@ namespace Ryujinx.Graphics.Vulkan
public void CopyMSToNonMS(VulkanRenderer gd, CommandBufferScoped cbs, TextureView src, TextureView dst, int srcLayer, int dstLayer, int depth) public void CopyMSToNonMS(VulkanRenderer gd, CommandBufferScoped cbs, TextureView src, TextureView dst, int srcLayer, int dstLayer, int depth)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"HelperShader.BlitColor: {src.VkFormat}:{srcLayer} -> {dst.VkFormat}:{dstLayer}", new ColorF(0, 1, 1, 1));
const int ParamsBufferSize = 16; const int ParamsBufferSize = 16;
Span<int> shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)]; Span<int> shaderParams = stackalloc int[ParamsBufferSize / sizeof(int)];

View file

@ -41,6 +41,8 @@ namespace Ryujinx.Graphics.Vulkan
if (srcBuffer.TryIncrementReferenceCount()) if (srcBuffer.TryIncrementReferenceCount())
{ {
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"PersistentFlushBuffer.GetBufferData: 0x{offset:X} {size} bytes", new ColorF(0.5f, 0.5f, 1, 1));
BufferHolder.Copy(_gd, cbs, srcBuffer, dstBuffer, offset, 0, size, registerSrcUsage: false); BufferHolder.Copy(_gd, cbs, srcBuffer, dstBuffer, offset, 0, size, registerSrcUsage: false);
} }
else else
@ -66,6 +68,8 @@ namespace Ryujinx.Graphics.Vulkan
var buffer = flushStorage.GetBuffer(cbs.CommandBuffer).Get(cbs).Value; var buffer = flushStorage.GetBuffer(cbs.CommandBuffer).Get(cbs).Value;
var image = view.GetImage().Get(cbs).Value; var image = view.GetImage().Get(cbs).Value;
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"PersistentFlushBuffer.GetTextureData: {size} bytes", new ColorF(0.5f, 0.5f, 1, 1));
view.CopyFromOrToBuffer(cbs.CommandBuffer, buffer, image, size, true, 0, 0, info.GetLayers(), info.Levels, singleSlice: false); view.CopyFromOrToBuffer(cbs.CommandBuffer, buffer, image, size, true, 0, 0, info.GetLayers(), info.Levels, singleSlice: false);
} }
@ -82,6 +86,8 @@ namespace Ryujinx.Graphics.Vulkan
var buffer = flushStorage.GetBuffer(cbs.CommandBuffer).Get(cbs).Value; var buffer = flushStorage.GetBuffer(cbs.CommandBuffer).Get(cbs).Value;
var image = view.GetImage().Get(cbs).Value; var image = view.GetImage().Get(cbs).Value;
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"PersistentFlushBuffer.GetTextureData: {size} bytes layer:{layer} level:{level}", new ColorF(0.5f, 0.5f, 1, 1));
view.CopyFromOrToBuffer(cbs.CommandBuffer, buffer, image, size, true, layer, level, 1, 1, singleSlice: true); view.CopyFromOrToBuffer(cbs.CommandBuffer, buffer, image, size, true, layer, level, 1, 1, singleSlice: true);
} }

View file

@ -54,6 +54,7 @@ namespace Ryujinx.Graphics.Vulkan
private Auto<DisposableFramebuffer> _framebuffer; private Auto<DisposableFramebuffer> _framebuffer;
private Auto<DisposableRenderPass> _renderPass; private Auto<DisposableRenderPass> _renderPass;
private int _writtenAttachmentCount; private int _writtenAttachmentCount;
private ILabelScope _renderPassLabelScope;
private bool _framebufferUsingColorWriteMask; private bool _framebufferUsingColorWriteMask;
@ -130,6 +131,8 @@ namespace Ryujinx.Graphics.Vulkan
public unsafe void Barrier() public unsafe void Barrier()
{ {
using var debugScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineBase.Barrier", new ColorF(1, 0.5f, 0, 1));
if (_drawCountSinceBarrier != DrawCount) if (_drawCountSinceBarrier != DrawCount)
{ {
_drawCountSinceBarrier = DrawCount; _drawCountSinceBarrier = DrawCount;
@ -164,6 +167,8 @@ namespace Ryujinx.Graphics.Vulkan
public void ComputeBarrier() public void ComputeBarrier()
{ {
using var debugScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineBase.ComputeBarrier", new ColorF(1, 0.5f, 0, 1));
MemoryBarrier memoryBarrier = new() MemoryBarrier memoryBarrier = new()
{ {
SType = StructureType.MemoryBarrier, SType = StructureType.MemoryBarrier,
@ -195,6 +200,8 @@ namespace Ryujinx.Graphics.Vulkan
var dst = Gd.BufferManager.GetBuffer(CommandBuffer, destination, offset, size, true).Get(Cbs, offset, size, true).Value; var dst = Gd.BufferManager.GetBuffer(CommandBuffer, destination, offset, size, true).Get(Cbs, offset, size, true).Value;
using var debugScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineBase.ClearBuffer: {value:X} -> 0x{offset:X} {size} bytes", new ColorF(1, 0.5f, 0, 1));
BufferHolder.InsertBufferBarrier( BufferHolder.InsertBufferBarrier(
Gd, Gd,
Cbs.CommandBuffer, Cbs.CommandBuffer,
@ -234,6 +241,8 @@ namespace Ryujinx.Graphics.Vulkan
BeginRenderPass(); BeginRenderPass();
_renderPassLabelScope?.InsertLabel($"PipelineBase.ClearRenderTargetColor({index}, {layer}, {layerCount})", color);
var clearValue = new ClearValue(new ClearColorValue(color.Red, color.Green, color.Blue, color.Alpha)); var clearValue = new ClearValue(new ClearColorValue(color.Red, color.Green, color.Blue, color.Alpha));
var attachment = new ClearAttachment(ImageAspectFlags.ColorBit, (uint)index, clearValue); var attachment = new ClearAttachment(ImageAspectFlags.ColorBit, (uint)index, clearValue);
var clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount); var clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount);
@ -269,9 +278,10 @@ namespace Ryujinx.Graphics.Vulkan
{ {
CreateRenderPass(); CreateRenderPass();
} }
BeginRenderPass(); BeginRenderPass();
_renderPassLabelScope?.InsertLabel($"PipelineBase.ClearRenderTargetDepthStencil({layer}, {layerCount}, {depthValue}, {stencilValue})", new ColorF(1, 0.5f, 0, 1));
var attachment = new ClearAttachment(flags, 0, clearValue); var attachment = new ClearAttachment(flags, 0, clearValue);
var clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount); var clearRect = FramebufferParams.GetClearRect(ClearScissor, layer, layerCount);
@ -368,6 +378,7 @@ namespace Ryujinx.Graphics.Vulkan
BeginRenderPass(); BeginRenderPass();
DrawCount++; DrawCount++;
_renderPassLabelScope?.InsertLabel($"PipelineBase.Draw({vertexCount}, {instanceCount}, {firstVertex}, {firstInstance})", new ColorF(1, 0.5f, 0, 1));
if (Gd.TopologyUnsupported(_topology)) if (Gd.TopologyUnsupported(_topology))
{ {
// Temporarily bind a conversion pattern as an index buffer. // Temporarily bind a conversion pattern as an index buffer.
@ -1296,6 +1307,8 @@ namespace Ryujinx.Graphics.Vulkan
} }
} }
using var debugScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineBase.SetVertexBuffers({validCount})", new ColorF(1, 0.5f, 0, 1));
_vertexBufferUpdater.Commit(Cbs); _vertexBufferUpdater.Commit(Cbs);
_newState.VertexBindingDescriptionsCount = (uint)validCount; _newState.VertexBindingDescriptionsCount = (uint)validCount;
@ -1572,6 +1585,8 @@ namespace Ryujinx.Graphics.Vulkan
Gd.FlushAllCommands(); Gd.FlushAllCommands();
} }
using var debugScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineBase.RecreatePipelineIfNeeded({pbp})", new ColorF(1, 0.75f, 0, 1));
DynamicState.ReplayIfDirty(Gd.Api, CommandBuffer); DynamicState.ReplayIfDirty(Gd.Api, CommandBuffer);
if (_needsIndexBufferRebind && _indexBufferPattern == null) if (_needsIndexBufferRebind && _indexBufferPattern == null)
@ -1660,6 +1675,7 @@ namespace Ryujinx.Graphics.Vulkan
ClearValueCount = 1, ClearValueCount = 1,
}; };
_renderPassLabelScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineBase.RenderPass: {FramebufferParams.Width}x{FramebufferParams.Height}", new ColorF(1, 0.5f, 0, 1));
Gd.Api.CmdBeginRenderPass(CommandBuffer, renderPassBeginInfo, SubpassContents.Inline); Gd.Api.CmdBeginRenderPass(CommandBuffer, renderPassBeginInfo, SubpassContents.Inline);
RenderPassActive = true; RenderPassActive = true;
} }
@ -1671,6 +1687,8 @@ namespace Ryujinx.Graphics.Vulkan
{ {
PauseTransformFeedbackInternal(); PauseTransformFeedbackInternal();
Gd.Api.CmdEndRenderPass(CommandBuffer); Gd.Api.CmdEndRenderPass(CommandBuffer);
_renderPassLabelScope.Dispose();
_renderPassLabelScope = null;
SignalRenderPassEnd(); SignalRenderPassEnd();
RenderPassActive = false; RenderPassActive = false;
} }

View file

@ -32,6 +32,8 @@ namespace Ryujinx.Graphics.Vulkan
private void CopyPendingQuery() private void CopyPendingQuery()
{ {
using var debugScope = _pendingQueryCopies.Count > 0 ? Gd.CreateLabelScope(CommandBuffer, $"PipelineFull.CopyPendingQuery({_pendingQueryCopies.Count})", new ColorF(0.5f, 1.0f, 0, 1)) : null;
foreach (var query in _pendingQueryCopies) foreach (var query in _pendingQueryCopies)
{ {
query.PoolCopy(Cbs); query.PoolCopy(Cbs);
@ -47,6 +49,8 @@ namespace Ryujinx.Graphics.Vulkan
return; return;
} }
using var debugScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineFull.ClearRenderTargetColor({index},{layer},{layerCount},{componentMask})", color);
if (componentMask != 0xf) if (componentMask != 0xf)
{ {
// We can't use CmdClearAttachments if not writing all components, // We can't use CmdClearAttachments if not writing all components,
@ -239,6 +243,8 @@ namespace Ryujinx.Graphics.Vulkan
public void Restore() public void Restore()
{ {
using var debugScope = Gd.CreateLabelScope(CommandBuffer, $"PipelineFull.Restore({Pbp})", new ColorF(0.5f, 1.0f, 0, 1));
if (Pipeline != null) if (Pipeline != null)
{ {
Gd.Api.CmdBindPipeline(CommandBuffer, Pbp, Pipeline.Get(Cbs).Value); Gd.Api.CmdBindPipeline(CommandBuffer, Pbp, Pipeline.Get(Cbs).Value);

View file

@ -1,5 +1,6 @@
using Ryujinx.Common; using Ryujinx.Common;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -102,6 +103,8 @@ namespace Ryujinx.Graphics.Vulkan
private void PushDataImpl(CommandBufferScoped cbs, BufferHolder dst, int dstOffset, ReadOnlySpan<byte> data) private void PushDataImpl(CommandBufferScoped cbs, BufferHolder dst, int dstOffset, ReadOnlySpan<byte> data)
{ {
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"StagingBuffer.PushDataImpl: {data.Length} bytes -> 0x{dstOffset:X}", new ColorF(1, 1, 0, 1));
var srcBuffer = _buffer.GetBuffer(); var srcBuffer = _buffer.GetBuffer();
var dstBuffer = dst.GetBuffer(cbs.CommandBuffer, dstOffset, data.Length, true); var dstBuffer = dst.GetBuffer(cbs.CommandBuffer, dstOffset, data.Length, true);

View file

@ -360,6 +360,8 @@ namespace Ryujinx.Graphics.Vulkan
TextureView src, TextureView src,
TextureView dst) TextureView dst)
{ {
using var debugScope = gd.CreateLabelScope(cbs.CommandBuffer, $"TextureCopy.ResolveDepthStencil({src.Info.Format})", new ColorF(1, 0, 1, 1));
var dsAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 0, ImageLayout.General); var dsAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 0, ImageLayout.General);
var dsResolveAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 1, ImageLayout.General); var dsResolveAttachmentReference = new AttachmentReference2(StructureType.AttachmentReference2, null, 1, ImageLayout.General);

View file

@ -256,6 +256,8 @@ namespace Ryujinx.Graphics.Vulkan
} }
} }
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureStorage.InitialTransition({srcLayout} -> {dstLayout})", new ColorF(1, 1, 0, 1));
var aspectFlags = _info.Format.ConvertAspectFlags(); var aspectFlags = _info.Format.ConvertAspectFlags();
var subresourceRange = new ImageSubresourceRange(aspectFlags, 0, (uint)_info.Levels, 0, (uint)_info.GetLayers()); var subresourceRange = new ImageSubresourceRange(aspectFlags, 0, (uint)_info.Levels, 0, (uint)_info.GetLayers());
@ -352,6 +354,8 @@ namespace Ryujinx.Graphics.Vulkan
ImageAspectFlags aspectFlags, ImageAspectFlags aspectFlags,
bool forFlush) bool forFlush)
{ {
using var debugScope = _gd.CreateLabelScope(commandBuffer, $"TextureStorage.CopyFromOrToBuffer({Info.Format} {(to ? "->" : "<-")} {size} bytes)", new ColorF(0, 0, 1, 1));
bool is3D = Info.Target == Target.Texture3D; bool is3D = Info.Target == Target.Texture3D;
int width = Info.Width; int width = Info.Width;
int height = Info.Height; int height = Info.Height;
@ -444,6 +448,8 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (_lastReadAccess != AccessFlags.None) if (_lastReadAccess != AccessFlags.None)
{ {
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureStorage.InsertReadToWriteBarrier({dstAccessFlags}, {dstStageFlags})", new ColorF(0, 0, 1, 1));
ImageAspectFlags aspectFlags = Info.Format.ConvertAspectFlags(); ImageAspectFlags aspectFlags = Info.Format.ConvertAspectFlags();
TextureView.InsertImageBarrier( TextureView.InsertImageBarrier(
@ -472,6 +478,8 @@ namespace Ryujinx.Graphics.Vulkan
if (_lastModificationAccess != AccessFlags.None) if (_lastModificationAccess != AccessFlags.None)
{ {
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureStorage.InsertWriteToReadBarrier({dstAccessFlags}, {dstStageFlags})", new ColorF(0, 0, 1, 1));
ImageAspectFlags aspectFlags = Info.Format.ConvertAspectFlags(); ImageAspectFlags aspectFlags = Info.Format.ConvertAspectFlags();
TextureView.InsertImageBarrier( TextureView.InsertImageBarrier(

View file

@ -195,6 +195,8 @@ namespace Ryujinx.Graphics.Vulkan
var srcImage = src.GetImage().Get(cbs).Value; var srcImage = src.GetImage().Get(cbs).Value;
var dstImage = dst.GetImage().Get(cbs).Value; var dstImage = dst.GetImage().Get(cbs).Value;
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureView.CopyTo({Info.Format} -> {dst.Info.Format}{firstLayer}:{firstLevel})", new ColorF(1, 1, 0, 1));
if (!dst.Info.Target.IsMultisample() && Info.Target.IsMultisample()) if (!dst.Info.Target.IsMultisample() && Info.Target.IsMultisample())
{ {
int layers = Math.Min(Info.GetLayers(), dst.Info.GetLayers() - firstLayer); int layers = Math.Min(Info.GetLayers(), dst.Info.GetLayers() - firstLayer);
@ -247,6 +249,7 @@ namespace Ryujinx.Graphics.Vulkan
var srcImage = src.GetImage().Get(cbs).Value; var srcImage = src.GetImage().Get(cbs).Value;
var dstImage = dst.GetImage().Get(cbs).Value; var dstImage = dst.GetImage().Get(cbs).Value;
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureView.CopyTo({Info.Format}:{srcLayer}:{srcLevel} -> {dst.Info.Format}:{dstLayer}:{dstLevel})", new ColorF(1, 1, 0, 1));
if (!dst.Info.Target.IsMultisample() && Info.Target.IsMultisample()) if (!dst.Info.Target.IsMultisample() && Info.Target.IsMultisample())
{ {
@ -292,6 +295,7 @@ namespace Ryujinx.Graphics.Vulkan
var cbs = _gd.PipelineInternal.CurrentCommandBuffer; var cbs = _gd.PipelineInternal.CurrentCommandBuffer;
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureView.CopyTo({Info.Format}:{srcRegion} -> {dst.Info.Format}:{dstRegion})", new ColorF(1, 1, 0, 1));
CopyToImpl(cbs, dst, srcRegion, dstRegion, linearFilter); CopyToImpl(cbs, dst, srcRegion, dstRegion, linearFilter);
} }
else else
@ -300,6 +304,7 @@ namespace Ryujinx.Graphics.Vulkan
using var cbs = cbp.Rent(); using var cbs = cbp.Rent();
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureView.CopyTo({Info.Format}:{srcRegion} -> {dst.Info.Format}:{dstRegion})", new ColorF(1, 1, 0, 1));
CopyToImpl(cbs, dst, srcRegion, dstRegion, linearFilter); CopyToImpl(cbs, dst, srcRegion, dstRegion, linearFilter);
} }
} }
@ -308,6 +313,8 @@ namespace Ryujinx.Graphics.Vulkan
{ {
var src = this; var src = this;
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"TextureView.CopyToImpl({src.Info.Format}:{srcRegion} -> {dst.Info.Format}:{dstRegion})", new ColorF(1, 1, 0, 1));
var srcFormat = GetCompatibleGalFormat(src.Info.Format); var srcFormat = GetCompatibleGalFormat(src.Info.Format);
var dstFormat = GetCompatibleGalFormat(dst.Info.Format); var dstFormat = GetCompatibleGalFormat(dst.Info.Format);
@ -767,6 +774,8 @@ namespace Ryujinx.Graphics.Vulkan
int offset = 0, int offset = 0,
int stride = 0) int stride = 0)
{ {
using var debugScope = _gd.CreateLabelScope(commandBuffer, $"TextureView.CopyFromOrToBuffer({Info.Format} {(to ? "->" : "<-")} {size} bytes)", new ColorF(1, 1, 0, 1));
bool is3D = Info.Target == Target.Texture3D; bool is3D = Info.Target == Target.Texture3D;
int width = Math.Max(1, Info.Width >> dstLevel); int width = Math.Max(1, Info.Width >> dstLevel);
int height = Math.Max(1, Info.Height >> dstLevel); int height = Math.Max(1, Info.Height >> dstLevel);
@ -777,6 +786,8 @@ namespace Ryujinx.Graphics.Vulkan
for (int level = 0; level < levels; level++) for (int level = 0; level < levels; level++)
{ {
debugScope.InsertLabel($"level: {level}", new ColorF(1, 1, 0, 1));
int mipSize = GetBufferDataLength(Info.GetMipSize2D(dstLevel + level) * dstLayers); int mipSize = GetBufferDataLength(Info.GetMipSize2D(dstLevel + level) * dstLayers);
int endOffset = offset + mipSize; int endOffset = offset + mipSize;
@ -847,6 +858,8 @@ namespace Ryujinx.Graphics.Vulkan
int width, int width,
int height) int height)
{ {
using var debugScope = _gd.CreateLabelScope(commandBuffer, $"TextureView.CopyFromOrToBuffer({Info.Format} {(to ? "->" : "<-")} {size} bytes)", new ColorF(1, 1, 0, 1));
var aspectFlags = Info.Format.ConvertAspectFlags(); var aspectFlags = Info.Format.ConvertAspectFlags();
if (aspectFlags == (ImageAspectFlags.DepthBit | ImageAspectFlags.StencilBit)) if (aspectFlags == (ImageAspectFlags.DepthBit | ImageAspectFlags.StencilBit))

View file

@ -295,6 +295,8 @@ namespace Ryujinx.Graphics.Vulkan
var cbs = _gd.CommandBufferPool.Rent(); var cbs = _gd.CommandBufferPool.Rent();
using var debugScope = _gd.CreateLabelScope(cbs.CommandBuffer, $"Window.Present", new ColorF(0, 1, 0, 1));
Transition( Transition(
cbs.CommandBuffer, cbs.CommandBuffer,
swapchainImage, swapchainImage,
@ -541,6 +543,8 @@ namespace Ryujinx.Graphics.Vulkan
ImageLayout srcLayout, ImageLayout srcLayout,
ImageLayout dstLayout) ImageLayout dstLayout)
{ {
using var debugScope = _gd.CreateLabelScope(commandBuffer, $"Window.Transition({srcAccess}:{srcLayout} -> {dstAccess}:{dstLayout})", new ColorF(1, 1, 0, 1));
var subresourceRange = new ImageSubresourceRange(ImageAspectFlags.ColorBit, 0, 1, 0, 1); var subresourceRange = new ImageSubresourceRange(ImageAspectFlags.ColorBit, 0, 1, 0, 1);
var barrier = new ImageMemoryBarrier var barrier = new ImageMemoryBarrier