No need to do it for images
This commit is contained in:
parent
8a12c113f9
commit
86511ecbd0
2 changed files with 2 additions and 106 deletions
|
@ -696,14 +696,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
if (_dirty.HasFlag(DirtyFlags.Image))
|
if (_dirty.HasFlag(DirtyFlags.Image))
|
||||||
{
|
{
|
||||||
if (program.UpdateImagesWithoutTemplate)
|
UpdateAndBind(cbs, program, PipelineBase.ImageSetIndex, pbp);
|
||||||
{
|
|
||||||
UpdateAndBindImagesWithoutTemplate(cbs, program, pbp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UpdateAndBind(cbs, program, PipelineBase.ImageSetIndex, pbp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (program.BindingSegments.Length > PipelineBase.DescriptorSetLayouts)
|
if (program.BindingSegments.Length > PipelineBase.DescriptorSetLayouts)
|
||||||
|
@ -1012,99 +1005,6 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
_gd.Api.CmdBindDescriptorSets(cbs.CommandBuffer, pbp, _program.PipelineLayout, (uint)setIndex, 1, sets, 0, ReadOnlySpan<uint>.Empty);
|
_gd.Api.CmdBindDescriptorSets(cbs.CommandBuffer, pbp, _program.PipelineLayout, (uint)setIndex, 1, sets, 0, ReadOnlySpan<uint>.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateAndBindImagesWithoutTemplate(CommandBufferScoped cbs, ShaderCollection program, PipelineBindPoint pbp)
|
|
||||||
{
|
|
||||||
int setIndex = PipelineBase.ImageSetIndex;
|
|
||||||
var bindingSegments = program.BindingSegments[setIndex];
|
|
||||||
|
|
||||||
if (bindingSegments.Length == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_updateDescriptorCacheCbIndex)
|
|
||||||
{
|
|
||||||
_updateDescriptorCacheCbIndex = false;
|
|
||||||
program.UpdateDescriptorCacheCommandBufferIndex(cbs.CommandBufferIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
var dsc = program.GetNewDescriptorSetCollection(setIndex, out _).Get(cbs);
|
|
||||||
|
|
||||||
foreach (ResourceBindingSegment segment in bindingSegments)
|
|
||||||
{
|
|
||||||
int binding = segment.Binding;
|
|
||||||
int count = segment.Count;
|
|
||||||
|
|
||||||
if (!segment.IsArray)
|
|
||||||
{
|
|
||||||
if (segment.Type != ResourceType.BufferImage)
|
|
||||||
{
|
|
||||||
Span<DescriptorImageInfo> images = _images;
|
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
images[i].ImageView = _imageRefs[binding + i].View?.Get(cbs).Value ?? default;
|
|
||||||
}
|
|
||||||
|
|
||||||
dsc.UpdateImages(0, binding, images[..count], DescriptorType.StorageImage);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Span<BufferView> bufferImages = _bufferImages;
|
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
bufferImages[i] = _bufferImageRefs[binding + i]?.GetBufferView(cbs, _bufferImageFormats[binding + i], true) ?? default;
|
|
||||||
}
|
|
||||||
|
|
||||||
dsc.UpdateBufferImages(0, binding, bufferImages[..count], DescriptorType.StorageTexelBuffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (segment.Type != ResourceType.BufferTexture)
|
|
||||||
{
|
|
||||||
dsc.UpdateImages(0, binding, _imageArrayRefs[binding].Array.GetImageInfos(_gd, cbs, _dummyTexture), DescriptorType.StorageImage);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dsc.UpdateBufferImages(0, binding, _imageArrayRefs[binding].Array.GetBufferViews(cbs), DescriptorType.StorageTexelBuffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var sets = dsc.GetSets();
|
|
||||||
|
|
||||||
_gd.Api.CmdBindDescriptorSets(cbs.CommandBuffer, pbp, _program.PipelineLayout, (uint)setIndex, 1, sets, 0, ReadOnlySpan<uint>.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void UpdateBuffers(
|
|
||||||
CommandBufferScoped cbs,
|
|
||||||
PipelineBindPoint pbp,
|
|
||||||
int baseBinding,
|
|
||||||
ReadOnlySpan<DescriptorBufferInfo> bufferInfo,
|
|
||||||
DescriptorType type)
|
|
||||||
{
|
|
||||||
if (bufferInfo.Length == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fixed (DescriptorBufferInfo* pBufferInfo = bufferInfo)
|
|
||||||
{
|
|
||||||
var writeDescriptorSet = new WriteDescriptorSet
|
|
||||||
{
|
|
||||||
SType = StructureType.WriteDescriptorSet,
|
|
||||||
DstBinding = (uint)baseBinding,
|
|
||||||
DescriptorType = type,
|
|
||||||
DescriptorCount = (uint)bufferInfo.Length,
|
|
||||||
PBufferInfo = pBufferInfo,
|
|
||||||
};
|
|
||||||
|
|
||||||
_gd.PushDescriptorApi.CmdPushDescriptorSet(cbs.CommandBuffer, pbp, _program.PipelineLayout, 0, 1, &writeDescriptorSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private void UpdateAndBindUniformBufferPd(CommandBufferScoped cbs)
|
private void UpdateAndBindUniformBufferPd(CommandBufferScoped cbs)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
public bool HasTessellationControlShader => (Stages & (1u << 3)) != 0;
|
public bool HasTessellationControlShader => (Stages & (1u << 3)) != 0;
|
||||||
|
|
||||||
public bool UpdateTexturesWithoutTemplate { get; }
|
public bool UpdateTexturesWithoutTemplate { get; }
|
||||||
public bool UpdateImagesWithoutTemplate { get; }
|
|
||||||
|
|
||||||
public uint Stages { get; }
|
public uint Stages { get; }
|
||||||
|
|
||||||
|
@ -144,10 +143,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
if (bindingSegment.Type == ResourceType.BufferTexture)
|
if (bindingSegment.Type == ResourceType.BufferTexture)
|
||||||
{
|
{
|
||||||
UpdateTexturesWithoutTemplate = true;
|
UpdateTexturesWithoutTemplate = true;
|
||||||
}
|
break;
|
||||||
else if (bindingSegment.Type == ResourceType.BufferImage)
|
|
||||||
{
|
|
||||||
UpdateImagesWithoutTemplate = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue