Fix some nits + rename some things to be less confusing
This commit is contained in:
parent
e496f4bfd4
commit
fb228c3be7
9 changed files with 37 additions and 40 deletions
|
@ -47,8 +47,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
const int Level = 0; //TODO: Support mipmap textures.
|
||||
const int Border = 0;
|
||||
|
||||
//Debug.Assert(Image.MaxMipmapLevel != 1, "No Mipmap support");
|
||||
|
||||
TextureCache.AddOrUpdate(Key, new ImageHandler(Handle, Image), (uint)Size);
|
||||
|
||||
if (ImageUtils.IsCompressed(Image.Format))
|
||||
|
@ -104,10 +102,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
for (int Face = 0; Face < 6; Face++)
|
||||
{
|
||||
GL.TexImage2D(
|
||||
TextureTarget.TextureCubeMapPositiveX + i,
|
||||
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||
Level,
|
||||
InternalFmt,
|
||||
Image.Width,
|
||||
|
@ -119,7 +117,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
}
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException($"Unsupported texture target type: {Target}");
|
||||
throw new NotImplementedException($"Unsupported texture target type: {Target}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,8 +132,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
const int Level = 0; //TODO: Support mipmap textures.
|
||||
const int Border = 0;
|
||||
|
||||
//Debug.Assert(Image.MaxMipmapLevel != 1, "No Mipmap support");
|
||||
|
||||
TextureCache.AddOrUpdate(Key, new ImageHandler(Handle, Image), (uint)Data.Length);
|
||||
|
||||
if (ImageUtils.IsCompressed(Image.Format) && !IsAstc(Image.Format))
|
||||
|
@ -183,17 +179,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
for (int Face = 0; Face < 6; Face++)
|
||||
{
|
||||
GL.CompressedTexImage2D(
|
||||
TextureTarget.TextureCubeMapPositiveX + i,
|
||||
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||
Level,
|
||||
InternalFmt,
|
||||
Image.Width,
|
||||
Image.Height,
|
||||
Border,
|
||||
FaceSize,
|
||||
Array.Slice(i * FaceSize, FaceSize).ToArray());
|
||||
Array.Slice(Face * FaceSize, FaceSize).ToArray());
|
||||
}
|
||||
break;
|
||||
case TextureTarget.TextureCubeMapArray:
|
||||
|
@ -209,7 +205,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
Data);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException($"Unsupported texture target type: {Target}");
|
||||
throw new NotImplementedException($"Unsupported texture target type: {Target}");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -282,10 +278,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
for (int Face = 0; Face < 6; Face++)
|
||||
{
|
||||
GL.TexImage2D(
|
||||
TextureTarget.TextureCubeMapPositiveX + i,
|
||||
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||
Level,
|
||||
InternalFmt,
|
||||
Image.Width,
|
||||
|
@ -293,11 +289,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
Border,
|
||||
Format,
|
||||
Type,
|
||||
Array.Slice(i * FaceSize, FaceSize).ToArray());
|
||||
Array.Slice(Face * FaceSize, FaceSize).ToArray());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException($"Unsupported texture target type: {Target}");
|
||||
throw new NotImplementedException($"Unsupported texture target type: {Target}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -268,7 +268,6 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
if (HasShadow)
|
||||
Result += "Shadow";
|
||||
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -1439,7 +1438,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
// TODO: Support AOFFI
|
||||
if ((Suffix & TextureInstructionSuffix.AOFFI) != 0)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
return "textureGather(" + Sampler + ", " + Coords + ", " + Comp + ")" + ChString;
|
||||
|
|
|
@ -508,7 +508,11 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
EmitTld4(Block, OpCode, TextureType.TwoD, Suffix, RGBA, OpCode.Read(0x34, 0x3), true);
|
||||
}
|
||||
|
||||
private static void EmitTexs(ShaderIrBlock Block, long OpCode, ShaderIrInst Inst, TextureType TextureType, TextureInstructionSuffix TextureInstructionSuffix)
|
||||
private static void EmitTexs(ShaderIrBlock Block,
|
||||
long OpCode,
|
||||
ShaderIrInst Inst,
|
||||
TextureType TextureType,
|
||||
TextureInstructionSuffix TextureInstructionSuffix)
|
||||
{
|
||||
if (Inst == ShaderIrInst.Txlf && TextureType == TextureType.CubeArray)
|
||||
{
|
||||
|
@ -580,7 +584,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
OperBIndex--;
|
||||
}
|
||||
|
||||
// TODO: Find what MZ do and what change about the encoding (Maybe Multisample?)
|
||||
// TODO: Find what MZ does and what changes about the encoding (Maybe Multisample?)
|
||||
if ((TextureInstructionSuffix & TextureInstructionSuffix.LL) != 0)
|
||||
{
|
||||
LevelOfDetail = OpCode.Gpr20();
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
private int XShift;
|
||||
private int GobStride;
|
||||
|
||||
private int LayerZ;
|
||||
private int SliceSize;
|
||||
|
||||
public BlockLinearSwizzle(int Width, int Height, int Bpp, int BlockHeight)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
XShift = CountLsbZeros(512 * BlockHeight);
|
||||
|
||||
LayerZ = Bpp * Width * Height;
|
||||
SliceSize = Bpp * Width * Height;
|
||||
}
|
||||
|
||||
private int CountLsbZeros(int Value)
|
||||
|
@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
Position += ((Y & 0x01) >> 0) << 4;
|
||||
Position += ((X & 0x0f) >> 0) << 0;
|
||||
|
||||
return (Z * LayerZ) + Position;
|
||||
return Z * SliceSize + Position;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
public int BytesPerPixel { get; private set; }
|
||||
public int BlockWidth { get; private set; }
|
||||
public int BlockHeight { get; private set; }
|
||||
public int BlockDepth { get; private set; }
|
||||
public int BlockDepth { get; private set; }
|
||||
|
||||
public TargetBuffer Target { get; private set; }
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
this.BytesPerPixel = BytesPerPixel;
|
||||
this.BlockWidth = BlockWidth;
|
||||
this.BlockHeight = BlockHeight;
|
||||
this.BlockDepth = BlockDepth;
|
||||
this.BlockDepth = BlockDepth;
|
||||
this.Target = Target;
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
case 3:
|
||||
return Desc.BytesPerPixel * Width * Height * Depth;
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
throw new InvalidOperationException($"Invalid component count: {ComponentCount}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
case TextureType.CubeArray:
|
||||
return 4;
|
||||
default:
|
||||
throw new NotImplementedException($"TextureTpe.{TextureType} not implemented yet");
|
||||
throw new NotImplementedException($"TextureTpe.{TextureType} not implemented yet.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,18 +5,18 @@ namespace Ryujinx.Graphics.Texture
|
|||
private int Pitch;
|
||||
private int Bpp;
|
||||
|
||||
private int ZLayer;
|
||||
private int SliceSize;
|
||||
|
||||
public LinearSwizzle(int Pitch, int Bpp, int Width, int Height)
|
||||
{
|
||||
this.Pitch = Pitch;
|
||||
this.Bpp = Bpp;
|
||||
this.ZLayer = Width * Height * Bpp;
|
||||
SliceSize = Width * Height * Bpp;
|
||||
}
|
||||
|
||||
public int GetSwizzleOffset(int X, int Y, int Z)
|
||||
{
|
||||
return Z * ZLayer + X * Bpp + Y * Pitch;
|
||||
return Z * SliceSize + X * Bpp + Y * Pitch;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,8 +16,6 @@ namespace Ryujinx.Graphics.Texture
|
|||
|
||||
TextureType TextureType = (TextureType)((Tic[4] >> 23) & 0xF);
|
||||
|
||||
|
||||
|
||||
GalTextureSource XSource = (GalTextureSource)((Tic[0] >> 19) & 7);
|
||||
GalTextureSource YSource = (GalTextureSource)((Tic[0] >> 22) & 7);
|
||||
GalTextureSource ZSource = (GalTextureSource)((Tic[0] >> 25) & 7);
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Texture
|
|||
int BlockHeight = ImageUtils.GetBlockHeight (Image.Format);
|
||||
int BytesPerPixel = ImageUtils.GetBytesPerPixel(Image.Format);
|
||||
|
||||
int Width = (Image.Width + (BlockWidth - 1)) / BlockWidth;
|
||||
int Width = (Image.Width + (BlockWidth - 1)) / BlockWidth;
|
||||
int Height = (Image.Height + (BlockHeight - 1)) / BlockHeight;
|
||||
|
||||
if (Image.Layout == GalMemoryLayout.BlockLinear)
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
{
|
||||
public enum TextureType
|
||||
{
|
||||
OneD = 0,
|
||||
TwoD = 1,
|
||||
ThreeD = 2,
|
||||
CubeMap = 3,
|
||||
OneDArray = 4,
|
||||
TwoDArray = 5,
|
||||
OneDBuffer = 6,
|
||||
OneD = 0,
|
||||
TwoD = 1,
|
||||
ThreeD = 2,
|
||||
CubeMap = 3,
|
||||
OneDArray = 4,
|
||||
TwoDArray = 5,
|
||||
OneDBuffer = 6,
|
||||
TwoDNoMipMap = 7,
|
||||
CubeArray = 8,
|
||||
CubeArray = 8,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue