mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-26 18:43:04 +00:00
Request Storage image bit feature flag only if its required
This commit is contained in:
parent
8bf7153794
commit
87105b0ad1
4 changed files with 23 additions and 8 deletions
|
@ -148,7 +148,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
return (formatFeatureFlags & flags) == flags;
|
return (formatFeatureFlags & flags) == flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
public VkFormat ConvertToVkFormat(Format srcFormat)
|
public VkFormat ConvertToVkFormat(Format srcFormat, bool required)
|
||||||
{
|
{
|
||||||
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())
|
if (srcFormat.IsImageCompatible() && required)
|
||||||
{
|
{
|
||||||
requiredFeatures |= FormatFeatureFlags.StorageImageBit;
|
requiredFeatures |= FormatFeatureFlags.StorageImageBit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,11 +29,17 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
int colorCount = 0;
|
int colorCount = 0;
|
||||||
int maxColorAttachmentIndex = -1;
|
int maxColorAttachmentIndex = -1;
|
||||||
|
|
||||||
|
bool supported = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
||||||
|
!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])
|
||||||
{
|
{
|
||||||
attachmentFormats[attachmentCount] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i]);
|
bool supportedAttachment = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
||||||
|
!state.AttachmentFormats[i].IsImageCompatible();
|
||||||
|
|
||||||
|
attachmentFormats[attachmentCount] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i], supportedAttachment);
|
||||||
|
|
||||||
attachmentIndices[attachmentCount++] = i;
|
attachmentIndices[attachmentCount++] = i;
|
||||||
colorCount++;
|
colorCount++;
|
||||||
|
@ -43,7 +49,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
if (state.DepthStencilEnable)
|
if (state.DepthStencilEnable)
|
||||||
{
|
{
|
||||||
attachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat);
|
attachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supported);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attachmentCount != 0)
|
if (attachmentCount != 0)
|
||||||
|
@ -296,7 +302,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
if (state.AttachmentEnable[i])
|
if (state.AttachmentEnable[i])
|
||||||
{
|
{
|
||||||
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i]);
|
bool supportedAttachment = gd.Capabilities.SupportsShaderStorageImageMultisample ||
|
||||||
|
!state.AttachmentFormats[i].IsImageCompatible();
|
||||||
|
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.AttachmentFormats[i], supportedAttachment);
|
||||||
maxColorAttachmentIndex = i;
|
maxColorAttachmentIndex = i;
|
||||||
|
|
||||||
if (state.AttachmentFormats[i].IsInteger())
|
if (state.AttachmentFormats[i].IsInteger())
|
||||||
|
@ -310,7 +318,10 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
if (state.DepthStencilEnable)
|
if (state.DepthStencilEnable)
|
||||||
{
|
{
|
||||||
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat);
|
bool supported = !state.DepthStencilFormat.IsImageCompatible() ||
|
||||||
|
gd.Capabilities.SupportsShaderStorageImageMultisample;
|
||||||
|
|
||||||
|
pipeline.Internal.AttachmentFormats[attachmentCount++] = gd.FormatCapabilities.ConvertToVkFormat(state.DepthStencilFormat, supported);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline.ColorBlendAttachmentStateCount = (uint)(maxColorAttachmentIndex + 1);
|
pipeline.ColorBlendAttachmentStateCount = (uint)(maxColorAttachmentIndex + 1);
|
||||||
|
|
|
@ -67,7 +67,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
_device = device;
|
_device = device;
|
||||||
_info = info;
|
_info = info;
|
||||||
|
|
||||||
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format);
|
bool multisample = gd.Capabilities.SupportsShaderStorageImageMultisample || !info.Target.IsMultisample();
|
||||||
|
|
||||||
|
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format, multisample);
|
||||||
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);
|
||||||
|
|
|
@ -59,7 +59,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
|
|
||||||
gd.Textures.Add(this);
|
gd.Textures.Add(this);
|
||||||
|
|
||||||
var format = _gd.FormatCapabilities.ConvertToVkFormat(info.Format);
|
bool multisample = 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 usage = TextureStorage.GetImageUsage(info.Format, info.Target, gd.Capabilities.SupportsShaderStorageImageMultisample, 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