Replace ShaderBindings with new ResourceLayout structure for Vulkan (#5025)
* Introduce ResourceLayout * Part 1: Use new ResourceSegments array on UpdateAndBind * Part 2: Use ResourceLayout to build PipelineLayout * Delete old code * XML docs * Fix shader cache load NRE * Fix typo
This commit is contained in:
parent
402f05b8ef
commit
5626f2ca1c
24 changed files with 1047 additions and 677 deletions
|
@ -36,6 +36,56 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
};
|
||||
}
|
||||
|
||||
public static ShaderStageFlags Convert(this ResourceStages stages)
|
||||
{
|
||||
ShaderStageFlags stageFlags = stages.HasFlag(ResourceStages.Compute)
|
||||
? ShaderStageFlags.ComputeBit
|
||||
: ShaderStageFlags.None;
|
||||
|
||||
if (stages.HasFlag(ResourceStages.Vertex))
|
||||
{
|
||||
stageFlags |= ShaderStageFlags.VertexBit;
|
||||
}
|
||||
|
||||
if (stages.HasFlag(ResourceStages.TessellationControl))
|
||||
{
|
||||
stageFlags |= ShaderStageFlags.TessellationControlBit;
|
||||
}
|
||||
|
||||
if (stages.HasFlag(ResourceStages.TessellationEvaluation))
|
||||
{
|
||||
stageFlags |= ShaderStageFlags.TessellationEvaluationBit;
|
||||
}
|
||||
|
||||
if (stages.HasFlag(ResourceStages.Geometry))
|
||||
{
|
||||
stageFlags |= ShaderStageFlags.GeometryBit;
|
||||
}
|
||||
|
||||
if (stages.HasFlag(ResourceStages.Fragment))
|
||||
{
|
||||
stageFlags |= ShaderStageFlags.FragmentBit;
|
||||
}
|
||||
|
||||
return stageFlags;
|
||||
}
|
||||
|
||||
public static DescriptorType Convert(this ResourceType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
ResourceType.UniformBuffer => DescriptorType.UniformBuffer,
|
||||
ResourceType.StorageBuffer => DescriptorType.StorageBuffer,
|
||||
ResourceType.Texture => DescriptorType.SampledImage,
|
||||
ResourceType.Sampler => DescriptorType.Sampler,
|
||||
ResourceType.TextureAndSampler => DescriptorType.CombinedImageSampler,
|
||||
ResourceType.Image => DescriptorType.StorageImage,
|
||||
ResourceType.BufferTexture => DescriptorType.UniformTexelBuffer,
|
||||
ResourceType.BufferImage => DescriptorType.StorageTexelBuffer,
|
||||
_ => throw new ArgumentException($"Invalid resource type \"{type}\".")
|
||||
};
|
||||
}
|
||||
|
||||
public static SamplerAddressMode Convert(this AddressMode mode)
|
||||
{
|
||||
return mode switch
|
||||
|
@ -48,7 +98,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
AddressMode.ClampToBorder => SamplerAddressMode.ClampToBorder,
|
||||
AddressMode.MirroredRepeat => SamplerAddressMode.MirroredRepeat,
|
||||
AddressMode.ClampToEdge => SamplerAddressMode.ClampToEdge,
|
||||
_ => LogInvalidAndReturn(mode, nameof(AddressMode), SamplerAddressMode.ClampToEdge) // TODO: Should be clamp.
|
||||
_ => LogInvalidAndReturn(mode, nameof(AddressMode), SamplerAddressMode.ClampToEdge) // TODO: Should be clamp.
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue