Renamed some variables for code review

This commit is contained in:
sunshineinabox 2024-07-21 18:33:09 -07:00
parent 87105b0ad1
commit 36294a60b3
4 changed files with 23 additions and 22 deletions

View file

@ -148,7 +148,7 @@ namespace Ryujinx.Graphics.Vulkan
return (formatFeatureFlags & flags) == flags;
}
public VkFormat ConvertToVkFormat(Format srcFormat, bool required)
public VkFormat ConvertToVkFormat(Format srcFormat, bool storageFeatureFlagRequired)
{
var format = FormatTable.GetFormat(srcFormat);
@ -165,7 +165,7 @@ namespace Ryujinx.Graphics.Vulkan
requiredFeatures |= FormatFeatureFlags.ColorAttachmentBit;
}
if (srcFormat.IsImageCompatible() && required)
if (srcFormat.IsImageCompatible() && storageFeatureFlagRequired)
{
requiredFeatures |= FormatFeatureFlags.StorageImageBit;
}

View file

@ -29,17 +29,17 @@ namespace Ryujinx.Graphics.Vulkan
int colorCount = 0;
int maxColorAttachmentIndex = -1;
bool supported = gd.Capabilities.SupportsShaderStorageImageMultisample ||
bool supportsIsNotMsOrSupportsStorage = gd.Capabilities.SupportsShaderStorageImageMultisample ||
!state.DepthStencilFormat.IsImageCompatible();
for (int i = 0; i < state.AttachmentEnable.Length; i++)
{
if (state.AttachmentEnable[i])
{
bool supportedAttachment = gd.Capabilities.SupportsShaderStorageImageMultisample ||
bool supportsIsNotMsOrSupportsStorageAttachments = gd.Capabilities.SupportsShaderStorageImageMultisample ||
!state.AttachmentFormats[i].IsImageCompatible();
attachmentFormats[attachmentCount] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i], supportedAttachment);
attachmentFormats[attachmentCount] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i], supportsIsNotMsOrSupportsStorageAttachments);
attachmentIndices[attachmentCount++] = i;
colorCount++;
@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Vulkan
if (state.DepthStencilEnable)
{
attachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supported);
attachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supportsIsNotMsOrSupportsStorage);
}
if (attachmentCount != 0)
@ -302,9 +302,10 @@ namespace Ryujinx.Graphics.Vulkan
{
if (state.AttachmentEnable[i])
{
bool supportedAttachment = gd.Capabilities.SupportsShaderStorageImageMultisample ||
bool supportsIsNotMsOrSupportsStorage = gd.Capabilities.SupportsShaderStorageImageMultisample ||
!state.AttachmentFormats[i].IsImageCompatible();
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i], supportedAttachment);
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i], supportsIsNotMsOrSupportsStorage);
maxColorAttachmentIndex = i;
if (state.AttachmentFormats[i].IsInteger())
@ -318,10 +319,10 @@ namespace Ryujinx.Graphics.Vulkan
if (state.DepthStencilEnable)
{
bool supported = !state.DepthStencilFormat.IsImageCompatible() ||
bool supportsIsNotMsOrSupportsStorage = !state.DepthStencilFormat.IsImageCompatible() ||
gd.Capabilities.SupportsShaderStorageImageMultisample;
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supported);
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supportsIsNotMsOrSupportsStorage);
}
pipeline.ColorBlendAttachmentStateCount = (uint)(maxColorAttachmentIndex + 1);

View file

@ -67,9 +67,9 @@ namespace Ryujinx.Graphics.Vulkan
_device = device;
_info = info;
bool multisample = gd.Capabilities.SupportsShaderStorageImageMultisample || !info.Target.IsMultisample();
bool supportsIsNotMsOrSupportsStorage = gd.Capabilities.SupportsShaderStorageImageMultisample || !info.Target.IsMultisample();
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format, multisample);
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format, supportsIsNotMsOrSupportsStorage);
var levels = (uint)info.Levels;
var layers = (uint)info.GetLayers();
var depth = (uint)(info.Target == Target.Texture3D ? info.Depth : 1);
@ -82,7 +82,7 @@ namespace Ryujinx.Graphics.Vulkan
var sampleCountFlags = ConvertToSampleCountFlags(gd.Capabilities.SupportedSampleCounts, (uint)info.Samples);
var usage = GetImageUsage(info.Format, info.Target, gd.Capabilities.SupportsShaderStorageImageMultisample, true);
var usage = GetImageUsage(info.Format, supportsIsNotMsOrSupportsStorage, true);
var flags = ImageCreateFlags.CreateMutableFormatBit | ImageCreateFlags.CreateExtendedUsageBit;
@ -294,7 +294,7 @@ namespace Ryujinx.Graphics.Vulkan
}
}
public static ImageUsageFlags GetImageUsage(Format format, Target target, bool supportsMsStorage, bool extendedUsage)
public static ImageUsageFlags GetImageUsage(Format format, bool supportsIsNotMsOrSupportsStorage, bool extendedUsage)
{
var usage = DefaultUsageFlags;
@ -307,7 +307,7 @@ namespace Ryujinx.Graphics.Vulkan
usage |= ImageUsageFlags.ColorAttachmentBit;
}
if ((format.IsImageCompatible() && (supportsMsStorage || !target.IsMultisample())) || extendedUsage)
if ((format.IsImageCompatible() && supportsIsNotMsOrSupportsStorage) || extendedUsage)
{
usage |= ImageUsageFlags.StorageBit;
}

View file

@ -59,10 +59,10 @@ namespace Ryujinx.Graphics.Vulkan
gd.Textures.Add(this);
bool multisample = gd.Capabilities.SupportsShaderStorageImageMultisample || !info.Target.IsMultisample();
bool supportsIsNotMsOrSupportsStorage = gd.Capabilities.SupportsShaderStorageImageMultisample || !info.Target.IsMultisample();
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format, multisample);
var usage = TextureStorage.GetImageUsage(info.Format, info.Target, gd.Capabilities.SupportsShaderStorageImageMultisample, false);
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format, supportsIsNotMsOrSupportsStorage);
var usage = TextureStorage.GetImageUsage(info.Format, supportsIsNotMsOrSupportsStorage, false);
var levels = (uint)info.Levels;
var layers = (uint)info.GetLayers();