* Add support for large sampler arrays on Vulkan * Shader cache version bump * Format whitespace * Move DescriptorSetManager to PipelineLayoutCacheEntry to allow different pool sizes per layout * Handle array textures with different types on the same buffer * Somewhat better caching system * Avoid useless buffer data modification checks * Move redundant bindings update checking to the backend * Fix an issue where texture arrays would get the same bindings across stages on Vulkan * Backport some fixes from part 2 * Fix typo * PR feedback * Format whitespace * Add some missing XML docs
57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using Ryujinx.Graphics.Shader.StructuredIr;
|
|
using System;
|
|
|
|
using static Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions.InstGenHelper;
|
|
using static Ryujinx.Graphics.Shader.StructuredIr.InstructionInfo;
|
|
|
|
namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
|
{
|
|
static class InstGenPacking
|
|
{
|
|
public static string PackDouble2x32(CodeGenContext context, AstOperation operation)
|
|
{
|
|
IAstNode src0 = operation.GetSource(0);
|
|
IAstNode src1 = operation.GetSource(1);
|
|
|
|
string src0Expr = GetSourceExpr(context, src0, GetSrcVarType(operation.Inst, 0));
|
|
string src1Expr = GetSourceExpr(context, src1, GetSrcVarType(operation.Inst, 1));
|
|
|
|
return $"packDouble2x32(uvec2({src0Expr}, {src1Expr}))";
|
|
}
|
|
|
|
public static string PackHalf2x16(CodeGenContext context, AstOperation operation)
|
|
{
|
|
IAstNode src0 = operation.GetSource(0);
|
|
IAstNode src1 = operation.GetSource(1);
|
|
|
|
string src0Expr = GetSourceExpr(context, src0, GetSrcVarType(operation.Inst, 0));
|
|
string src1Expr = GetSourceExpr(context, src1, GetSrcVarType(operation.Inst, 1));
|
|
|
|
return $"packHalf2x16(vec2({src0Expr}, {src1Expr}))";
|
|
}
|
|
|
|
public static string UnpackDouble2x32(CodeGenContext context, AstOperation operation)
|
|
{
|
|
IAstNode src = operation.GetSource(0);
|
|
|
|
string srcExpr = GetSourceExpr(context, src, GetSrcVarType(operation.Inst, 0));
|
|
|
|
return $"unpackDouble2x32({srcExpr}){GetMask(operation.Index)}";
|
|
}
|
|
|
|
public static string UnpackHalf2x16(CodeGenContext context, AstOperation operation)
|
|
{
|
|
IAstNode src = operation.GetSource(0);
|
|
|
|
string srcExpr = GetSourceExpr(context, src, GetSrcVarType(operation.Inst, 0));
|
|
|
|
return $"unpackHalf2x16({srcExpr}){GetMask(operation.Index)}";
|
|
}
|
|
|
|
private static string GetMask(int index)
|
|
{
|
|
return $".{"xy".AsSpan(index, 1)}";
|
|
}
|
|
}
|
|
}
|