mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-23 23:57:10 +02:00
language feature: Extension Members: Misc enum extensions methods converted to properties
This commit is contained in:
parent
6c5f21e4e9
commit
81b454282a
22 changed files with 73 additions and 95 deletions
|
@ -26,7 +26,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_operand.Type.IsInteger())
|
if (_operand.Type.IsInteger)
|
||||||
{
|
{
|
||||||
_registerAllocator.FreeTempGprRegister(_operand.AsInt32());
|
_registerAllocator.FreeTempGprRegister(_operand.AsInt32());
|
||||||
}
|
}
|
||||||
|
|
|
@ -381,7 +381,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
if (currentCond != ArmCondition.Al)
|
if (currentCond != ArmCondition.Al)
|
||||||
{
|
{
|
||||||
instructionPointer = context.CodeWriter.InstructionPointer;
|
instructionPointer = context.CodeWriter.InstructionPointer;
|
||||||
context.Arm64Assembler.B(currentCond.Invert(), 0);
|
context.Arm64Assembler.B(currentCond.Inverse, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
|
||||||
|
|
||||||
if (invert)
|
if (invert)
|
||||||
{
|
{
|
||||||
conditions[i++] = ((ArmCondition)firstCond).Invert();
|
conditions[i++] = ((ArmCondition)firstCond).Inverse;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,9 +22,9 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
|
|
||||||
static class ArmConditionExtensions
|
static class ArmConditionExtensions
|
||||||
{
|
{
|
||||||
public static ArmCondition Invert(this ArmCondition condition)
|
extension(ArmCondition condition)
|
||||||
{
|
{
|
||||||
return (ArmCondition)((int)condition ^ 1);
|
public ArmCondition Inverse => (ArmCondition)((int)condition ^ 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -673,7 +673,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
|
|
||||||
public readonly void Mov(Operand rd, Operand rn)
|
public readonly void Mov(Operand rd, Operand rn)
|
||||||
{
|
{
|
||||||
Debug.Assert(rd.Type.IsInteger());
|
Debug.Assert(rd.Type.IsInteger);
|
||||||
Orr(rd, new Operand(ZrRegister, RegisterType.Integer, rd.Type), rn);
|
Orr(rd, new Operand(ZrRegister, RegisterType.Integer, rd.Type), rn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4544,7 +4544,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
uint instruction;
|
uint instruction;
|
||||||
int scale;
|
int scale;
|
||||||
|
|
||||||
if (type.IsInteger())
|
if (type.IsInteger)
|
||||||
{
|
{
|
||||||
instruction = intInst;
|
instruction = intInst;
|
||||||
|
|
||||||
|
@ -4580,7 +4580,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
{
|
{
|
||||||
uint instruction;
|
uint instruction;
|
||||||
|
|
||||||
if (type.IsInteger())
|
if (type.IsInteger)
|
||||||
{
|
{
|
||||||
instruction = intInst;
|
instruction = intInst;
|
||||||
|
|
||||||
|
@ -4610,7 +4610,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
{
|
{
|
||||||
uint instruction;
|
uint instruction;
|
||||||
|
|
||||||
if (type.IsInteger())
|
if (type.IsInteger)
|
||||||
{
|
{
|
||||||
instruction = intInst;
|
instruction = intInst;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
int gprCalleeSavedRegsCount = BitOperations.PopCount(_gprMask);
|
int gprCalleeSavedRegsCount = BitOperations.PopCount(_gprMask);
|
||||||
int fpSimdCalleeSavedRegsCount = BitOperations.PopCount(_fpSimdMask);
|
int fpSimdCalleeSavedRegsCount = BitOperations.PopCount(_fpSimdMask);
|
||||||
|
|
||||||
return (_hasCall ? 16 : 0) + Align16(gprCalleeSavedRegsCount * 8 + fpSimdCalleeSavedRegsCount * _fpSimdType.GetSizeInBytes());
|
return (_hasCall ? 16 : 0) + Align16(gprCalleeSavedRegsCount * 8 + fpSimdCalleeSavedRegsCount * _fpSimdType.ByteSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WritePrologue(ref Assembler asm)
|
public void WritePrologue(ref Assembler asm)
|
||||||
|
@ -46,7 +46,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
int fpSimdCalleeSavedRegsCount = BitOperations.PopCount(fpSimdMask);
|
int fpSimdCalleeSavedRegsCount = BitOperations.PopCount(fpSimdMask);
|
||||||
|
|
||||||
int reservedStackSize = Align16(_reservedStackSize);
|
int reservedStackSize = Align16(_reservedStackSize);
|
||||||
int calleeSaveRegionSize = Align16(gprCalleeSavedRegsCount * 8 + fpSimdCalleeSavedRegsCount * _fpSimdType.GetSizeInBytes()) + reservedStackSize;
|
int calleeSaveRegionSize = Align16(gprCalleeSavedRegsCount * 8 + fpSimdCalleeSavedRegsCount * _fpSimdType.ByteSize) + reservedStackSize;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
WritePrologueCalleeSavesPreIndexed(ref asm, ref gprMask, ref offset, calleeSaveRegionSize, OperandType.I64);
|
WritePrologueCalleeSavesPreIndexed(ref asm, ref gprMask, ref offset, calleeSaveRegionSize, OperandType.I64);
|
||||||
|
@ -103,7 +103,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
asm.StrRiUn(Register(reg, type), Register(Assembler.SpRegister), 0);
|
asm.StrRiUn(Register(reg, type), Register(Assembler.SpRegister), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += type.GetSizeInBytes();
|
offset += type.ByteSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (mask != 0)
|
while (mask != 0)
|
||||||
|
@ -130,7 +130,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
asm.StpRiUn(Register(reg, type), Register(reg2, type), Register(Assembler.SpRegister), 0);
|
asm.StpRiUn(Register(reg, type), Register(reg2, type), Register(Assembler.SpRegister), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += type.GetSizeInBytes() * 2;
|
offset += type.ByteSize * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
|
|
||||||
bool misalignedVector = _fpSimdType == OperandType.V128 && (gprCalleeSavedRegsCount & 1) != 0;
|
bool misalignedVector = _fpSimdType == OperandType.V128 && (gprCalleeSavedRegsCount & 1) != 0;
|
||||||
|
|
||||||
int offset = gprCalleeSavedRegsCount * 8 + fpSimdCalleeSavedRegsCount * _fpSimdType.GetSizeInBytes();
|
int offset = gprCalleeSavedRegsCount * 8 + fpSimdCalleeSavedRegsCount * _fpSimdType.ByteSize;
|
||||||
|
|
||||||
if (misalignedVector)
|
if (misalignedVector)
|
||||||
{
|
{
|
||||||
|
@ -197,7 +197,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
|
|
||||||
mask &= ~(1u << reg2);
|
mask &= ~(1u << reg2);
|
||||||
|
|
||||||
offset -= type.GetSizeInBytes() * 2;
|
offset -= type.ByteSize * 2;
|
||||||
|
|
||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +215,7 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen.Arm64
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
offset -= type.GetSizeInBytes();
|
offset -= type.ByteSize;
|
||||||
|
|
||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,14 +14,11 @@ namespace Ryujinx.Cpu.LightningJit.CodeGen
|
||||||
|
|
||||||
static class OperandTypeExtensions
|
static class OperandTypeExtensions
|
||||||
{
|
{
|
||||||
public static bool IsInteger(this OperandType type)
|
extension(OperandType type)
|
||||||
{
|
{
|
||||||
return type is OperandType.I32 or OperandType.I64;
|
public bool IsInteger => type is OperandType.I32 or OperandType.I64;
|
||||||
}
|
|
||||||
|
|
||||||
public static int GetSizeInBytes(this OperandType type)
|
public int ByteSize => type switch
|
||||||
{
|
|
||||||
return type switch
|
|
||||||
{
|
{
|
||||||
OperandType.FP32 => 4,
|
OperandType.FP32 => 4,
|
||||||
OperandType.FP64 => 8,
|
OperandType.FP64 => 8,
|
||||||
|
|
|
@ -41,22 +41,12 @@ namespace Ryujinx.Graphics.GAL
|
||||||
|
|
||||||
public static class BlendFactorExtensions
|
public static class BlendFactorExtensions
|
||||||
{
|
{
|
||||||
public static bool IsDualSource(this BlendFactor factor)
|
extension(BlendFactor factor)
|
||||||
{
|
{
|
||||||
switch (factor)
|
public bool IsDualSource => factor is
|
||||||
{
|
BlendFactor.Src1Color or BlendFactor.Src1ColorGl or BlendFactor.Src1Alpha or BlendFactor.Src1AlphaGl
|
||||||
case BlendFactor.Src1Color:
|
or BlendFactor.OneMinusSrc1Color or BlendFactor.OneMinusSrc1ColorGl or BlendFactor.OneMinusSrc1Alpha
|
||||||
case BlendFactor.Src1ColorGl:
|
or BlendFactor.OneMinusSrc1AlphaGl;
|
||||||
case BlendFactor.Src1Alpha:
|
|
||||||
case BlendFactor.Src1AlphaGl:
|
|
||||||
case BlendFactor.OneMinusSrc1Color:
|
|
||||||
case BlendFactor.OneMinusSrc1ColorGl:
|
|
||||||
case BlendFactor.OneMinusSrc1Alpha:
|
|
||||||
case BlendFactor.OneMinusSrc1AlphaGl:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1298,10 +1298,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||||
FilterBlendFactor(blend.AlphaDstFactor, index));
|
FilterBlendFactor(blend.AlphaDstFactor, index));
|
||||||
|
|
||||||
if (enable &&
|
if (enable &&
|
||||||
(blend.ColorSrcFactor.IsDualSource() ||
|
(blend.ColorSrcFactor.IsDualSource ||
|
||||||
blend.ColorDstFactor.IsDualSource() ||
|
blend.ColorDstFactor.IsDualSource ||
|
||||||
blend.AlphaSrcFactor.IsDualSource() ||
|
blend.AlphaSrcFactor.IsDualSource ||
|
||||||
blend.AlphaDstFactor.IsDualSource()))
|
blend.AlphaDstFactor.IsDualSource))
|
||||||
{
|
{
|
||||||
dualSourceBlendEnabled = true;
|
dualSourceBlendEnabled = true;
|
||||||
}
|
}
|
||||||
|
@ -1326,10 +1326,10 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||||
FilterBlendFactor(blend.AlphaDstFactor, 0));
|
FilterBlendFactor(blend.AlphaDstFactor, 0));
|
||||||
|
|
||||||
if (enable &&
|
if (enable &&
|
||||||
(blend.ColorSrcFactor.IsDualSource() ||
|
(blend.ColorSrcFactor.IsDualSource ||
|
||||||
blend.ColorDstFactor.IsDualSource() ||
|
blend.ColorDstFactor.IsDualSource ||
|
||||||
blend.AlphaSrcFactor.IsDualSource() ||
|
blend.AlphaSrcFactor.IsDualSource ||
|
||||||
blend.AlphaDstFactor.IsDualSource()))
|
blend.AlphaDstFactor.IsDualSource))
|
||||||
{
|
{
|
||||||
dualSourceBlendEnabled = true;
|
dualSourceBlendEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -812,10 +812,10 @@ namespace Ryujinx.Graphics.OpenGL
|
||||||
EnsureFramebuffer();
|
EnsureFramebuffer();
|
||||||
|
|
||||||
_framebuffer.SetDualSourceBlend(
|
_framebuffer.SetDualSourceBlend(
|
||||||
blend.ColorSrcFactor.IsDualSource() ||
|
blend.ColorSrcFactor.IsDualSource ||
|
||||||
blend.ColorDstFactor.IsDualSource() ||
|
blend.ColorDstFactor.IsDualSource ||
|
||||||
blend.AlphaSrcFactor.IsDualSource() ||
|
blend.AlphaSrcFactor.IsDualSource ||
|
||||||
blend.AlphaDstFactor.IsDualSource());
|
blend.AlphaDstFactor.IsDualSource);
|
||||||
|
|
||||||
if (_blendConstant != blend.BlendConstant)
|
if (_blendConstant != blend.BlendConstant)
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
||||||
{
|
{
|
||||||
if (context.Definitions.Stage == ShaderStage.Geometry)
|
if (context.Definitions.Stage == ShaderStage.Geometry)
|
||||||
{
|
{
|
||||||
string inPrimitive = context.Definitions.InputTopology.ToGlslString();
|
string inPrimitive = context.Definitions.InputTopology.GlslString;
|
||||||
|
|
||||||
context.AppendLine($"layout (invocations = {context.Definitions.ThreadsPerInputPrimitive}, {inPrimitive}) in;");
|
context.AppendLine($"layout (invocations = {context.Definitions.ThreadsPerInputPrimitive}, {inPrimitive}) in;");
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string outPrimitive = context.Definitions.OutputTopology.ToGlslString();
|
string outPrimitive = context.Definitions.OutputTopology.GlslString;
|
||||||
int maxOutputVertices = context.Definitions.MaxOutputVertices;
|
int maxOutputVertices = context.Definitions.MaxOutputVertices;
|
||||||
|
|
||||||
context.AppendLine($"layout ({outPrimitive}, max_vertices = {maxOutputVertices}) out;");
|
context.AppendLine($"layout ({outPrimitive}, max_vertices = {maxOutputVertices}) out;");
|
||||||
|
|
|
@ -390,7 +390,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
if (context.Definitions.Stage != ShaderStage.Vertex)
|
if (context.Definitions.Stage != ShaderStage.Vertex)
|
||||||
{
|
{
|
||||||
SpvInstruction perVertexInputStructType = CreatePerVertexStructType(context);
|
SpvInstruction perVertexInputStructType = CreatePerVertexStructType(context);
|
||||||
int arraySize = context.Definitions.Stage == ShaderStage.Geometry ? context.Definitions.InputTopology.ToInputVertices() : 32;
|
int arraySize = context.Definitions.Stage == ShaderStage.Geometry ? context.Definitions.InputTopology.InputVertexCount : 32;
|
||||||
SpvInstruction perVertexInputArrayType = context.TypeArray(perVertexInputStructType, context.Constant(context.TypeU32(), arraySize));
|
SpvInstruction perVertexInputArrayType = context.TypeArray(perVertexInputStructType, context.Constant(context.TypeU32(), arraySize));
|
||||||
SpvInstruction perVertexInputPointerType = context.TypePointer(StorageClass.Input, perVertexInputArrayType);
|
SpvInstruction perVertexInputPointerType = context.TypePointer(StorageClass.Input, perVertexInputArrayType);
|
||||||
SpvInstruction perVertexInputVariable = context.Variable(perVertexInputPointerType, StorageClass.Input);
|
SpvInstruction perVertexInputVariable = context.Variable(perVertexInputPointerType, StorageClass.Input);
|
||||||
|
@ -537,7 +537,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
|
|
||||||
if (!isPerPatch && IoMap.IsPerVertex(ioVariable, context.Definitions.Stage, isOutput))
|
if (!isPerPatch && IoMap.IsPerVertex(ioVariable, context.Definitions.Stage, isOutput))
|
||||||
{
|
{
|
||||||
int arraySize = context.Definitions.Stage == ShaderStage.Geometry ? context.Definitions.InputTopology.ToInputVertices() : 32;
|
int arraySize = context.Definitions.Stage == ShaderStage.Geometry ? context.Definitions.InputTopology.InputVertexCount : 32;
|
||||||
spvType = context.TypeArray(spvType, context.Constant(context.TypeU32(), arraySize));
|
spvType = context.TypeArray(spvType, context.Constant(context.TypeU32(), arraySize));
|
||||||
|
|
||||||
if (context.Definitions.GpPassthrough && context.HostCapabilities.SupportsGeometryShaderPassthrough)
|
if (context.Definitions.GpPassthrough && context.HostCapabilities.SupportsGeometryShaderPassthrough)
|
||||||
|
|
|
@ -11,9 +11,9 @@ namespace Ryujinx.Graphics.Shader
|
||||||
|
|
||||||
static class InputTopologyExtensions
|
static class InputTopologyExtensions
|
||||||
{
|
{
|
||||||
public static string ToGlslString(this InputTopology topology)
|
extension(InputTopology topology)
|
||||||
{
|
{
|
||||||
return topology switch
|
public string GlslString => topology switch
|
||||||
{
|
{
|
||||||
InputTopology.Points => "points",
|
InputTopology.Points => "points",
|
||||||
InputTopology.Lines => "lines",
|
InputTopology.Lines => "lines",
|
||||||
|
@ -22,11 +22,8 @@ namespace Ryujinx.Graphics.Shader
|
||||||
InputTopology.TrianglesAdjacency => "triangles_adjacency",
|
InputTopology.TrianglesAdjacency => "triangles_adjacency",
|
||||||
_ => "points",
|
_ => "points",
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
public int InputVertexCount => topology switch
|
||||||
public static int ToInputVertices(this InputTopology topology)
|
|
||||||
{
|
|
||||||
return topology switch
|
|
||||||
{
|
{
|
||||||
InputTopology.Points => 1,
|
InputTopology.Points => 1,
|
||||||
InputTopology.Lines => 2,
|
InputTopology.Lines => 2,
|
||||||
|
@ -35,17 +32,14 @@ namespace Ryujinx.Graphics.Shader
|
||||||
InputTopology.TrianglesAdjacency => 6,
|
InputTopology.TrianglesAdjacency => 6,
|
||||||
_ => 1,
|
_ => 1,
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
public int InputVertexCountNoAdjacency => topology switch
|
||||||
public static int ToInputVerticesNoAdjacency(this InputTopology topology)
|
|
||||||
{
|
|
||||||
return topology switch
|
|
||||||
{
|
{
|
||||||
InputTopology.Points => 1,
|
InputTopology.Points => 1,
|
||||||
InputTopology.Lines or
|
InputTopology.Lines or
|
||||||
InputTopology.LinesAdjacency => 2,
|
InputTopology.LinesAdjacency => 2,
|
||||||
InputTopology.Triangles or
|
InputTopology.Triangles or
|
||||||
InputTopology.TrianglesAdjacency => 3,
|
InputTopology.TrianglesAdjacency => 3,
|
||||||
_ => 1,
|
_ => 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src = Const(context.TranslatorContext.Definitions.InputTopology.ToInputVertices() << 16);
|
src = Const(context.TranslatorContext.Definitions.InputTopology.InputVertexCount << 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,9 +9,10 @@ namespace Ryujinx.Graphics.Shader
|
||||||
|
|
||||||
static class OutputTopologyExtensions
|
static class OutputTopologyExtensions
|
||||||
{
|
{
|
||||||
public static string ToGlslString(this OutputTopology topology)
|
|
||||||
|
extension(OutputTopology topology)
|
||||||
{
|
{
|
||||||
return topology switch
|
public string GlslString => topology switch
|
||||||
{
|
{
|
||||||
OutputTopology.LineStrip => "line_strip",
|
OutputTopology.LineStrip => "line_strip",
|
||||||
OutputTopology.PointList => "points",
|
OutputTopology.PointList => "points",
|
||||||
|
|
|
@ -135,7 +135,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
}
|
}
|
||||||
else if (TranslatorContext.Stage == ShaderStage.Geometry)
|
else if (TranslatorContext.Stage == ShaderStage.Geometry)
|
||||||
{
|
{
|
||||||
int inputVertices = TranslatorContext.Definitions.InputTopology.ToInputVertices();
|
int inputVertices = TranslatorContext.Definitions.InputTopology.InputVertexCount;
|
||||||
|
|
||||||
Operand baseVertex = this.IMultiply(outputVertexOffset, Const(inputVertices));
|
Operand baseVertex = this.IMultiply(outputVertexOffset, Const(inputVertices));
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inputStart = 0;
|
inputStart = 0;
|
||||||
inputEnd = topology.ToInputVerticesNoAdjacency();
|
inputEnd = topology.InputVertexCountNoAdjacency;
|
||||||
inputStep = 1;
|
inputStep = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
}
|
}
|
||||||
else if (stage == ShaderStage.Geometry)
|
else if (stage == ShaderStage.Geometry)
|
||||||
{
|
{
|
||||||
LocalTopologyRemapMemoryId = AddMemoryDefinition("local_topology_remap", AggregateType.Array | AggregateType.U32, inputTopology.ToInputVertices());
|
LocalTopologyRemapMemoryId = AddMemoryDefinition("local_topology_remap", AggregateType.Array | AggregateType.U32, inputTopology.InputVertexCount);
|
||||||
|
|
||||||
LocalGeometryOutputVertexCountMemoryId = AddMemoryDefinition("local_geometry_output_vertex", AggregateType.U32);
|
LocalGeometryOutputVertexCountMemoryId = AddMemoryDefinition("local_geometry_output_vertex", AggregateType.U32);
|
||||||
LocalGeometryOutputIndexCountMemoryId = AddMemoryDefinition("local_geometry_output_index", AggregateType.U32);
|
LocalGeometryOutputIndexCountMemoryId = AddMemoryDefinition("local_geometry_output_index", AggregateType.U32);
|
||||||
|
|
|
@ -157,7 +157,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
||||||
GpPassthrough = gpPassthrough;
|
GpPassthrough = gpPassthrough;
|
||||||
ThreadsPerInputPrimitive = threadsPerInputPrimitive;
|
ThreadsPerInputPrimitive = threadsPerInputPrimitive;
|
||||||
OutputTopology = outputTopology;
|
OutputTopology = outputTopology;
|
||||||
MaxOutputVertices = gpPassthrough ? graphicsState.Topology.ToInputVerticesNoAdjacency() : maxOutputVertices;
|
MaxOutputVertices = gpPassthrough ? graphicsState.Topology.InputVertexCountNoAdjacency : maxOutputVertices;
|
||||||
ImapTypes = imapTypes;
|
ImapTypes = imapTypes;
|
||||||
OmapTargets = omapTargets;
|
OmapTargets = omapTargets;
|
||||||
OmapSampleMask = omapSampleMask;
|
OmapSampleMask = omapSampleMask;
|
||||||
|
|
|
@ -644,7 +644,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
result.ThrowOnError();
|
result.ThrowOnError();
|
||||||
}
|
}
|
||||||
else if (result.IsError())
|
else if (result.IsError)
|
||||||
{
|
{
|
||||||
program.AddGraphicsPipeline(ref Internal, null);
|
program.AddGraphicsPipeline(ref Internal, null);
|
||||||
|
|
||||||
|
|
|
@ -5,18 +5,17 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
{
|
{
|
||||||
static class ResultExtensions
|
static class ResultExtensions
|
||||||
{
|
{
|
||||||
public static bool IsError(this Result result)
|
extension(Result result)
|
||||||
{
|
{
|
||||||
// Only negative result codes are errors.
|
public bool IsError => result < Result.Success;
|
||||||
return result < Result.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ThrowOnError(this Result result)
|
public void ThrowOnError()
|
||||||
{
|
|
||||||
// Only negative result codes are errors.
|
|
||||||
if (result.IsError())
|
|
||||||
{
|
{
|
||||||
throw new VulkanException(result);
|
// Only negative result codes are errors.
|
||||||
|
if (result.IsError)
|
||||||
|
{
|
||||||
|
throw new VulkanException(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,19 +4,16 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
{
|
{
|
||||||
static class CapabilityExtensions
|
static class CapabilityExtensions
|
||||||
{
|
{
|
||||||
|
extension(CapabilityType type)
|
||||||
|
{
|
||||||
|
public uint Flag => (uint)type + 1;
|
||||||
|
|
||||||
|
public uint Id => (uint)BitOperations.TrailingZeroCount(type.Flag);
|
||||||
|
}
|
||||||
|
|
||||||
public static CapabilityType GetCapabilityType(this uint cap)
|
public static CapabilityType GetCapabilityType(this uint cap)
|
||||||
{
|
{
|
||||||
return (CapabilityType)(((cap + 1) & ~cap) - 1);
|
return (CapabilityType)(((cap + 1) & ~cap) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static uint GetFlag(this CapabilityType type)
|
|
||||||
{
|
|
||||||
return (uint)type + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static uint GetId(this CapabilityType type)
|
|
||||||
{
|
|
||||||
return (uint)BitOperations.TrailingZeroCount(type.GetFlag());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
int codeMask = 1 << (32 - BitOperations.LeadingZeroCount(code.GetFlag() + 1));
|
int codeMask = 1 << (32 - BitOperations.LeadingZeroCount(code.Flag + 1));
|
||||||
|
|
||||||
// Check if the property was already set.
|
// Check if the property was already set.
|
||||||
if (((mask0 & codeMask) & 0x1e008) != 0)
|
if (((mask0 & codeMask) & 0x1e008) != 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue