Renaming part 4
This commit is contained in:
parent
6adbbc376d
commit
faa7e1e4c3
40 changed files with 248 additions and 248 deletions
|
@ -5,15 +5,15 @@ namespace Ryujinx.Graphics.Gal
|
||||||
{
|
{
|
||||||
static class EmbeddedResource
|
static class EmbeddedResource
|
||||||
{
|
{
|
||||||
public static string GetString(string Name)
|
public static string GetString(string name)
|
||||||
{
|
{
|
||||||
Assembly Asm = typeof(EmbeddedResource).Assembly;
|
Assembly asm = typeof(EmbeddedResource).Assembly;
|
||||||
|
|
||||||
using (Stream ResStream = Asm.GetManifestResourceStream(Name))
|
using (Stream resStream = asm.GetManifestResourceStream(name))
|
||||||
{
|
{
|
||||||
StreamReader Reader = new StreamReader(ResStream);
|
StreamReader reader = new StreamReader(resStream);
|
||||||
|
|
||||||
return Reader.ReadToEnd();
|
return reader.ReadToEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,15 +8,15 @@ namespace Ryujinx.Graphics.Gal
|
||||||
public float Alpha { get; private set; }
|
public float Alpha { get; private set; }
|
||||||
|
|
||||||
public GalColorF(
|
public GalColorF(
|
||||||
float Red,
|
float red,
|
||||||
float Green,
|
float green,
|
||||||
float Blue,
|
float blue,
|
||||||
float Alpha)
|
float alpha)
|
||||||
{
|
{
|
||||||
this.Red = Red;
|
Red = red;
|
||||||
this.Green = Green;
|
Green = green;
|
||||||
this.Blue = Blue;
|
Blue = blue;
|
||||||
this.Alpha = Alpha;
|
Alpha = alpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@
|
||||||
{
|
{
|
||||||
public enum GalFrontFace
|
public enum GalFrontFace
|
||||||
{
|
{
|
||||||
CW = 0x900,
|
Cw = 0x900,
|
||||||
CCW = 0x901
|
Ccw = 0x901
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -25,63 +25,63 @@ namespace Ryujinx.Graphics.Gal
|
||||||
public GalTextureTarget TextureTarget;
|
public GalTextureTarget TextureTarget;
|
||||||
|
|
||||||
public GalImage(
|
public GalImage(
|
||||||
int Width,
|
int width,
|
||||||
int Height,
|
int height,
|
||||||
int Depth,
|
int depth,
|
||||||
int LayerCount,
|
int layerCount,
|
||||||
int TileWidth,
|
int tileWidth,
|
||||||
int GobBlockHeight,
|
int gobBlockHeight,
|
||||||
int GobBlockDepth,
|
int gobBlockDepth,
|
||||||
GalMemoryLayout Layout,
|
GalMemoryLayout layout,
|
||||||
GalImageFormat Format,
|
GalImageFormat format,
|
||||||
GalTextureTarget TextureTarget,
|
GalTextureTarget textureTarget,
|
||||||
int MaxMipmapLevel = 1,
|
int maxMipmapLevel = 1,
|
||||||
GalTextureSource XSource = GalTextureSource.Red,
|
GalTextureSource xSource = GalTextureSource.Red,
|
||||||
GalTextureSource YSource = GalTextureSource.Green,
|
GalTextureSource ySource = GalTextureSource.Green,
|
||||||
GalTextureSource ZSource = GalTextureSource.Blue,
|
GalTextureSource zSource = GalTextureSource.Blue,
|
||||||
GalTextureSource WSource = GalTextureSource.Alpha)
|
GalTextureSource wSource = GalTextureSource.Alpha)
|
||||||
{
|
{
|
||||||
this.Width = Width;
|
Width = width;
|
||||||
this.Height = Height;
|
Height = height;
|
||||||
this.LayerCount = LayerCount;
|
LayerCount = layerCount;
|
||||||
this.Depth = Depth;
|
Depth = depth;
|
||||||
this.TileWidth = TileWidth;
|
TileWidth = tileWidth;
|
||||||
this.GobBlockHeight = GobBlockHeight;
|
GobBlockHeight = gobBlockHeight;
|
||||||
this.GobBlockDepth = GobBlockDepth;
|
GobBlockDepth = gobBlockDepth;
|
||||||
this.Layout = Layout;
|
Layout = layout;
|
||||||
this.Format = Format;
|
Format = format;
|
||||||
this.MaxMipmapLevel = MaxMipmapLevel;
|
MaxMipmapLevel = maxMipmapLevel;
|
||||||
this.XSource = XSource;
|
XSource = xSource;
|
||||||
this.YSource = YSource;
|
YSource = ySource;
|
||||||
this.ZSource = ZSource;
|
ZSource = zSource;
|
||||||
this.WSource = WSource;
|
WSource = wSource;
|
||||||
this.TextureTarget = TextureTarget;
|
TextureTarget = textureTarget;
|
||||||
|
|
||||||
Pitch = ImageUtils.GetPitch(Format, Width);
|
Pitch = ImageUtils.GetPitch(format, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SizeMatches(GalImage Image, bool IgnoreLayer = false)
|
public bool SizeMatches(GalImage image, bool ignoreLayer = false)
|
||||||
{
|
{
|
||||||
if (ImageUtils.GetBytesPerPixel(Format) !=
|
if (ImageUtils.GetBytesPerPixel(Format) !=
|
||||||
ImageUtils.GetBytesPerPixel(Image.Format))
|
ImageUtils.GetBytesPerPixel(image.Format))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImageUtils.GetAlignedWidth(this) !=
|
if (ImageUtils.GetAlignedWidth(this) !=
|
||||||
ImageUtils.GetAlignedWidth(Image))
|
ImageUtils.GetAlignedWidth(image))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Result = Height == Image.Height && Depth == Image.Depth;
|
bool result = Height == image.Height && Depth == image.Depth;
|
||||||
|
|
||||||
if (!IgnoreLayer)
|
if (!ignoreLayer)
|
||||||
{
|
{
|
||||||
Result = Result && LayerCount == Image.LayerCount;
|
result = result && LayerCount == image.LayerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -111,9 +111,9 @@
|
||||||
{
|
{
|
||||||
ConstBufferKeys = new long[Stages][];
|
ConstBufferKeys = new long[Stages][];
|
||||||
|
|
||||||
for (int Stage = 0; Stage < Stages; Stage++)
|
for (int stage = 0; stage < Stages; stage++)
|
||||||
{
|
{
|
||||||
ConstBufferKeys[Stage] = new long[ConstBuffersPerStage];
|
ConstBufferKeys[stage] = new long[ConstBuffersPerStage];
|
||||||
}
|
}
|
||||||
|
|
||||||
Blends = new BlendState[RenderTargetsCount];
|
Blends = new BlendState[RenderTargetsCount];
|
||||||
|
|
|
@ -16,26 +16,26 @@ namespace Ryujinx.Graphics.Gal
|
||||||
public DepthCompareFunc DepthCompareFunc { get; private set; }
|
public DepthCompareFunc DepthCompareFunc { get; private set; }
|
||||||
|
|
||||||
public GalTextureSampler(
|
public GalTextureSampler(
|
||||||
GalTextureWrap AddressU,
|
GalTextureWrap addressU,
|
||||||
GalTextureWrap AddressV,
|
GalTextureWrap addressV,
|
||||||
GalTextureWrap AddressP,
|
GalTextureWrap addressP,
|
||||||
GalTextureFilter MinFilter,
|
GalTextureFilter minFilter,
|
||||||
GalTextureFilter MagFilter,
|
GalTextureFilter magFilter,
|
||||||
GalTextureMipFilter MipFilter,
|
GalTextureMipFilter mipFilter,
|
||||||
GalColorF BorderColor,
|
GalColorF borderColor,
|
||||||
bool DepthCompare,
|
bool depthCompare,
|
||||||
DepthCompareFunc DepthCompareFunc)
|
DepthCompareFunc depthCompareFunc)
|
||||||
{
|
{
|
||||||
this.AddressU = AddressU;
|
AddressU = addressU;
|
||||||
this.AddressV = AddressV;
|
AddressV = addressV;
|
||||||
this.AddressP = AddressP;
|
AddressP = addressP;
|
||||||
this.MinFilter = MinFilter;
|
MinFilter = minFilter;
|
||||||
this.MagFilter = MagFilter;
|
MagFilter = magFilter;
|
||||||
this.MipFilter = MipFilter;
|
MipFilter = mipFilter;
|
||||||
this.BorderColor = BorderColor;
|
BorderColor = borderColor;
|
||||||
|
|
||||||
this.DepthCompare = DepthCompare;
|
DepthCompare = depthCompare;
|
||||||
this.DepthCompareFunc = DepthCompareFunc;
|
DepthCompareFunc = depthCompareFunc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,8 +6,8 @@
|
||||||
Unorm = 2,
|
Unorm = 2,
|
||||||
Sint = 3,
|
Sint = 3,
|
||||||
Uint = 4,
|
Uint = 4,
|
||||||
Snorm_Force_Fp16 = 5,
|
SnormForceFp16 = 5,
|
||||||
Unorm_Force_Fp16 = 6,
|
UnormForceFp16 = 6,
|
||||||
Float = 7
|
Float = 7
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -13,21 +13,21 @@ namespace Ryujinx.Graphics.Gal
|
||||||
public bool IsBgra { get; private set; }
|
public bool IsBgra { get; private set; }
|
||||||
|
|
||||||
public GalVertexAttrib(
|
public GalVertexAttrib(
|
||||||
int Index,
|
int index,
|
||||||
bool IsConst,
|
bool isConst,
|
||||||
int Offset,
|
int offset,
|
||||||
byte[] Data,
|
byte[] data,
|
||||||
GalVertexAttribSize Size,
|
GalVertexAttribSize size,
|
||||||
GalVertexAttribType Type,
|
GalVertexAttribType type,
|
||||||
bool IsBgra)
|
bool isBgra)
|
||||||
{
|
{
|
||||||
this.Index = Index;
|
Index = index;
|
||||||
this.IsConst = IsConst;
|
IsConst = isConst;
|
||||||
this.Data = Data;
|
Data = data;
|
||||||
this.Offset = Offset;
|
Offset = offset;
|
||||||
this.Size = Size;
|
Size = size;
|
||||||
this.Type = Type;
|
Type = type;
|
||||||
this.IsBgra = IsBgra;
|
IsBgra = isBgra;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,11 +7,11 @@ namespace Ryujinx.Graphics.Gal
|
||||||
void LockCache();
|
void LockCache();
|
||||||
void UnlockCache();
|
void UnlockCache();
|
||||||
|
|
||||||
void Create(long Key, long Size);
|
void Create(long key, long size);
|
||||||
|
|
||||||
bool IsCached(long Key, long Size);
|
bool IsCached(long key, long size);
|
||||||
|
|
||||||
void SetData(long Key, long Size, IntPtr HostAddress);
|
void SetData(long key, long size, IntPtr hostAddress);
|
||||||
void SetData(long Key, byte[] Data);
|
void SetData(long key, byte[] data);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,6 +2,6 @@ namespace Ryujinx.Graphics.Gal
|
||||||
{
|
{
|
||||||
public unsafe interface IGalMemory
|
public unsafe interface IGalMemory
|
||||||
{
|
{
|
||||||
int ReadInt32(long Position);
|
int ReadInt32(long position);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,9 +2,9 @@
|
||||||
{
|
{
|
||||||
public interface IGalPipeline
|
public interface IGalPipeline
|
||||||
{
|
{
|
||||||
void Bind(GalPipelineState State);
|
void Bind(GalPipelineState state);
|
||||||
|
|
||||||
void ResetDepthMask();
|
void ResetDepthMask();
|
||||||
void ResetColorMask(int Index);
|
void ResetColorMask(int index);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,29 +8,29 @@ namespace Ryujinx.Graphics.Gal
|
||||||
void UnlockCaches();
|
void UnlockCaches();
|
||||||
|
|
||||||
void ClearBuffers(
|
void ClearBuffers(
|
||||||
GalClearBufferFlags Flags,
|
GalClearBufferFlags flags,
|
||||||
int Attachment,
|
int attachment,
|
||||||
float Red,
|
float red,
|
||||||
float Green,
|
float green,
|
||||||
float Blue,
|
float blue,
|
||||||
float Alpha,
|
float alpha,
|
||||||
float Depth,
|
float depth,
|
||||||
int Stencil);
|
int stencil);
|
||||||
|
|
||||||
bool IsVboCached(long Key, long DataSize);
|
bool IsVboCached(long key, long dataSize);
|
||||||
|
|
||||||
bool IsIboCached(long Key, long DataSize);
|
bool IsIboCached(long key, long dataSize);
|
||||||
|
|
||||||
void CreateVbo(long Key, int DataSize, IntPtr HostAddress);
|
void CreateVbo(long key, int dataSize, IntPtr hostAddress);
|
||||||
void CreateVbo(long Key, byte[] Data);
|
void CreateVbo(long key, byte[] data);
|
||||||
|
|
||||||
void CreateIbo(long Key, int DataSize, IntPtr HostAddress);
|
void CreateIbo(long key, int dataSize, IntPtr hostAddress);
|
||||||
void CreateIbo(long Key, int DataSize, byte[] Buffer);
|
void CreateIbo(long key, int dataSize, byte[] buffer);
|
||||||
|
|
||||||
void SetIndexArray(int Size, GalIndexFormat Format);
|
void SetIndexArray(int size, GalIndexFormat format);
|
||||||
|
|
||||||
void DrawArrays(int First, int Count, GalPrimitiveType PrimType);
|
void DrawArrays(int first, int count, GalPrimitiveType primType);
|
||||||
|
|
||||||
void DrawElements(long IboKey, int First, int VertexBase, GalPrimitiveType PrimType);
|
void DrawElements(long iboKey, int first, int vertexBase, GalPrimitiveType primType);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,42 +4,42 @@ namespace Ryujinx.Graphics.Gal
|
||||||
{
|
{
|
||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
void BindColor(long Key, int Attachment);
|
void BindColor(long key, int attachment);
|
||||||
|
|
||||||
void UnbindColor(int Attachment);
|
void UnbindColor(int attachment);
|
||||||
|
|
||||||
void BindZeta(long Key);
|
void BindZeta(long key);
|
||||||
|
|
||||||
void UnbindZeta();
|
void UnbindZeta();
|
||||||
|
|
||||||
void Present(long Key);
|
void Present(long key);
|
||||||
|
|
||||||
void SetMap(int[] Map);
|
void SetMap(int[] map);
|
||||||
|
|
||||||
void SetTransform(bool FlipX, bool FlipY, int Top, int Left, int Right, int Bottom);
|
void SetTransform(bool flipX, bool flipY, int top, int left, int right, int bottom);
|
||||||
|
|
||||||
void SetWindowSize(int Width, int Height);
|
void SetWindowSize(int width, int height);
|
||||||
|
|
||||||
void SetViewport(int Attachment, int X, int Y, int Width, int Height);
|
void SetViewport(int attachment, int x, int y, int width, int height);
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
|
|
||||||
void Copy(
|
void Copy(
|
||||||
GalImage SrcImage,
|
GalImage srcImage,
|
||||||
GalImage DstImage,
|
GalImage dstImage,
|
||||||
long SrcKey,
|
long srcKey,
|
||||||
long DstKey,
|
long dstKey,
|
||||||
int SrcLayer,
|
int srcLayer,
|
||||||
int DstLayer,
|
int dstLayer,
|
||||||
int SrcX0,
|
int srcX0,
|
||||||
int SrcY0,
|
int srcY0,
|
||||||
int SrcX1,
|
int srcX1,
|
||||||
int SrcY1,
|
int srcY1,
|
||||||
int DstX0,
|
int dstX0,
|
||||||
int DstY0,
|
int dstY0,
|
||||||
int DstX1,
|
int dstX1,
|
||||||
int DstY1);
|
int dstY1);
|
||||||
|
|
||||||
void Reinterpret(long Key, GalImage NewImage);
|
void Reinterpret(long key, GalImage newImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,7 +4,7 @@ namespace Ryujinx.Graphics.Gal
|
||||||
{
|
{
|
||||||
public interface IGalRenderer
|
public interface IGalRenderer
|
||||||
{
|
{
|
||||||
void QueueAction(Action ActionMthd);
|
void QueueAction(Action actionMthd);
|
||||||
|
|
||||||
void RunActions();
|
void RunActions();
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,16 @@ namespace Ryujinx.Graphics.Gal
|
||||||
{
|
{
|
||||||
public interface IGalShader
|
public interface IGalShader
|
||||||
{
|
{
|
||||||
void Create(IGalMemory Memory, long Key, GalShaderType Type);
|
void Create(IGalMemory memory, long key, GalShaderType type);
|
||||||
|
|
||||||
void Create(IGalMemory Memory, long VpAPos, long Key, GalShaderType Type);
|
void Create(IGalMemory memory, long vpAPos, long key, GalShaderType type);
|
||||||
|
|
||||||
IEnumerable<ShaderDeclInfo> GetConstBufferUsage(long Key);
|
IEnumerable<ShaderDeclInfo> GetConstBufferUsage(long key);
|
||||||
IEnumerable<ShaderDeclInfo> GetTextureUsage(long Key);
|
IEnumerable<ShaderDeclInfo> GetTextureUsage(long key);
|
||||||
|
|
||||||
void Bind(long Key);
|
void Bind(long key);
|
||||||
|
|
||||||
void Unbind(GalShaderType Type);
|
void Unbind(GalShaderType type);
|
||||||
|
|
||||||
void BindProgram();
|
void BindProgram();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,14 +5,14 @@ namespace Ryujinx.Graphics.Gal
|
||||||
void LockCache();
|
void LockCache();
|
||||||
void UnlockCache();
|
void UnlockCache();
|
||||||
|
|
||||||
void Create(long Key, int Size, GalImage Image);
|
void Create(long key, int size, GalImage image);
|
||||||
|
|
||||||
void Create(long Key, byte[] Data, GalImage Image);
|
void Create(long key, byte[] data, GalImage image);
|
||||||
|
|
||||||
bool TryGetImage(long Key, out GalImage Image);
|
bool TryGetImage(long key, out GalImage image);
|
||||||
|
|
||||||
void Bind(long Key, int Index, GalImage Image);
|
void Bind(long key, int index, GalImage image);
|
||||||
|
|
||||||
void SetSampler(GalImage Image, GalTextureSampler Sampler);
|
void SetSampler(GalImage image, GalTextureSampler sampler);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,8 +9,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
{
|
{
|
||||||
switch (frontFace)
|
switch (frontFace)
|
||||||
{
|
{
|
||||||
case GalFrontFace.CW: return FrontFaceDirection.Cw;
|
case GalFrontFace.Cw: return FrontFaceDirection.Cw;
|
||||||
case GalFrontFace.CCW: return FrontFaceDirection.Ccw;
|
case GalFrontFace.Ccw: return FrontFaceDirection.Ccw;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ArgumentException(nameof(frontFace) + " \"" + frontFace + "\" is not valid!");
|
throw new ArgumentException(nameof(frontFace) + " \"" + frontFace + "\" is not valid!");
|
||||||
|
|
|
@ -98,7 +98,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
//These values match OpenGL's defaults
|
//These values match OpenGL's defaults
|
||||||
_old = new GalPipelineState
|
_old = new GalPipelineState
|
||||||
{
|
{
|
||||||
FrontFace = GalFrontFace.CCW,
|
FrontFace = GalFrontFace.Ccw,
|
||||||
|
|
||||||
CullFaceEnabled = false,
|
CullFaceEnabled = false,
|
||||||
CullFace = GalCullFace.Back,
|
CullFace = GalCullFace.Back,
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
private GlslDecl(GalShaderType shaderType)
|
private GlslDecl(GalShaderType shaderType)
|
||||||
{
|
{
|
||||||
this.ShaderType = shaderType;
|
ShaderType = shaderType;
|
||||||
|
|
||||||
m_CbTextures = new Dictionary<ShaderIrOp, ShaderDeclInfo>();
|
m_CbTextures = new Dictionary<ShaderIrOp, ShaderDeclInfo>();
|
||||||
|
|
||||||
|
|
|
@ -114,8 +114,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{ ShaderIrInst.Xor, GetXorExpr }
|
{ ShaderIrInst.Xor, GetXorExpr }
|
||||||
};
|
};
|
||||||
|
|
||||||
this.MaxUboSize = maxUboSize / 16;
|
MaxUboSize = maxUboSize / 16;
|
||||||
this._isNvidiaDriver = isNvidiaDriver;
|
_isNvidiaDriver = isNvidiaDriver;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GlslProgram Decompile(
|
public GlslProgram Decompile(
|
||||||
|
|
|
@ -14,9 +14,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
IEnumerable<ShaderDeclInfo> textures,
|
IEnumerable<ShaderDeclInfo> textures,
|
||||||
IEnumerable<ShaderDeclInfo> uniforms)
|
IEnumerable<ShaderDeclInfo> uniforms)
|
||||||
{
|
{
|
||||||
this.Code = code;
|
Code = code;
|
||||||
this.Textures = textures;
|
Textures = textures;
|
||||||
this.Uniforms = uniforms;
|
Uniforms = uniforms;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,8 +7,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrAsg(ShaderIrNode dst, ShaderIrNode src)
|
public ShaderIrAsg(ShaderIrNode dst, ShaderIrNode src)
|
||||||
{
|
{
|
||||||
this.Dst = dst;
|
Dst = dst;
|
||||||
this.Src = src;
|
Src = src;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,7 +16,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrBlock(int position)
|
public ShaderIrBlock(int position)
|
||||||
{
|
{
|
||||||
this.Position = position;
|
Position = position;
|
||||||
|
|
||||||
Sources = new List<ShaderIrBlock>();
|
Sources = new List<ShaderIrBlock>();
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrCmnt(string comment)
|
public ShaderIrCmnt(string comment)
|
||||||
{
|
{
|
||||||
this.Comment = comment;
|
Comment = comment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,9 +9,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrCond(ShaderIrNode pred, ShaderIrNode child, bool not)
|
public ShaderIrCond(ShaderIrNode pred, ShaderIrNode child, bool not)
|
||||||
{
|
{
|
||||||
this.Pred = pred;
|
Pred = pred;
|
||||||
this.Child = child;
|
Child = child;
|
||||||
this.Not = not;
|
Not = not;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
public ShaderIrMetaIpa(ShaderIpaMode mode)
|
public ShaderIrMetaIpa(ShaderIpaMode mode)
|
||||||
{
|
{
|
||||||
this.Mode = mode;
|
Mode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,10 +15,10 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrMetaTex(int elem, GalTextureTarget textureTarget, TextureInstructionSuffix textureInstructionSuffix, params ShaderIrNode[] coordinates)
|
public ShaderIrMetaTex(int elem, GalTextureTarget textureTarget, TextureInstructionSuffix textureInstructionSuffix, params ShaderIrNode[] coordinates)
|
||||||
{
|
{
|
||||||
this.Elem = elem;
|
Elem = elem;
|
||||||
this.TextureTarget = textureTarget;
|
TextureTarget = textureTarget;
|
||||||
this.TextureInstructionSuffix = textureInstructionSuffix;
|
TextureInstructionSuffix = textureInstructionSuffix;
|
||||||
this.Coordinates = coordinates;
|
Coordinates = coordinates;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,8 +8,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrMetaTexq(ShaderTexqInfo info, int elem)
|
public ShaderIrMetaTexq(ShaderTexqInfo info, int elem)
|
||||||
{
|
{
|
||||||
this.Info = info;
|
Info = info;
|
||||||
this.Elem = elem;
|
Elem = elem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,11 +15,11 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
ShaderIrNode operandC = null,
|
ShaderIrNode operandC = null,
|
||||||
ShaderIrMeta metaData = null)
|
ShaderIrMeta metaData = null)
|
||||||
{
|
{
|
||||||
this.Inst = inst;
|
Inst = inst;
|
||||||
this.OperandA = operandA;
|
OperandA = operandA;
|
||||||
this.OperandB = operandB;
|
OperandB = operandB;
|
||||||
this.OperandC = operandC;
|
OperandC = operandC;
|
||||||
this.MetaData = metaData;
|
MetaData = metaData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,8 +8,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrOperAbuf(int offs, ShaderIrNode vertex)
|
public ShaderIrOperAbuf(int offs, ShaderIrNode vertex)
|
||||||
{
|
{
|
||||||
this.Offs = offs;
|
Offs = offs;
|
||||||
this.Vertex = vertex;
|
Vertex = vertex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,9 +9,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrOperCbuf(int index, int pos, ShaderIrNode offs = null)
|
public ShaderIrOperCbuf(int index, int pos, ShaderIrNode offs = null)
|
||||||
{
|
{
|
||||||
this.Index = index;
|
Index = index;
|
||||||
this.Pos = pos;
|
Pos = pos;
|
||||||
this.Offs = offs;
|
Offs = offs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,15 +15,15 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrOperGpr(int index)
|
public ShaderIrOperGpr(int index)
|
||||||
{
|
{
|
||||||
this.Index = index;
|
Index = index;
|
||||||
|
|
||||||
RegisterSize = ShaderRegisterSize.Single;
|
RegisterSize = ShaderRegisterSize.Single;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShaderIrOperGpr(int index, int halfPart)
|
public ShaderIrOperGpr(int index, int halfPart)
|
||||||
{
|
{
|
||||||
this.Index = index;
|
Index = index;
|
||||||
this.HalfPart = halfPart;
|
HalfPart = halfPart;
|
||||||
|
|
||||||
RegisterSize = ShaderRegisterSize.Half;
|
RegisterSize = ShaderRegisterSize.Half;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrOperImm(int value)
|
public ShaderIrOperImm(int value)
|
||||||
{
|
{
|
||||||
this.Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrOperImmf(float value)
|
public ShaderIrOperImmf(float value)
|
||||||
{
|
{
|
||||||
this.Value = value;
|
Value = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderIrOperPred(int index)
|
public ShaderIrOperPred(int index)
|
||||||
{
|
{
|
||||||
this.Index = index;
|
Index = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,8 +14,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
public ShaderDecodeEntry(ShaderDecodeFunc func, int xBits)
|
public ShaderDecodeEntry(ShaderDecodeFunc func, int xBits)
|
||||||
{
|
{
|
||||||
this.Func = func;
|
Func = func;
|
||||||
this.XBits = xBits;
|
XBits = xBits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,29 +16,29 @@ namespace Ryujinx.Graphics.Gal
|
||||||
public TextureInstructionSuffix TextureSuffix { get; private set; }
|
public TextureInstructionSuffix TextureSuffix { get; private set; }
|
||||||
|
|
||||||
public ShaderDeclInfo(
|
public ShaderDeclInfo(
|
||||||
string Name,
|
string name,
|
||||||
int Index,
|
int index,
|
||||||
bool IsCb = false,
|
bool isCb = false,
|
||||||
int Cbuf = 0,
|
int cbuf = 0,
|
||||||
int Size = 1,
|
int size = 1,
|
||||||
GalTextureTarget TextureTarget = GalTextureTarget.TwoD,
|
GalTextureTarget textureTarget = GalTextureTarget.TwoD,
|
||||||
TextureInstructionSuffix TextureSuffix = TextureInstructionSuffix.None)
|
TextureInstructionSuffix textureSuffix = TextureInstructionSuffix.None)
|
||||||
{
|
{
|
||||||
this.Name = Name;
|
Name = name;
|
||||||
this.Index = Index;
|
Index = index;
|
||||||
this.IsCb = IsCb;
|
IsCb = isCb;
|
||||||
this.Cbuf = Cbuf;
|
Cbuf = cbuf;
|
||||||
this.Size = Size;
|
Size = size;
|
||||||
|
|
||||||
this.TextureTarget = TextureTarget;
|
TextureTarget = textureTarget;
|
||||||
this.TextureSuffix = TextureSuffix;
|
TextureSuffix = textureSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Enlarge(int NewSize)
|
internal void Enlarge(int newSize)
|
||||||
{
|
{
|
||||||
if (Size < NewSize)
|
if (Size < newSize)
|
||||||
{
|
{
|
||||||
Size = NewSize;
|
Size = newSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,67 +5,67 @@ namespace Ryujinx.Graphics.Gal
|
||||||
{
|
{
|
||||||
static class ShaderDumper
|
static class ShaderDumper
|
||||||
{
|
{
|
||||||
private static string RuntimeDir;
|
private static string _runtimeDir;
|
||||||
|
|
||||||
public static int DumpIndex { get; private set; } = 1;
|
public static int DumpIndex { get; private set; } = 1;
|
||||||
|
|
||||||
public static void Dump(IGalMemory Memory, long Position, GalShaderType Type, string ExtSuffix = "")
|
public static void Dump(IGalMemory memory, long position, GalShaderType type, string extSuffix = "")
|
||||||
{
|
{
|
||||||
if (!IsDumpEnabled())
|
if (!IsDumpEnabled())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string FileName = "Shader" + DumpIndex.ToString("d4") + "." + ShaderExtension(Type) + ExtSuffix + ".bin";
|
string fileName = "Shader" + DumpIndex.ToString("d4") + "." + ShaderExtension(type) + extSuffix + ".bin";
|
||||||
|
|
||||||
string FullPath = Path.Combine(FullDir(), FileName);
|
string fullPath = Path.Combine(FullDir(), fileName);
|
||||||
string CodePath = Path.Combine(CodeDir(), FileName);
|
string codePath = Path.Combine(CodeDir(), fileName);
|
||||||
|
|
||||||
DumpIndex++;
|
DumpIndex++;
|
||||||
|
|
||||||
using (FileStream FullFile = File.Create(FullPath))
|
using (FileStream fullFile = File.Create(fullPath))
|
||||||
using (FileStream CodeFile = File.Create(CodePath))
|
using (FileStream codeFile = File.Create(codePath))
|
||||||
{
|
{
|
||||||
BinaryWriter FullWriter = new BinaryWriter(FullFile);
|
BinaryWriter fullWriter = new BinaryWriter(fullFile);
|
||||||
BinaryWriter CodeWriter = new BinaryWriter(CodeFile);
|
BinaryWriter codeWriter = new BinaryWriter(codeFile);
|
||||||
|
|
||||||
for (long i = 0; i < 0x50; i += 4)
|
for (long i = 0; i < 0x50; i += 4)
|
||||||
{
|
{
|
||||||
FullWriter.Write(Memory.ReadInt32(Position + i));
|
fullWriter.Write(memory.ReadInt32(position + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
long Offset = 0;
|
long offset = 0;
|
||||||
|
|
||||||
ulong Instruction = 0;
|
ulong instruction = 0;
|
||||||
|
|
||||||
//Dump until a NOP instruction is found
|
//Dump until a NOP instruction is found
|
||||||
while ((Instruction >> 48 & 0xfff8) != 0x50b0)
|
while ((instruction >> 48 & 0xfff8) != 0x50b0)
|
||||||
{
|
{
|
||||||
uint Word0 = (uint)Memory.ReadInt32(Position + 0x50 + Offset + 0);
|
uint word0 = (uint)memory.ReadInt32(position + 0x50 + offset + 0);
|
||||||
uint Word1 = (uint)Memory.ReadInt32(Position + 0x50 + Offset + 4);
|
uint word1 = (uint)memory.ReadInt32(position + 0x50 + offset + 4);
|
||||||
|
|
||||||
Instruction = Word0 | (ulong)Word1 << 32;
|
instruction = word0 | (ulong)word1 << 32;
|
||||||
|
|
||||||
//Zero instructions (other kind of NOP) stop immediatly,
|
//Zero instructions (other kind of NOP) stop immediatly,
|
||||||
//this is to avoid two rows of zeroes
|
//this is to avoid two rows of zeroes
|
||||||
if (Instruction == 0)
|
if (instruction == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
FullWriter.Write(Instruction);
|
fullWriter.Write(instruction);
|
||||||
CodeWriter.Write(Instruction);
|
codeWriter.Write(instruction);
|
||||||
|
|
||||||
Offset += 8;
|
offset += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Align to meet nvdisasm requeriments
|
//Align to meet nvdisasm requeriments
|
||||||
while (Offset % 0x20 != 0)
|
while (offset % 0x20 != 0)
|
||||||
{
|
{
|
||||||
FullWriter.Write(0);
|
fullWriter.Write(0);
|
||||||
CodeWriter.Write(0);
|
codeWriter.Write(0);
|
||||||
|
|
||||||
Offset += 4;
|
offset += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,37 +87,37 @@ namespace Ryujinx.Graphics.Gal
|
||||||
|
|
||||||
private static string DumpDir()
|
private static string DumpDir()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(RuntimeDir))
|
if (string.IsNullOrEmpty(_runtimeDir))
|
||||||
{
|
{
|
||||||
int Index = 1;
|
int index = 1;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
RuntimeDir = Path.Combine(GraphicsConfig.ShadersDumpPath, "Dumps" + Index.ToString("d2"));
|
_runtimeDir = Path.Combine(GraphicsConfig.ShadersDumpPath, "Dumps" + index.ToString("d2"));
|
||||||
|
|
||||||
Index++;
|
index++;
|
||||||
}
|
}
|
||||||
while (Directory.Exists(RuntimeDir));
|
while (Directory.Exists(_runtimeDir));
|
||||||
|
|
||||||
Directory.CreateDirectory(RuntimeDir);
|
Directory.CreateDirectory(_runtimeDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RuntimeDir;
|
return _runtimeDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string CreateAndReturn(string Dir)
|
private static string CreateAndReturn(string dir)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Dir))
|
if (!Directory.Exists(dir))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Dir);
|
Directory.CreateDirectory(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string ShaderExtension(GalShaderType Type)
|
private static string ShaderExtension(GalShaderType type)
|
||||||
{
|
{
|
||||||
switch (Type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case GalShaderType.Vertex: return "vert";
|
case GalShaderType.Vertex: return "vert";
|
||||||
case GalShaderType.TessControl: return "tesc";
|
case GalShaderType.TessControl: return "tesc";
|
||||||
|
@ -125,7 +125,7 @@ namespace Ryujinx.Graphics.Gal
|
||||||
case GalShaderType.Geometry: return "geom";
|
case GalShaderType.Geometry: return "geom";
|
||||||
case GalShaderType.Fragment: return "frag";
|
case GalShaderType.Fragment: return "frag";
|
||||||
|
|
||||||
default: throw new ArgumentException(nameof(Type));
|
default: throw new ArgumentException(nameof(type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,6 @@ namespace Ryujinx.Graphics.Gal
|
||||||
{
|
{
|
||||||
public ShaderException() : base() { }
|
public ShaderException() : base() { }
|
||||||
|
|
||||||
public ShaderException(string Message) : base(Message) { }
|
public ShaderException(string message) : base(message) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
||||||
|
|
||||||
WriteRegister(NvGpuEngine3dReg.FrameBufferSrgb, 1);
|
WriteRegister(NvGpuEngine3dReg.FrameBufferSrgb, 1);
|
||||||
|
|
||||||
WriteRegister(NvGpuEngine3dReg.FrontFace, (int)GalFrontFace.CW);
|
WriteRegister(NvGpuEngine3dReg.FrontFace, (int)GalFrontFace.Cw);
|
||||||
|
|
||||||
for (int Index = 0; Index < GalPipelineState.RenderTargetsCount; Index++)
|
for (int Index = 0; Index < GalPipelineState.RenderTargetsCount; Index++)
|
||||||
{
|
{
|
||||||
|
@ -364,8 +364,8 @@ namespace Ryujinx.Graphics.Graphics3d
|
||||||
{
|
{
|
||||||
switch (FrontFace)
|
switch (FrontFace)
|
||||||
{
|
{
|
||||||
case GalFrontFace.CW: FrontFace = GalFrontFace.CCW; break;
|
case GalFrontFace.Cw: FrontFace = GalFrontFace.Ccw; break;
|
||||||
case GalFrontFace.CCW: FrontFace = GalFrontFace.CW; break;
|
case GalFrontFace.Ccw: FrontFace = GalFrontFace.Cw; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue