mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-17 22:26:39 +00:00
Renamed some variables for code review
This commit is contained in:
parent
87105b0ad1
commit
36294a60b3
4 changed files with 23 additions and 22 deletions
|
@ -148,7 +148,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
return (formatFeatureFlags & flags) == flags;
|
return (formatFeatureFlags & flags) == flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VkFormat ConvertToVkFormat(Format srcFormat, bool required)
|
public VkFormat ConvertToVkFormat(Format srcFormat, bool storageFeatureFlagRequired)
|
||||||
{
|
{
|
||||||
var format = FormatTable.GetFormat(srcFormat);
|
var format = FormatTable.GetFormat(srcFormat);
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
requiredFeatures |= FormatFeatureFlags.ColorAttachmentBit;
|
requiredFeatures |= FormatFeatureFlags.ColorAttachmentBit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (srcFormat.IsImageCompatible() && required)
|
if (srcFormat.IsImageCompatible() && storageFeatureFlagRequired)
|
||||||
{
|
{
|
||||||
requiredFeatures |= FormatFeatureFlags.StorageImageBit;
|
requiredFeatures |= FormatFeatureFlags.StorageImageBit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,17 +29,17 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
int colorCount = 0;
|
int colorCount = 0;
|
||||||
int maxColorAttachmentIndex = -1;
|
int maxColorAttachmentIndex = -1;
|
||||||
|
|
||||||
bool supported = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
bool supportsIsNotMsOrSupportsStorage = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
||||||
!state.DepthStencilFormat.IsImageCompatible();
|
!state.DepthStencilFormat.IsImageCompatible();
|
||||||
|
|
||||||
for (int i = 0; i < state.AttachmentEnable.Length; i++)
|
for (int i = 0; i < state.AttachmentEnable.Length; i++)
|
||||||
{
|
{
|
||||||
if (state.AttachmentEnable[i])
|
if (state.AttachmentEnable[i])
|
||||||
{
|
{
|
||||||
bool supportedAttachment = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
bool supportsIsNotMsOrSupportsStorageAttachments = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
||||||
!state.AttachmentFormats[i].IsImageCompatible();
|
!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;
|
attachmentIndices[attachmentCount++] = i;
|
||||||
colorCount++;
|
colorCount++;
|
||||||
|
@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
if (state.DepthStencilEnable)
|
if (state.DepthStencilEnable)
|
||||||
{
|
{
|
||||||
attachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supported);
|
attachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supportsIsNotMsOrSupportsStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachmentCount != 0)
|
if (attachmentCount != 0)
|
||||||
|
@ -302,9 +302,10 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
if (state.AttachmentEnable[i])
|
if (state.AttachmentEnable[i])
|
||||||
{
|
{
|
||||||
bool supportedAttachment = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
bool supportsIsNotMsOrSupportsStorage = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
||||||
!state.AttachmentFormats[i].IsImageCompatible();
|
!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;
|
maxColorAttachmentIndex = i;
|
||||||
|
|
||||||
if (state.AttachmentFormats[i].IsInteger())
|
if (state.AttachmentFormats[i].IsInteger())
|
||||||
|
@ -318,10 +319,10 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
if (state.DepthStencilEnable)
|
if (state.DepthStencilEnable)
|
||||||
{
|
{
|
||||||
bool supported = !state.DepthStencilFormat.IsImageCompatible() ||
|
bool supportsIsNotMsOrSupportsStorage = !state.DepthStencilFormat.IsImageCompatible() ||
|
||||||
gd.Capabilities.SupportsShaderStorageImageMultisample;
|
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);
|
pipeline.ColorBlendAttachmentStateCount = (uint)(maxColorAttachmentIndex + 1);
|
||||||
|
|
|
@ -67,9 +67,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
_device = device;
|
_device = device;
|
||||||
_info = info;
|
_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 levels = (uint)info.Levels;
|
||||||
var layers = (uint)info.GetLayers();
|
var layers = (uint)info.GetLayers();
|
||||||
var depth = (uint)(info.Target == Target.Texture3D ? info.Depth : 1);
|
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 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;
|
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;
|
var usage = DefaultUsageFlags;
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
usage |= ImageUsageFlags.ColorAttachmentBit;
|
usage |= ImageUsageFlags.ColorAttachmentBit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((format.IsImageCompatible() && (supportsMsStorage || !target.IsMultisample())) || extendedUsage)
|
if ((format.IsImageCompatible() && supportsIsNotMsOrSupportsStorage) || extendedUsage)
|
||||||
{
|
{
|
||||||
usage |= ImageUsageFlags.StorageBit;
|
usage |= ImageUsageFlags.StorageBit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,10 +59,10 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
gd.Textures.Add(this);
|
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 format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format, supportsIsNotMsOrSupportsStorage);
|
||||||
var usage = TextureStorage.GetImageUsage(info.Format, info.Target, gd.Capabilities.SupportsShaderStorageImageMultisample, false);
|
var usage = TextureStorage.GetImageUsage(info.Format, supportsIsNotMsOrSupportsStorage, false);
|
||||||
var levels = (uint)info.Levels;
|
var levels = (uint)info.Levels;
|
||||||
var layers = (uint)info.GetLayers();
|
var layers = (uint)info.GetLayers();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue