Implement TEX texture array
This commit is contained in:
parent
3bc53382c8
commit
a7de2322a1
4 changed files with 54 additions and 34 deletions
|
@ -62,38 +62,38 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
break;
|
||||
|
||||
case TextureTarget.TextureCubeMap:
|
||||
{
|
||||
long FaceSize = Data.LongLength / 6;
|
||||
|
||||
for (int Face = 0; Face < 6; Face++)
|
||||
{
|
||||
long FaceSize = Data.LongLength / 6;
|
||||
|
||||
for (int Face = 0; Face < 6; Face++)
|
||||
fixed (byte* DataPtr = Data)
|
||||
{
|
||||
fixed (byte* DataPtr = Data)
|
||||
IntPtr Addr;
|
||||
|
||||
if (Data != null)
|
||||
{
|
||||
IntPtr Addr;
|
||||
|
||||
if (Data != null)
|
||||
{
|
||||
Addr = new IntPtr(DataPtr + FaceSize * Face);
|
||||
}
|
||||
else
|
||||
{
|
||||
Addr = new IntPtr(0);
|
||||
}
|
||||
|
||||
GL.TexImage2D(
|
||||
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||
Level,
|
||||
InternalFormat,
|
||||
Width,
|
||||
Height,
|
||||
Border,
|
||||
PixelFormat,
|
||||
PixelType,
|
||||
Addr);
|
||||
Addr = new IntPtr(DataPtr + FaceSize * Face);
|
||||
}
|
||||
else
|
||||
{
|
||||
Addr = new IntPtr(0);
|
||||
}
|
||||
|
||||
GL.TexImage2D(
|
||||
TextureTarget.TextureCubeMapPositiveX + Face,
|
||||
Level,
|
||||
InternalFormat,
|
||||
Width,
|
||||
Height,
|
||||
Border,
|
||||
PixelFormat,
|
||||
PixelType,
|
||||
Addr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new NotImplementedException(Target.ToString());
|
||||
|
@ -112,6 +112,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
{
|
||||
switch (Target)
|
||||
{
|
||||
case TextureTarget.Texture1D:
|
||||
GL.CompressedTexImage1D(
|
||||
Target,
|
||||
Level,
|
||||
InternalFormat,
|
||||
Width,
|
||||
Border,
|
||||
Data.Length,
|
||||
Data);
|
||||
break;
|
||||
|
||||
case TextureTarget.Texture2D:
|
||||
GL.CompressedTexImage2D(
|
||||
Target,
|
||||
|
|
|
@ -31,12 +31,12 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
{ RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ }
|
||||
};
|
||||
|
||||
private static ShaderTextureType[] TexTypes = new ShaderTextureType[]
|
||||
private static ShaderTextureType[,] TexTypes = new ShaderTextureType[,]
|
||||
{
|
||||
ShaderTextureType._1d,
|
||||
ShaderTextureType._2d,
|
||||
ShaderTextureType._3d,
|
||||
ShaderTextureType.Cube,
|
||||
{ ShaderTextureType._1d, ShaderTextureType._1dArray },
|
||||
{ ShaderTextureType._2d, ShaderTextureType._2dArray },
|
||||
{ ShaderTextureType._3d, ShaderTextureType.Invalid },
|
||||
{ ShaderTextureType.Cube, ShaderTextureType.Invalid }
|
||||
};
|
||||
|
||||
private static int[] TexTypeCoords = new int[] { 1, 2, 3, 3 };
|
||||
|
@ -169,13 +169,20 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
|
||||
private static void EmitTex(ShaderIrBlock Block, long OpCode, bool GprHandle)
|
||||
{
|
||||
bool IsArray = ((OpCode >> 28) & 1) != 0;
|
||||
|
||||
int TypeId = (int)((OpCode >> 29) & 3);
|
||||
|
||||
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[3];
|
||||
|
||||
ShaderTextureType Type = TexTypes[TypeId];
|
||||
ShaderTextureType Type = TexTypes[TypeId, IsArray ? 1 : 0];
|
||||
|
||||
for (int Index = 0; Index < TexTypeCoords[TypeId]; Index++)
|
||||
if (Type == ShaderTextureType.Invalid)
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
for (int Index = 0; Index < TexTypeCoords[TypeId] + (IsArray ? 1 : 0); Index++)
|
||||
{
|
||||
Coords[Index] = GetOperGpr8(OpCode) + Index;
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
{
|
||||
enum ShaderTextureType
|
||||
{
|
||||
Invalid,
|
||||
_1d,
|
||||
_1dArray,
|
||||
_2d,
|
||||
_2dArray,
|
||||
_3d,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Enable_Memory_Checks = false
|
||||
|
||||
#Dump shaders in local directory (e.g. `C:\ShaderDumps`)
|
||||
Graphics_Shaders_Dump_Path = D:\Shaders
|
||||
Graphics_Shaders_Dump_Path =
|
||||
|
||||
#Enable print debug logs
|
||||
Logging_Enable_Debug = false
|
||||
|
|
Loading…
Reference in a new issue