|
@@ -5,6 +5,8 @@ using System.Collections.Concurrent;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
+using Buffer = System.Buffer;
|
|
|
|
|
+
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
{
|
|
{
|
|
|
public class OGLShader : IGalShader
|
|
public class OGLShader : IGalShader
|
|
@@ -151,7 +153,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
return Enumerable.Empty<ShaderDeclInfo>();
|
|
return Enumerable.Empty<ShaderDeclInfo>();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void SetConstBuffer(long Key, int Cbuf, byte[] Data)
|
|
|
|
|
|
|
+ public void SetConstBuffer(long Key, int Cbuf, int DataSize, IntPtr HostAddress)
|
|
|
{
|
|
{
|
|
|
if (Stages.TryGetValue(Key, out ShaderStage Stage))
|
|
if (Stages.TryGetValue(Key, out ShaderStage Stage))
|
|
|
{
|
|
{
|
|
@@ -159,13 +161,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
{
|
|
{
|
|
|
OGLStreamBuffer Buffer = GetConstBuffer(Stage.Type, Cbuf);
|
|
OGLStreamBuffer Buffer = GetConstBuffer(Stage.Type, Cbuf);
|
|
|
|
|
|
|
|
- int Size = Math.Min(Data.Length, Buffer.Size);
|
|
|
|
|
-
|
|
|
|
|
- byte[] Destiny = Buffer.Map(Size);
|
|
|
|
|
-
|
|
|
|
|
- Array.Copy(Data, Destiny, Size);
|
|
|
|
|
|
|
+ int Size = Math.Min(DataSize, Buffer.Size);
|
|
|
|
|
|
|
|
- Buffer.Unmap(Size);
|
|
|
|
|
|
|
+ Buffer.SetData(Size, HostAddress);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -278,7 +276,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
{
|
|
{
|
|
|
int FreeBinding = 0;
|
|
int FreeBinding = 0;
|
|
|
|
|
|
|
|
- int BindUniformBlocksIfNotNull(ShaderStage Stage)
|
|
|
|
|
|
|
+ void BindUniformBlocksIfNotNull(ShaderStage Stage)
|
|
|
{
|
|
{
|
|
|
if (Stage != null)
|
|
if (Stage != null)
|
|
|
{
|
|
{
|
|
@@ -297,8 +295,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
FreeBinding++;
|
|
FreeBinding++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return FreeBinding;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
BindUniformBlocksIfNotNull(Current.Vertex);
|
|
BindUniformBlocksIfNotNull(Current.Vertex);
|
|
@@ -312,7 +308,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
{
|
|
{
|
|
|
int FreeBinding = 0;
|
|
int FreeBinding = 0;
|
|
|
|
|
|
|
|
- int BindUniformBuffersIfNotNull(ShaderStage Stage)
|
|
|
|
|
|
|
+ void BindUniformBuffersIfNotNull(ShaderStage Stage)
|
|
|
{
|
|
{
|
|
|
if (Stage != null)
|
|
if (Stage != null)
|
|
|
{
|
|
{
|
|
@@ -325,8 +321,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
FreeBinding++;
|
|
FreeBinding++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return FreeBinding;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
BindUniformBuffersIfNotNull(Current.Vertex);
|
|
BindUniformBuffersIfNotNull(Current.Vertex);
|
|
@@ -347,7 +341,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
//Allocate a maximum of 64 KiB
|
|
//Allocate a maximum of 64 KiB
|
|
|
int Size = Math.Min(GL.GetInteger(GetPName.MaxUniformBlockSize), 64 * 1024);
|
|
int Size = Math.Min(GL.GetInteger(GetPName.MaxUniformBlockSize), 64 * 1024);
|
|
|
|
|
|
|
|
- Buffer = OGLStreamBuffer.Create(BufferTarget.UniformBuffer, Size);
|
|
|
|
|
|
|
+ Buffer = new OGLStreamBuffer(BufferTarget.UniformBuffer, Size);
|
|
|
|
|
|
|
|
ConstBuffers[StageIndex][Cbuf] = Buffer;
|
|
ConstBuffers[StageIndex][Cbuf] = Buffer;
|
|
|
}
|
|
}
|