aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/StructuredIr
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-17 23:41:18 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit1b7d95519569639135a68e7ebda5148f3263217c (patch)
tree52a5e471418bf28ce970a268e1b86b64abc9048f /Ryujinx.Graphics.Shader/StructuredIr
parent717ace6f6ed65118148dc78976c6e818a095fa4d (diff)
Initial support for image stores, support texture sample on compute
Diffstat (limited to 'Ryujinx.Graphics.Shader/StructuredIr')
-rw-r--r--Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs8
-rw-r--r--Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs40
-rw-r--r--Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs2
3 files changed, 36 insertions, 14 deletions
diff --git a/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs b/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs
index c9bd5750..7261b9ff 100644
--- a/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs
+++ b/Ryujinx.Graphics.Shader/StructuredIr/AstTextureOperation.cs
@@ -4,20 +4,20 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
class AstTextureOperation : AstOperation
{
- public TextureTarget Target { get; }
- public TextureFlags Flags { get; }
+ public SamplerType Type { get; }
+ public TextureFlags Flags { get; }
public int Handle { get; }
public AstTextureOperation(
Instruction inst,
- TextureTarget target,
+ SamplerType type,
TextureFlags flags,
int handle,
int compMask,
params IAstNode[] sources) : base(inst, compMask, sources)
{
- Target = target;
+ Type = type;
Flags = flags;
Handle = handle;
}
diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs
index dc822621..53ca6700 100644
--- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs
+++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs
@@ -51,6 +51,19 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
sources[index] = context.GetOperandUse(operation.GetSource(index));
}
+ int componentMask = 1 << operation.ComponentIndex;
+
+ AstTextureOperation GetAstTextureOperation(TextureOperation texOp)
+ {
+ return new AstTextureOperation(
+ inst,
+ texOp.Type,
+ texOp.Flags,
+ texOp.Handle,
+ componentMask,
+ sources);
+ }
+
if (operation.Dest != null)
{
AstOperand dest = context.GetOperandDef(operation.Dest);
@@ -108,21 +121,20 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
dest.VarType = InstructionInfo.GetDestVarType(inst);
}
- int componentMask = 1 << operation.ComponentIndex;
-
IAstNode source;
if (operation is TextureOperation texOp)
{
- AstTextureOperation astTexOp = new AstTextureOperation(
- inst,
- texOp.Target,
- texOp.Flags,
- texOp.Handle,
- componentMask,
- sources);
+ AstTextureOperation astTexOp = GetAstTextureOperation(texOp);
- context.Info.Samplers.Add(astTexOp);
+ if (texOp.Inst == Instruction.ImageLoad)
+ {
+ context.Info.Images.Add(astTexOp);
+ }
+ else
+ {
+ context.Info.Samplers.Add(astTexOp);
+ }
source = astTexOp;
}
@@ -143,6 +155,14 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
{
context.AddNode(new AstComment(((CommentNode)operation).Comment));
}
+ else if (operation is TextureOperation texOp)
+ {
+ AstTextureOperation astTexOp = GetAstTextureOperation(texOp);
+
+ context.Info.Images.Add(astTexOp);
+
+ context.AddNode(astTexOp);
+ }
else
{
if (inst == Instruction.StoreStorage)
diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs
index 27fd1487..1094fba2 100644
--- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs
+++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgramInfo.cs
@@ -19,6 +19,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
public bool UsesInstanceId { get; set; }
public HashSet<AstTextureOperation> Samplers { get; }
+ public HashSet<AstTextureOperation> Images { get; }
public StructuredProgramInfo(AstBlock mainBlock)
{
@@ -35,6 +36,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr
InterpolationQualifiers = new InterpolationQualifier[32];
Samplers = new HashSet<AstTextureOperation>();
+ Images = new HashSet<AstTextureOperation>();
}
}
} \ No newline at end of file