mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-04 19:22:01 +00:00
Add scaling for Texture2DArray when using TexelFetch. (#1645)
* Add scaling for Texture2DArray when using TexelFetch. * Should only really trigger for Texture2D. (do not emit texelfetch for TextureBufferArray(?) and Texture1DArray) * Address nit.
This commit is contained in:
parent
0031edae27
commit
780c7530d6
1 changed files with 16 additions and 11 deletions
|
@ -407,20 +407,25 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
||||||
|
|
||||||
if ((context.Config.Stage == ShaderStage.Fragment || context.Config.Stage == ShaderStage.Compute) &&
|
if ((context.Config.Stage == ShaderStage.Fragment || context.Config.Stage == ShaderStage.Compute) &&
|
||||||
(texOp.Flags & TextureFlags.Bindless) == 0 &&
|
(texOp.Flags & TextureFlags.Bindless) == 0 &&
|
||||||
texOp.Type != SamplerType.Indexed &&
|
texOp.Type != SamplerType.Indexed)
|
||||||
pCount == 2)
|
|
||||||
{
|
{
|
||||||
return "Helper_TexelFetchScale(" + vector + ", " + index + ")";
|
if (pCount == 3 && isArray)
|
||||||
|
{
|
||||||
|
// The array index is not scaled, just x and y.
|
||||||
|
return "ivec3(Helper_TexelFetchScale((" + vector + ").xy, " + index + "), (" + vector + ").z)";
|
||||||
|
}
|
||||||
|
else if (pCount == 2 && !isArray)
|
||||||
|
{
|
||||||
|
return "Helper_TexelFetchScale(" + vector + ", " + index + ")";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// Resolution scaling cannot be applied to this texture right now.
|
|
||||||
// Flag so that we know to blacklist scaling on related textures when binding them.
|
|
||||||
|
|
||||||
TextureDescriptor descriptor = context.TextureDescriptors[index];
|
// Resolution scaling cannot be applied to this texture right now.
|
||||||
descriptor.Flags |= TextureUsageFlags.ResScaleUnsupported;
|
// Flag so that we know to blacklist scaling on related textures when binding them.
|
||||||
context.TextureDescriptors[index] = descriptor;
|
|
||||||
}
|
TextureDescriptor descriptor = context.TextureDescriptors[index];
|
||||||
|
descriptor.Flags |= TextureUsageFlags.ResScaleUnsupported;
|
||||||
|
context.TextureDescriptors[index] = descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
return vector;
|
return vector;
|
||||||
|
|
Loading…
Reference in a new issue