Implement TEX texture array

This commit is contained in:
ReinUsesLisp 2018-08-27 03:03:31 -03:00
parent 3bc53382c8
commit a7de2322a1
4 changed files with 54 additions and 34 deletions

View file

@ -112,6 +112,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{ {
switch (Target) switch (Target)
{ {
case TextureTarget.Texture1D:
GL.CompressedTexImage1D(
Target,
Level,
InternalFormat,
Width,
Border,
Data.Length,
Data);
break;
case TextureTarget.Texture2D: case TextureTarget.Texture2D:
GL.CompressedTexImage2D( GL.CompressedTexImage2D(
Target, Target,

View file

@ -31,12 +31,12 @@ namespace Ryujinx.Graphics.Gal.Shader
{ RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ } { RGB_, RG_A, R_BA, _GBA, RGBA, ____, ____, ____ }
}; };
private static ShaderTextureType[] TexTypes = new ShaderTextureType[] private static ShaderTextureType[,] TexTypes = new ShaderTextureType[,]
{ {
ShaderTextureType._1d, { ShaderTextureType._1d, ShaderTextureType._1dArray },
ShaderTextureType._2d, { ShaderTextureType._2d, ShaderTextureType._2dArray },
ShaderTextureType._3d, { ShaderTextureType._3d, ShaderTextureType.Invalid },
ShaderTextureType.Cube, { ShaderTextureType.Cube, ShaderTextureType.Invalid }
}; };
private static int[] TexTypeCoords = new int[] { 1, 2, 3, 3 }; 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) private static void EmitTex(ShaderIrBlock Block, long OpCode, bool GprHandle)
{ {
bool IsArray = ((OpCode >> 28) & 1) != 0;
int TypeId = (int)((OpCode >> 29) & 3); int TypeId = (int)((OpCode >> 29) & 3);
ShaderIrOperGpr[] Coords = new ShaderIrOperGpr[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; Coords[Index] = GetOperGpr8(OpCode) + Index;

View file

@ -2,7 +2,9 @@
{ {
enum ShaderTextureType enum ShaderTextureType
{ {
Invalid,
_1d, _1d,
_1dArray,
_2d, _2d,
_2dArray, _2dArray,
_3d, _3d,

View file

@ -2,7 +2,7 @@
Enable_Memory_Checks = false Enable_Memory_Checks = false
#Dump shaders in local directory (e.g. `C:\ShaderDumps`) #Dump shaders in local directory (e.g. `C:\ShaderDumps`)
Graphics_Shaders_Dump_Path = D:\Shaders Graphics_Shaders_Dump_Path =
#Enable print debug logs #Enable print debug logs
Logging_Enable_Debug = false Logging_Enable_Debug = false