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 Level = 0; //TODO: Support mipmap textures.
|
||||||
const int Border = 0;
|
const int Border = 0;
|
||||||
|
|
||||||
//Debug.Assert(Image.MaxMipmapLevel != 1, "No Mipmap support");
|
|
||||||
|
|
||||||
TextureCache.AddOrUpdate(Key, new ImageHandler(Handle, Image), (uint)Size);
|
TextureCache.AddOrUpdate(Key, new ImageHandler(Handle, Image), (uint)Size);
|
||||||
|
|
||||||
if (ImageUtils.IsCompressed(Image.Format))
|
if (ImageUtils.IsCompressed(Image.Format))
|
||||||
|
@ -104,10 +102,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
|
|
||||||
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int Face = 0; Face < 6; Face++)
|
||||||
{
|
{
|
||||||
GL.TexImage2D(
|
GL.TexImage2D(
|
||||||
TextureTarget.TextureCubeMapPositiveX + i,
|
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||||
Level,
|
Level,
|
||||||
InternalFmt,
|
InternalFmt,
|
||||||
Image.Width,
|
Image.Width,
|
||||||
|
@ -119,7 +117,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
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 Level = 0; //TODO: Support mipmap textures.
|
||||||
const int Border = 0;
|
const int Border = 0;
|
||||||
|
|
||||||
//Debug.Assert(Image.MaxMipmapLevel != 1, "No Mipmap support");
|
|
||||||
|
|
||||||
TextureCache.AddOrUpdate(Key, new ImageHandler(Handle, Image), (uint)Data.Length);
|
TextureCache.AddOrUpdate(Key, new ImageHandler(Handle, Image), (uint)Data.Length);
|
||||||
|
|
||||||
if (ImageUtils.IsCompressed(Image.Format) && !IsAstc(Image.Format))
|
if (ImageUtils.IsCompressed(Image.Format) && !IsAstc(Image.Format))
|
||||||
|
@ -183,17 +179,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
|
|
||||||
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int Face = 0; Face < 6; Face++)
|
||||||
{
|
{
|
||||||
GL.CompressedTexImage2D(
|
GL.CompressedTexImage2D(
|
||||||
TextureTarget.TextureCubeMapPositiveX + i,
|
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||||
Level,
|
Level,
|
||||||
InternalFmt,
|
InternalFmt,
|
||||||
Image.Width,
|
Image.Width,
|
||||||
Image.Height,
|
Image.Height,
|
||||||
Border,
|
Border,
|
||||||
FaceSize,
|
FaceSize,
|
||||||
Array.Slice(i * FaceSize, FaceSize).ToArray());
|
Array.Slice(Face * FaceSize, FaceSize).ToArray());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TextureTarget.TextureCubeMapArray:
|
case TextureTarget.TextureCubeMapArray:
|
||||||
|
@ -209,7 +205,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
Data);
|
Data);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException($"Unsupported texture target type: {Target}");
|
throw new NotImplementedException($"Unsupported texture target type: {Target}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -282,10 +278,10 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
|
|
||||||
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
int FaceSize = ImageUtils.GetSize(Image) / Image.Depth;
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int Face = 0; Face < 6; Face++)
|
||||||
{
|
{
|
||||||
GL.TexImage2D(
|
GL.TexImage2D(
|
||||||
TextureTarget.TextureCubeMapPositiveX + i,
|
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||||
Level,
|
Level,
|
||||||
InternalFmt,
|
InternalFmt,
|
||||||
Image.Width,
|
Image.Width,
|
||||||
|
@ -293,11 +289,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
Border,
|
Border,
|
||||||
Format,
|
Format,
|
||||||
Type,
|
Type,
|
||||||
Array.Slice(i * FaceSize, FaceSize).ToArray());
|
Array.Slice(Face * FaceSize, FaceSize).ToArray());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
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)
|
if (HasShadow)
|
||||||
Result += "Shadow";
|
Result += "Shadow";
|
||||||
|
|
||||||
|
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1439,7 +1438,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
// TODO: Support AOFFI
|
// TODO: Support AOFFI
|
||||||
if ((Suffix & TextureInstructionSuffix.AOFFI) != 0)
|
if ((Suffix & TextureInstructionSuffix.AOFFI) != 0)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
return "textureGather(" + Sampler + ", " + Coords + ", " + Comp + ")" + ChString;
|
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);
|
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)
|
if (Inst == ShaderIrInst.Txlf && TextureType == TextureType.CubeArray)
|
||||||
{
|
{
|
||||||
|
@ -580,7 +584,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
||||||
OperBIndex--;
|
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)
|
if ((TextureInstructionSuffix & TextureInstructionSuffix.LL) != 0)
|
||||||
{
|
{
|
||||||
LevelOfDetail = OpCode.Gpr20();
|
LevelOfDetail = OpCode.Gpr20();
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
private int XShift;
|
private int XShift;
|
||||||
private int GobStride;
|
private int GobStride;
|
||||||
|
|
||||||
private int LayerZ;
|
private int SliceSize;
|
||||||
|
|
||||||
public BlockLinearSwizzle(int Width, int Height, int Bpp, int BlockHeight)
|
public BlockLinearSwizzle(int Width, int Height, int Bpp, int BlockHeight)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
|
|
||||||
XShift = CountLsbZeros(512 * BlockHeight);
|
XShift = CountLsbZeros(512 * BlockHeight);
|
||||||
|
|
||||||
LayerZ = Bpp * Width * Height;
|
SliceSize = Bpp * Width * Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int CountLsbZeros(int Value)
|
private int CountLsbZeros(int Value)
|
||||||
|
@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
Position += ((Y & 0x01) >> 0) << 4;
|
Position += ((Y & 0x01) >> 0) << 4;
|
||||||
Position += ((X & 0x0f) >> 0) << 0;
|
Position += ((X & 0x0f) >> 0) << 0;
|
||||||
|
|
||||||
return (Z * LayerZ) + Position;
|
return Z * SliceSize + Position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
case 3:
|
case 3:
|
||||||
return Desc.BytesPerPixel * Width * Height * Depth;
|
return Desc.BytesPerPixel * Width * Height * Depth;
|
||||||
default:
|
default:
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException($"Invalid component count: {ComponentCount}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,7 +529,7 @@ namespace Ryujinx.Graphics.Texture
|
||||||
case TextureType.CubeArray:
|
case TextureType.CubeArray:
|
||||||
return 4;
|
return 4;
|
||||||
default:
|
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 Pitch;
|
||||||
private int Bpp;
|
private int Bpp;
|
||||||
|
|
||||||
private int ZLayer;
|
private int SliceSize;
|
||||||
|
|
||||||
public LinearSwizzle(int Pitch, int Bpp, int Width, int Height)
|
public LinearSwizzle(int Pitch, int Bpp, int Width, int Height)
|
||||||
{
|
{
|
||||||
this.Pitch = Pitch;
|
this.Pitch = Pitch;
|
||||||
this.Bpp = Bpp;
|
this.Bpp = Bpp;
|
||||||
this.ZLayer = Width * Height * Bpp;
|
SliceSize = Width * Height * Bpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetSwizzleOffset(int X, int Y, int Z)
|
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);
|
TextureType TextureType = (TextureType)((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);
|
||||||
GalTextureSource ZSource = (GalTextureSource)((Tic[0] >> 25) & 7);
|
GalTextureSource ZSource = (GalTextureSource)((Tic[0] >> 25) & 7);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue