Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6e784e0aca | ||
|
5a0aa074b6 | ||
|
93aa40f1fb | ||
|
bedee64af5 | ||
|
86931cc3f1 | ||
|
2be8b6ea45 | ||
|
f95b7c5877 | ||
|
eb528ae0f0 | ||
|
487261592e | ||
|
9e04e6cba1 | ||
|
4cf2419e6c | ||
|
440abac9f8 | ||
|
732714349e | ||
|
016262514d | ||
|
326749498b | ||
|
fec8291c17 | ||
|
c5d9e67cb2 | ||
|
e5261228d7 | ||
|
e61c09bc85 | ||
|
ac2444f908 | ||
|
9c6071a645 | ||
|
fa32ef9275 |
@@ -1,8 +1,7 @@
|
||||
# Remove the line below if you want to inherit .editorconfig settings from higher directories
|
||||
root = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
[*]
|
||||
|
||||
#### Core EditorConfig Options ####
|
||||
|
||||
@@ -12,8 +11,11 @@ indent_style = space
|
||||
tab_width = 4
|
||||
|
||||
# New line preferences
|
||||
end_of_line = crlf
|
||||
insert_final_newline = false
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
|
||||
#### .NET Coding Conventions ####
|
||||
|
||||
@@ -59,7 +61,7 @@ dotnet_style_prefer_simplified_interpolation = true:suggestion
|
||||
dotnet_style_readonly_field = true:suggestion
|
||||
|
||||
# Parameter preferences
|
||||
dotnet_code_quality_unused_parameters = all:suggestion
|
||||
dotnet_code_quality_unused_parameters = all:silent
|
||||
|
||||
#### C# Coding Conventions ####
|
||||
|
||||
@@ -85,7 +87,7 @@ csharp_style_expression_bodied_properties = true:silent
|
||||
# Pattern matching preferences
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_prefer_switch_expression = true:suggestion
|
||||
csharp_style_prefer_switch_expression = false:silent
|
||||
|
||||
# Null-checking preferences
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
@@ -94,6 +96,7 @@ csharp_style_conditional_delegate_call = true:suggestion
|
||||
csharp_prefer_static_local_function = true:suggestion
|
||||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
|
||||
csharp_style_prefer_readonly_struct = true
|
||||
csharp_style_prefer_method_group_conversion = true
|
||||
|
||||
# Code-block preferences
|
||||
csharp_prefer_braces = true:silent
|
||||
@@ -109,6 +112,7 @@ csharp_style_prefer_range_operator = true:suggestion
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
|
||||
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
|
||||
csharp_style_implicit_object_creation_when_type_is_apparent = true
|
||||
|
||||
# 'using' directive preferences
|
||||
csharp_using_directive_placement = outside_namespace:silent
|
||||
@@ -140,7 +144,6 @@ csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = false
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
@@ -158,23 +161,31 @@ csharp_space_between_square_brackets = false
|
||||
|
||||
# Wrapping preferences
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = true
|
||||
csharp_preserve_single_line_statements = false
|
||||
|
||||
#### Naming styles ####
|
||||
|
||||
# Naming rules
|
||||
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
|
||||
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
|
||||
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.severity = suggestion
|
||||
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.symbols = interface
|
||||
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.style = IPascalCase
|
||||
|
||||
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.types_should_be_pascal_case.style = PascalCase
|
||||
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
|
||||
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = PascalCase
|
||||
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.symbols = private_static_readonly_fields
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.severity = suggestion
|
||||
dotnet_naming_rule.private_static_readonly_fields_should_be_camel_case_and_prefixed_with__.style = _camelCase
|
||||
|
||||
dotnet_naming_rule.local_constants_should_be_pascal_case.symbols = local_constants
|
||||
dotnet_naming_rule.local_constants_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.local_constants_should_be_pascal_case.style = PascalCase
|
||||
|
||||
# Symbol specifications
|
||||
|
||||
@@ -190,14 +201,39 @@ dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, meth
|
||||
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
|
||||
dotnet_naming_symbols.non_field_members.required_modifiers =
|
||||
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private
|
||||
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly
|
||||
|
||||
dotnet_naming_symbols.local_constants.applicable_kinds = local
|
||||
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
|
||||
dotnet_naming_symbols.local_constants.required_modifiers = const
|
||||
|
||||
# Naming styles
|
||||
|
||||
dotnet_naming_style.pascal_case.required_prefix =
|
||||
dotnet_naming_style.pascal_case.required_suffix =
|
||||
dotnet_naming_style.pascal_case.word_separator =
|
||||
dotnet_naming_style.pascal_case.capitalization = pascal_case
|
||||
dotnet_naming_style._camelCase.required_prefix = _
|
||||
dotnet_naming_style._camelCase.required_suffix =
|
||||
dotnet_naming_style._camelCase.word_separator =
|
||||
dotnet_naming_style._camelCase.capitalization = camel_case
|
||||
|
||||
dotnet_naming_style.begins_with_i.required_prefix = I
|
||||
dotnet_naming_style.begins_with_i.required_suffix =
|
||||
dotnet_naming_style.begins_with_i.word_separator =
|
||||
dotnet_naming_style.begins_with_i.capitalization = pascal_case
|
||||
dotnet_naming_style.PascalCase.required_prefix =
|
||||
dotnet_naming_style.PascalCase.required_suffix =
|
||||
dotnet_naming_style.PascalCase.word_separator =
|
||||
dotnet_naming_style.PascalCase.capitalization = pascal_case
|
||||
|
||||
dotnet_naming_style.IPascalCase.required_prefix = I
|
||||
dotnet_naming_style.IPascalCase.required_suffix =
|
||||
dotnet_naming_style.IPascalCase.word_separator =
|
||||
dotnet_naming_style.IPascalCase.capitalization = pascal_case
|
||||
|
||||
[src/Ryujinx.HLE/HOS/Services/**.cs]
|
||||
# Disable "mark members as static" rule for services
|
||||
dotnet_diagnostic.CA1822.severity = none
|
||||
|
||||
[src/Ryujinx.Ava/UI/ViewModels/**.cs]
|
||||
# Disable "mark members as static" rule for ViewModels
|
||||
dotnet_diagnostic.CA1822.severity = none
|
||||
|
||||
[src/Ryujinx.Tests/Cpu/*.cs]
|
||||
# Disable naming rules for CPU tests
|
||||
dotnet_diagnostic.IDE1006.severity = none
|
||||
|
8
.github/assign/audio.yml
vendored
8
.github/assign/audio.yml
vendored
@@ -1,8 +0,0 @@
|
||||
addReviewers: true
|
||||
|
||||
reviewers:
|
||||
- marysaka
|
||||
|
||||
filterLabels:
|
||||
include:
|
||||
- audio
|
11
.github/assign/cpu.yml
vendored
11
.github/assign/cpu.yml
vendored
@@ -1,11 +0,0 @@
|
||||
addReviewers: true
|
||||
|
||||
reviewers:
|
||||
- gdkchan
|
||||
- riperiperi
|
||||
- marysaka
|
||||
- LDj3SNuD
|
||||
|
||||
filterLabels:
|
||||
include:
|
||||
- cpu
|
4
.github/assign/global.yml
vendored
4
.github/assign/global.yml
vendored
@@ -1,4 +0,0 @@
|
||||
addReviewers: true
|
||||
|
||||
reviewers:
|
||||
- Ryujinx/developers
|
10
.github/assign/gpu.yml
vendored
10
.github/assign/gpu.yml
vendored
@@ -1,10 +0,0 @@
|
||||
addReviewers: true
|
||||
|
||||
reviewers:
|
||||
- gdkchan
|
||||
- riperiperi
|
||||
- marysaka
|
||||
|
||||
filterLabels:
|
||||
include:
|
||||
- gpu
|
11
.github/assign/gui.yml
vendored
11
.github/assign/gui.yml
vendored
@@ -1,11 +0,0 @@
|
||||
addReviewers: true
|
||||
|
||||
reviewers:
|
||||
- Ack77
|
||||
- emmauss
|
||||
- TSRBerry
|
||||
- marysaka
|
||||
|
||||
filterLabels:
|
||||
include:
|
||||
- gui
|
11
.github/assign/horizon.yml
vendored
11
.github/assign/horizon.yml
vendored
@@ -1,11 +0,0 @@
|
||||
addReviewers: true
|
||||
|
||||
reviewers:
|
||||
- gdkchan
|
||||
- Ack77
|
||||
- marysaka
|
||||
- TSRBerry
|
||||
|
||||
filterLabels:
|
||||
include:
|
||||
- horizon
|
9
.github/assign/infra.yml
vendored
9
.github/assign/infra.yml
vendored
@@ -1,9 +0,0 @@
|
||||
addReviewers: true
|
||||
|
||||
reviewers:
|
||||
- marysaka
|
||||
- TSRBerry
|
||||
|
||||
filterLabels:
|
||||
include:
|
||||
- infra
|
32
.github/reviewers.yml
vendored
Normal file
32
.github/reviewers.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
audio:
|
||||
- marysaka
|
||||
|
||||
cpu:
|
||||
- gdkchan
|
||||
- riperiperi
|
||||
- marysaka
|
||||
- LDj3SNuD
|
||||
|
||||
gpu:
|
||||
- gdkchan
|
||||
- riperiperi
|
||||
- marysaka
|
||||
|
||||
gui:
|
||||
- Ack77
|
||||
- emmauss
|
||||
- TSRBerry
|
||||
- marysaka
|
||||
|
||||
horizon:
|
||||
- gdkchan
|
||||
- Ack77
|
||||
- marysaka
|
||||
- TSRBerry
|
||||
|
||||
infra:
|
||||
- marysaka
|
||||
- TSRBerry
|
||||
|
||||
default:
|
||||
- marysaka
|
79
.github/update_reviewers.py
vendored
Normal file
79
.github/update_reviewers.py
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
from pathlib import Path
|
||||
from typing import List, Set
|
||||
from github import Github
|
||||
from github.Repository import Repository
|
||||
from github.GithubException import GithubException
|
||||
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
|
||||
def add_reviewers(
|
||||
reviewers: Set[str], team_reviewers: Set[str], new_entries: List[str]
|
||||
):
|
||||
for reviewer in new_entries:
|
||||
if reviewer.startswith("@"):
|
||||
team_reviewers.add(reviewer[1:])
|
||||
else:
|
||||
reviewers.add(reviewer)
|
||||
|
||||
|
||||
def update_reviewers(config, repo: Repository, pr_id: int) -> int:
|
||||
pull_request = repo.get_pull(pr_id)
|
||||
|
||||
if not pull_request:
|
||||
sys.stderr.writable(f"Unknown PR #{pr_id}\n")
|
||||
return 1
|
||||
|
||||
pull_request_author = pull_request.user.login
|
||||
reviewers = set()
|
||||
team_reviewers = set()
|
||||
|
||||
for label in pull_request.labels:
|
||||
if label.name in config:
|
||||
add_reviewers(reviewers, team_reviewers, config[label.name])
|
||||
|
||||
if "default" in config:
|
||||
add_reviewers(reviewers, team_reviewers, config["default"])
|
||||
|
||||
if pull_request_author in reviewers:
|
||||
reviewers.remove(pull_request_author)
|
||||
|
||||
try:
|
||||
reviewers = list(reviewers)
|
||||
team_reviewers = list(team_reviewers)
|
||||
print(
|
||||
f"Attempting to assign reviewers ({reviewers}) and team_reviewers ({team_reviewers})"
|
||||
)
|
||||
pull_request.create_review_request(reviewers, team_reviewers)
|
||||
return 0
|
||||
except GithubException as e:
|
||||
sys.stderr.write(f"Cannot assign review request for PR #{pr_id}: {e}\n")
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 5:
|
||||
sys.stderr.write("usage: <token> <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])
|
||||
|
||||
g = Github(token)
|
||||
repo = g.get_repo(repo_path)
|
||||
|
||||
if not repo:
|
||||
sys.stderr.write("Repository not found!\n")
|
||||
sys.exit(1)
|
||||
|
||||
if not config_path.exists():
|
||||
sys.stderr.write(f'Config "{config_path}" not found!\n')
|
||||
sys.exit(1)
|
||||
|
||||
with open(config_path, "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
sys.exit(update_reviewers(config, repo, pr_id))
|
19
.github/workflows/build.yml
vendored
19
.github/workflows/build.yml
vendored
@@ -1,19 +1,10 @@
|
||||
name: Build job
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs: {}
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '*.yml'
|
||||
- '*.json'
|
||||
- '*.config'
|
||||
- 'README.md'
|
||||
workflow_call:
|
||||
|
||||
concurrency:
|
||||
group: pr-checks-${{ github.event.number }}
|
||||
group: pr-builds-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
@@ -63,7 +54,11 @@ jobs:
|
||||
run: dotnet build -c "${{ matrix.configuration }}" -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER
|
||||
|
||||
- name: Test
|
||||
run: dotnet test --no-build -c "${{ matrix.configuration }}"
|
||||
uses: TSRBerry/unstable-commands@v1
|
||||
with:
|
||||
commands: dotnet test --no-build -c "${{ matrix.configuration }}"
|
||||
timeout-minutes: 10
|
||||
retry-codes: 139
|
||||
|
||||
- name: Publish Ryujinx
|
||||
run: dotnet publish -c "${{ matrix.configuration }}" -r "${{ matrix.DOTNET_RUNTIME_IDENTIFIER }}" -o ./publish -p:Version="${{ env.RYUJINX_BASE_VERSION }}" -p:DebugType=embedded -p:SourceRevisionId="${{ steps.git_short_hash.outputs.result }}" -p:ExtraDefineConstants=DISABLE_UPDATER src/Ryujinx --self-contained true
|
||||
|
71
.github/workflows/checks.yml
vendored
Normal file
71
.github/workflows/checks.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Perform checks
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- '**'
|
||||
- '!.github/**'
|
||||
- '!*.yml'
|
||||
- '!*.config'
|
||||
- '!README.md'
|
||||
- '.github/workflows/*.yml'
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
checks: write
|
||||
|
||||
concurrency:
|
||||
group: pr-checks-${{ github.event.number }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
global-json-file: global.json
|
||||
|
||||
- run: dotnet restore
|
||||
|
||||
- name: Print dotnet format version
|
||||
run: dotnet format --version
|
||||
|
||||
- name: Run dotnet format whitespace
|
||||
run: |
|
||||
dotnet format whitespace --verify-no-changes --report ./whitespace-report.json -v d
|
||||
|
||||
# For some unknown reason this step sometimes fails with exit code 139 (segfault?),
|
||||
# so in that case we'll try again (3 tries max).
|
||||
- name: Run dotnet format style
|
||||
uses: TSRBerry/unstable-commands@v1
|
||||
with:
|
||||
commands: dotnet format style --severity info --verify-no-changes --report ./style-report.json -v d
|
||||
timeout-minutes: 5
|
||||
retry-codes: 139
|
||||
|
||||
# For some unknown reason this step sometimes fails with exit code 139 (segfault?),
|
||||
# so in that case we'll try again (3 tries max).
|
||||
- name: Run dotnet format analyzers
|
||||
uses: TSRBerry/unstable-commands@v1
|
||||
with:
|
||||
commands: dotnet format analyzers --severity info --verify-no-changes --report ./analyzers-report.json -v d
|
||||
timeout-minutes: 5
|
||||
retry-codes: 139
|
||||
|
||||
- name: Upload report
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dotnet-format
|
||||
path: ./*-report.json
|
||||
|
||||
pr_build:
|
||||
uses: ./.github/workflows/build.yml
|
||||
needs: format
|
||||
secrets: inherit
|
4
.github/workflows/nightly_pr_comment.yml
vendored
4
.github/workflows/nightly_pr_comment.yml
vendored
@@ -1,8 +1,10 @@
|
||||
name: Comment PR artifacts links
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ['Build job']
|
||||
workflows: ['Perform checks']
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
pr_comment:
|
||||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
|
||||
|
48
.github/workflows/pr_triage.yml
vendored
48
.github/workflows/pr_triage.yml
vendored
@@ -12,43 +12,23 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Grab sources to get update_reviewers.py and reviewers.yml
|
||||
- name: Fetch sources
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
# Ensure we pin the source origin as pull_request_target run under forks.
|
||||
fetch-depth: 0
|
||||
repository: Ryujinx/Ryujinx
|
||||
ref: master
|
||||
|
||||
- name: Update labels based on changes
|
||||
uses: actions/labeler@v4
|
||||
with:
|
||||
sync-labels: true
|
||||
dot: true
|
||||
|
||||
- name: Auto Assign [Audio]
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: '.github/assign/audio.yml'
|
||||
|
||||
- name: Auto Assign [CPU]
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: '.github/assign/cpu.yml'
|
||||
|
||||
- name: Auto Assign [GPU]
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: '.github/assign/gpu.yml'
|
||||
|
||||
- name: Auto Assign [GUI]
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: '.github/assign/gui.yml'
|
||||
|
||||
- name: Auto Assign [Horizon]
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: '.github/assign/horizon.yml'
|
||||
|
||||
- name: Auto Assign [Infra]
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: '.github/assign/infra.yml'
|
||||
|
||||
- name: Auto Assign [Global]
|
||||
uses: kentaro-m/auto-assign-action@v1.2.5
|
||||
with:
|
||||
configuration-path: '.github/assign/global.yml'
|
||||
- name: Assign reviewers
|
||||
run: |
|
||||
pip3 install PyGithub
|
||||
python3 .github/update_reviewers.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.pull_request.number }} .github/reviewers.yml
|
||||
shell: bash
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<PackageVersion Include="Avalonia.Svg.Skia" Version="0.10.18" />
|
||||
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
|
||||
<PackageVersion Include="Concentus" Version="1.1.7" />
|
||||
<PackageVersion Include="DiscordRichPresence" Version="1.1.3.18" />
|
||||
<PackageVersion Include="DiscordRichPresence" Version="1.2.1.24" />
|
||||
<PackageVersion Include="DynamicData" Version="7.14.2" />
|
||||
<PackageVersion Include="FluentAvaloniaUI" Version="1.4.5" />
|
||||
<PackageVersion Include="GtkSharp.Dependencies" Version="1.1.1" />
|
||||
@@ -20,7 +20,7 @@
|
||||
<PackageVersion Include="jp2masa.Avalonia.Flexbox" Version="0.2.0" />
|
||||
<PackageVersion Include="LibHac" Version="0.18.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
|
||||
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.6.0" />
|
||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
|
||||
<PackageVersion Include="Microsoft.IO.RecyclableMemoryStream" Version="2.3.2" />
|
||||
<PackageVersion Include="MsgPack.Cli" Version="1.0.1" />
|
||||
@@ -34,7 +34,7 @@
|
||||
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies" Version="5.0.1-build13" />
|
||||
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
|
||||
<PackageVersion Include="Ryujinx.GtkSharp" Version="3.24.24.59-ryujinx" />
|
||||
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.26.3-build25" />
|
||||
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.28.1-build28" />
|
||||
<PackageVersion Include="shaderc.net" Version="0.1.0" />
|
||||
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
|
||||
<PackageVersion Include="Silk.NET.Vulkan" Version="2.16.0" />
|
||||
|
@@ -330,6 +330,7 @@ namespace ARMeilleure.Decoders
|
||||
SetA64("011111100x110000110010xxxxxxxxxx", InstName.Fmaxnmp_S, InstEmit.Fmaxnmp_S, OpCodeSimd.Create);
|
||||
SetA64("0>1011100<1xxxxx110001xxxxxxxxxx", InstName.Fmaxnmp_V, InstEmit.Fmaxnmp_V, OpCodeSimdReg.Create);
|
||||
SetA64("0110111000110000110010xxxxxxxxxx", InstName.Fmaxnmv_V, InstEmit.Fmaxnmv_V, OpCodeSimd.Create);
|
||||
SetA64("011111100x110000111110xxxxxxxxxx", InstName.Fmaxp_S, InstEmit.Fmaxp_S, OpCodeSimd.Create);
|
||||
SetA64("0>1011100<1xxxxx111101xxxxxxxxxx", InstName.Fmaxp_V, InstEmit.Fmaxp_V, OpCodeSimdReg.Create);
|
||||
SetA64("0110111000110000111110xxxxxxxxxx", InstName.Fmaxv_V, InstEmit.Fmaxv_V, OpCodeSimd.Create);
|
||||
SetA64("000111100x1xxxxx010110xxxxxxxxxx", InstName.Fmin_S, InstEmit.Fmin_S, OpCodeSimdReg.Create);
|
||||
@@ -339,6 +340,7 @@ namespace ARMeilleure.Decoders
|
||||
SetA64("011111101x110000110010xxxxxxxxxx", InstName.Fminnmp_S, InstEmit.Fminnmp_S, OpCodeSimd.Create);
|
||||
SetA64("0>1011101<1xxxxx110001xxxxxxxxxx", InstName.Fminnmp_V, InstEmit.Fminnmp_V, OpCodeSimdReg.Create);
|
||||
SetA64("0110111010110000110010xxxxxxxxxx", InstName.Fminnmv_V, InstEmit.Fminnmv_V, OpCodeSimd.Create);
|
||||
SetA64("011111101x110000111110xxxxxxxxxx", InstName.Fminp_S, InstEmit.Fminp_S, OpCodeSimd.Create);
|
||||
SetA64("0>1011101<1xxxxx111101xxxxxxxxxx", InstName.Fminp_V, InstEmit.Fminp_V, OpCodeSimdReg.Create);
|
||||
SetA64("0110111010110000111110xxxxxxxxxx", InstName.Fminv_V, InstEmit.Fminv_V, OpCodeSimd.Create);
|
||||
SetA64("010111111xxxxxxx0001x0xxxxxxxxxx", InstName.Fmla_Se, InstEmit.Fmla_Se, OpCodeSimdRegElemF.Create);
|
||||
|
@@ -883,6 +883,31 @@ namespace ARMeilleure.Instructions
|
||||
}
|
||||
}
|
||||
|
||||
public static void Fmaxp_S(ArmEmitterContext context)
|
||||
{
|
||||
if (Optimizations.UseAdvSimd)
|
||||
{
|
||||
InstEmitSimdHelperArm64.EmitScalarUnaryOpF(context, Intrinsic.Arm64FmaxpS);
|
||||
}
|
||||
else if (Optimizations.FastFP && Optimizations.UseSse41)
|
||||
{
|
||||
EmitSse2ScalarPairwiseOpF(context, (op1, op2) =>
|
||||
{
|
||||
return EmitSse41ProcessNaNsOpF(context, (op1, op2) =>
|
||||
{
|
||||
return EmitSse2VectorMaxMinOpF(context, op1, op2, isMax: true);
|
||||
}, scalar: true, op1, op2);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
EmitScalarPairwiseOpF(context, (op1, op2) =>
|
||||
{
|
||||
return EmitSoftFloatCall(context, nameof(SoftFloat32.FPMax), op1, op2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void Fmaxp_V(ArmEmitterContext context)
|
||||
{
|
||||
if (Optimizations.UseAdvSimd)
|
||||
@@ -1081,6 +1106,31 @@ namespace ARMeilleure.Instructions
|
||||
}
|
||||
}
|
||||
|
||||
public static void Fminp_S(ArmEmitterContext context)
|
||||
{
|
||||
if (Optimizations.UseAdvSimd)
|
||||
{
|
||||
InstEmitSimdHelperArm64.EmitScalarUnaryOpF(context, Intrinsic.Arm64FminpS);
|
||||
}
|
||||
else if (Optimizations.FastFP && Optimizations.UseSse41)
|
||||
{
|
||||
EmitSse2ScalarPairwiseOpF(context, (op1, op2) =>
|
||||
{
|
||||
return EmitSse41ProcessNaNsOpF(context, (op1, op2) =>
|
||||
{
|
||||
return EmitSse2VectorMaxMinOpF(context, op1, op2, isMax: false);
|
||||
}, scalar: true, op1, op2);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
EmitScalarPairwiseOpF(context, (op1, op2) =>
|
||||
{
|
||||
return EmitSoftFloatCall(context, nameof(SoftFloat32.FPMin), op1, op2);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void Fminp_V(ArmEmitterContext context)
|
||||
{
|
||||
if (Optimizations.UseAdvSimd)
|
||||
|
@@ -228,6 +228,7 @@ namespace ARMeilleure.Instructions
|
||||
Fmaxnmp_S,
|
||||
Fmaxnmp_V,
|
||||
Fmaxnmv_V,
|
||||
Fmaxp_S,
|
||||
Fmaxp_V,
|
||||
Fmaxv_V,
|
||||
Fmin_S,
|
||||
@@ -237,6 +238,7 @@ namespace ARMeilleure.Instructions
|
||||
Fminnmp_S,
|
||||
Fminnmp_V,
|
||||
Fminnmv_V,
|
||||
Fminp_S,
|
||||
Fminp_V,
|
||||
Fminv_V,
|
||||
Fmla_Se,
|
||||
|
@@ -1448,6 +1448,7 @@ namespace ARMeilleure.Instructions
|
||||
{
|
||||
var overflowToInf = fpcr.GetRoundingMode() switch
|
||||
{
|
||||
FPRoundingMode.ToNearest => true,
|
||||
FPRoundingMode.TowardsPlusInfinity => !sign,
|
||||
FPRoundingMode.TowardsMinusInfinity => sign,
|
||||
FPRoundingMode.TowardsZero => false,
|
||||
@@ -2879,6 +2880,7 @@ namespace ARMeilleure.Instructions
|
||||
{
|
||||
var overflowToInf = fpcr.GetRoundingMode() switch
|
||||
{
|
||||
FPRoundingMode.ToNearest => true,
|
||||
FPRoundingMode.TowardsPlusInfinity => !sign,
|
||||
FPRoundingMode.TowardsMinusInfinity => sign,
|
||||
FPRoundingMode.TowardsZero => false,
|
||||
|
@@ -29,7 +29,7 @@ namespace ARMeilleure.Translation.PTC
|
||||
private const string OuterHeaderMagicString = "PTCohd\0\0";
|
||||
private const string InnerHeaderMagicString = "PTCihd\0\0";
|
||||
|
||||
private const uint InternalVersion = 5343; //! To be incremented manually for each change to the ARMeilleure project.
|
||||
private const uint InternalVersion = 5502; //! To be incremented manually for each change to the ARMeilleure project.
|
||||
|
||||
private const string ActualDir = "0";
|
||||
private const string BackupDir = "1";
|
||||
|
@@ -31,7 +31,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
||||
_stillRunning = true;
|
||||
_updaterThread = new Thread(Update)
|
||||
{
|
||||
Name = "HardwareDeviceDriver.OpenAL"
|
||||
Name = "HardwareDeviceDriver.OpenAL",
|
||||
};
|
||||
|
||||
_updaterThread.Start();
|
||||
|
@@ -67,7 +67,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
|
||||
{
|
||||
DriverIdentifier = buffer.DataPointer,
|
||||
BufferId = AL.GenBuffer(),
|
||||
SampleCount = GetSampleCount(buffer)
|
||||
SampleCount = GetSampleCount(buffer),
|
||||
};
|
||||
|
||||
AL.BufferData(driverBuffer.BufferId, _targetFormat, buffer.Data, (int)RequestedSampleRate);
|
||||
|
@@ -7,7 +7,6 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
using static Ryujinx.Audio.Integration.IHardwareDeviceDriver;
|
||||
using static SDL2.SDL;
|
||||
|
||||
@@ -111,7 +110,7 @@ namespace Ryujinx.Audio.Backends.SDL2
|
||||
channels = (byte)requestedChannelCount,
|
||||
format = GetSDL2Format(requestedSampleFormat),
|
||||
freq = (int)requestedSampleRate,
|
||||
samples = (ushort)sampleCount
|
||||
samples = (ushort)sampleCount,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -8,6 +8,6 @@
|
||||
Alsa = 3,
|
||||
CoreAudio = 4,
|
||||
Wasapi = 5,
|
||||
Dummy = 6
|
||||
Dummy = 6,
|
||||
}
|
||||
}
|
||||
|
@@ -3,6 +3,6 @@
|
||||
public enum SoundIoDeviceAim
|
||||
{
|
||||
SoundIoDeviceAimInput = 0,
|
||||
SoundIoDeviceAimOutput = 1
|
||||
SoundIoDeviceAimOutput = 1,
|
||||
}
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ namespace Ryujinx.Ava.Common
|
||||
|
||||
public static void OpenSaveDir(ulong saveDataId)
|
||||
{
|
||||
string saveRootPath = Path.Combine(_virtualFileSystem.GetNandPath(), $"user/save/{saveDataId:x16}");
|
||||
string saveRootPath = Path.Combine(VirtualFileSystem.GetNandPath(), $"user/save/{saveDataId:x16}");
|
||||
|
||||
if (!Directory.Exists(saveRootPath))
|
||||
{
|
||||
|
@@ -53,8 +53,6 @@ namespace Ryujinx.Ava.UI.Applet
|
||||
|
||||
bool opened = false;
|
||||
|
||||
_parent.Activate();
|
||||
|
||||
UserResult response = await ContentDialogHelper.ShowDeferredContentDialog(_parent,
|
||||
title,
|
||||
message,
|
||||
|
@@ -315,8 +315,10 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
|
||||
Window parent = GetMainWindow();
|
||||
|
||||
if (parent is { IsActive: true } and MainWindow window && window.ViewModel.IsGameRunning)
|
||||
if (parent is MainWindow window)
|
||||
{
|
||||
parent.Activate();
|
||||
|
||||
contentDialogOverlayWindow = new()
|
||||
{
|
||||
Height = parent.Bounds.Height,
|
||||
@@ -369,7 +371,9 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await contentDialog.ShowAsync();
|
||||
result = ContentDialogResult.None;
|
||||
|
||||
Logger.Warning?.Print(LogClass.Ui, "Content dialog overlay failed to populate. Default value has been returned.");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -390,7 +394,7 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||
{
|
||||
foreach (Window item in al.Windows)
|
||||
{
|
||||
if (item.IsActive && item is MainWindow window)
|
||||
if (item is MainWindow window)
|
||||
{
|
||||
return window;
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@
|
||||
{
|
||||
List,
|
||||
Grid,
|
||||
Chip
|
||||
Chip,
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ using LibHac.Fs;
|
||||
using LibHac.Ncm;
|
||||
using Ryujinx.Ava.UI.ViewModels;
|
||||
using Ryujinx.Ava.UI.Windows;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.Ui.App.Common;
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -81,7 +82,7 @@ namespace Ryujinx.Ava.UI.Models
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
var saveRoot = Path.Combine(MainWindow.MainWindowViewModel.VirtualFileSystem.GetNandPath(), $"user/save/{info.SaveDataId:x16}");
|
||||
var saveRoot = Path.Combine(VirtualFileSystem.GetNandPath(), $"user/save/{info.SaveDataId:x16}");
|
||||
|
||||
long totalSize = GetDirectorySize(saveRoot);
|
||||
|
||||
|
@@ -105,7 +105,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||
}
|
||||
|
||||
string contentPath = contentManager.GetInstalledContentPath(0x010000000000080A, StorageId.BuiltInSystem, NcaContentType.Data);
|
||||
string avatarPath = virtualFileSystem.SwitchPathToSystemPath(contentPath);
|
||||
string avatarPath = VirtualFileSystem.SwitchPathToSystemPath(contentPath);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(avatarPath))
|
||||
{
|
||||
|
@@ -25,7 +25,7 @@ namespace Ryujinx.Common
|
||||
_workerThread = new Thread(DoWork)
|
||||
{
|
||||
Name = name,
|
||||
IsBackground = true
|
||||
IsBackground = true,
|
||||
};
|
||||
_workerThread.Start();
|
||||
}
|
||||
|
@@ -8,6 +8,6 @@ namespace Ryujinx.Common.Configuration
|
||||
{
|
||||
Auto,
|
||||
Off,
|
||||
On
|
||||
On,
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,6 @@ namespace Ryujinx.Common.Configuration
|
||||
public enum GraphicsBackend
|
||||
{
|
||||
Vulkan,
|
||||
OpenGl
|
||||
OpenGl,
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,6 @@ namespace Ryujinx.Common.Configuration
|
||||
None,
|
||||
Error,
|
||||
Slowdowns,
|
||||
All
|
||||
All,
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,6 @@ namespace Ryujinx.Common.Configuration.Hid.Controller.Motion
|
||||
{
|
||||
Invalid,
|
||||
GamepadDriver,
|
||||
CemuHook
|
||||
CemuHook,
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,6 @@ namespace Ryujinx.Common.Configuration
|
||||
{
|
||||
SoftwarePageTable,
|
||||
HostMapped,
|
||||
HostMappedUnsafe
|
||||
HostMappedUnsafe,
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,6 @@
|
||||
|
||||
OglThreadControlDefault = 0,
|
||||
OglThreadControlEnable = 1,
|
||||
OglThreadControlDisable = 2
|
||||
OglThreadControlDisable = 2,
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,6 @@ namespace Ryujinx.Common.Logging
|
||||
Guest,
|
||||
AccessLog,
|
||||
Notice,
|
||||
Trace
|
||||
Trace,
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#pragma warning disable CS0169, IDE0051 // Remove unused private member
|
||||
@@ -9,6 +10,8 @@ namespace Ryujinx.Common.Memory
|
||||
T _e0;
|
||||
public readonly int Length => 1;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -18,6 +21,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array1<T> _other;
|
||||
public readonly int Length => 2;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -27,6 +32,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array2<T> _other;
|
||||
public readonly int Length => 3;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -36,6 +43,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array3<T> _other;
|
||||
public readonly int Length => 4;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -45,6 +54,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array4<T> _other;
|
||||
public readonly int Length => 5;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -54,6 +65,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array5<T> _other;
|
||||
public readonly int Length => 6;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -63,6 +76,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array6<T> _other;
|
||||
public readonly int Length => 7;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -72,6 +87,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array7<T> _other;
|
||||
public readonly int Length => 8;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -81,6 +98,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array8<T> _other;
|
||||
public readonly int Length => 9;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -90,6 +109,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array9<T> _other;
|
||||
public readonly int Length => 10;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -99,6 +120,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array10<T> _other;
|
||||
public readonly int Length => 11;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -108,6 +131,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array11<T> _other;
|
||||
public readonly int Length => 12;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -117,6 +142,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array12<T> _other;
|
||||
public readonly int Length => 13;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -126,6 +153,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array13<T> _other;
|
||||
public readonly int Length => 14;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -135,6 +164,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array14<T> _other;
|
||||
public readonly int Length => 15;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -144,6 +175,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array15<T> _other;
|
||||
public readonly int Length => 16;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -153,6 +186,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array16<T> _other;
|
||||
public readonly int Length => 17;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -162,6 +197,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array17<T> _other;
|
||||
public readonly int Length => 18;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -171,6 +208,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array18<T> _other;
|
||||
public readonly int Length => 19;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -180,6 +219,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array19<T> _other;
|
||||
public readonly int Length => 20;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -189,6 +230,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array20<T> _other;
|
||||
public readonly int Length => 21;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -198,6 +241,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array21<T> _other;
|
||||
public readonly int Length => 22;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -207,6 +252,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array22<T> _other;
|
||||
public readonly int Length => 23;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -217,6 +264,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 24;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -227,6 +276,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 25;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -237,6 +288,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 26;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -247,6 +300,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 27;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -257,6 +312,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 28;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -267,6 +324,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 29;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -277,6 +336,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 30;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -287,6 +348,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 31;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -297,6 +360,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 32;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -307,6 +372,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 33;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -317,6 +384,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 34;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -327,6 +396,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 35;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -337,6 +408,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 36;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -347,6 +420,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 37;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -357,6 +432,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 38;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -367,6 +444,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 39;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -377,6 +456,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 40;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -387,6 +468,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 41;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -397,6 +480,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 42;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -407,6 +492,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 43;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -417,6 +504,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 44;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -427,6 +516,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 45;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -437,6 +528,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 46;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -447,6 +540,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 47;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -457,6 +552,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 48;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -467,6 +564,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 49;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -477,6 +576,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 50;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -487,6 +588,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 51;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -497,6 +600,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 52;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -507,6 +612,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 53;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -517,6 +624,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 54;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -527,6 +636,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 55;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -537,6 +648,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 56;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -547,6 +660,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 57;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -557,6 +672,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 58;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -567,6 +684,8 @@ namespace Ryujinx.Common.Memory
|
||||
|
||||
public readonly int Length => 59;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -576,6 +695,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array59<T> _other;
|
||||
public readonly int Length => 60;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -585,6 +706,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array60<T> _other;
|
||||
public readonly int Length => 61;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -594,6 +717,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array61<T> _other;
|
||||
public readonly int Length => 62;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -603,6 +728,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array62<T> _other;
|
||||
public readonly int Length => 63;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -612,6 +739,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array63<T> _other;
|
||||
public readonly int Length => 64;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -622,6 +751,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array8<T> _other2;
|
||||
public readonly int Length => 73;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -632,6 +763,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array62<T> _other2;
|
||||
public readonly int Length => 127;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -642,6 +775,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array63<T> _other2;
|
||||
public readonly int Length => 128;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
|
||||
@@ -652,6 +787,8 @@ namespace Ryujinx.Common.Memory
|
||||
Array127<T> _other2;
|
||||
public readonly int Length => 256;
|
||||
public ref T this[int index] => ref AsSpan()[index];
|
||||
|
||||
[Pure]
|
||||
public Span<T> AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length);
|
||||
}
|
||||
}
|
||||
|
@@ -179,7 +179,7 @@ namespace Ryujinx.Cpu
|
||||
{
|
||||
addressSpace = null;
|
||||
|
||||
const MemoryAllocationFlags asFlags = MemoryAllocationFlags.Reserve | MemoryAllocationFlags.ViewCompatible;
|
||||
const MemoryAllocationFlags AsFlags = MemoryAllocationFlags.Reserve | MemoryAllocationFlags.ViewCompatible;
|
||||
|
||||
ulong minAddressSpaceSize = Math.Min(asSize, 1UL << 36);
|
||||
|
||||
@@ -191,8 +191,8 @@ namespace Ryujinx.Cpu
|
||||
|
||||
try
|
||||
{
|
||||
baseMemory = new MemoryBlock(addressSpaceSize, asFlags);
|
||||
mirrorMemory = new MemoryBlock(addressSpaceSize, asFlags);
|
||||
baseMemory = new MemoryBlock(addressSpaceSize, AsFlags);
|
||||
mirrorMemory = new MemoryBlock(addressSpaceSize, AsFlags);
|
||||
addressSpace = new AddressSpace(backingMemory, baseMemory, mirrorMemory, addressSpaceSize, supports4KBPages);
|
||||
|
||||
break;
|
||||
|
@@ -22,6 +22,6 @@ namespace Ryujinx.Cpu.AppleHv.Arm
|
||||
|
||||
UserNoneKernelReadWrite = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (0UL << (int)ApShift),
|
||||
UserNoneKernelRead = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (2UL << (int)ApShift),
|
||||
UserReadKernelRead = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (3UL << (int)ApShift)
|
||||
UserReadKernelRead = (1UL << (int)PxnShift) | (1UL << (int)UxnShift) | (3UL << (int)ApShift),
|
||||
}
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ namespace Ryujinx.Graphics.Device
|
||||
TypeCode.Double => sizeof(double),
|
||||
TypeCode.Decimal => sizeof(decimal),
|
||||
TypeCode.Boolean => sizeof(bool),
|
||||
_ => throw new ArgumentException($"Length for type \"{type.Name}\" is unknown.")
|
||||
_ => throw new ArgumentException($"Length for type \"{type.Name}\" is unknown."),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -79,7 +79,6 @@ namespace Ryujinx.Graphics.GAL
|
||||
|
||||
void SetRasterizerDiscard(bool discard);
|
||||
|
||||
void SetRenderTargetScale(float scale);
|
||||
void SetRenderTargetColorMasks(ReadOnlySpan<uint> componentMask);
|
||||
void SetRenderTargets(ITexture[] colors, ITexture depthStencil);
|
||||
|
||||
@@ -99,7 +98,7 @@ namespace Ryujinx.Graphics.GAL
|
||||
void SetVertexAttribs(ReadOnlySpan<VertexAttribDescriptor> vertexAttribs);
|
||||
void SetVertexBuffers(ReadOnlySpan<VertexBufferDescriptor> vertexBuffers);
|
||||
|
||||
void SetViewports(ReadOnlySpan<Viewport> viewports, bool disableTransform);
|
||||
void SetViewports(ReadOnlySpan<Viewport> viewports);
|
||||
|
||||
void TextureBarrier();
|
||||
void TextureBarrierTiled();
|
||||
@@ -107,7 +106,5 @@ namespace Ryujinx.Graphics.GAL
|
||||
bool TryHostConditionalRendering(ICounterEvent value, ulong compare, bool isEqual);
|
||||
bool TryHostConditionalRendering(ICounterEvent value, ICounterEvent compare, bool isEqual);
|
||||
void EndHostConditionalRendering();
|
||||
|
||||
void UpdateRenderScale(ReadOnlySpan<float> scales, int totalCount, int fragmentCount);
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,6 @@ namespace Ryujinx.Graphics.GAL
|
||||
void BackgroundContextAction(Action action, bool alwaysBackground = false);
|
||||
|
||||
BufferHandle CreateBuffer(int size, BufferHandle storageHint);
|
||||
|
||||
BufferHandle CreateBuffer(int size)
|
||||
{
|
||||
return CreateBuffer(size, BufferHandle.Null);
|
||||
@@ -28,7 +27,7 @@ namespace Ryujinx.Graphics.GAL
|
||||
IProgram CreateProgram(ShaderSource[] shaders, ShaderInfo info);
|
||||
|
||||
ISampler CreateSampler(SamplerCreateInfo info);
|
||||
ITexture CreateTexture(TextureCreateInfo info, float scale);
|
||||
ITexture CreateTexture(TextureCreateInfo info);
|
||||
bool PrepareHostMapping(nint address, ulong size);
|
||||
|
||||
void CreateSync(ulong id, bool strict);
|
||||
@@ -49,7 +48,7 @@ namespace Ryujinx.Graphics.GAL
|
||||
|
||||
void PreFrame();
|
||||
|
||||
ICounterEvent ReportCounter(CounterType type, EventHandler<ulong> resultHandler, bool hostReserved);
|
||||
ICounterEvent ReportCounter(CounterType type, EventHandler<ulong> resultHandler, float divisor, bool hostReserved);
|
||||
|
||||
void ResetCounter(CounterType type);
|
||||
|
||||
|
@@ -6,7 +6,6 @@ namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
int Width { get; }
|
||||
int Height { get; }
|
||||
float ScaleFactor { get; }
|
||||
|
||||
void CopyTo(ITexture destination, int firstLayer, int firstLevel);
|
||||
void CopyTo(ITexture destination, int srcLayer, int dstLayer, int srcLevel, int dstLevel);
|
||||
|
@@ -125,7 +125,6 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
||||
Register<SetProgramCommand>(CommandType.SetProgram);
|
||||
Register<SetRasterizerDiscardCommand>(CommandType.SetRasterizerDiscard);
|
||||
Register<SetRenderTargetColorMasksCommand>(CommandType.SetRenderTargetColorMasks);
|
||||
Register<SetRenderTargetScaleCommand>(CommandType.SetRenderTargetScale);
|
||||
Register<SetRenderTargetsCommand>(CommandType.SetRenderTargets);
|
||||
Register<SetScissorsCommand>(CommandType.SetScissor);
|
||||
Register<SetStencilTestCommand>(CommandType.SetStencilTest);
|
||||
@@ -138,7 +137,6 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
||||
Register<TextureBarrierTiledCommand>(CommandType.TextureBarrierTiled);
|
||||
Register<TryHostConditionalRenderingCommand>(CommandType.TryHostConditionalRendering);
|
||||
Register<TryHostConditionalRenderingFlushCommand>(CommandType.TryHostConditionalRenderingFlush);
|
||||
Register<UpdateRenderScaleCommand>(CommandType.UpdateRenderScale);
|
||||
|
||||
return maxCommandSize;
|
||||
}
|
||||
|
@@ -87,7 +87,6 @@
|
||||
SetProgram,
|
||||
SetRasterizerDiscard,
|
||||
SetRenderTargetColorMasks,
|
||||
SetRenderTargetScale,
|
||||
SetRenderTargets,
|
||||
SetScissor,
|
||||
SetStencilTest,
|
||||
@@ -100,6 +99,5 @@
|
||||
TextureBarrierTiled,
|
||||
TryHostConditionalRendering,
|
||||
TryHostConditionalRenderingFlush,
|
||||
UpdateRenderScale,
|
||||
}
|
||||
}
|
||||
|
@@ -8,18 +8,16 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
|
||||
public readonly CommandType CommandType => CommandType.CreateTexture;
|
||||
private TableRef<ThreadedTexture> _texture;
|
||||
private TextureCreateInfo _info;
|
||||
private float _scale;
|
||||
|
||||
public void Set(TableRef<ThreadedTexture> texture, TextureCreateInfo info, float scale)
|
||||
public void Set(TableRef<ThreadedTexture> texture, TextureCreateInfo info)
|
||||
{
|
||||
_texture = texture;
|
||||
_info = info;
|
||||
_scale = scale;
|
||||
}
|
||||
|
||||
public static void Run(ref CreateTextureCommand command, ThreadedRenderer threaded, IRenderer renderer)
|
||||
{
|
||||
command._texture.Get(threaded).Base = renderer.CreateTexture(command._info, command._scale);
|
||||
command._texture.Get(threaded).Base = renderer.CreateTexture(command._info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,13 +10,15 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
|
||||
private TableRef<ThreadedCounterEvent> _event;
|
||||
private CounterType _type;
|
||||
private TableRef<EventHandler<ulong>> _resultHandler;
|
||||
private float _divisor;
|
||||
private bool _hostReserved;
|
||||
|
||||
public void Set(TableRef<ThreadedCounterEvent> evt, CounterType type, TableRef<EventHandler<ulong>> resultHandler, bool hostReserved)
|
||||
public void Set(TableRef<ThreadedCounterEvent> evt, CounterType type, TableRef<EventHandler<ulong>> resultHandler, float divisor, bool hostReserved)
|
||||
{
|
||||
_event = evt;
|
||||
_type = type;
|
||||
_resultHandler = resultHandler;
|
||||
_divisor = divisor;
|
||||
_hostReserved = hostReserved;
|
||||
}
|
||||
|
||||
@@ -24,7 +26,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands.Renderer
|
||||
{
|
||||
ThreadedCounterEvent evt = command._event.Get(threaded);
|
||||
|
||||
evt.Create(renderer, command._type, command._resultHandler.Get(threaded), command._hostReserved);
|
||||
evt.Create(renderer, command._type, command._resultHandler.Get(threaded), command._divisor, command._hostReserved);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,18 +0,0 @@
|
||||
namespace Ryujinx.Graphics.GAL.Multithreading.Commands
|
||||
{
|
||||
struct SetRenderTargetScaleCommand : IGALCommand, IGALCommand<SetRenderTargetScaleCommand>
|
||||
{
|
||||
public readonly CommandType CommandType => CommandType.SetRenderTargetScale;
|
||||
private float _scale;
|
||||
|
||||
public void Set(float scale)
|
||||
{
|
||||
_scale = scale;
|
||||
}
|
||||
|
||||
public static void Run(ref SetRenderTargetScaleCommand command, ThreadedRenderer threaded, IRenderer renderer)
|
||||
{
|
||||
renderer.Pipeline.SetRenderTargetScale(command._scale);
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,18 +7,16 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Commands
|
||||
{
|
||||
public readonly CommandType CommandType => CommandType.SetViewports;
|
||||
private SpanRef<Viewport> _viewports;
|
||||
private bool _disableTransform;
|
||||
|
||||
public void Set(SpanRef<Viewport> viewports, bool disableTransform)
|
||||
public void Set(SpanRef<Viewport> viewports)
|
||||
{
|
||||
_viewports = viewports;
|
||||
_disableTransform = disableTransform;
|
||||
}
|
||||
|
||||
public static void Run(ref SetViewportsCommand command, ThreadedRenderer threaded, IRenderer renderer)
|
||||
{
|
||||
ReadOnlySpan<Viewport> viewports = command._viewports.Get(threaded);
|
||||
renderer.Pipeline.SetViewports(viewports, command._disableTransform);
|
||||
renderer.Pipeline.SetViewports(viewports);
|
||||
command._viewports.Dispose(threaded);
|
||||
}
|
||||
}
|
||||
|
@@ -1,25 +0,0 @@
|
||||
using Ryujinx.Graphics.GAL.Multithreading.Model;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL.Multithreading.Commands
|
||||
{
|
||||
struct UpdateRenderScaleCommand : IGALCommand, IGALCommand<UpdateRenderScaleCommand>
|
||||
{
|
||||
public readonly CommandType CommandType => CommandType.UpdateRenderScale;
|
||||
private SpanRef<float> _scales;
|
||||
private int _totalCount;
|
||||
private int _fragmentCount;
|
||||
|
||||
public void Set(SpanRef<float> scales, int totalCount, int fragmentCount)
|
||||
{
|
||||
_scales = scales;
|
||||
_totalCount = totalCount;
|
||||
_fragmentCount = fragmentCount;
|
||||
}
|
||||
|
||||
public static void Run(ref UpdateRenderScaleCommand command, ThreadedRenderer threaded, IRenderer renderer)
|
||||
{
|
||||
renderer.Pipeline.UpdateRenderScale(command._scales.Get(threaded), command._totalCount, command._fragmentCount);
|
||||
command._scales.Dispose(threaded);
|
||||
}
|
||||
}
|
||||
}
|
@@ -70,10 +70,10 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources
|
||||
}
|
||||
}
|
||||
|
||||
public void Create(IRenderer renderer, CounterType type, System.EventHandler<ulong> eventHandler, bool hostReserved)
|
||||
public void Create(IRenderer renderer, CounterType type, System.EventHandler<ulong> eventHandler, float divisor, bool hostReserved)
|
||||
{
|
||||
ThreadedHelpers.SpinUntilExchange(ref _createLock, 1, 0);
|
||||
Base = renderer.ReportCounter(type, eventHandler, hostReserved || _reserved);
|
||||
Base = renderer.ReportCounter(type, eventHandler, divisor, hostReserved || _reserved);
|
||||
Volatile.Write(ref _createLock, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -17,13 +17,10 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources
|
||||
|
||||
public int Height => _info.Height;
|
||||
|
||||
public float ScaleFactor { get; }
|
||||
|
||||
public ThreadedTexture(ThreadedRenderer renderer, TextureCreateInfo info, float scale)
|
||||
public ThreadedTexture(ThreadedRenderer renderer, TextureCreateInfo info)
|
||||
{
|
||||
_renderer = renderer;
|
||||
_info = info;
|
||||
ScaleFactor = scale;
|
||||
}
|
||||
|
||||
private TableRef<T> Ref<T>(T reference)
|
||||
@@ -64,7 +61,7 @@ namespace Ryujinx.Graphics.GAL.Multithreading.Resources
|
||||
|
||||
public ITexture CreateView(TextureCreateInfo info, int firstLayer, int firstLevel)
|
||||
{
|
||||
ThreadedTexture newTex = new(_renderer, info, ScaleFactor);
|
||||
ThreadedTexture newTex = new(_renderer, info);
|
||||
_renderer.New<TextureCreateViewCommand>().Set(Ref(this), Ref(newTex), info, firstLayer, firstLevel);
|
||||
_renderer.QueueCommand();
|
||||
|
||||
|
@@ -261,12 +261,6 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
||||
_renderer.QueueCommand();
|
||||
}
|
||||
|
||||
public void SetRenderTargetScale(float scale)
|
||||
{
|
||||
_renderer.New<SetRenderTargetScaleCommand>().Set(scale);
|
||||
_renderer.QueueCommand();
|
||||
}
|
||||
|
||||
public void SetScissors(ReadOnlySpan<Rectangle<int>> scissors)
|
||||
{
|
||||
_renderer.New<SetScissorsCommand>().Set(_renderer.CopySpan(scissors));
|
||||
@@ -321,9 +315,9 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
||||
_renderer.QueueCommand();
|
||||
}
|
||||
|
||||
public void SetViewports(ReadOnlySpan<Viewport> viewports, bool disableTransform)
|
||||
public void SetViewports(ReadOnlySpan<Viewport> viewports)
|
||||
{
|
||||
_renderer.New<SetViewportsCommand>().Set(_renderer.CopySpan(viewports), disableTransform);
|
||||
_renderer.New<SetViewportsCommand>().Set(_renderer.CopySpan(viewports));
|
||||
_renderer.QueueCommand();
|
||||
}
|
||||
|
||||
@@ -368,11 +362,5 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
||||
_renderer.QueueCommand();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void UpdateRenderScale(ReadOnlySpan<float> scales, int totalCount, int fragmentCount)
|
||||
{
|
||||
_renderer.New<UpdateRenderScaleCommand>().Set(_renderer.CopySpan(scales[..totalCount]), totalCount, fragmentCount);
|
||||
_renderer.QueueCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -320,21 +320,21 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
||||
QueueCommand();
|
||||
}
|
||||
|
||||
public ITexture CreateTexture(TextureCreateInfo info, float scale)
|
||||
public ITexture CreateTexture(TextureCreateInfo info)
|
||||
{
|
||||
if (IsGpuThread())
|
||||
{
|
||||
var texture = new ThreadedTexture(this, info, scale);
|
||||
New<CreateTextureCommand>().Set(Ref(texture), info, scale);
|
||||
var texture = new ThreadedTexture(this, info);
|
||||
New<CreateTextureCommand>().Set(Ref(texture), info);
|
||||
QueueCommand();
|
||||
|
||||
return texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
var texture = new ThreadedTexture(this, info, scale)
|
||||
var texture = new ThreadedTexture(this, info)
|
||||
{
|
||||
Base = _baseRenderer.CreateTexture(info, scale),
|
||||
Base = _baseRenderer.CreateTexture(info),
|
||||
};
|
||||
|
||||
return texture;
|
||||
@@ -410,10 +410,10 @@ namespace Ryujinx.Graphics.GAL.Multithreading
|
||||
QueueCommand();
|
||||
}
|
||||
|
||||
public ICounterEvent ReportCounter(CounterType type, EventHandler<ulong> resultHandler, bool hostReserved)
|
||||
public ICounterEvent ReportCounter(CounterType type, EventHandler<ulong> resultHandler, float divisor, bool hostReserved)
|
||||
{
|
||||
ThreadedCounterEvent evt = new(this, type, _lastSampleCounterClear);
|
||||
New<ReportCounterCommand>().Set(Ref(evt), type, Ref(resultHandler), hostReserved);
|
||||
New<ReportCounterCommand>().Set(Ref(evt), type, Ref(resultHandler), divisor, hostReserved);
|
||||
QueueCommand();
|
||||
|
||||
if (type == CounterType.SamplesPassed)
|
||||
|
@@ -1,102 +0,0 @@
|
||||
using Ryujinx.Graphics.Shader;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Graphics.GAL
|
||||
{
|
||||
public class SupportBufferUpdater : IDisposable
|
||||
{
|
||||
public SupportBuffer Data;
|
||||
public BufferHandle Handle;
|
||||
|
||||
private readonly IRenderer _renderer;
|
||||
private int _startOffset = -1;
|
||||
private int _endOffset = -1;
|
||||
|
||||
public SupportBufferUpdater(IRenderer renderer)
|
||||
{
|
||||
_renderer = renderer;
|
||||
Handle = renderer.CreateBuffer(SupportBuffer.RequiredSize);
|
||||
renderer.Pipeline.ClearBuffer(Handle, 0, SupportBuffer.RequiredSize, 0);
|
||||
}
|
||||
|
||||
private void MarkDirty(int startOffset, int byteSize)
|
||||
{
|
||||
int endOffset = startOffset + byteSize;
|
||||
|
||||
if (_startOffset == -1)
|
||||
{
|
||||
_startOffset = startOffset;
|
||||
_endOffset = endOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (startOffset < _startOffset)
|
||||
{
|
||||
_startOffset = startOffset;
|
||||
}
|
||||
|
||||
if (endOffset > _endOffset)
|
||||
{
|
||||
_endOffset = endOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateFragmentRenderScaleCount(int count)
|
||||
{
|
||||
if (Data.FragmentRenderScaleCount.X != count)
|
||||
{
|
||||
Data.FragmentRenderScaleCount.X = count;
|
||||
|
||||
MarkDirty(SupportBuffer.FragmentRenderScaleCountOffset, sizeof(int));
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateGenericField<T>(int baseOffset, ReadOnlySpan<T> data, Span<T> target, int offset, int count) where T : unmanaged
|
||||
{
|
||||
data[..count].CopyTo(target[offset..]);
|
||||
|
||||
int elemSize = Unsafe.SizeOf<T>();
|
||||
|
||||
MarkDirty(baseOffset + offset * elemSize, count * elemSize);
|
||||
}
|
||||
|
||||
public void UpdateRenderScale(ReadOnlySpan<Vector4<float>> data, int offset, int count)
|
||||
{
|
||||
UpdateGenericField(SupportBuffer.GraphicsRenderScaleOffset, data, Data.RenderScale.AsSpan(), offset, count);
|
||||
}
|
||||
|
||||
public void UpdateFragmentIsBgra(ReadOnlySpan<Vector4<int>> data, int offset, int count)
|
||||
{
|
||||
UpdateGenericField(SupportBuffer.FragmentIsBgraOffset, data, Data.FragmentIsBgra.AsSpan(), offset, count);
|
||||
}
|
||||
|
||||
public void UpdateViewportInverse(Vector4<float> data)
|
||||
{
|
||||
Data.ViewportInverse = data;
|
||||
|
||||
MarkDirty(SupportBuffer.ViewportInverseOffset, SupportBuffer.FieldSize);
|
||||
}
|
||||
|
||||
public void Commit()
|
||||
{
|
||||
if (_startOffset != -1)
|
||||
{
|
||||
ReadOnlySpan<byte> data = MemoryMarshal.Cast<SupportBuffer, byte>(MemoryMarshal.CreateSpan(ref Data, 1));
|
||||
|
||||
_renderer.SetBufferData(Handle, _startOffset, data[_startOffset.._endOffset]);
|
||||
|
||||
_startOffset = -1;
|
||||
_endOffset = -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
_renderer.DeleteBuffer(Handle);
|
||||
}
|
||||
}
|
||||
}
|
@@ -177,13 +177,15 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
resultHandler(null, (ulong)_state.State.SemaphorePayload);
|
||||
break;
|
||||
case ReportCounterType.SamplesPassed:
|
||||
counter = _context.Renderer.ReportCounter(CounterType.SamplesPassed, resultHandler, false);
|
||||
float scale = _channel.TextureManager.RenderTargetScale;
|
||||
float divisor = scale * scale;
|
||||
counter = _context.Renderer.ReportCounter(CounterType.SamplesPassed, resultHandler, divisor, false);
|
||||
break;
|
||||
case ReportCounterType.PrimitivesGenerated:
|
||||
counter = _context.Renderer.ReportCounter(CounterType.PrimitivesGenerated, resultHandler, false);
|
||||
counter = _context.Renderer.ReportCounter(CounterType.PrimitivesGenerated, resultHandler, 1f, false);
|
||||
break;
|
||||
case ReportCounterType.TransformFeedbackPrimitivesWritten:
|
||||
counter = _context.Renderer.ReportCounter(CounterType.TransformFeedbackPrimitivesWritten, resultHandler, false);
|
||||
counter = _context.Renderer.ReportCounter(CounterType.TransformFeedbackPrimitivesWritten, resultHandler, 1f, false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -342,5 +342,19 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
Signal();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y negate enabled state.
|
||||
/// </summary>
|
||||
/// <param name="enabled">True if Y negate of the fragment coordinates is enabled</param>
|
||||
public void SetYNegateEnabled(bool enabled)
|
||||
{
|
||||
if (enabled != _graphics.YNegateEnabled)
|
||||
{
|
||||
_graphics.YNegateEnabled = enabled;
|
||||
|
||||
Signal();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
private ProgramPipelineState _pipeline;
|
||||
|
||||
private bool _fsReadsFragCoord;
|
||||
private bool _vsUsesDrawParameters;
|
||||
private bool _vtgWritesRtLayer;
|
||||
private byte _vsClipDistancesWritten;
|
||||
@@ -330,7 +331,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
UpdateShaderState();
|
||||
}
|
||||
|
||||
_channel.BufferManager.CommitGraphicsBindings();
|
||||
_channel.BufferManager.CommitGraphicsBindings(_drawState.DrawIndexed);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -495,6 +496,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
{
|
||||
clipRegionHeight = color.Height / samplesInY;
|
||||
}
|
||||
|
||||
if (!_context.Capabilities.SupportsBgraFormat)
|
||||
{
|
||||
_context.SupportBufferUpdater.SetRenderTargetIsBgra(index, color.Format.IsBgr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,7 +545,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
|
||||
if (oldScale != _channel.TextureManager.RenderTargetScale)
|
||||
{
|
||||
_context.Renderer.Pipeline.SetRenderTargetScale(_channel.TextureManager.RenderTargetScale);
|
||||
_context.SupportBufferUpdater.SetRenderTargetScale(_channel.TextureManager.RenderTargetScale);
|
||||
|
||||
UpdateViewportTransform();
|
||||
UpdateScissorState();
|
||||
@@ -687,12 +693,11 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
var face = _state.State.FaceState;
|
||||
|
||||
bool disableTransform = _state.State.ViewportTransformEnable == 0;
|
||||
bool yNegate = yControl.HasFlag(YControl.NegateY);
|
||||
|
||||
UpdateFrontFace(yControl, face.FrontFace);
|
||||
UpdateDepthMode();
|
||||
|
||||
bool flipY = yControl.HasFlag(YControl.NegateY);
|
||||
|
||||
Span<Viewport> viewports = stackalloc Viewport[Constants.TotalViewports];
|
||||
|
||||
for (int index = 0; index < Constants.TotalViewports; index++)
|
||||
@@ -714,7 +719,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
float scaleX = MathF.Abs(transform.ScaleX);
|
||||
float scaleY = transform.ScaleY;
|
||||
|
||||
if (flipY)
|
||||
if (yNegate)
|
||||
{
|
||||
scaleY = -scaleY;
|
||||
}
|
||||
@@ -758,10 +763,25 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
}
|
||||
|
||||
_context.Renderer.Pipeline.SetDepthMode(GetDepthMode());
|
||||
_context.Renderer.Pipeline.SetViewports(viewports, disableTransform);
|
||||
_context.Renderer.Pipeline.SetViewports(viewports);
|
||||
|
||||
_currentSpecState.SetViewportTransformDisable(_state.State.ViewportTransformEnable == 0);
|
||||
_context.SupportBufferUpdater.SetViewportTransformDisable(
|
||||
viewports[0].Region.Width,
|
||||
viewports[0].Region.Height,
|
||||
_channel.TextureManager.RenderTargetScale,
|
||||
disableTransform);
|
||||
|
||||
// Viewport size is only used on the shader when YNegate is enabled,
|
||||
// and if the fragment shader accesses gl_FragCoord,
|
||||
// so there's no need to update it in other cases.
|
||||
if (yNegate && _fsReadsFragCoord)
|
||||
{
|
||||
UpdateSupportBufferViewportSize();
|
||||
}
|
||||
|
||||
_currentSpecState.SetViewportTransformDisable(disableTransform);
|
||||
_currentSpecState.SetDepthMode(GetDepthMode() == DepthMode.MinusOneToOne);
|
||||
_currentSpecState.SetYNegateEnabled(yNegate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1404,9 +1424,41 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
|
||||
_currentProgramInfo[stageIndex] = info;
|
||||
}
|
||||
|
||||
if (gs.Shaders[5]?.Info.UsesFragCoord == true)
|
||||
{
|
||||
// Make sure we update the viewport size on the support buffer if it will be consumed on the new shader.
|
||||
|
||||
if (!_fsReadsFragCoord && _state.State.YControl.HasFlag(YControl.NegateY))
|
||||
{
|
||||
UpdateSupportBufferViewportSize();
|
||||
}
|
||||
|
||||
_fsReadsFragCoord = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_fsReadsFragCoord = false;
|
||||
}
|
||||
|
||||
_context.Renderer.Pipeline.SetProgram(gs.HostProgram);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the viewport size on the support buffer for fragment shader access.
|
||||
/// </summary>
|
||||
private void UpdateSupportBufferViewportSize()
|
||||
{
|
||||
ref var transform = ref _state.State.ViewportTransform[0];
|
||||
|
||||
float scaleX = MathF.Abs(transform.ScaleX);
|
||||
float scaleY = transform.ScaleY;
|
||||
|
||||
float width = scaleX * 2;
|
||||
float height = scaleY * 2;
|
||||
|
||||
_context.SupportBufferUpdater.SetViewportSize(width, MathF.Abs(height));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates bindings consumed by the shader on the texture and buffer managers.
|
||||
/// </summary>
|
||||
|
@@ -85,6 +85,11 @@ namespace Ryujinx.Graphics.Gpu
|
||||
/// </summary>
|
||||
internal ConcurrentDictionary<ulong, PhysicalMemory> PhysicalMemoryRegistry { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Support buffer updater.
|
||||
/// </summary>
|
||||
internal SupportBufferUpdater SupportBufferUpdater { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Host hardware capabilities.
|
||||
/// </summary>
|
||||
@@ -125,6 +130,8 @@ namespace Ryujinx.Graphics.Gpu
|
||||
|
||||
PhysicalMemoryRegistry = new ConcurrentDictionary<ulong, PhysicalMemory>();
|
||||
|
||||
SupportBufferUpdater = new SupportBufferUpdater(renderer);
|
||||
|
||||
_firstTimestamp = ConvertNanosecondsToTicks((ulong)PerformanceCounter.ElapsedNanoseconds);
|
||||
}
|
||||
|
||||
@@ -399,6 +406,8 @@ namespace Ryujinx.Graphics.Gpu
|
||||
physicalMemory.Dispose();
|
||||
}
|
||||
|
||||
SupportBufferUpdater.Dispose();
|
||||
|
||||
PhysicalMemoryRegistry.Clear();
|
||||
|
||||
RunDeferredActions();
|
||||
|
@@ -278,7 +278,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
Debug.Assert(!isView);
|
||||
|
||||
TextureCreateInfo createInfo = TextureCache.GetCreateInfo(Info, _context.Capabilities, ScaleFactor);
|
||||
HostTexture = _context.Renderer.CreateTexture(createInfo, ScaleFactor);
|
||||
HostTexture = _context.Renderer.CreateTexture(createInfo);
|
||||
|
||||
SynchronizeMemory(); // Load the data.
|
||||
if (ScaleMode == TextureScaleMode.Scaled)
|
||||
@@ -302,7 +302,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
}
|
||||
|
||||
TextureCreateInfo createInfo = TextureCache.GetCreateInfo(Info, _context.Capabilities, ScaleFactor);
|
||||
HostTexture = _context.Renderer.CreateTexture(createInfo, ScaleFactor);
|
||||
HostTexture = _context.Renderer.CreateTexture(createInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -490,7 +490,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
if (storage == null)
|
||||
{
|
||||
TextureCreateInfo createInfo = TextureCache.GetCreateInfo(Info, _context.Capabilities, scale);
|
||||
storage = _context.Renderer.CreateTexture(createInfo, scale);
|
||||
storage = _context.Renderer.CreateTexture(createInfo);
|
||||
}
|
||||
|
||||
if (copy)
|
||||
|
@@ -302,7 +302,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
|
||||
_lastFragmentTotal = fragmentTotal;
|
||||
|
||||
_context.Renderer.Pipeline.UpdateRenderScale(_scales, total, fragmentTotal);
|
||||
_context.SupportBufferUpdater.UpdateRenderScale(_scales, total, fragmentTotal);
|
||||
|
||||
_scaleChanged = false;
|
||||
}
|
||||
|
@@ -478,6 +478,8 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
|
||||
// Force rebind after doing compute work.
|
||||
Rebind();
|
||||
|
||||
_context.SupportBufferUpdater.Commit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -513,10 +515,13 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
/// Ensures that the graphics engine bindings are visible to the host GPU.
|
||||
/// Note: this actually performs the binding using the host graphics API.
|
||||
/// </summary>
|
||||
public void CommitGraphicsBindings()
|
||||
/// <param name="indexed">True if the index buffer is in use</param>
|
||||
public void CommitGraphicsBindings(bool indexed)
|
||||
{
|
||||
var bufferCache = _channel.MemoryManager.Physical.BufferCache;
|
||||
|
||||
if (indexed)
|
||||
{
|
||||
if (_indexBufferDirty || _rebind)
|
||||
{
|
||||
_indexBufferDirty = false;
|
||||
@@ -532,6 +537,11 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
{
|
||||
bufferCache.SynchronizeBufferRange(_indexBuffer.Address, _indexBuffer.Size);
|
||||
}
|
||||
}
|
||||
else if (_rebind)
|
||||
{
|
||||
_indexBufferDirty = true;
|
||||
}
|
||||
|
||||
uint vbEnableMask = _vertexBuffersEnableMask;
|
||||
|
||||
@@ -686,6 +696,8 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
||||
CommitBufferTextureBindings();
|
||||
|
||||
_rebind = false;
|
||||
|
||||
_context.SupportBufferUpdater.Commit();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
262
src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
Normal file
262
src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs
Normal file
@@ -0,0 +1,262 @@
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu.Memory
|
||||
{
|
||||
/// <summary>
|
||||
/// Support buffer data updater.
|
||||
/// </summary>
|
||||
class SupportBufferUpdater : IDisposable
|
||||
{
|
||||
private SupportBuffer _data;
|
||||
private BufferHandle _handle;
|
||||
|
||||
private readonly IRenderer _renderer;
|
||||
private int _startOffset = -1;
|
||||
private int _endOffset = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the support buffer updater.
|
||||
/// </summary>
|
||||
/// <param name="renderer">Renderer that the support buffer will be used with</param>
|
||||
public SupportBufferUpdater(IRenderer renderer)
|
||||
{
|
||||
_renderer = renderer;
|
||||
|
||||
var defaultScale = new Vector4<float> { X = 1f, Y = 0f, Z = 0f, W = 0f };
|
||||
_data.RenderScale.AsSpan().Fill(defaultScale);
|
||||
DirtyRenderScale(0, SupportBuffer.RenderScaleMaxCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mark a region of the support buffer as modified and needing to be sent to the GPU.
|
||||
/// </summary>
|
||||
/// <param name="startOffset">Start offset of the region in bytes</param>
|
||||
/// <param name="byteSize">Size of the region in bytes</param>
|
||||
private void MarkDirty(int startOffset, int byteSize)
|
||||
{
|
||||
int endOffset = startOffset + byteSize;
|
||||
|
||||
if (_startOffset == -1)
|
||||
{
|
||||
_startOffset = startOffset;
|
||||
_endOffset = endOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (startOffset < _startOffset)
|
||||
{
|
||||
_startOffset = startOffset;
|
||||
}
|
||||
|
||||
if (endOffset > _endOffset)
|
||||
{
|
||||
_endOffset = endOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks the fragment render scale count as being modified.
|
||||
/// </summary>
|
||||
private void DirtyFragmentRenderScaleCount()
|
||||
{
|
||||
MarkDirty(SupportBuffer.FragmentRenderScaleCountOffset, sizeof(int));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks data of a given type as being modified.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the data</typeparam>
|
||||
/// <param name="baseOffset">Base offset of the data in bytes</param>
|
||||
/// <param name="offset">Index of the data, in elements</param>
|
||||
/// <param name="count">Number of elements</param>
|
||||
private void DirtyGenericField<T>(int baseOffset, int offset, int count) where T : unmanaged
|
||||
{
|
||||
int elemSize = Unsafe.SizeOf<T>();
|
||||
|
||||
MarkDirty(baseOffset + offset * elemSize, count * elemSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks render scales as being modified.
|
||||
/// </summary>
|
||||
/// <param name="offset">Index of the first scale that was modified</param>
|
||||
/// <param name="count">Number of modified scales</param>
|
||||
private void DirtyRenderScale(int offset, int count)
|
||||
{
|
||||
DirtyGenericField<Vector4<float>>(SupportBuffer.GraphicsRenderScaleOffset, offset, count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks render target BGRA format state as modified.
|
||||
/// </summary>
|
||||
/// <param name="offset">Index of the first render target that had its BGRA format modified</param>
|
||||
/// <param name="count">Number of render targets</param>
|
||||
private void DirtyFragmentIsBgra(int offset, int count)
|
||||
{
|
||||
DirtyGenericField<Vector4<int>>(SupportBuffer.FragmentIsBgraOffset, offset, count);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the inverse viewport vector.
|
||||
/// </summary>
|
||||
/// <param name="data">Inverse viewport vector</param>
|
||||
private void UpdateViewportInverse(Vector4<float> data)
|
||||
{
|
||||
_data.ViewportInverse = data;
|
||||
|
||||
MarkDirty(SupportBuffer.ViewportInverseOffset, SupportBuffer.FieldSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the viewport size vector.
|
||||
/// </summary>
|
||||
/// <param name="data">Viewport size vector</param>
|
||||
private void UpdateViewportSize(Vector4<float> data)
|
||||
{
|
||||
_data.ViewportSize = data;
|
||||
|
||||
MarkDirty(SupportBuffer.ViewportSizeOffset, SupportBuffer.FieldSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the scale of all output render targets (they should all have the same scale).
|
||||
/// </summary>
|
||||
/// <param name="scale">Scale value</param>
|
||||
public void SetRenderTargetScale(float scale)
|
||||
{
|
||||
_data.RenderScale[0].X = scale;
|
||||
DirtyRenderScale(0, 1); // Just the first element.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the render scales for shader input textures or images.
|
||||
/// </summary>
|
||||
/// <param name="scales">Scale values</param>
|
||||
/// <param name="totalCount">Total number of scales across all stages</param>
|
||||
/// <param name="fragmentCount">Total number of scales on the fragment shader stage</param>
|
||||
public void UpdateRenderScale(ReadOnlySpan<float> scales, int totalCount, int fragmentCount)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
for (int index = 0; index < totalCount; index++)
|
||||
{
|
||||
if (_data.RenderScale[1 + index].X != scales[index])
|
||||
{
|
||||
_data.RenderScale[1 + index].X = scales[index];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Only update fragment count if there are scales after it for the vertex stage.
|
||||
if (fragmentCount != totalCount && fragmentCount != _data.FragmentRenderScaleCount.X)
|
||||
{
|
||||
_data.FragmentRenderScaleCount.X = fragmentCount;
|
||||
DirtyFragmentRenderScaleCount();
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
DirtyRenderScale(0, 1 + totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether the format of a given render target is a BGRA format.
|
||||
/// </summary>
|
||||
/// <param name="index">Render target index</param>
|
||||
/// <param name="isBgra">True if the format is BGRA< false otherwise</param>
|
||||
public void SetRenderTargetIsBgra(int index, bool isBgra)
|
||||
{
|
||||
bool isBgraChanged = (_data.FragmentIsBgra[index].X != 0) != isBgra;
|
||||
|
||||
if (isBgraChanged)
|
||||
{
|
||||
_data.FragmentIsBgra[index].X = isBgra ? 1 : 0;
|
||||
DirtyFragmentIsBgra(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets whether a viewport has transform disabled.
|
||||
/// </summary>
|
||||
/// <param name="viewportWidth">Value used as viewport width</param>
|
||||
/// <param name="viewportHeight">Value used as viewport height</param>
|
||||
/// <param name="scale">Render target scale</param>
|
||||
/// <param name="disableTransform">True if transform is disabled, false otherwise</param>
|
||||
public void SetViewportTransformDisable(float viewportWidth, float viewportHeight, float scale, bool disableTransform)
|
||||
{
|
||||
float disableTransformF = disableTransform ? 1.0f : 0.0f;
|
||||
if (_data.ViewportInverse.W != disableTransformF || disableTransform)
|
||||
{
|
||||
UpdateViewportInverse(new Vector4<float>
|
||||
{
|
||||
X = scale * 2f / viewportWidth,
|
||||
Y = scale * 2f / viewportHeight,
|
||||
Z = 1,
|
||||
W = disableTransformF,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the viewport size, used to invert the fragment coordinates Y value.
|
||||
/// </summary>
|
||||
/// <param name="viewportWidth">Value used as viewport width</param>
|
||||
/// <param name="viewportHeight">Value used as viewport height</param>
|
||||
public void SetViewportSize(float viewportWidth, float viewportHeight)
|
||||
{
|
||||
if (_data.ViewportSize.X != viewportWidth || _data.ViewportSize.Y != viewportHeight)
|
||||
{
|
||||
UpdateViewportSize(new Vector4<float>
|
||||
{
|
||||
X = viewportWidth,
|
||||
Y = viewportHeight,
|
||||
Z = 1,
|
||||
W = 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Submits all pending buffer updates to the GPU.
|
||||
/// </summary>
|
||||
public void Commit()
|
||||
{
|
||||
if (_startOffset != -1)
|
||||
{
|
||||
if (_handle == BufferHandle.Null)
|
||||
{
|
||||
_handle = _renderer.CreateBuffer(SupportBuffer.RequiredSize);
|
||||
_renderer.Pipeline.ClearBuffer(_handle, 0, SupportBuffer.RequiredSize, 0);
|
||||
|
||||
var range = new BufferRange(_handle, 0, SupportBuffer.RequiredSize);
|
||||
_renderer.Pipeline.SetUniformBuffers(stackalloc[] { new BufferAssignment(0, range) });
|
||||
}
|
||||
|
||||
ReadOnlySpan<byte> data = MemoryMarshal.Cast<SupportBuffer, byte>(MemoryMarshal.CreateSpan(ref _data, 1));
|
||||
|
||||
_renderer.SetBufferData(_handle, _startOffset, data[_startOffset.._endOffset]);
|
||||
|
||||
_startOffset = -1;
|
||||
_endOffset = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destroys the support buffer.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (_handle != BufferHandle.Null)
|
||||
{
|
||||
_renderer.DeleteBuffer(_handle);
|
||||
_handle = BufferHandle.Null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -247,6 +247,12 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||
return _oldSpecState.GraphicsState.ViewportTransformDisable;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool QueryYNegateEnabled()
|
||||
{
|
||||
return _oldSpecState.GraphicsState.YNegateEnabled;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void RegisterTexture(int handle, int cbufSlot)
|
||||
{
|
||||
|
@@ -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 = 5266;
|
||||
private const uint CodeGenVersion = 4675;
|
||||
|
||||
private const string SharedTocFileName = "shared.toc";
|
||||
private const string SharedDataFileName = "shared.data";
|
||||
@@ -140,6 +140,11 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||
/// </summary>
|
||||
public ShaderStage Stage;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the fragment shader accesses the fragment coordinate built-in variable.
|
||||
/// </summary>
|
||||
public bool UsesFragCoord;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the shader accesses the Instance ID built-in variable.
|
||||
/// </summary>
|
||||
@@ -781,6 +786,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||
ShaderIdentification.None,
|
||||
0,
|
||||
dataInfo.Stage,
|
||||
dataInfo.UsesFragCoord,
|
||||
dataInfo.UsesInstanceId,
|
||||
dataInfo.UsesDrawParameters,
|
||||
dataInfo.UsesRtLayer,
|
||||
@@ -807,6 +813,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||
TexturesCount = (ushort)info.Textures.Count,
|
||||
ImagesCount = (ushort)info.Images.Count,
|
||||
Stage = info.Stage,
|
||||
UsesFragCoord = info.UsesFragCoord,
|
||||
UsesInstanceId = info.UsesInstanceId,
|
||||
UsesDrawParameters = info.UsesDrawParameters,
|
||||
UsesRtLayer = info.UsesRtLayer,
|
||||
|
@@ -113,6 +113,13 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
return _state.GraphicsState.AttributeTypes[location];
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool QueryEarlyZForce()
|
||||
{
|
||||
_state.SpecializationState?.RecordEarlyZForce();
|
||||
return _state.GraphicsState.EarlyZForce;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public AttributeType QueryFragmentOutputType(int location)
|
||||
{
|
||||
@@ -275,19 +282,18 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
return _state.TransformFeedbackDescriptors[bufferIndex].Stride;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool QueryEarlyZForce()
|
||||
{
|
||||
_state.SpecializationState?.RecordEarlyZForce();
|
||||
return _state.GraphicsState.EarlyZForce;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool QueryViewportTransformDisable()
|
||||
{
|
||||
return _state.GraphicsState.ViewportTransformDisable;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool QueryYNegateEnabled()
|
||||
{
|
||||
return _state.GraphicsState.YNegateEnabled;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void RegisterTexture(int handle, int cbufSlot)
|
||||
{
|
||||
|
@@ -97,6 +97,11 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
/// </summary>
|
||||
public bool DualSourceBlendEnable;
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether Y negate of the fragment coordinates is enabled.
|
||||
/// </summary>
|
||||
public bool YNegateEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new GPU graphics state.
|
||||
/// </summary>
|
||||
@@ -116,7 +121,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
/// <param name="hasConstantBufferDrawParameters">Indicates that the draw is writing the base vertex, base instance and draw index to Constant Buffer 0</param>
|
||||
/// <param name="hasUnalignedStorageBuffer">Indicates that any storage buffer use is unaligned</param>
|
||||
/// <param name="fragmentOutputTypes">Type of the fragment shader outputs</param>
|
||||
/// <param name="dualSourceBlendEnable">Type of the vertex attributes consumed by the shader</param>
|
||||
/// <param name="dualSourceBlendEnable">Indicates whether dual source blend is enabled</param>
|
||||
/// <param name="yNegateEnabled">Indicates whether Y negate of the fragment coordinates is enabled</param>
|
||||
public GpuChannelGraphicsState(
|
||||
bool earlyZForce,
|
||||
PrimitiveTopology topology,
|
||||
@@ -134,7 +140,8 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
bool hasConstantBufferDrawParameters,
|
||||
bool hasUnalignedStorageBuffer,
|
||||
ref Array8<AttributeType> fragmentOutputTypes,
|
||||
bool dualSourceBlendEnable)
|
||||
bool dualSourceBlendEnable,
|
||||
bool yNegateEnabled)
|
||||
{
|
||||
EarlyZForce = earlyZForce;
|
||||
Topology = topology;
|
||||
@@ -153,6 +160,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
HasUnalignedStorageBuffer = hasUnalignedStorageBuffer;
|
||||
FragmentOutputTypes = fragmentOutputTypes;
|
||||
DualSourceBlendEnable = dualSourceBlendEnable;
|
||||
YNegateEnabled = yNegateEnabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
}
|
||||
|
||||
AddDescriptor(SupportBufferStages, ResourceType.UniformBuffer, UniformSetIndex, 0, 1);
|
||||
AddUsage(SupportBufferStages, ResourceType.UniformBuffer, ResourceAccess.Read, UniformSetIndex, 0, 1);
|
||||
|
||||
_reservedConstantBuffers = 1; // For the support buffer.
|
||||
|
||||
|
@@ -540,6 +540,11 @@ namespace Ryujinx.Graphics.Gpu.Shader
|
||||
return false;
|
||||
}
|
||||
|
||||
if (graphicsState.YNegateEnabled != GraphicsState.YNegateEnabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Matches(channel, ref poolState, checkTextures, isCompute: false);
|
||||
}
|
||||
|
||||
|
@@ -8,8 +8,6 @@ using System.Threading;
|
||||
|
||||
namespace Ryujinx.Graphics.Gpu
|
||||
{
|
||||
using Texture = Image.Texture;
|
||||
|
||||
/// <summary>
|
||||
/// GPU image presentation window.
|
||||
/// </summary>
|
||||
@@ -202,13 +200,22 @@ namespace Ryujinx.Graphics.Gpu
|
||||
{
|
||||
pt.AcquireCallback(_context, pt.UserObj);
|
||||
|
||||
Texture texture = pt.Cache.FindOrCreateTexture(null, TextureSearchFlags.WithUpscale, pt.Info, 0, pt.Range);
|
||||
Image.Texture texture = pt.Cache.FindOrCreateTexture(null, TextureSearchFlags.WithUpscale, pt.Info, 0, pt.Range);
|
||||
|
||||
pt.Cache.Tick();
|
||||
|
||||
texture.SynchronizeMemory();
|
||||
|
||||
ImageCrop crop = pt.Crop;
|
||||
ImageCrop crop = new(
|
||||
(int)(pt.Crop.Left * texture.ScaleFactor),
|
||||
(int)MathF.Ceiling(pt.Crop.Right * texture.ScaleFactor),
|
||||
(int)(pt.Crop.Top * texture.ScaleFactor),
|
||||
(int)MathF.Ceiling(pt.Crop.Bottom * texture.ScaleFactor),
|
||||
pt.Crop.FlipX,
|
||||
pt.Crop.FlipY,
|
||||
pt.Crop.IsStretched,
|
||||
pt.Crop.AspectRatioX,
|
||||
pt.Crop.AspectRatioY);
|
||||
|
||||
if (texture.Info.Width > pt.Info.Width || texture.Info.Height > pt.Info.Height)
|
||||
{
|
||||
|
@@ -15,6 +15,6 @@
|
||||
Tsec = 0xe0,
|
||||
Tsecb = 0xe1,
|
||||
Nvjpg = 0xc0,
|
||||
Nvdec = 0xf0
|
||||
Nvdec = 0xf0,
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Host1x
|
||||
_syncMgr = syncMgr;
|
||||
_state = new DeviceState<Host1xClassRegisters>(new Dictionary<string, RwCallback>
|
||||
{
|
||||
{ nameof(Host1xClassRegisters.WaitSyncpt32), new RwCallback(WaitSyncpt32, null) }
|
||||
{ nameof(Host1xClassRegisters.WaitSyncpt32), new RwCallback(WaitSyncpt32, null) },
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,6 @@
|
||||
NonIncrW,
|
||||
GatherW,
|
||||
RestartW,
|
||||
Extend
|
||||
Extend,
|
||||
}
|
||||
}
|
||||
|
@@ -57,7 +57,7 @@ namespace Ryujinx.Graphics.Host1x
|
||||
_state = new DeviceState<ThiRegisters>(new Dictionary<string, RwCallback>
|
||||
{
|
||||
{ nameof(ThiRegisters.IncrSyncpt), new RwCallback(IncrSyncpt, null) },
|
||||
{ nameof(ThiRegisters.Method1), new RwCallback(Method1, null) }
|
||||
{ nameof(ThiRegisters.Method1), new RwCallback(Method1, null) },
|
||||
});
|
||||
|
||||
_previousContextId = -1;
|
||||
|
@@ -127,7 +127,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
|
||||
35, 42, 49, 56, 57, 50, 43, 36,
|
||||
29, 22, 15, 23, 30, 37, 44, 51,
|
||||
58, 59, 52, 45, 38, 31, 39, 46,
|
||||
53, 60, 61, 54, 47, 55, 62, 63
|
||||
53, 60, 61, 54, 47, 55, 62, 63,
|
||||
};
|
||||
|
||||
private static ReadOnlySpan<byte> ZigZagScan => new byte[]
|
||||
@@ -135,7 +135,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.H264
|
||||
0 + 0 * 4, 1 + 0 * 4, 0 + 1 * 4, 0 + 2 * 4,
|
||||
1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4,
|
||||
1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4,
|
||||
3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4
|
||||
3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4,
|
||||
};
|
||||
|
||||
private static void WriteScalingList(ref H264BitStreamWriter writer, IArray<byte> list)
|
||||
|
@@ -10,6 +10,6 @@
|
||||
Verbose = 40,
|
||||
Debug = 48,
|
||||
Trace = 56,
|
||||
MaxOffset = 64
|
||||
MaxOffset = 64,
|
||||
}
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Nvdec.FFmpeg.Native
|
||||
private static readonly Dictionary<string, (int, int)> _librariesWhitelist = new()
|
||||
{
|
||||
{ AvCodecLibraryName, (58, 59) },
|
||||
{ AvUtilLibraryName, (56, 57) }
|
||||
{ AvUtilLibraryName, (56, 57) },
|
||||
};
|
||||
|
||||
private static string FormatLibraryNameForCurrentOs(string libraryName, int version)
|
||||
|
@@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Nvdec
|
||||
_rm = new ResourceManager(gmm, new SurfaceCache(gmm));
|
||||
_state = new DeviceState<NvdecRegisters>(new Dictionary<string, RwCallback>
|
||||
{
|
||||
{ nameof(NvdecRegisters.Execute), new RwCallback(Execute, null) }
|
||||
{ nameof(NvdecRegisters.Execute), new RwCallback(Execute, null) },
|
||||
});
|
||||
_contexts = new ConcurrentDictionary<long, NvdecDecoderContext>();
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.H264
|
||||
FrameType = 0,
|
||||
PicWidthInMbsMinus1 = PicWidthInMbs - 1,
|
||||
PicHeightInMapUnitsMinus1 = (PicHeightInMbs >> (FrameMbsOnlyFlag != 0 ? 0 : 1)) - 1,
|
||||
QpprimeYZeroTransformBypassFlag = QpprimeYZeroTransformBypassFlag
|
||||
QpprimeYZeroTransformBypassFlag = QpprimeYZeroTransformBypassFlag,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp8
|
||||
FirstPartSize = FirstPartSize,
|
||||
Version = Version,
|
||||
FrameWidth = FrameWidth,
|
||||
FrameHeight = FrameHeight
|
||||
FrameHeight = FrameHeight,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,6 @@
|
||||
FrameSizeChanged = 1 << 2,
|
||||
ErrorResilientMode = 1 << 3,
|
||||
LastShowFrame = 1 << 4,
|
||||
IntraOnly = 1 << 5
|
||||
IntraOnly = 1 << 5,
|
||||
}
|
||||
}
|
||||
|
@@ -80,7 +80,7 @@ namespace Ryujinx.Graphics.Nvdec.Types.Vp9
|
||||
SegmentFeatureData = Seg.FeatureData,
|
||||
ModeRefDeltaEnabled = Lf.ModeRefDeltaEnabled != 0,
|
||||
RefDeltas = Lf.RefDeltas,
|
||||
ModeDeltas = Lf.ModeDeltas
|
||||
ModeDeltas = Lf.ModeDeltas,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -114,7 +114,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects
|
||||
originalInfo.SwizzleB,
|
||||
originalInfo.SwizzleA);
|
||||
|
||||
_intermediaryTexture = new TextureStorage(_renderer, info, view.ScaleFactor);
|
||||
_intermediaryTexture = new TextureStorage(_renderer, info);
|
||||
_intermediaryTexture.CreateDefaultView();
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ namespace Ryujinx.Graphics.OpenGL.Effects
|
||||
if (_textureStorage == null || _textureStorage.Info.Width != view.Width || _textureStorage.Info.Height != view.Height)
|
||||
{
|
||||
_textureStorage?.Dispose();
|
||||
_textureStorage = new TextureStorage(_renderer, view.Info, view.ScaleFactor);
|
||||
_textureStorage = new TextureStorage(_renderer, view.Info);
|
||||
_textureStorage.CreateDefaultView();
|
||||
}
|
||||
|
||||
|
@@ -147,8 +147,8 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
|
||||
SwizzleComponent.Blue,
|
||||
SwizzleComponent.Alpha);
|
||||
|
||||
_areaTexture = new TextureStorage(_renderer, areaInfo, 1);
|
||||
_searchTexture = new TextureStorage(_renderer, searchInfo, 1);
|
||||
_areaTexture = new TextureStorage(_renderer, areaInfo);
|
||||
_searchTexture = new TextureStorage(_renderer, searchInfo);
|
||||
|
||||
var areaTexture = EmbeddedResources.Read("Ryujinx.Graphics.OpenGL/Effects/Textures/SmaaAreaTexture.bin");
|
||||
var searchTexture = EmbeddedResources.Read("Ryujinx.Graphics.OpenGL/Effects/Textures/SmaaSearchTexture.bin");
|
||||
@@ -165,11 +165,11 @@ namespace Ryujinx.Graphics.OpenGL.Effects.Smaa
|
||||
if (_outputTexture == null || _outputTexture.Info.Width != view.Width || _outputTexture.Info.Height != view.Height)
|
||||
{
|
||||
_outputTexture?.Dispose();
|
||||
_outputTexture = new TextureStorage(_renderer, view.Info, view.ScaleFactor);
|
||||
_outputTexture = new TextureStorage(_renderer, view.Info);
|
||||
_outputTexture.CreateDefaultView();
|
||||
_edgeOutputTexture = new TextureStorage(_renderer, view.Info, view.ScaleFactor);
|
||||
_edgeOutputTexture = new TextureStorage(_renderer, view.Info);
|
||||
_edgeOutputTexture.CreateDefaultView();
|
||||
_blendOutputTexture = new TextureStorage(_renderer, view.Info, view.ScaleFactor);
|
||||
_blendOutputTexture = new TextureStorage(_renderer, view.Info);
|
||||
_blendOutputTexture.CreateDefaultView();
|
||||
|
||||
DeleteShaders();
|
||||
|
@@ -668,7 +668,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
ShaderStage.TessellationEvaluation => ShaderType.TessEvaluationShader,
|
||||
ShaderStage.Geometry => ShaderType.GeometryShader,
|
||||
ShaderStage.Fragment => ShaderType.FragmentShader,
|
||||
_ => ShaderType.VertexShader
|
||||
_ => ShaderType.VertexShader,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
AmdUnix,
|
||||
IntelWindows,
|
||||
IntelUnix,
|
||||
Nvidia
|
||||
Nvidia,
|
||||
}
|
||||
|
||||
private static readonly Lazy<GpuVendor> _gpuVendor = new(GetGpuVendor);
|
||||
|
@@ -87,7 +87,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
SwizzleComponent.Red,
|
||||
SwizzleComponent.Green,
|
||||
SwizzleComponent.Blue,
|
||||
SwizzleComponent.Alpha), 1f);
|
||||
SwizzleComponent.Alpha));
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@@ -33,7 +33,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
info.BorderColor.Red,
|
||||
info.BorderColor.Green,
|
||||
info.BorderColor.Blue,
|
||||
info.BorderColor.Alpha
|
||||
info.BorderColor.Alpha,
|
||||
};
|
||||
|
||||
GL.SamplerParameter(Handle, SamplerParameterName.TextureBorderColor, borderColor);
|
||||
|
@@ -11,15 +11,13 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
|
||||
public int Width => Info.Width;
|
||||
public int Height => Info.Height;
|
||||
public float ScaleFactor { get; }
|
||||
|
||||
public Target Target => Info.Target;
|
||||
public Format Format => Info.Format;
|
||||
|
||||
public TextureBase(TextureCreateInfo info, float scaleFactor = 1f)
|
||||
public TextureBase(TextureCreateInfo info)
|
||||
{
|
||||
Info = info;
|
||||
ScaleFactor = scaleFactor;
|
||||
|
||||
Handle = GL.GenTexture();
|
||||
}
|
||||
|
@@ -349,7 +349,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
|
||||
public TextureView BgraSwap(TextureView from)
|
||||
{
|
||||
TextureView to = (TextureView)_renderer.CreateTexture(from.Info, from.ScaleFactor);
|
||||
TextureView to = (TextureView)_renderer.CreateTexture(from.Info);
|
||||
|
||||
EnsurePbo(from);
|
||||
|
||||
|
@@ -133,7 +133,7 @@ void main()
|
||||
1 => SizedInternalFormat.R8ui,
|
||||
2 => SizedInternalFormat.Rg8ui,
|
||||
4 => SizedInternalFormat.Rgba8ui,
|
||||
_ => throw new ArgumentException($"Invalid components count {componentsCount}.")
|
||||
_ => throw new ArgumentException($"Invalid components count {componentsCount}."),
|
||||
};
|
||||
}
|
||||
else if (componentSize == 2)
|
||||
@@ -143,7 +143,7 @@ void main()
|
||||
1 => SizedInternalFormat.R16ui,
|
||||
2 => SizedInternalFormat.Rg16ui,
|
||||
4 => SizedInternalFormat.Rgba16ui,
|
||||
_ => throw new ArgumentException($"Invalid components count {componentsCount}.")
|
||||
_ => throw new ArgumentException($"Invalid components count {componentsCount}."),
|
||||
};
|
||||
}
|
||||
else if (componentSize == 4)
|
||||
@@ -153,7 +153,7 @@ void main()
|
||||
1 => SizedInternalFormat.R32ui,
|
||||
2 => SizedInternalFormat.Rg32ui,
|
||||
4 => SizedInternalFormat.Rgba32ui,
|
||||
_ => throw new ArgumentException($"Invalid components count {componentsCount}.")
|
||||
_ => throw new ArgumentException($"Invalid components count {componentsCount}."),
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@@ -173,7 +173,7 @@ void main()
|
||||
4 => SizedInternalFormat.R32ui,
|
||||
8 => SizedInternalFormat.Rg32ui,
|
||||
16 => SizedInternalFormat.Rgba32ui,
|
||||
_ => throw new ArgumentException($"Invalid bytes per pixel {bytesPerPixel}.")
|
||||
_ => throw new ArgumentException($"Invalid bytes per pixel {bytesPerPixel}."),
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,6 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
{
|
||||
public ITextureInfo Storage => this;
|
||||
public int Handle { get; private set; }
|
||||
public float ScaleFactor { get; private set; }
|
||||
|
||||
public TextureCreateInfo Info { get; }
|
||||
|
||||
@@ -18,13 +17,12 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
|
||||
internal ITexture DefaultView { get; private set; }
|
||||
|
||||
public TextureStorage(OpenGLRenderer renderer, TextureCreateInfo info, float scaleFactor)
|
||||
public TextureStorage(OpenGLRenderer renderer, TextureCreateInfo info)
|
||||
{
|
||||
_renderer = renderer;
|
||||
Info = info;
|
||||
|
||||
Handle = GL.GenTexture();
|
||||
ScaleFactor = scaleFactor;
|
||||
|
||||
CreateImmutableStorage();
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
TextureStorage parent,
|
||||
TextureCreateInfo info,
|
||||
int firstLayer,
|
||||
int firstLevel) : base(info, parent.ScaleFactor)
|
||||
int firstLevel) : base(info)
|
||||
{
|
||||
_renderer = renderer;
|
||||
_parent = parent;
|
||||
@@ -72,7 +72,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
(int)Info.SwizzleR.Convert(),
|
||||
(int)Info.SwizzleG.Convert(),
|
||||
(int)Info.SwizzleB.Convert(),
|
||||
(int)Info.SwizzleA.Convert()
|
||||
(int)Info.SwizzleA.Convert(),
|
||||
};
|
||||
|
||||
if (Info.Format == Format.A1B5G5R5Unorm)
|
||||
@@ -210,7 +210,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
{
|
||||
Target.Texture2DMultisample => Target.Texture2D,
|
||||
Target.Texture2DMultisampleArray => Target.Texture2DArray,
|
||||
_ => Target
|
||||
_ => Target,
|
||||
};
|
||||
|
||||
TextureView intermmediate = _renderer.TextureCopy.IntermediatePool.GetOrCreateWithAtLeast(
|
||||
@@ -354,7 +354,7 @@ namespace Ryujinx.Graphics.OpenGL.Image
|
||||
TextureTarget.TextureCubeMapArray => (layer / 6) * mipSize,
|
||||
TextureTarget.Texture1DArray => layer * mipSize,
|
||||
TextureTarget.Texture2DArray => layer * mipSize,
|
||||
_ => 0
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -95,7 +95,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
return new Sampler(info);
|
||||
}
|
||||
|
||||
public ITexture CreateTexture(TextureCreateInfo info, float scaleFactor)
|
||||
public ITexture CreateTexture(TextureCreateInfo info)
|
||||
{
|
||||
if (info.Target == Target.TextureBuffer)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResourcePool.GetTextureOrNull(info, scaleFactor) ?? new TextureStorage(this, info, scaleFactor).CreateDefaultView();
|
||||
return ResourcePool.GetTextureOrNull(info) ?? new TextureStorage(this, info).CreateDefaultView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,9 +194,9 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
ResourcePool.Tick();
|
||||
}
|
||||
|
||||
public ICounterEvent ReportCounter(CounterType type, EventHandler<ulong> resultHandler, bool hostReserved)
|
||||
public ICounterEvent ReportCounter(CounterType type, EventHandler<ulong> resultHandler, float divisor, bool hostReserved)
|
||||
{
|
||||
return _counters.QueueReport(type, resultHandler, _pipeline.DrawCount, hostReserved);
|
||||
return _counters.QueueReport(type, resultHandler, divisor, _pipeline.DrawCount, hostReserved);
|
||||
}
|
||||
|
||||
public void Initialize(GraphicsDebugLevel glLogLevel)
|
||||
@@ -210,8 +210,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
GL.Arb.MaxShaderCompilerThreads(Math.Min(Environment.ProcessorCount, 8));
|
||||
}
|
||||
|
||||
_pipeline.Initialize(this);
|
||||
_counters.Initialize(_pipeline);
|
||||
_counters.Initialize();
|
||||
|
||||
// This is required to disable [0, 1] clamping for SNorm outputs on compatibility profiles.
|
||||
// This call is expected to fail if we're running with a core profile,
|
||||
|
@@ -5,7 +5,6 @@ using Ryujinx.Graphics.OpenGL.Image;
|
||||
using Ryujinx.Graphics.OpenGL.Queries;
|
||||
using Ryujinx.Graphics.Shader;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Graphics.OpenGL
|
||||
{
|
||||
@@ -45,8 +44,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
private CounterQueueEvent _activeConditionalRender;
|
||||
|
||||
private readonly Vector4<int>[] _fpIsBgra = new Vector4<int>[SupportBuffer.FragmentIsBgraCount];
|
||||
private readonly Vector4<float>[] _renderScale = new Vector4<float>[73];
|
||||
private int _fragmentScaleCount;
|
||||
|
||||
private readonly (TextureBase, Format)[] _images;
|
||||
private TextureBase _unit0Texture;
|
||||
@@ -66,7 +63,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
private bool _tfEnabled;
|
||||
private TransformFeedbackPrimitiveType _tfTopology;
|
||||
|
||||
private SupportBufferUpdater _supportBuffer;
|
||||
private readonly BufferHandle[] _tfbs;
|
||||
private readonly BufferRange[] _tfbTargets;
|
||||
|
||||
@@ -84,22 +80,10 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
|
||||
_images = new (TextureBase, Format)[SavedImages];
|
||||
|
||||
var defaultScale = new Vector4<float> { X = 1f, Y = 0f, Z = 0f, W = 0f };
|
||||
new Span<Vector4<float>>(_renderScale).Fill(defaultScale);
|
||||
|
||||
_tfbs = new BufferHandle[Constants.MaxTransformFeedbackBuffers];
|
||||
_tfbTargets = new BufferRange[Constants.MaxTransformFeedbackBuffers];
|
||||
}
|
||||
|
||||
public void Initialize(OpenGLRenderer renderer)
|
||||
{
|
||||
_supportBuffer = new SupportBufferUpdater(renderer);
|
||||
GL.BindBufferBase(BufferRangeTarget.UniformBuffer, 0, Unsafe.As<BufferHandle, int>(ref _supportBuffer.Handle));
|
||||
|
||||
_supportBuffer.UpdateFragmentIsBgra(_fpIsBgra, 0, SupportBuffer.FragmentIsBgraCount);
|
||||
_supportBuffer.UpdateRenderScale(_renderScale, 0, SupportBuffer.RenderScaleMaxCount);
|
||||
}
|
||||
|
||||
public void Barrier()
|
||||
{
|
||||
GL.MemoryBarrier(MemoryBarrierFlags.AllBarrierBits);
|
||||
@@ -684,8 +668,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
{
|
||||
if (texture is TextureView view && sampler is Sampler samp)
|
||||
{
|
||||
_supportBuffer.Commit();
|
||||
|
||||
if (HwCapabilities.SupportsDrawTexture)
|
||||
{
|
||||
GL.NV.DrawTexture(
|
||||
@@ -777,16 +759,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
_tfEnabled = false;
|
||||
}
|
||||
|
||||
public double GetCounterDivisor(CounterType type)
|
||||
{
|
||||
if (type == CounterType.SamplesPassed)
|
||||
{
|
||||
return _renderScale[0].X * _renderScale[0].X;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void SetAlphaTest(bool enable, float reference, CompareOp op)
|
||||
{
|
||||
if (!enable)
|
||||
@@ -1172,12 +1144,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
_rasterizerDiscard = discard;
|
||||
}
|
||||
|
||||
public void SetRenderTargetScale(float scale)
|
||||
{
|
||||
_renderScale[0].X = scale;
|
||||
_supportBuffer.UpdateRenderScale(_renderScale, 0, 1); // Just the first element.
|
||||
}
|
||||
|
||||
public void SetRenderTargetColorMasks(ReadOnlySpan<uint> componentMasks)
|
||||
{
|
||||
_componentMasks = 0;
|
||||
@@ -1194,8 +1160,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
{
|
||||
EnsureFramebuffer();
|
||||
|
||||
bool isBgraChanged = false;
|
||||
|
||||
for (int index = 0; index < colors.Length; index++)
|
||||
{
|
||||
TextureView color = (TextureView)colors[index];
|
||||
@@ -1209,18 +1173,12 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
if (_fpIsBgra[index].X != isBgra)
|
||||
{
|
||||
_fpIsBgra[index].X = isBgra;
|
||||
isBgraChanged = true;
|
||||
|
||||
RestoreComponentMask(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isBgraChanged)
|
||||
{
|
||||
_supportBuffer.UpdateFragmentIsBgra(_fpIsBgra, 0, SupportBuffer.FragmentIsBgraCount);
|
||||
}
|
||||
|
||||
TextureView depthStencilView = (TextureView)depthStencil;
|
||||
|
||||
_framebuffer.AttachDepthStencil(depthStencilView);
|
||||
@@ -1411,7 +1369,7 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
_vertexArray.SetVertexBuffers(vertexBuffers);
|
||||
}
|
||||
|
||||
public void SetViewports(ReadOnlySpan<Viewport> viewports, bool disableTransform)
|
||||
public void SetViewports(ReadOnlySpan<Viewport> viewports)
|
||||
{
|
||||
Array.Resize(ref _viewportArray, viewports.Length * 4);
|
||||
Array.Resize(ref _depthRangeArray, viewports.Length * 2);
|
||||
@@ -1450,19 +1408,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
|
||||
GL.ViewportArray(0, viewports.Length, viewportArray);
|
||||
GL.DepthRangeArray(0, viewports.Length, depthRangeArray);
|
||||
|
||||
float disableTransformF = disableTransform ? 1.0f : 0.0f;
|
||||
if (_supportBuffer.Data.ViewportInverse.W != disableTransformF || disableTransform)
|
||||
{
|
||||
float scale = _renderScale[0].X;
|
||||
_supportBuffer.UpdateViewportInverse(new Vector4<float>
|
||||
{
|
||||
X = scale * 2f / viewports[0].Region.Width,
|
||||
Y = scale * 2f / viewports[0].Region.Height,
|
||||
Z = 1,
|
||||
W = disableTransformF
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void TextureBarrier()
|
||||
@@ -1552,36 +1497,9 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
return (_boundDrawFramebuffer, _boundReadFramebuffer);
|
||||
}
|
||||
|
||||
public void UpdateRenderScale(ReadOnlySpan<float> scales, int totalCount, int fragmentCount)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
for (int index = 0; index < totalCount; index++)
|
||||
{
|
||||
if (_renderScale[1 + index].X != scales[index])
|
||||
{
|
||||
_renderScale[1 + index].X = scales[index];
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Only update fragment count if there are scales after it for the vertex stage.
|
||||
if (fragmentCount != totalCount && fragmentCount != _fragmentScaleCount)
|
||||
{
|
||||
_fragmentScaleCount = fragmentCount;
|
||||
_supportBuffer.UpdateFragmentRenderScaleCount(_fragmentScaleCount);
|
||||
}
|
||||
|
||||
if (changed)
|
||||
{
|
||||
_supportBuffer.UpdateRenderScale(_renderScale, 0, 1 + totalCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void PrepareForDispatch()
|
||||
{
|
||||
_unit0Texture?.Bind(0);
|
||||
_supportBuffer.Commit();
|
||||
}
|
||||
|
||||
private void PreDraw(int vertexCount)
|
||||
@@ -1601,7 +1519,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
DrawCount++;
|
||||
|
||||
_unit0Texture?.Bind(0);
|
||||
_supportBuffer.Commit();
|
||||
}
|
||||
|
||||
private void PostDraw()
|
||||
@@ -1752,8 +1669,6 @@ namespace Ryujinx.Graphics.OpenGL
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_supportBuffer?.Dispose();
|
||||
|
||||
for (int i = 0; i < Constants.MaxTransformFeedbackBuffers; i++)
|
||||
{
|
||||
if (_tfbs[i] != BufferHandle.Null)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user