Use maximum shared memory size supported by hardware
This commit is contained in:
parent
375ee0ba96
commit
0d9672f3ae
6 changed files with 28 additions and 15 deletions
|
@ -4,17 +4,20 @@ namespace Ryujinx.Graphics.GAL
|
|||
{
|
||||
public bool SupportsAstcCompression { get; }
|
||||
|
||||
public int MaximumViewportDimensions { get; }
|
||||
public int StorageBufferOffsetAlignment { get; }
|
||||
public int MaximumViewportDimensions { get; }
|
||||
public int MaximumComputeSharedMemorySize { get; }
|
||||
public int StorageBufferOffsetAlignment { get; }
|
||||
|
||||
public Capabilities(
|
||||
bool supportsAstcCompression,
|
||||
int maximumViewportDimensions,
|
||||
int maximumComputeSharedMemorySize,
|
||||
int storageBufferOffsetAlignment)
|
||||
{
|
||||
SupportsAstcCompression = supportsAstcCompression;
|
||||
MaximumViewportDimensions = maximumViewportDimensions;
|
||||
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
||||
SupportsAstcCompression = supportsAstcCompression;
|
||||
MaximumViewportDimensions = maximumViewportDimensions;
|
||||
MaximumComputeSharedMemorySize = maximumComputeSharedMemorySize;
|
||||
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -352,6 +352,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
|||
{
|
||||
return new ShaderCapabilities(
|
||||
_context.Capabilities.MaximumViewportDimensions,
|
||||
_context.Capabilities.MaximumComputeSharedMemorySize,
|
||||
_context.Capabilities.StorageBufferOffsetAlignment);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,15 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
{
|
||||
private static Lazy<bool> _supportsAstcCompression = new Lazy<bool>(() => HasExtension("GL_KHR_texture_compression_astc_ldr"));
|
||||
|
||||
private static Lazy<int> _maximumViewportDimensions = new Lazy<int>(() => GetLimit(All.MaxViewportDims));
|
||||
private static Lazy<int> _storageBufferOffsetAlignment = new Lazy<int>(() => GetLimit(All.ShaderStorageBufferOffsetAlignment));
|
||||
private static Lazy<int> _maximumViewportDimensions = new Lazy<int>(() => GetLimit(All.MaxViewportDims));
|
||||
private static Lazy<int> _maximumComputeSharedMemorySize = new Lazy<int>(() => GetLimit(All.MaxComputeSharedMemorySize));
|
||||
private static Lazy<int> _storageBufferOffsetAlignment = new Lazy<int>(() => GetLimit(All.ShaderStorageBufferOffsetAlignment));
|
||||
|
||||
public static bool SupportsAstcCompression => _supportsAstcCompression.Value;
|
||||
|
||||
public static int MaximumViewportDimensions => _maximumViewportDimensions.Value;
|
||||
public static int StorageBufferOffsetAlignment => _storageBufferOffsetAlignment.Value;
|
||||
public static int MaximumViewportDimensions => _maximumViewportDimensions.Value;
|
||||
public static int MaximumComputeSharedMemorySize => _maximumComputeSharedMemorySize.Value;
|
||||
public static int StorageBufferOffsetAlignment => _storageBufferOffsetAlignment.Value;
|
||||
|
||||
private static bool HasExtension(string name)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
return new Capabilities(
|
||||
HwCapabilities.SupportsAstcCompression,
|
||||
HwCapabilities.MaximumViewportDimensions,
|
||||
HwCapabilities.MaximumComputeSharedMemorySize,
|
||||
HwCapabilities.StorageBufferOffsetAlignment);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
|||
|
||||
if (context.Config.Stage == ShaderStage.Compute)
|
||||
{
|
||||
context.AppendLine($"shared uint {DefaultNames.SharedMemoryName}[0x100];");
|
||||
string size = NumberFormatter.FormatInt(context.Config.Capabilities.MaximumComputeSharedMemorySize / 4);
|
||||
|
||||
context.AppendLine($"shared uint {DefaultNames.SharedMemoryName}[{size}];");
|
||||
context.AppendLine();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,19 +2,23 @@ namespace Ryujinx.Graphics.Shader
|
|||
{
|
||||
public struct ShaderCapabilities
|
||||
{
|
||||
private static readonly ShaderCapabilities _default = new ShaderCapabilities(32768, 16);
|
||||
// Initialize with default values for Maxwell.
|
||||
private static readonly ShaderCapabilities _default = new ShaderCapabilities(32768, 49152, 16);
|
||||
|
||||
public static ShaderCapabilities Default => _default;
|
||||
|
||||
public int MaximumViewportDimensions { get; }
|
||||
public int StorageBufferOffsetAlignment { get; }
|
||||
public int MaximumViewportDimensions { get; }
|
||||
public int MaximumComputeSharedMemorySize { get; }
|
||||
public int StorageBufferOffsetAlignment { get; }
|
||||
|
||||
public ShaderCapabilities(
|
||||
int maximumViewportDimensions,
|
||||
int maximumComputeSharedMemorySize,
|
||||
int storageBufferOffsetAlignment)
|
||||
{
|
||||
MaximumViewportDimensions = maximumViewportDimensions;
|
||||
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
||||
MaximumViewportDimensions = maximumViewportDimensions;
|
||||
MaximumComputeSharedMemorySize = maximumComputeSharedMemorySize;
|
||||
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue