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
|
@ -5,15 +5,18 @@ namespace Ryujinx.Graphics.GAL
|
||||||
public bool SupportsAstcCompression { get; }
|
public bool SupportsAstcCompression { get; }
|
||||||
|
|
||||||
public int MaximumViewportDimensions { get; }
|
public int MaximumViewportDimensions { get; }
|
||||||
|
public int MaximumComputeSharedMemorySize { get; }
|
||||||
public int StorageBufferOffsetAlignment { get; }
|
public int StorageBufferOffsetAlignment { get; }
|
||||||
|
|
||||||
public Capabilities(
|
public Capabilities(
|
||||||
bool supportsAstcCompression,
|
bool supportsAstcCompression,
|
||||||
int maximumViewportDimensions,
|
int maximumViewportDimensions,
|
||||||
|
int maximumComputeSharedMemorySize,
|
||||||
int storageBufferOffsetAlignment)
|
int storageBufferOffsetAlignment)
|
||||||
{
|
{
|
||||||
SupportsAstcCompression = supportsAstcCompression;
|
SupportsAstcCompression = supportsAstcCompression;
|
||||||
MaximumViewportDimensions = maximumViewportDimensions;
|
MaximumViewportDimensions = maximumViewportDimensions;
|
||||||
|
MaximumComputeSharedMemorySize = maximumComputeSharedMemorySize;
|
||||||
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,6 +352,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||||
{
|
{
|
||||||
return new ShaderCapabilities(
|
return new ShaderCapabilities(
|
||||||
_context.Capabilities.MaximumViewportDimensions,
|
_context.Capabilities.MaximumViewportDimensions,
|
||||||
|
_context.Capabilities.MaximumComputeSharedMemorySize,
|
||||||
_context.Capabilities.StorageBufferOffsetAlignment);
|
_context.Capabilities.StorageBufferOffsetAlignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,13 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
private static Lazy<bool> _supportsAstcCompression = new Lazy<bool>(() => HasExtension("GL_KHR_texture_compression_astc_ldr"));
|
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> _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));
|
private static Lazy<int> _storageBufferOffsetAlignment = new Lazy<int>(() => GetLimit(All.ShaderStorageBufferOffsetAlignment));
|
||||||
|
|
||||||
public static bool SupportsAstcCompression => _supportsAstcCompression.Value;
|
public static bool SupportsAstcCompression => _supportsAstcCompression.Value;
|
||||||
|
|
||||||
public static int MaximumViewportDimensions => _maximumViewportDimensions.Value;
|
public static int MaximumViewportDimensions => _maximumViewportDimensions.Value;
|
||||||
|
public static int MaximumComputeSharedMemorySize => _maximumComputeSharedMemorySize.Value;
|
||||||
public static int StorageBufferOffsetAlignment => _storageBufferOffsetAlignment.Value;
|
public static int StorageBufferOffsetAlignment => _storageBufferOffsetAlignment.Value;
|
||||||
|
|
||||||
private static bool HasExtension(string name)
|
private static bool HasExtension(string name)
|
||||||
|
|
|
@ -64,6 +64,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
return new Capabilities(
|
return new Capabilities(
|
||||||
HwCapabilities.SupportsAstcCompression,
|
HwCapabilities.SupportsAstcCompression,
|
||||||
HwCapabilities.MaximumViewportDimensions,
|
HwCapabilities.MaximumViewportDimensions,
|
||||||
|
HwCapabilities.MaximumComputeSharedMemorySize,
|
||||||
HwCapabilities.StorageBufferOffsetAlignment);
|
HwCapabilities.StorageBufferOffsetAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,9 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
||||||
|
|
||||||
if (context.Config.Stage == ShaderStage.Compute)
|
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();
|
context.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,22 @@ namespace Ryujinx.Graphics.Shader
|
||||||
{
|
{
|
||||||
public struct ShaderCapabilities
|
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 static ShaderCapabilities Default => _default;
|
||||||
|
|
||||||
public int MaximumViewportDimensions { get; }
|
public int MaximumViewportDimensions { get; }
|
||||||
|
public int MaximumComputeSharedMemorySize { get; }
|
||||||
public int StorageBufferOffsetAlignment { get; }
|
public int StorageBufferOffsetAlignment { get; }
|
||||||
|
|
||||||
public ShaderCapabilities(
|
public ShaderCapabilities(
|
||||||
int maximumViewportDimensions,
|
int maximumViewportDimensions,
|
||||||
|
int maximumComputeSharedMemorySize,
|
||||||
int storageBufferOffsetAlignment)
|
int storageBufferOffsetAlignment)
|
||||||
{
|
{
|
||||||
MaximumViewportDimensions = maximumViewportDimensions;
|
MaximumViewportDimensions = maximumViewportDimensions;
|
||||||
|
MaximumComputeSharedMemorySize = maximumComputeSharedMemorySize;
|
||||||
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
StorageBufferOffsetAlignment = storageBufferOffsetAlignment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue