Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
17354d59d1 | ||
|
0c445184c1 | ||
|
511b558ddc | ||
|
9b8625d999 | ||
|
b12ea343d0 |
18
.github/csc.json
vendored
Normal file
18
.github/csc.json
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "csc",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^((?:\\\\|/)(?:[^\\\\/:]+(?:\\\\|/))+[^\\\\/]+)\\((\\d+),(\\d+)\\):\\s+([a-zA-Z]+)\\s+([^:]+):\\s+([^[]+)\\s+\\[",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"code": 5,
|
||||
"message": 6
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
2
.github/reviewers.yml
vendored
2
.github/reviewers.yml
vendored
@@ -29,4 +29,4 @@ infra:
|
||||
- TSRBerry
|
||||
|
||||
default:
|
||||
- marysaka
|
||||
- @developers
|
||||
|
24
.github/update_reviewers.py
vendored
24
.github/update_reviewers.py
vendored
@@ -1,9 +1,10 @@
|
||||
from pathlib import Path
|
||||
from typing import List, Set
|
||||
from github import Github
|
||||
from github import Auth, Github
|
||||
from github.Repository import Repository
|
||||
from github.GithubException import GithubException
|
||||
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
@@ -25,6 +26,10 @@ def update_reviewers(config, repo: Repository, pr_id: int) -> int:
|
||||
sys.stderr.writable(f"Unknown PR #{pr_id}\n")
|
||||
return 1
|
||||
|
||||
if pull_request.draft:
|
||||
print("Not assigning reviewers for draft PRs")
|
||||
return 0
|
||||
|
||||
pull_request_author = pull_request.user.login
|
||||
reviewers = set()
|
||||
team_reviewers = set()
|
||||
@@ -53,16 +58,19 @@ def update_reviewers(config, repo: Repository, pr_id: int) -> int:
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 5:
|
||||
sys.stderr.write("usage: <token> <repo_path> <pr_id> <config_path>\n")
|
||||
if len(sys.argv) != 7:
|
||||
sys.stderr.write("usage: <app_id> <private_key_env_name> <installation_id> <repo_path> <pr_id> <config_path>\n")
|
||||
sys.exit(1)
|
||||
|
||||
token = sys.argv[1]
|
||||
repo_path = sys.argv[2]
|
||||
pr_id = int(sys.argv[3])
|
||||
config_path = Path(sys.argv[4])
|
||||
app_id = sys.argv[1]
|
||||
private_key = os.environ[sys.argv[2]]
|
||||
installation_id = sys.argv[3]
|
||||
repo_path = sys.argv[4]
|
||||
pr_id = int(sys.argv[5])
|
||||
config_path = Path(sys.argv[6])
|
||||
|
||||
g = Github(token)
|
||||
auth = Auth.AppAuth(app_id, private_key).get_installation_auth(installation_id)
|
||||
g = Github(auth=auth)
|
||||
repo = g.get_repo(repo_path)
|
||||
|
||||
if not repo:
|
||||
|
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -40,6 +40,9 @@ jobs:
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Overwrite csc problem matcher
|
||||
run: echo "::add-matcher::.github/csc.json"
|
||||
|
||||
- name: Get git short hash
|
||||
id: git_short_hash
|
||||
|
3
.github/workflows/checks.yml
vendored
3
.github/workflows/checks.yml
vendored
@@ -31,6 +31,9 @@ jobs:
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Overwrite csc problem matcher
|
||||
run: echo "::add-matcher::.github/csc.json"
|
||||
|
||||
- run: dotnet restore
|
||||
|
||||
- name: Print dotnet format version
|
||||
|
8
.github/workflows/pr_triage.yml
vendored
8
.github/workflows/pr_triage.yml
vendored
@@ -27,9 +27,11 @@ jobs:
|
||||
sync-labels: true
|
||||
dot: true
|
||||
|
||||
- run: pip3 install PyGithub
|
||||
|
||||
- name: Assign reviewers
|
||||
if: ! github.event.pull_request.draft
|
||||
run: |
|
||||
pip3 install PyGithub
|
||||
python3 .github/update_reviewers.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.pull_request.number }} .github/reviewers.yml
|
||||
python3 .github/update_reviewers.py ${{ secrets.MAKO_APP_ID }} "MAKO_PRIVATE_KEY" ${{ secrets.MAKO_INSTALLATION_ID }} ${{ github.repository }} ${{ github.event.pull_request.number }} .github/reviewers.yml
|
||||
shell: bash
|
||||
env:
|
||||
MAKO_PRIVATE_KEY: ${{ secrets.MAKO_PRIVATE_KEY }}
|
||||
|
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@@ -67,6 +67,9 @@ jobs:
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- name: Overwrite csc problem matcher
|
||||
run: echo "::add-matcher::.github/csc.json"
|
||||
|
||||
- name: Get version info
|
||||
id: version_info
|
||||
|
@@ -179,6 +179,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
R32G32B32A32Uint = R32G32B32A32 | RUint | GUint | BUint | AUint, // 0x49201
|
||||
R32G32B32A32Sint = R32G32B32A32 | RSint | GSint | BSint | ASint, // 0x36d81
|
||||
Z16Unorm = Z16 | RUnorm | GUnorm | BUnorm | AUnorm, // 0x2493a
|
||||
Z16RUnormGUintBUintAUint = Z16 | RUnorm | GUint | BUint | AUint, // 0x4913a
|
||||
Zf32RFloatGUintBUintAUint = Zf32 | RFloat | GUint | BUint | AUint, // 0x493af
|
||||
Zf32Float = Zf32 | RFloat | GFloat | BFloat | AFloat, // 0x7ffaf
|
||||
G24R8RUintGUnormBUnormAUnorm = G24R8 | RUint | GUnorm | BUnorm | AUnorm, // 0x24a0e
|
||||
@@ -403,6 +404,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{ TextureFormat.R32G32B32A32Uint, new FormatInfo(Format.R32G32B32A32Uint, 1, 1, 16, 4) },
|
||||
{ TextureFormat.R32G32B32A32Sint, new FormatInfo(Format.R32G32B32A32Sint, 1, 1, 16, 4) },
|
||||
{ TextureFormat.Z16Unorm, new FormatInfo(Format.D16Unorm, 1, 1, 2, 1) },
|
||||
{ TextureFormat.Z16RUnormGUintBUintAUint, new FormatInfo(Format.D16Unorm, 1, 1, 2, 1) },
|
||||
{ TextureFormat.Zf32RFloatGUintBUintAUint, new FormatInfo(Format.D32Float, 1, 1, 4, 1) },
|
||||
{ TextureFormat.Zf32Float, new FormatInfo(Format.D32Float, 1, 1, 4, 1) },
|
||||
{ TextureFormat.G24R8RUintGUnormBUnormAUnorm, new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2) },
|
||||
|
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||
private const ushort FileFormatVersionMajor = 1;
|
||||
private const ushort FileFormatVersionMinor = 2;
|
||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||
private const uint CodeGenVersion = 5529;
|
||||
private const uint CodeGenVersion = 5576;
|
||||
|
||||
private const string SharedTocFileName = "shared.toc";
|
||||
private const string SharedDataFileName = "shared.data";
|
||||
|
@@ -348,12 +348,98 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (IoMap.IsPerVertexBuiltIn(ioDefinition.IoVariable))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isOutput = ioDefinition.StorageKind.IsOutput();
|
||||
bool isPerPatch = ioDefinition.StorageKind.IsPerPatch();
|
||||
|
||||
DeclareInputOrOutput(context, ioDefinition, isOutput, isPerPatch, iq, firstLocation);
|
||||
}
|
||||
|
||||
DeclarePerVertexBlock(context);
|
||||
}
|
||||
|
||||
private static void DeclarePerVertexBlock(CodeGenContext context)
|
||||
{
|
||||
if (context.Definitions.Stage.IsVtg())
|
||||
{
|
||||
if (context.Definitions.Stage != ShaderStage.Vertex)
|
||||
{
|
||||
var perVertexInputStructType = CreatePerVertexStructType(context);
|
||||
int arraySize = context.Definitions.Stage == ShaderStage.Geometry ? context.InputVertices : 32;
|
||||
var perVertexInputArrayType = context.TypeArray(perVertexInputStructType, context.Constant(context.TypeU32(), arraySize));
|
||||
var perVertexInputPointerType = context.TypePointer(StorageClass.Input, perVertexInputArrayType);
|
||||
var perVertexInputVariable = context.Variable(perVertexInputPointerType, StorageClass.Input);
|
||||
|
||||
context.Name(perVertexInputVariable, "gl_in");
|
||||
|
||||
context.AddGlobalVariable(perVertexInputVariable);
|
||||
context.Inputs.Add(new IoDefinition(StorageKind.Input, IoVariable.Position), perVertexInputVariable);
|
||||
}
|
||||
|
||||
var perVertexOutputStructType = CreatePerVertexStructType(context);
|
||||
|
||||
void DecorateTfo(IoVariable ioVariable, int fieldIndex)
|
||||
{
|
||||
if (context.Definitions.TryGetTransformFeedbackOutput(ioVariable, 0, 0, out var transformFeedbackOutput))
|
||||
{
|
||||
context.MemberDecorate(perVertexOutputStructType, fieldIndex, Decoration.XfbBuffer, (LiteralInteger)transformFeedbackOutput.Buffer);
|
||||
context.MemberDecorate(perVertexOutputStructType, fieldIndex, Decoration.XfbStride, (LiteralInteger)transformFeedbackOutput.Stride);
|
||||
context.MemberDecorate(perVertexOutputStructType, fieldIndex, Decoration.Offset, (LiteralInteger)transformFeedbackOutput.Offset);
|
||||
}
|
||||
}
|
||||
|
||||
DecorateTfo(IoVariable.Position, 0);
|
||||
DecorateTfo(IoVariable.PointSize, 1);
|
||||
DecorateTfo(IoVariable.ClipDistance, 2);
|
||||
|
||||
SpvInstruction perVertexOutputArrayType;
|
||||
|
||||
if (context.Definitions.Stage == ShaderStage.TessellationControl)
|
||||
{
|
||||
int arraySize = context.Definitions.ThreadsPerInputPrimitive;
|
||||
perVertexOutputArrayType = context.TypeArray(perVertexOutputStructType, context.Constant(context.TypeU32(), arraySize));
|
||||
}
|
||||
else
|
||||
{
|
||||
perVertexOutputArrayType = perVertexOutputStructType;
|
||||
}
|
||||
|
||||
var perVertexOutputPointerType = context.TypePointer(StorageClass.Output, perVertexOutputArrayType);
|
||||
var perVertexOutputVariable = context.Variable(perVertexOutputPointerType, StorageClass.Output);
|
||||
|
||||
context.AddGlobalVariable(perVertexOutputVariable);
|
||||
context.Outputs.Add(new IoDefinition(StorageKind.Output, IoVariable.Position), perVertexOutputVariable);
|
||||
}
|
||||
}
|
||||
|
||||
private static SpvInstruction CreatePerVertexStructType(CodeGenContext context)
|
||||
{
|
||||
var vec4FloatType = context.TypeVector(context.TypeFP32(), 4);
|
||||
var floatType = context.TypeFP32();
|
||||
var array8FloatType = context.TypeArray(context.TypeFP32(), context.Constant(context.TypeU32(), 8));
|
||||
var array1FloatType = context.TypeArray(context.TypeFP32(), context.Constant(context.TypeU32(), 1));
|
||||
|
||||
var perVertexStructType = context.TypeStruct(true, vec4FloatType, floatType, array8FloatType, array1FloatType);
|
||||
|
||||
context.Name(perVertexStructType, "gl_PerVertex");
|
||||
|
||||
context.MemberName(perVertexStructType, 0, "gl_Position");
|
||||
context.MemberName(perVertexStructType, 1, "gl_PointSize");
|
||||
context.MemberName(perVertexStructType, 2, "gl_ClipDistance");
|
||||
context.MemberName(perVertexStructType, 3, "gl_CullDistance");
|
||||
|
||||
context.Decorate(perVertexStructType, Decoration.Block);
|
||||
|
||||
context.MemberDecorate(perVertexStructType, 0, Decoration.BuiltIn, (LiteralInteger)BuiltIn.Position);
|
||||
context.MemberDecorate(perVertexStructType, 1, Decoration.BuiltIn, (LiteralInteger)BuiltIn.PointSize);
|
||||
context.MemberDecorate(perVertexStructType, 2, Decoration.BuiltIn, (LiteralInteger)BuiltIn.ClipDistance);
|
||||
context.MemberDecorate(perVertexStructType, 3, Decoration.BuiltIn, (LiteralInteger)BuiltIn.CullDistance);
|
||||
|
||||
return perVertexStructType;
|
||||
}
|
||||
|
||||
private static void DeclareInputOrOutput(
|
||||
|
@@ -1788,6 +1788,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||
StorageClass storageClass;
|
||||
SpvInstruction baseObj;
|
||||
int srcIndex = 0;
|
||||
IoVariable? perVertexBuiltIn = null;
|
||||
|
||||
switch (storageKind)
|
||||
{
|
||||
@@ -1881,6 +1882,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||
else
|
||||
{
|
||||
(_, varType) = IoMap.GetSpirvBuiltIn(ioVariable);
|
||||
|
||||
if (IoMap.IsPerVertexBuiltIn(ioVariable))
|
||||
{
|
||||
perVertexBuiltIn = ioVariable;
|
||||
ioVariable = IoVariable.Position;
|
||||
}
|
||||
}
|
||||
|
||||
varType &= AggregateType.ElementTypeMask;
|
||||
@@ -1902,6 +1909,31 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||
bool isStoreOrAtomic = operation.Inst == Instruction.Store || operation.Inst.IsAtomic();
|
||||
int inputsCount = (isStoreOrAtomic ? operation.SourcesCount - 1 : operation.SourcesCount) - srcIndex;
|
||||
|
||||
if (perVertexBuiltIn.HasValue)
|
||||
{
|
||||
int fieldIndex = IoMap.GetPerVertexStructFieldIndex(perVertexBuiltIn.Value);
|
||||
|
||||
var indexes = new SpvInstruction[inputsCount + 1];
|
||||
int index = 0;
|
||||
|
||||
if (IoMap.IsPerVertexArrayBuiltIn(storageKind, context.Definitions.Stage))
|
||||
{
|
||||
indexes[index++] = context.Get(AggregateType.S32, operation.GetSource(srcIndex++));
|
||||
indexes[index++] = context.Constant(context.TypeS32(), fieldIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
indexes[index++] = context.Constant(context.TypeS32(), fieldIndex);
|
||||
}
|
||||
|
||||
for (; index < inputsCount + 1; srcIndex++, index++)
|
||||
{
|
||||
indexes[index] = context.Get(AggregateType.S32, operation.GetSource(srcIndex));
|
||||
}
|
||||
|
||||
return context.AccessChain(context.TypePointer(storageClass, context.GetType(varType)), baseObj, indexes);
|
||||
}
|
||||
|
||||
if (operation.Inst == Instruction.AtomicCompareAndSwap)
|
||||
{
|
||||
inputsCount--;
|
||||
|
@@ -1,5 +1,6 @@
|
||||
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
||||
using Ryujinx.Graphics.Shader.Translation;
|
||||
using System;
|
||||
using static Spv.Specification;
|
||||
|
||||
namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||
@@ -80,5 +81,43 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsPerVertexBuiltIn(IoVariable ioVariable)
|
||||
{
|
||||
switch (ioVariable)
|
||||
{
|
||||
case IoVariable.Position:
|
||||
case IoVariable.PointSize:
|
||||
case IoVariable.ClipDistance:
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsPerVertexArrayBuiltIn(StorageKind storageKind, ShaderStage stage)
|
||||
{
|
||||
if (storageKind == StorageKind.Output)
|
||||
{
|
||||
return stage == ShaderStage.TessellationControl;
|
||||
}
|
||||
else
|
||||
{
|
||||
return stage == ShaderStage.TessellationControl ||
|
||||
stage == ShaderStage.TessellationEvaluation ||
|
||||
stage == ShaderStage.Geometry;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetPerVertexStructFieldIndex(IoVariable ioVariable)
|
||||
{
|
||||
return ioVariable switch
|
||||
{
|
||||
IoVariable.Position => 0,
|
||||
IoVariable.PointSize => 1,
|
||||
IoVariable.ClipDistance => 2,
|
||||
_ => throw new ArgumentException($"Invalid built-in variable {ioVariable}.")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,5 +23,18 @@ namespace Ryujinx.Graphics.Shader
|
||||
{
|
||||
return stage == ShaderStage.Vertex || stage == ShaderStage.Fragment || stage == ShaderStage.Compute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the shader stage is vertex, tessellation or geometry.
|
||||
/// </summary>
|
||||
/// <param name="stage">Shader stage</param>
|
||||
/// <returns>True if the shader stage is vertex, tessellation or geometry, false otherwise</returns>
|
||||
public static bool IsVtg(this ShaderStage stage)
|
||||
{
|
||||
return stage == ShaderStage.Vertex ||
|
||||
stage == ShaderStage.TessellationControl ||
|
||||
stage == ShaderStage.TessellationEvaluation ||
|
||||
stage == ShaderStage.Geometry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -246,7 +246,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
return true;
|
||||
}
|
||||
|
||||
private void FreeCompleted()
|
||||
public void FreeCompleted()
|
||||
{
|
||||
FenceHolder signalledFence = null;
|
||||
while (_pendingCopies.TryPeek(out var pc) && (pc.Fence == signalledFence || pc.Fence.IsSignaled()))
|
||||
|
@@ -475,6 +475,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
internal void RegisterFlush()
|
||||
{
|
||||
SyncManager.RegisterFlush();
|
||||
|
||||
// Periodically free unused regions of the staging buffer to avoid doing it all at once.
|
||||
BufferManager.StagingBuffer.FreeCompleted();
|
||||
}
|
||||
|
||||
public PinnedSpan<byte> GetBufferData(BufferHandle buffer, int offset, int size)
|
||||
|
@@ -28,6 +28,7 @@ namespace Spv.Generator
|
||||
|
||||
// In the declaration block.
|
||||
private readonly Dictionary<TypeDeclarationKey, Instruction> _typeDeclarations;
|
||||
private readonly List<Instruction> _typeDeclarationsList;
|
||||
// In the declaration block.
|
||||
private readonly List<Instruction> _globals;
|
||||
// In the declaration block.
|
||||
@@ -54,6 +55,7 @@ namespace Spv.Generator
|
||||
_debug = new List<Instruction>();
|
||||
_annotations = new List<Instruction>();
|
||||
_typeDeclarations = new Dictionary<TypeDeclarationKey, Instruction>();
|
||||
_typeDeclarationsList = new List<Instruction>();
|
||||
_constants = new Dictionary<ConstantKey, Instruction>();
|
||||
_globals = new List<Instruction>();
|
||||
_functionsDeclarations = new List<Instruction>();
|
||||
@@ -126,7 +128,8 @@ namespace Spv.Generator
|
||||
|
||||
instruction.SetId(GetNewId());
|
||||
|
||||
_typeDeclarations.Add(key, instruction);
|
||||
_typeDeclarations[key] = instruction;
|
||||
_typeDeclarationsList.Add(instruction);
|
||||
}
|
||||
|
||||
public void AddEntryPoint(ExecutionModel executionModel, Instruction function, string name, params Instruction[] interfaces)
|
||||
@@ -330,7 +333,7 @@ namespace Spv.Generator
|
||||
|
||||
// Ensure that everything is in the right order in the declarations section.
|
||||
List<Instruction> declarations = new();
|
||||
declarations.AddRange(_typeDeclarations.Values);
|
||||
declarations.AddRange(_typeDeclarationsList);
|
||||
declarations.AddRange(_globals);
|
||||
declarations.AddRange(_constants.Values);
|
||||
declarations.Sort((Instruction x, Instruction y) => x.Id.CompareTo(y.Id));
|
||||
|
Reference in New Issue
Block a user