Support separate textures and samplers (#1216)
* Support separate textures and samplers * Add missing bindless flag, fix SNORM format on buffer textures * Add missing separation * Add comments about the new handles
This commit is contained in:
parent
0b6d206daa
commit
5795bb1528
17 changed files with 240 additions and 59 deletions
|
@ -879,6 +879,8 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
if (op.IsBindless)
|
||||
{
|
||||
sourcesList.Add(Ra());
|
||||
|
||||
flags |= TextureFlags.Bindless;
|
||||
}
|
||||
|
||||
SamplerType type = ConvertSamplerType(op.Dimensions);
|
||||
|
@ -1081,6 +1083,24 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
|
||||
SamplerType type = ConvertSamplerType(op.Dimensions);
|
||||
|
||||
bool hasLod = op.LodMode > TextureLodMode.LodZero;
|
||||
|
||||
if (type == SamplerType.Texture1D && (flags & ~TextureFlags.Bindless) == TextureFlags.IntCoords && !(hasLod ||
|
||||
op.HasDepthCompare ||
|
||||
op.HasOffset ||
|
||||
op.IsArray ||
|
||||
op.IsMultisample))
|
||||
{
|
||||
// For bindless, we don't have any way to know the texture type,
|
||||
// so we assume it's texture buffer when the sampler type is 1D, since that's more common.
|
||||
bool isTypeBuffer = isBindless || context.Config.GpuAccessor.QueryIsTextureBuffer(op.Immediate);
|
||||
|
||||
if (isTypeBuffer)
|
||||
{
|
||||
type = SamplerType.TextureBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
int coordsCount = type.GetDimensions();
|
||||
|
||||
for (int index = 0; index < coordsCount; index++)
|
||||
|
@ -1095,8 +1115,6 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
type |= SamplerType.Array;
|
||||
}
|
||||
|
||||
bool hasLod = op.LodMode > TextureLodMode.LodZero;
|
||||
|
||||
Operand lodValue = hasLod ? Rb() : ConstF(0);
|
||||
|
||||
Operand packedOffs = op.HasOffset ? Rb() : null;
|
||||
|
@ -1110,7 +1128,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
|
||||
if ((op.LodMode == TextureLodMode.LodZero ||
|
||||
op.LodMode == TextureLodMode.LodLevel ||
|
||||
op.LodMode == TextureLodMode.LodLevelA) && !op.IsMultisample)
|
||||
op.LodMode == TextureLodMode.LodLevelA) && !op.IsMultisample && type != SamplerType.TextureBuffer)
|
||||
{
|
||||
sourcesList.Add(lodValue);
|
||||
|
||||
|
@ -1142,16 +1160,6 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
type |= SamplerType.Multisample;
|
||||
}
|
||||
|
||||
if (type == SamplerType.Texture1D && flags == TextureFlags.IntCoords && !isBindless)
|
||||
{
|
||||
bool isTypeBuffer = context.Config.GpuAccessor.QueryIsTextureBuffer(op.Immediate);
|
||||
|
||||
if (isTypeBuffer)
|
||||
{
|
||||
type = SamplerType.TextureBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
Operand[] sources = sourcesList.ToArray();
|
||||
|
||||
int rdIndex = op.Rd.Index;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue