Delete ShaderConfig and organize shader resources/definitions better (#5509)
* Move some properties out of ShaderConfig * Stop using ShaderConfig on backends * Replace ShaderConfig usages on Translator and passes * Move remaining properties out of ShaderConfig and delete ShaderConfig * Remove ResourceManager property from TranslatorContext * Move Rewriter passes to separate transform pass files * Fix TransformPasses.RunPass on cases where a node is removed * Move remaining ClipDistancePrimitivesWritten and UsedFeatures updates to decode stage * Reduce excessive parameter passing a bit by using structs more * Remove binding parameter from ShaderProperties methods since it is redundant * Replace decoder instruction checks with switch statement * Put GLSL on the same plan as SPIR-V for input/output declaration * Stop mutating TranslatorContext state when Translate is called * Pass most of the graphics state using a struct instead of individual query methods * Auto-format * Auto-format * Add backend logging interface * Auto-format * Remove unnecessary use of interpolated strings * Remove more modifications of AttributeUsage after decode * PR feedback * gl_Layer is not supported on compute
This commit is contained in:
parent
8edfb2bc7b
commit
b423197619
68 changed files with 2653 additions and 2407 deletions
|
@ -57,8 +57,6 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
{
|
||||
InstTld op = context.GetOp<InstTld>();
|
||||
|
||||
context.Config.SetUsedFeature(FeatureFlags.IntegerSampling);
|
||||
|
||||
var lod = op.Lod ? Lod.Ll : Lod.Lz;
|
||||
|
||||
EmitTex(context, TextureFlags.IntCoords, op.Dim, lod, op.TidB, op.WMask, op.SrcA, op.SrcB, op.Dest, op.Ms, false, op.Toff);
|
||||
|
@ -68,8 +66,6 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
{
|
||||
InstTldB op = context.GetOp<InstTldB>();
|
||||
|
||||
context.Config.SetUsedFeature(FeatureFlags.IntegerSampling);
|
||||
|
||||
var flags = TextureFlags.IntCoords | TextureFlags.Bindless;
|
||||
var lod = op.Lod ? Lod.Ll : Lod.Lz;
|
||||
|
||||
|
@ -224,7 +220,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
{
|
||||
// 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.QuerySamplerType(imm) == SamplerType.TextureBuffer;
|
||||
bool isTypeBuffer = isBindless || context.TranslatorContext.GpuAccessor.QuerySamplerType(imm) == SamplerType.TextureBuffer;
|
||||
if (isTypeBuffer)
|
||||
{
|
||||
type = SamplerType.TextureBuffer;
|
||||
|
@ -386,7 +382,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
|
||||
if (type == SamplerType.None)
|
||||
{
|
||||
context.Config.GpuAccessor.Log("Invalid texture sampler type.");
|
||||
context.TranslatorContext.GpuAccessor.Log("Invalid texture sampler type.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -478,16 +474,14 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
|
||||
if (type == SamplerType.None)
|
||||
{
|
||||
context.Config.GpuAccessor.Log("Invalid texel fetch sampler type.");
|
||||
context.TranslatorContext.GpuAccessor.Log("Invalid texel fetch sampler type.");
|
||||
return;
|
||||
}
|
||||
|
||||
context.Config.SetUsedFeature(FeatureFlags.IntegerSampling);
|
||||
|
||||
flags = ConvertTextureFlags(tldsOp.Target) | TextureFlags.IntCoords;
|
||||
|
||||
if (tldsOp.Target == TldsTarget.Texture1DLodZero &&
|
||||
context.Config.GpuAccessor.QuerySamplerType(tldsOp.TidB) == SamplerType.TextureBuffer)
|
||||
context.TranslatorContext.GpuAccessor.QuerySamplerType(tldsOp.TidB) == SamplerType.TextureBuffer)
|
||||
{
|
||||
type = SamplerType.TextureBuffer;
|
||||
flags &= ~TextureFlags.LodLevel;
|
||||
|
@ -884,7 +878,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
return Register(dest++, RegisterType.Gpr);
|
||||
}
|
||||
|
||||
int binding = isBindless ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
int binding = isBindless ? 0 : context.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.Lod,
|
||||
type,
|
||||
TextureFormat.Unknown,
|
||||
|
@ -1065,8 +1059,6 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
return;
|
||||
}
|
||||
|
||||
context.Config.SetUsedFeature(FeatureFlags.IntegerSampling);
|
||||
|
||||
Operand Ra()
|
||||
{
|
||||
if (srcA > RegisterConsts.RegisterZeroIndex)
|
||||
|
@ -1106,12 +1098,12 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
}
|
||||
else
|
||||
{
|
||||
type = context.Config.GpuAccessor.QuerySamplerType(imm);
|
||||
type = context.TranslatorContext.GpuAccessor.QuerySamplerType(imm);
|
||||
}
|
||||
|
||||
TextureFlags flags = isBindless ? TextureFlags.Bindless : TextureFlags.None;
|
||||
|
||||
int binding = isBindless ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
int binding = isBindless ? 0 : context.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.TextureSize,
|
||||
type,
|
||||
TextureFormat.Unknown,
|
||||
|
@ -1147,7 +1139,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
|||
Operand[] dests,
|
||||
Operand[] sources)
|
||||
{
|
||||
int binding = flags.HasFlag(TextureFlags.Bindless) ? 0 : context.Config.ResourceManager.GetTextureOrImageBinding(
|
||||
int binding = flags.HasFlag(TextureFlags.Bindless) ? 0 : context.ResourceManager.GetTextureOrImageBinding(
|
||||
Instruction.TextureSample,
|
||||
type,
|
||||
TextureFormat.Unknown,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue