mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-06-29 03:46:24 +02:00
Update packages and fix descriptor address issue
This commit is contained in:
parent
d9099429f2
commit
2ba59b2ce9
6 changed files with 85 additions and 31 deletions
|
@ -48,32 +48,58 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
}
|
||||
|
||||
public unsafe void UpdateBuffers(int setIndex, int baseBinding, ReadOnlySpan<DescriptorBufferInfo> bufferInfo, DescriptorType type)
|
||||
{
|
||||
|
||||
// DEBUG: Validate inputs
|
||||
if (bufferInfo.Length == 0)
|
||||
{
|
||||
Console.WriteLine("bufferInfo is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
// DEBUG: Check if _descriptorSets and _holder.Device are properly initialized
|
||||
if (_descriptorSets == null || _descriptorSets.Length <= setIndex)
|
||||
{
|
||||
throw new Exception("Descriptor set at the specified index is null or out of range.");
|
||||
}
|
||||
|
||||
if (_holder?.Device == null)
|
||||
{
|
||||
throw new Exception("_holder.Device is null or uninitialized.");
|
||||
}
|
||||
|
||||
// DEBUG: Check each DescriptorBufferInfo in the span
|
||||
foreach (var info in bufferInfo)
|
||||
{
|
||||
if (info.Buffer.Handle == 0)
|
||||
{
|
||||
if (bufferInfo.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fixed (DescriptorBufferInfo* pBufferInfo = bufferInfo)
|
||||
{
|
||||
var writeDescriptorSet = new WriteDescriptorSet
|
||||
{
|
||||
SType = StructureType.WriteDescriptorSet,
|
||||
DstSet = _descriptorSets[setIndex],
|
||||
DstBinding = (uint)baseBinding,
|
||||
DescriptorType = type,
|
||||
DescriptorCount = (uint)bufferInfo.Length,
|
||||
PBufferInfo = pBufferInfo,
|
||||
};
|
||||
|
||||
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null);
|
||||
}
|
||||
throw new Exception("One of the buffers in bufferInfo is null or uninitialized.");
|
||||
}
|
||||
}
|
||||
|
||||
// Proceed if all checks pass
|
||||
fixed (DescriptorBufferInfo* pBufferInfo = bufferInfo)
|
||||
{
|
||||
var writeDescriptorSet = new WriteDescriptorSet
|
||||
{
|
||||
SType = StructureType.WriteDescriptorSet,
|
||||
DstSet = _descriptorSets[setIndex],
|
||||
DstBinding = (uint)baseBinding,
|
||||
DescriptorType = type,
|
||||
DescriptorCount = (uint)bufferInfo.Length,
|
||||
PBufferInfo = pBufferInfo
|
||||
};
|
||||
|
||||
// Update descriptor sets
|
||||
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void UpdateImage(int setIndex, int bindingIndex, DescriptorImageInfo imageInfo, DescriptorType type)
|
||||
{
|
||||
if (imageInfo.ImageView.Handle != 0UL)
|
||||
{
|
||||
|
||||
var writeDescriptorSet = new WriteDescriptorSet
|
||||
{
|
||||
SType = StructureType.WriteDescriptorSet,
|
||||
|
@ -90,11 +116,22 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
public unsafe void UpdateImages(int setIndex, int baseBinding, ReadOnlySpan<DescriptorImageInfo> imageInfo, DescriptorType type)
|
||||
{
|
||||
|
||||
// DEBUG: Check if imageInfo is Empty
|
||||
if (imageInfo.Length == 0)
|
||||
{
|
||||
|
||||
Console.WriteLine("Error: imageInfo is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
// DEBUG: Check the values inside imageInfo
|
||||
foreach (var info in imageInfo)
|
||||
{
|
||||
Console.WriteLine($"Buffer Handle: {info.ImageView.Handle}");
|
||||
}
|
||||
|
||||
|
||||
fixed (DescriptorImageInfo* pImageInfo = imageInfo)
|
||||
{
|
||||
var writeDescriptorSet = new WriteDescriptorSet
|
||||
|
@ -107,6 +144,8 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
PImageInfo = pImageInfo,
|
||||
};
|
||||
|
||||
|
||||
|
||||
_holder.Api.UpdateDescriptorSets(_holder.Device, 1, writeDescriptorSet, 0, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue