Improve shader sampler type selection (#989)

This commit is contained in:
gdkchan 2020-03-14 21:24:45 -03:00 committed by GitHub
parent 8ce3993afa
commit 8bb64ac69c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,7 +254,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
{
Dictionary<string, AstTextureOperation> samplers = new Dictionary<string, AstTextureOperation>();
foreach (AstTextureOperation texOp in info.Samplers.OrderBy(x => x.Handle))
// Texture instructions other than TextureSample (like TextureSize)
// may have incomplete sampler type information. In those cases,
// we prefer instead the more accurate information from the
// TextureSample instruction, if both are available.
foreach (AstTextureOperation texOp in info.Samplers.OrderBy(x => x.Handle * 2 + (x.Inst == Instruction.TextureSample ? 0 : 1)))
{
string indexExpr = NumberFormatter.FormatInt(texOp.ArraySize);