finish renaming TextureType to TextureTarget
This commit is contained in:
parent
c9b0ee8178
commit
bdeb47d97d
10 changed files with 60 additions and 60 deletions
|
@ -18,7 +18,7 @@ namespace Ryujinx.Graphics.Gal
|
||||||
public GalTextureSource YSource;
|
public GalTextureSource YSource;
|
||||||
public GalTextureSource ZSource;
|
public GalTextureSource ZSource;
|
||||||
public GalTextureSource WSource;
|
public GalTextureSource WSource;
|
||||||
public GalTextureTarget TextureType;
|
public GalTextureTarget TextureTarget;
|
||||||
|
|
||||||
public GalImage(
|
public GalImage(
|
||||||
int Width,
|
int Width,
|
||||||
|
@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Gal
|
||||||
int GobBlockHeight,
|
int GobBlockHeight,
|
||||||
GalMemoryLayout Layout,
|
GalMemoryLayout Layout,
|
||||||
GalImageFormat Format,
|
GalImageFormat Format,
|
||||||
GalTextureTarget TextureType,
|
GalTextureTarget TextureTarget,
|
||||||
int MaxMipmapLevel = 1,
|
int MaxMipmapLevel = 1,
|
||||||
GalTextureSource XSource = GalTextureSource.Red,
|
GalTextureSource XSource = GalTextureSource.Red,
|
||||||
GalTextureSource YSource = GalTextureSource.Green,
|
GalTextureSource YSource = GalTextureSource.Green,
|
||||||
|
@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Gal
|
||||||
this.YSource = YSource;
|
this.YSource = YSource;
|
||||||
this.ZSource = ZSource;
|
this.ZSource = ZSource;
|
||||||
this.WSource = WSource;
|
this.WSource = WSource;
|
||||||
this.TextureType = TextureType;
|
this.TextureTarget = TextureTarget;
|
||||||
|
|
||||||
Pitch = ImageUtils.GetPitch(Format, Width);
|
Pitch = ImageUtils.GetPitch(Format, Width);
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,7 +477,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
|
|
||||||
(_, PixelFormat Format, PixelType Type) = OGLEnumConverter.GetImageFormat(CachedImage.Format);
|
(_, PixelFormat Format, PixelType Type) = OGLEnumConverter.GetImageFormat(CachedImage.Format);
|
||||||
|
|
||||||
TextureTarget Target = ImageUtils.GetTextureTarget(NewImage.TextureType);
|
TextureTarget Target = ImageUtils.GetTextureTarget(NewImage.TextureTarget);
|
||||||
|
|
||||||
GL.BindTexture(Target, CachedImage.Handle);
|
GL.BindTexture(Target, CachedImage.Handle);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
{
|
{
|
||||||
int Handle = GL.GenTexture();
|
int Handle = GL.GenTexture();
|
||||||
|
|
||||||
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType);
|
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget);
|
||||||
|
|
||||||
GL.BindTexture(Target, Handle);
|
GL.BindTexture(Target, Handle);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
{
|
{
|
||||||
int Handle = GL.GenTexture();
|
int Handle = GL.GenTexture();
|
||||||
|
|
||||||
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType);
|
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget);
|
||||||
|
|
||||||
GL.BindTexture(Target, Handle);
|
GL.BindTexture(Target, Handle);
|
||||||
|
|
||||||
|
@ -335,7 +335,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
{
|
{
|
||||||
GL.ActiveTexture(TextureUnit.Texture0 + Index);
|
GL.ActiveTexture(TextureUnit.Texture0 + Index);
|
||||||
|
|
||||||
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType);
|
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget);
|
||||||
|
|
||||||
GL.BindTexture(Target, CachedImage.Handle);
|
GL.BindTexture(Target, CachedImage.Handle);
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
int MinFilter = (int)OGLEnumConverter.GetTextureMinFilter(Sampler.MinFilter, Sampler.MipFilter);
|
int MinFilter = (int)OGLEnumConverter.GetTextureMinFilter(Sampler.MinFilter, Sampler.MipFilter);
|
||||||
int MagFilter = (int)OGLEnumConverter.GetTextureMagFilter(Sampler.MagFilter);
|
int MagFilter = (int)OGLEnumConverter.GetTextureMagFilter(Sampler.MagFilter);
|
||||||
|
|
||||||
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureType);
|
TextureTarget Target = ImageUtils.GetTextureTarget(Image.TextureTarget);
|
||||||
|
|
||||||
GL.TexParameter(Target, TextureParameterName.TextureWrapS, WrapS);
|
GL.TexParameter(Target, TextureParameterName.TextureWrapS, WrapS);
|
||||||
GL.TexParameter(Target, TextureParameterName.TextureWrapT, WrapT);
|
GL.TexParameter(Target, TextureParameterName.TextureWrapT, WrapT);
|
||||||
|
|
|
@ -235,25 +235,25 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
string Name = StagePrefix + TextureName + Index;
|
string Name = StagePrefix + TextureName + Index;
|
||||||
|
|
||||||
GalTextureTarget TextureType;
|
GalTextureTarget TextureTarget;
|
||||||
|
|
||||||
TextureInstructionSuffix TextureInstructionSuffix;
|
TextureInstructionSuffix TextureInstructionSuffix;
|
||||||
|
|
||||||
// TODO: Non 2D texture type for TEXQ?
|
// TODO: Non 2D texture type for TEXQ?
|
||||||
if (Op.Inst == ShaderIrInst.Texq)
|
if (Op.Inst == ShaderIrInst.Texq)
|
||||||
{
|
{
|
||||||
TextureType = GalTextureTarget.TwoD;
|
TextureTarget = GalTextureTarget.TwoD;
|
||||||
TextureInstructionSuffix = TextureInstructionSuffix.None;
|
TextureInstructionSuffix = TextureInstructionSuffix.None;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShaderIrMetaTex Meta = ((ShaderIrMetaTex)Op.MetaData);
|
ShaderIrMetaTex Meta = ((ShaderIrMetaTex)Op.MetaData);
|
||||||
|
|
||||||
TextureType = Meta.TextureType;
|
TextureTarget = Meta.TextureTarget;
|
||||||
TextureInstructionSuffix = Meta.TextureInstructionSuffix;
|
TextureInstructionSuffix = Meta.TextureInstructionSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Textures.TryAdd(Handle, new ShaderDeclInfo(Name, Handle, false, 0, 1, TextureType, TextureInstructionSuffix));
|
m_Textures.TryAdd(Handle, new ShaderDeclInfo(Name, Handle, false, 0, 1, TextureTarget, TextureInstructionSuffix));
|
||||||
}
|
}
|
||||||
else if (Op.Inst == ShaderIrInst.Texb)
|
else if (Op.Inst == ShaderIrInst.Texb)
|
||||||
{
|
{
|
||||||
|
@ -281,7 +281,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
ShaderIrMetaTex Meta = ((ShaderIrMetaTex)Op.MetaData);
|
ShaderIrMetaTex Meta = ((ShaderIrMetaTex)Op.MetaData);
|
||||||
string Name = StagePrefix + TextureName + "_cb" + Cbuf.Index + "_" + Cbuf.Pos;
|
string Name = StagePrefix + TextureName + "_cb" + Cbuf.Index + "_" + Cbuf.Pos;
|
||||||
|
|
||||||
m_CbTextures.Add(Op, new ShaderDeclInfo(Name, Cbuf.Pos, true, Cbuf.Index, 1, Meta.TextureType, Meta.TextureInstructionSuffix));
|
m_CbTextures.Add(Op, new ShaderDeclInfo(Name, Cbuf.Pos, true, Cbuf.Index, 1, Meta.TextureTarget, Meta.TextureInstructionSuffix));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -275,14 +275,14 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{
|
{
|
||||||
foreach (ShaderDeclInfo DeclInfo in IterateCbTextures())
|
foreach (ShaderDeclInfo DeclInfo in IterateCbTextures())
|
||||||
{
|
{
|
||||||
TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureType);
|
TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureTarget);
|
||||||
SB.AppendLine($"// {DeclInfo.TextureSuffix}");
|
SB.AppendLine($"// {DeclInfo.TextureSuffix}");
|
||||||
SB.AppendLine("uniform " + GetSamplerType(Target, (DeclInfo.TextureSuffix & TextureInstructionSuffix.DC) != 0) + " " + DeclInfo.Name + ";");
|
SB.AppendLine("uniform " + GetSamplerType(Target, (DeclInfo.TextureSuffix & TextureInstructionSuffix.DC) != 0) + " " + DeclInfo.Name + ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ShaderDeclInfo DeclInfo in Decl.Textures.Values.OrderBy(DeclKeySelector))
|
foreach (ShaderDeclInfo DeclInfo in Decl.Textures.Values.OrderBy(DeclKeySelector))
|
||||||
{
|
{
|
||||||
TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureType);
|
TextureTarget Target = ImageUtils.GetTextureTarget(DeclInfo.TextureTarget);
|
||||||
SB.AppendLine($"// {DeclInfo.TextureSuffix}");
|
SB.AppendLine($"// {DeclInfo.TextureSuffix}");
|
||||||
SB.AppendLine("uniform " + GetSamplerType(Target, (DeclInfo.TextureSuffix & TextureInstructionSuffix.DC) != 0) + " " + DeclInfo.Name + ";");
|
SB.AppendLine("uniform " + GetSamplerType(Target, (DeclInfo.TextureSuffix & TextureInstructionSuffix.DC) != 0) + " " + DeclInfo.Name + ";");
|
||||||
}
|
}
|
||||||
|
@ -1338,9 +1338,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
|
|
||||||
bool HasDepth = (Meta.TextureInstructionSuffix & TextureInstructionSuffix.DC) != 0;
|
bool HasDepth = (Meta.TextureInstructionSuffix & TextureInstructionSuffix.DC) != 0;
|
||||||
|
|
||||||
int Coords = ImageUtils.GetCoordsCountTextureType(Meta.TextureType);
|
int Coords = ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget);
|
||||||
|
|
||||||
bool IsArray = ImageUtils.IsArray(Meta.TextureType);
|
bool IsArray = ImageUtils.IsArray(Meta.TextureTarget);
|
||||||
|
|
||||||
|
|
||||||
string GetLastArgument(ShaderIrNode Node)
|
string GetLastArgument(ShaderIrNode Node)
|
||||||
|
@ -1400,9 +1400,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
return "(" + Operation + " >> " + index * 4 + ") & 0xF";
|
return "(" + Operation + " >> " + index * 4 + ") & 0xF";
|
||||||
}
|
}
|
||||||
|
|
||||||
int Coords = ImageUtils.GetCoordsCountTextureType(Meta.TextureType);
|
int Coords = ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget);
|
||||||
|
|
||||||
if (ImageUtils.IsArray(Meta.TextureType))
|
if (ImageUtils.IsArray(Meta.TextureTarget))
|
||||||
Coords -= 1;
|
Coords -= 1;
|
||||||
|
|
||||||
switch (Coords)
|
switch (Coords)
|
||||||
|
@ -1509,7 +1509,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{
|
{
|
||||||
ShaderIrMetaTex Meta = (ShaderIrMetaTex)Op.MetaData;
|
ShaderIrMetaTex Meta = (ShaderIrMetaTex)Op.MetaData;
|
||||||
|
|
||||||
switch (ImageUtils.GetCoordsCountTextureType(Meta.TextureType))
|
switch (ImageUtils.GetCoordsCountTextureTarget(Meta.TextureTarget))
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return GetOperExpr(Op, Meta.Coordinates[0]);
|
return GetOperExpr(Op, Meta.Coordinates[0]);
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{ RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ }
|
{ RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ }
|
||||||
};
|
};
|
||||||
|
|
||||||
private static GalTextureTarget TexToTextureType(int TexType, bool IsArray)
|
private static GalTextureTarget TexToTextureTarget(int TexType, bool IsArray)
|
||||||
{
|
{
|
||||||
switch (TexType)
|
switch (TexType)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GalTextureTarget TexsToTextureType(int TexType)
|
private static GalTextureTarget TexsToTextureTarget(int TexType)
|
||||||
{
|
{
|
||||||
switch (TexType)
|
switch (TexType)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GalTextureTarget TldsToTextureType(int TexType)
|
public static GalTextureTarget TldsToTextureTarget(int TexType)
|
||||||
{
|
{
|
||||||
switch (TexType)
|
switch (TexType)
|
||||||
{
|
{
|
||||||
|
@ -279,7 +279,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
{
|
{
|
||||||
bool IsArray = OpCode.HasArray();
|
bool IsArray = OpCode.HasArray();
|
||||||
|
|
||||||
GalTextureTarget TextureType = TexToTextureType(OpCode.Read(28, 6), IsArray);
|
GalTextureTarget TextureTarget = TexToTextureTarget(OpCode.Read(28, 6), IsArray);
|
||||||
|
|
||||||
bool HasDepthCompare = OpCode.Read(0x32);
|
bool HasDepthCompare = OpCode.Read(0x32);
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
TextureInstructionSuffix |= TextureInstructionSuffix.DC;
|
TextureInstructionSuffix |= TextureInstructionSuffix.DC;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureType(TextureType)];
|
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureTarget(TextureTarget)];
|
||||||
|
|
||||||
int IndexExtraCoord = 0;
|
int IndexExtraCoord = 0;
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureType, TextureInstructionSuffix, Coords)
|
ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureTarget, TextureInstructionSuffix, Coords)
|
||||||
{
|
{
|
||||||
LevelOfDetail = LevelOfDetail,
|
LevelOfDetail = LevelOfDetail,
|
||||||
Offset = Offset,
|
Offset = Offset,
|
||||||
|
@ -430,9 +430,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
throw new InvalidOperationException($"Invalid Suffix for TEXS instruction {RawSuffix}");
|
throw new InvalidOperationException($"Invalid Suffix for TEXS instruction {RawSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
GalTextureTarget TextureType = TexsToTextureType(OpCode.Read(52, 0x1e));
|
GalTextureTarget TextureTarget = TexsToTextureTarget(OpCode.Read(52, 0x1e));
|
||||||
|
|
||||||
EmitTexs(Block, OpCode, ShaderIrInst.Texs, TextureType, Suffix);
|
EmitTexs(Block, OpCode, ShaderIrInst.Texs, TextureTarget, Suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Tlds(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Tlds(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
|
@ -466,9 +466,9 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
throw new InvalidOperationException($"Invalid Suffix for TLDS instruction {RawSuffix}");
|
throw new InvalidOperationException($"Invalid Suffix for TLDS instruction {RawSuffix}");
|
||||||
}
|
}
|
||||||
|
|
||||||
GalTextureTarget TextureType = TldsToTextureType(OpCode.Read(52, 0x1e));
|
GalTextureTarget TextureTarget = TldsToTextureTarget(OpCode.Read(52, 0x1e));
|
||||||
|
|
||||||
EmitTexs(Block, OpCode, ShaderIrInst.Txlf, TextureType, Suffix);
|
EmitTexs(Block, OpCode, ShaderIrInst.Txlf, TextureTarget, Suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Tld4(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Tld4(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
|
@ -497,14 +497,14 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
bool IsArray = OpCode.HasArray();
|
bool IsArray = OpCode.HasArray();
|
||||||
int ChMask = OpCode.Read(31, 0xf);
|
int ChMask = OpCode.Read(31, 0xf);
|
||||||
|
|
||||||
GalTextureTarget TextureType = TexToTextureType(OpCode.Read(28, 6), IsArray);
|
GalTextureTarget TextureTarget = TexToTextureTarget(OpCode.Read(28, 6), IsArray);
|
||||||
|
|
||||||
if (IsShadow)
|
if (IsShadow)
|
||||||
{
|
{
|
||||||
Suffix |= TextureInstructionSuffix.DC;
|
Suffix |= TextureInstructionSuffix.DC;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitTld4(Block, OpCode, TextureType, Suffix, ChMask, OpCode.Read(0x38, 0x3), false);
|
EmitTld4(Block, OpCode, TextureTarget, Suffix, ChMask, OpCode.Read(0x38, 0x3), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Tld4s(ShaderIrBlock Block, long OpCode, int Position)
|
public static void Tld4s(ShaderIrBlock Block, long OpCode, int Position)
|
||||||
|
@ -531,17 +531,17 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
private static void EmitTexs(ShaderIrBlock Block,
|
private static void EmitTexs(ShaderIrBlock Block,
|
||||||
long OpCode,
|
long OpCode,
|
||||||
ShaderIrInst Inst,
|
ShaderIrInst Inst,
|
||||||
GalTextureTarget TextureType,
|
GalTextureTarget TextureTarget,
|
||||||
TextureInstructionSuffix TextureInstructionSuffix)
|
TextureInstructionSuffix TextureInstructionSuffix)
|
||||||
{
|
{
|
||||||
if (Inst == ShaderIrInst.Txlf && TextureType == GalTextureTarget.CubeArray)
|
if (Inst == ShaderIrInst.Txlf && TextureTarget == GalTextureTarget.CubeArray)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("TLDS instructions cannot use CUBE modifier!");
|
throw new InvalidOperationException("TLDS instructions cannot use CUBE modifier!");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsArray = ImageUtils.IsArray(TextureType);
|
bool IsArray = ImageUtils.IsArray(TextureTarget);
|
||||||
|
|
||||||
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureType(TextureType)];
|
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureTarget(TextureTarget)];
|
||||||
|
|
||||||
ShaderIrOperGpr OperA = OpCode.Gpr8();
|
ShaderIrOperGpr OperA = OpCode.Gpr8();
|
||||||
ShaderIrOperGpr OperB = OpCode.Gpr20();
|
ShaderIrOperGpr OperB = OpCode.Gpr20();
|
||||||
|
@ -597,7 +597,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
// Encoding of TEXS/TLDS is a bit special and change for 2d textures
|
// Encoding of TEXS/TLDS is a bit special and change for 2d textures
|
||||||
// NOTE: OperA seems to hold at best two args.
|
// NOTE: OperA seems to hold at best two args.
|
||||||
// On 2D textures, if no suffix need an additional values, Y is stored in OperB, otherwise coords are in OperA and the additional values is in OperB.
|
// On 2D textures, if no suffix need an additional values, Y is stored in OperB, otherwise coords are in OperA and the additional values is in OperB.
|
||||||
if (TextureInstructionSuffix != TextureInstructionSuffix.None && TextureInstructionSuffix != TextureInstructionSuffix.LZ && TextureType == GalTextureTarget.TwoD)
|
if (TextureInstructionSuffix != TextureInstructionSuffix.None && TextureInstructionSuffix != TextureInstructionSuffix.LZ && TextureTarget == GalTextureTarget.TwoD)
|
||||||
{
|
{
|
||||||
Coords[Coords.Length - CoordStartIndex - 1] = OpCode.Gpr8();
|
Coords[Coords.Length - CoordStartIndex - 1] = OpCode.Gpr8();
|
||||||
Coords[Coords.Length - CoordStartIndex - 1].Index += Coords.Length - CoordStartIndex - 1;
|
Coords[Coords.Length - CoordStartIndex - 1].Index += Coords.Length - CoordStartIndex - 1;
|
||||||
|
@ -702,7 +702,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureType, TextureInstructionSuffix, Coords)
|
ShaderIrMetaTex Meta = new ShaderIrMetaTex(Ch, TextureTarget, TextureInstructionSuffix, Coords)
|
||||||
{
|
{
|
||||||
LevelOfDetail = LevelOfDetail,
|
LevelOfDetail = LevelOfDetail,
|
||||||
Offset = Offset,
|
Offset = Offset,
|
||||||
|
@ -725,7 +725,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
ShaderIrOperGpr OperB = OpCode.Gpr20();
|
ShaderIrOperGpr OperB = OpCode.Gpr20();
|
||||||
ShaderIrOperImm OperC = OpCode.Imm13_36();
|
ShaderIrOperImm OperC = OpCode.Imm13_36();
|
||||||
|
|
||||||
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureType(TextureType)];
|
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[ImageUtils.GetCoordsCountTextureTarget(TextureType)];
|
||||||
|
|
||||||
ShaderIrOperGpr Offset = null;
|
ShaderIrOperGpr Offset = null;
|
||||||
ShaderIrOperGpr DepthCompare = null;
|
ShaderIrOperGpr DepthCompare = null;
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
class ShaderIrMetaTex : ShaderIrMeta
|
class ShaderIrMetaTex : ShaderIrMeta
|
||||||
{
|
{
|
||||||
public int Elem { get; private set; }
|
public int Elem { get; private set; }
|
||||||
public GalTextureTarget TextureType { get; private set; }
|
public GalTextureTarget TextureTarget { get; private set; }
|
||||||
public ShaderIrNode[] Coordinates { get; private set; }
|
public ShaderIrNode[] Coordinates { get; private set; }
|
||||||
public TextureInstructionSuffix TextureInstructionSuffix { get; private set; }
|
public TextureInstructionSuffix TextureInstructionSuffix { get; private set; }
|
||||||
public ShaderIrOperGpr LevelOfDetail;
|
public ShaderIrOperGpr LevelOfDetail;
|
||||||
|
@ -13,10 +13,10 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
public ShaderIrOperGpr DepthCompare;
|
public ShaderIrOperGpr DepthCompare;
|
||||||
public int Component; // for TLD4(S)
|
public int Component; // for TLD4(S)
|
||||||
|
|
||||||
public ShaderIrMetaTex(int Elem, GalTextureTarget TextureType, TextureInstructionSuffix TextureInstructionSuffix, params ShaderIrNode[] Coordinates)
|
public ShaderIrMetaTex(int Elem, GalTextureTarget TextureTarget, TextureInstructionSuffix TextureInstructionSuffix, params ShaderIrNode[] Coordinates)
|
||||||
{
|
{
|
||||||
this.Elem = Elem;
|
this.Elem = Elem;
|
||||||
this.TextureType = TextureType;
|
this.TextureTarget = TextureTarget;
|
||||||
this.TextureInstructionSuffix = TextureInstructionSuffix;
|
this.TextureInstructionSuffix = TextureInstructionSuffix;
|
||||||
this.Coordinates = Coordinates;
|
this.Coordinates = Coordinates;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Gal
|
||||||
public int Cbuf { get; private set; }
|
public int Cbuf { get; private set; }
|
||||||
public int Size { get; private set; }
|
public int Size { get; private set; }
|
||||||
|
|
||||||
public GalTextureTarget TextureType { get; private set; }
|
public GalTextureTarget TextureTarget { get; private set; }
|
||||||
|
|
||||||
public TextureInstructionSuffix TextureSuffix { get; private set; }
|
public TextureInstructionSuffix TextureSuffix { get; private set; }
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Gal
|
||||||
bool IsCb = false,
|
bool IsCb = false,
|
||||||
int Cbuf = 0,
|
int Cbuf = 0,
|
||||||
int Size = 1,
|
int Size = 1,
|
||||||
GalTextureTarget TextureType = GalTextureTarget.TwoD,
|
GalTextureTarget TextureTarget = GalTextureTarget.TwoD,
|
||||||
TextureInstructionSuffix TextureSuffix = TextureInstructionSuffix.None)
|
TextureInstructionSuffix TextureSuffix = TextureInstructionSuffix.None)
|
||||||
{
|
{
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
|
@ -29,8 +29,8 @@ namespace Ryujinx.Graphics.Gal
|
||||||
this.IsCb = IsCb;
|
this.IsCb = IsCb;
|
||||||
this.Cbuf = Cbuf;
|
this.Cbuf = Cbuf;
|
||||||
this.Size = Size;
|
this.Size = Size;
|
||||||
this.TextureType = TextureType;
|
|
||||||
|
|
||||||
|
this.TextureTarget = TextureTarget;
|
||||||
this.TextureSuffix = TextureSuffix;
|
this.TextureSuffix = TextureSuffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -341,9 +341,9 @@ namespace Ryujinx.Graphics.Texture
|
||||||
{
|
{
|
||||||
ImageDescriptor Desc = GetImageDescriptor(Image.Format);
|
ImageDescriptor Desc = GetImageDescriptor(Image.Format);
|
||||||
|
|
||||||
int ComponentCount = GetCoordsCountTextureType(Image.TextureType);
|
int ComponentCount = GetCoordsCountTextureTarget(Image.TextureTarget);
|
||||||
|
|
||||||
if (IsArray(Image.TextureType))
|
if (IsArray(Image.TextureTarget))
|
||||||
ComponentCount--;
|
ComponentCount--;
|
||||||
|
|
||||||
int Width = DivRoundUp(Image.Width, Desc.BlockWidth);
|
int Width = DivRoundUp(Image.Width, Desc.BlockWidth);
|
||||||
|
@ -474,9 +474,9 @@ namespace Ryujinx.Graphics.Texture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextureTarget GetTextureTarget(GalTextureTarget TextureType)
|
public static TextureTarget GetTextureTarget(GalTextureTarget GalTextureTarget)
|
||||||
{
|
{
|
||||||
switch (TextureType)
|
switch (GalTextureTarget)
|
||||||
{
|
{
|
||||||
case GalTextureTarget.OneD:
|
case GalTextureTarget.OneD:
|
||||||
return TextureTarget.Texture1D;
|
return TextureTarget.Texture1D;
|
||||||
|
@ -494,13 +494,13 @@ namespace Ryujinx.Graphics.Texture
|
||||||
case GalTextureTarget.CubeArray:
|
case GalTextureTarget.CubeArray:
|
||||||
return TextureTarget.TextureCubeMapArray;
|
return TextureTarget.TextureCubeMapArray;
|
||||||
default:
|
default:
|
||||||
throw new NotSupportedException($"Texture type {TextureType} currently not supported!");
|
throw new NotSupportedException($"Texture target {GalTextureTarget} currently not supported!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsArray(GalTextureTarget TextureType)
|
public static bool IsArray(GalTextureTarget TextureTarget)
|
||||||
{
|
{
|
||||||
switch (TextureType)
|
switch (TextureTarget)
|
||||||
{
|
{
|
||||||
case GalTextureTarget.OneDArray:
|
case GalTextureTarget.OneDArray:
|
||||||
case GalTextureTarget.TwoDArray:
|
case GalTextureTarget.TwoDArray:
|
||||||
|
@ -511,9 +511,9 @@ namespace Ryujinx.Graphics.Texture
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetCoordsCountTextureType(GalTextureTarget TextureType)
|
public static int GetCoordsCountTextureTarget(GalTextureTarget TextureTarget)
|
||||||
{
|
{
|
||||||
switch (TextureType)
|
switch (TextureTarget)
|
||||||
{
|
{
|
||||||
case GalTextureTarget.OneD:
|
case GalTextureTarget.OneD:
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -528,7 +528,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
case GalTextureTarget.CubeArray:
|
case GalTextureTarget.CubeArray:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException($"TextureTpe.{TextureType} not implemented yet.");
|
throw new NotImplementedException($"TextureTarget.{TextureTarget} not implemented yet.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
|
|
||||||
GalImageFormat Format = GetImageFormat(Tic);
|
GalImageFormat Format = GetImageFormat(Tic);
|
||||||
|
|
||||||
GalTextureTarget TextureType = (GalTextureTarget)((Tic[4] >> 23) & 0xF);
|
GalTextureTarget TextureTarget = (GalTextureTarget)((Tic[4] >> 23) & 0xF);
|
||||||
|
|
||||||
GalTextureSource XSource = (GalTextureSource)((Tic[0] >> 19) & 7);
|
GalTextureSource XSource = (GalTextureSource)((Tic[0] >> 19) & 7);
|
||||||
GalTextureSource YSource = (GalTextureSource)((Tic[0] >> 22) & 7);
|
GalTextureSource YSource = (GalTextureSource)((Tic[0] >> 22) & 7);
|
||||||
|
@ -45,16 +45,16 @@ namespace Ryujinx.Graphics.Texture
|
||||||
int Height = (Tic[5] & 0xffff) + 1;
|
int Height = (Tic[5] & 0xffff) + 1;
|
||||||
int Depth = ((Tic[5] >> 16) & 0x3fff) + 1;
|
int Depth = ((Tic[5] >> 16) & 0x3fff) + 1;
|
||||||
|
|
||||||
if (TextureType == GalTextureTarget.OneD)
|
if (TextureTarget == GalTextureTarget.OneD)
|
||||||
{
|
{
|
||||||
Height = 1;
|
Height = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextureType == GalTextureTarget.TwoD || TextureType == GalTextureTarget.OneD)
|
if (TextureTarget == GalTextureTarget.TwoD || TextureTarget == GalTextureTarget.OneD)
|
||||||
{
|
{
|
||||||
Depth = 1;
|
Depth = 1;
|
||||||
}
|
}
|
||||||
else if (TextureType == GalTextureTarget.CubeMap)
|
else if (TextureTarget == GalTextureTarget.CubeMap)
|
||||||
{
|
{
|
||||||
Depth = 6;
|
Depth = 6;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
BlockHeight,
|
BlockHeight,
|
||||||
Layout,
|
Layout,
|
||||||
Format,
|
Format,
|
||||||
TextureType,
|
TextureTarget,
|
||||||
MaxMipmapLevel,
|
MaxMipmapLevel,
|
||||||
XSource,
|
XSource,
|
||||||
YSource,
|
YSource,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue