Compare commits

..

4 Commits

Author SHA1 Message Date
CamilleLaVey 01ca6071c5 Quick tests 2026-09-11 02:15:04 -04:00
CamilleLaVey bbae69f09a Remove fp16 toggle 2026-09-11 01:15:41 -04:00
CamilleLaVey d1867be6eb More changes to UI. 2026-09-11 00:23:01 -04:00
CamilleLaVey 8968534d75 Another intent to refine LSFG UI 2026-09-10 22:34:59 -04:00
45 changed files with 543 additions and 285 deletions
@@ -9,6 +9,7 @@ import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.RadioGroup
import android.widget.TextView
import androidx.drawerlayout.widget.DrawerLayout
@@ -673,6 +674,167 @@ class QuickSettings(val emulationFragment: EmulationFragment) {
}
}
private fun addFrameGenCell(inflater: LayoutInflater, row: ViewGroup): TextView {
val cell = inflater.inflate(R.layout.item_quick_settings_frame_gen_cell, row, false)
as TextView
row.addView(cell)
return cell
}
fun addFrameGen(container: ViewGroup) {
val inflater = LayoutInflater.from(emulationFragment.requireContext())
val itemView = inflater.inflate(R.layout.item_quick_settings_frame_gen, container, false)
val multiplierRow = itemView.findViewById<LinearLayout>(R.id.frame_gen_multipliers)
val targetRow = itemView.findViewById<LinearLayout>(R.id.frame_gen_targets)
val targetSection = itemView.findViewById<ViewGroup>(R.id.frame_gen_target_section)
val flowRow = itemView.findViewById<LinearLayout>(R.id.frame_gen_flow)
val flowSection = itemView.findViewById<ViewGroup>(R.id.frame_gen_flow_section)
val multiplierNames =
emulationFragment.resources.getStringArray(R.array.frameGenMultiplierNames)
val multiplierValues =
emulationFragment.resources.getIntArray(R.array.frameGenMultiplierValues)
val targetValues =
emulationFragment.resources.getIntArray(R.array.frameGenTargetRateValues)
val flowValues =
emulationFragment.resources.getIntArray(R.array.frameGenFlowScaleValues)
val columns = maxOf(
multiplierValues.size + 1,
targetValues.size,
flowValues.size + 1
).toFloat()
multiplierRow.weightSum = columns
targetRow.weightSum = columns
flowRow.weightSum = columns
val powerCell = addFrameGenCell(inflater, multiplierRow)
val multiplierCells = mutableListOf<TextView>()
for (name in multiplierNames) {
val cell = addFrameGenCell(inflater, multiplierRow)
cell.text = name
multiplierCells.add(cell)
}
val targetCells = mutableListOf<TextView>()
for (value in targetValues) {
val cell = addFrameGenCell(inflater, targetRow)
if (value == 0) {
cell.setText(R.string.frame_gen_fixed)
} else {
cell.text = value.toString()
}
targetCells.add(cell)
}
val autoCell = addFrameGenCell(inflater, flowRow)
autoCell.setText(R.string.frame_gen_flow_auto)
val flowCells = mutableListOf<TextView>()
for (value in flowValues) {
val cell = addFrameGenCell(inflater, flowRow)
cell.text = "$value%"
flowCells.add(cell)
}
val inactiveAlpha = 0.38f
fun refresh() {
val enabled = BooleanSetting.RENDERER_FRAME_GEN.getBoolean(needsGlobal = false)
val multiplier = IntSetting.RENDERER_FRAME_GEN_MULTIPLIER.getInt(needsGlobal = false)
val target = IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.getInt(needsGlobal = false)
val fixed = target == 0
val flowAuto =
BooleanSetting.RENDERER_FRAME_GEN_FLOW_SCALE_AUTO.getBoolean(needsGlobal = false)
val flowScale = IntSetting.RENDERER_FRAME_GEN_FLOW_SCALE.getInt(needsGlobal = false)
var powerLabel = R.string.frame_gen_off
var rowAlpha = inactiveAlpha
if (enabled) {
powerLabel = R.string.frame_gen_on
rowAlpha = 1.0f
}
var multiplierAlpha = inactiveAlpha
if (enabled && fixed) {
multiplierAlpha = 1.0f
}
powerCell.setText(powerLabel)
powerCell.isSelected = enabled
multiplierCells.forEachIndexed { index, cell ->
cell.isEnabled = enabled
cell.isSelected = enabled && fixed && multiplierValues[index] == multiplier
cell.alpha = multiplierAlpha
}
targetSection.alpha = rowAlpha
targetCells.forEachIndexed { index, cell ->
cell.isEnabled = enabled
cell.isSelected = enabled && targetValues[index] == target
}
flowSection.alpha = rowAlpha
autoCell.isEnabled = enabled
autoCell.isSelected = enabled && flowAuto
flowCells.forEachIndexed { index, cell ->
cell.isEnabled = enabled
cell.isSelected = enabled && !flowAuto && flowValues[index] == flowScale
}
}
powerCell.setOnClickListener {
if (BooleanSetting.RENDERER_FRAME_GEN.getBoolean(needsGlobal = false)) {
BooleanSetting.RENDERER_FRAME_GEN.setBoolean(false)
} else {
IntSetting.RENDERER_FRAME_GEN_MULTIPLIER.setInt(multiplierValues.first())
IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.setInt(0)
BooleanSetting.RENDERER_FRAME_GEN.setBoolean(true)
}
saveSettings()
refresh()
}
multiplierCells.forEachIndexed { index, cell ->
cell.setOnClickListener {
IntSetting.RENDERER_FRAME_GEN_MULTIPLIER.setInt(multiplierValues[index])
IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.setInt(0)
saveSettings()
refresh()
}
}
targetCells.forEachIndexed { index, cell ->
cell.setOnClickListener {
IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.setInt(targetValues[index])
saveSettings()
refresh()
}
}
autoCell.setOnClickListener {
BooleanSetting.RENDERER_FRAME_GEN_FLOW_SCALE_AUTO.setBoolean(true)
saveSettings()
refresh()
}
flowCells.forEachIndexed { index, cell ->
cell.setOnClickListener {
IntSetting.RENDERER_FRAME_GEN_FLOW_SCALE.setInt(flowValues[index])
BooleanSetting.RENDERER_FRAME_GEN_FLOW_SCALE_AUTO.setBoolean(false)
saveSettings()
refresh()
}
}
refresh()
container.addView(itemView)
}
fun addDivider(container: ViewGroup) {
val inflater = LayoutInflater.from(emulationFragment.requireContext())
val dividerView = inflater.inflate(R.layout.item_quick_settings_divider, container, false)
@@ -38,9 +38,7 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
RENDERER_VERTEX_INPUT_DYNAMIC_STATE("vertex_input_dynamic_state"),
RENDERER_SAMPLE_SHADING("sample_shading"),
RENDERER_FRAME_GEN("frame_gen"),
RENDERER_FRAME_GEN_FP16("frame_gen_fp16"),
RENDERER_FRAME_GEN_FLOW_SCALE_AUTO("frame_gen_flow_scale_auto"),
RENDERER_FRAME_GEN_DUMP_FLOW("frame_gen_dump_flow"),
GPU_UNSWIZZLE_ENABLED("gpu_unswizzle_enabled"),
PICTURE_IN_PICTURE("picture_in_picture"),
USE_CUSTOM_RTC("custom_rtc_enabled"),
@@ -123,9 +123,7 @@ abstract class SettingsItem(
IntSetting.RENDERER_FRAME_GEN_TARGET_RATE.key,
IntSetting.RENDERER_FRAME_GEN_QUEUE_TARGET.key,
BooleanSetting.RENDERER_FRAME_GEN_FLOW_SCALE_AUTO.key,
IntSetting.RENDERER_FRAME_GEN_FLOW_SCALE.key,
BooleanSetting.RENDERER_FRAME_GEN_FP16.key,
BooleanSetting.RENDERER_FRAME_GEN_DUMP_FLOW.key
IntSetting.RENDERER_FRAME_GEN_FLOW_SCALE.key
)
const val TYPE_HEADER = 0
@@ -709,20 +707,6 @@ abstract class SettingsItem(
units = "%"
)
)
put(
SwitchSetting(
BooleanSetting.RENDERER_FRAME_GEN_FP16,
titleId = R.string.frame_gen_fp16,
descriptionId = R.string.frame_gen_fp16_description
)
)
put(
SwitchSetting(
BooleanSetting.RENDERER_FRAME_GEN_DUMP_FLOW,
titleId = R.string.frame_gen_dump_flow,
descriptionId = R.string.frame_gen_dump_flow_description
)
)
put(
SingleChoiceSetting(
IntSetting.RENDERER_SCREEN_LAYOUT,
@@ -124,7 +124,6 @@ class SettingsFragmentPresenter(
) {
add(IntSetting.RENDERER_FRAME_GEN_FLOW_SCALE.key)
}
add(BooleanSetting.RENDERER_FRAME_GEN_FP16.key)
}
}
@@ -1553,7 +1552,6 @@ class SettingsFragmentPresenter(
add(BooleanSetting.DUMP_GUEST_SHADERS.key)
add(BooleanSetting.GPU_LOG_SHADER_DUMPS.key)
add(BooleanSetting.DUMP_MACROS.key)
add(BooleanSetting.RENDERER_FRAME_GEN_DUMP_FLOW.key)
add(BooleanSetting.GPU_LOG_MEMORY_TRACKING.key)
add(BooleanSetting.GPU_LOG_DRIVER_DEBUG.key)
add(IntSetting.GPU_LOG_RING_BUFFER_SIZE.key)
@@ -92,6 +92,7 @@ import org.yuzu.yuzu_emu.utils.GameIconUtils
import org.yuzu.yuzu_emu.utils.GpuDriverHelper
import org.yuzu.yuzu_emu.utils.InputHandler
import org.yuzu.yuzu_emu.utils.Log
import org.yuzu.yuzu_emu.utils.LosslessScalingHelper
import org.yuzu.yuzu_emu.utils.NativeConfig
import org.yuzu.yuzu_emu.utils.NativeFreedrenoConfig
import org.yuzu.yuzu_emu.utils.NativePostProcessing
@@ -1188,6 +1189,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
quickSettings.addDivider(container)
if (LosslessScalingHelper.isInstalled() && LosslessScalingHelper.isSupportedByGpu()) {
quickSettings.addFrameGen(container)
quickSettings.addDivider(container)
}
quickSettings.addIntSetting(
R.string.renderer_accuracy,
container,
+8 -4
View File
@@ -1168,7 +1168,7 @@ VkPhysicalDeviceProperties GetVulkanDeviceProperties() {
return physical_device.GetProperties();
}
bool GetVulkanMemoryModelSupport() {
bool GetFrameGenerationSupport() {
Common::DynamicLibrary library;
if (!library.Open("libvulkan.so")) {
return false;
@@ -1183,9 +1183,13 @@ bool GetVulkanMemoryModelSupport() {
const Vulkan::vk::PhysicalDevice physical_device(physical_devices[0], dld);
VkPhysicalDeviceShaderFloat16Int8Features float16_int8{
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES,
.pNext = nullptr,
};
VkPhysicalDeviceVulkanMemoryModelFeatures memory_model{
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES,
.pNext = nullptr,
.pNext = &float16_int8,
};
VkPhysicalDeviceFeatures2 features{
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
@@ -1193,7 +1197,7 @@ bool GetVulkanMemoryModelSupport() {
};
physical_device.GetFeatures2(features);
return memory_model.vulkanMemoryModel == VK_TRUE;
return memory_model.vulkanMemoryModel == VK_TRUE && float16_int8.shaderFloat16 == VK_TRUE;
}
} // namespace
@@ -1272,7 +1276,7 @@ jstring Java_org_yuzu_yuzu_1emu_NativeLibrary_getVulkanApiVersion(JNIEnv* env, j
jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_supportsFrameGeneration(JNIEnv* env, jobject jobj) {
try {
return static_cast<jboolean>(GetVulkanMemoryModelSupport());
return static_cast<jboolean>(GetFrameGenerationSupport());
} catch (...) {
return static_cast<jboolean>(false);
}
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/colorOnPrimary" android:state_selected="true" />
<item android:color="?attr/colorOnSurface" />
</selector>
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<selector>
<item android:state_selected="true">
<shape android:shape="rectangle">
<solid android:color="?attr/colorPrimary" />
<corners android:radius="8dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="8dp" />
<stroke
android:width="1dp"
android:color="?attr/colorOutline" />
</shape>
</item>
</selector>
</item>
</ripple>
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="24dp"
android:paddingEnd="18dp"
android:paddingTop="12dp"
android:paddingBottom="8dp">
<com.google.android.material.textview.MaterialTextView
style="@style/TextAppearance.Material3.TitleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:text="@string/frame_gen" />
<com.google.android.material.textview.MaterialTextView
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginEnd="6dp"
android:text="@string/frame_gen_quick_description"
android:textColor="?attr/colorOnSurfaceVariant" />
<LinearLayout
android:id="@+id/frame_gen_multipliers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/frame_gen_target_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="24dp"
android:paddingEnd="18dp"
android:paddingTop="12dp"
android:paddingBottom="8dp">
<com.google.android.material.textview.MaterialTextView
style="@style/TextAppearance.Material3.TitleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:text="@string/frame_gen_target_rate" />
<com.google.android.material.textview.MaterialTextView
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginEnd="6dp"
android:text="@string/frame_gen_target_rate_quick_description"
android:textColor="?attr/colorOnSurfaceVariant" />
<LinearLayout
android:id="@+id/frame_gen_targets"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal" />
</LinearLayout>
<LinearLayout
android:id="@+id/frame_gen_flow_section"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="24dp"
android:paddingEnd="18dp"
android:paddingTop="12dp"
android:paddingBottom="8dp">
<com.google.android.material.textview.MaterialTextView
style="@style/TextAppearance.Material3.TitleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:text="@string/frame_gen_flow_scale" />
<com.google.android.material.textview.MaterialTextView
style="@style/TextAppearance.Material3.BodySmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginEnd="6dp"
android:text="@string/frame_gen_flow_scale_quick_description"
android:textColor="?attr/colorOnSurfaceVariant" />
<LinearLayout
android:id="@+id/frame_gen_flow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal" />
</LinearLayout>
</LinearLayout>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.textview.MaterialTextView xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/TextAppearance.Material3.LabelLarge"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="1"
android:layout_marginEnd="6dp"
android:background="@drawable/frame_gen_cell_background"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:maxLines="1"
android:textColor="@color/frame_gen_cell_text" />
@@ -305,8 +305,6 @@
<string name="frame_gen_target_rate_60">60 إطارًا في الثانية</string>
<string name="frame_gen_target_rate_90">90 إطارًا في الثانية</string>
<string name="frame_gen_target_rate_120">120 إطارًا في الثانية</string>
<string name="frame_gen_target_rate_144">144 إطارًا في الثانية</string>
<string name="frame_gen_target_rate_165">165 إطارًا في الثانية</string>
<string name="frame_gen_queue_target">هدف قائمة انتظار الإطارات</string>
<string name="frame_gen_queue_target_description">كم عدد الإطارات المكتملة التي قد تنتظر قبل عرضها؟ تعمل قوائم الانتظار الأكبر حجمًا على امتصاص الارتفاعات المفاجئة في حمل وحدة معالجة الرسومات على حساب زمن انتقال الإدخال.</string>
<string name="frame_gen_queue_target_0">أقل زمن انتقال (بدون تخزين مؤقت)</string>
@@ -316,10 +314,6 @@
<string name="frame_gen_flow_scale_auto_description">قم بتقدير الحركة بناءً على الدقة التي تعرضها اللعبة فعليًّا، بدلاً من الإخراج الذي تم رفع دقته. ولا يؤثر ذلك على الدقة بأي شكل، لأن رفع الدقة لا يضيف أي تفاصيل تتعلق بالحركة.</string>
<string name="frame_gen_flow_scale">دقة تقدير الحركة</string>
<string name="frame_gen_flow_scale_description">دقة مسار التدفق البصري، كجزء من الناتج. ويُعد خفض هذه القيمة أرخص طريقة لاستعادة الأداء.</string>
<string name="frame_gen_fp16">مُظلِّلات نصف الدقة</string>
<string name="frame_gen_fp16_description">استخدم نسخة التظليل 16 بت. يتم التراجع تلقائيًا إلى الخيار البديل في حالة عدم توفرها في برنامج التشغيل أو الملف.</string>
<string name="frame_gen_dump_flow">إفراغ الإطار الذي تم إنشاؤه</string>
<string name="frame_gen_dump_flow_description">قم بكتابة مستويات MIP للتدفق البصري والإطار المُستكمل إلى مجلد lossless/debug مرة واحدة، لغرض استكشاف الأخطاء وإصلاحها</string>
<string name="frame_gen_unsupported">توليد الإطار غير متاح</string>
<string name="frame_gen_unsupported_description">لا يدعم برنامج تشغيل وحدة معالجة الرسومات هذا نموذج ذاكرة Vulkan، الذي تتطلبه برامج التظليل الخاصة بـ«Lossless Scaling».</string>
<string name="lossless_scaling_setup_description">اختياري. قم بتوفير ملف Lossless.dll الخاص بك لتمكين إنشاء الإطارات لاحقًا</string>
@@ -304,8 +304,6 @@
<string name="frame_gen_target_rate_60">60 FPS</string>
<string name="frame_gen_target_rate_90">90 FPS</string>
<string name="frame_gen_target_rate_120">120 FPS</string>
<string name="frame_gen_target_rate_144">144 FPS</string>
<string name="frame_gen_target_rate_165">165 FPS</string>
<string name="frame_gen_queue_target_1">Ausbalanciert (1 Bild)</string>
<string name="frame_gen_queue_target_2">Flüssigste (2 Bilder)</string>
<string name="frame_gen_unsupported">Frame-Generation nicht verfügbar</string>
@@ -301,12 +301,9 @@
<string name="frame_gen_target_rate_60">60 FPS</string>
<string name="frame_gen_target_rate_90">90 FPS</string>
<string name="frame_gen_target_rate_120">120 FPS</string>
<string name="frame_gen_target_rate_144">144 FPS</string>
<string name="frame_gen_target_rate_165">165 FPS</string>
<string name="frame_gen_queue_target_0">Latencia más baja (Sin búfer)</string>
<string name="frame_gen_queue_target_1">Equilibrado (1 fotograma)</string>
<string name="frame_gen_queue_target_2">Más suave (2 fotogramas)</string>
<string name="frame_gen_fp16">Sombreadores de media precisión</string>
<string name="frame_gen_unsupported">Generación de fotogramas no disponbile</string>
<string name="lossless_scaling_install">Instalar Lossless.dll</string>
<string name="lossless_scaling_replace_description">Seleccionar una copia diferente de Lossless.dll</string>
@@ -308,10 +308,6 @@
<string name="frame_gen_flow_scale_auto_description">Оценивать движение в разрешении, которое игра действительно рендерит, вместо масштабированного вывода. Ничего не стоит в точности, так как масштабирование не добавляет деталей движения.</string>
<string name="frame_gen_flow_scale">Разрешение оценки движения</string>
<string name="frame_gen_flow_scale_description">Разрешение прохода оптического потока в долях от выходного разрешения. Его понижение — самый дешёвый способ вернуть производительность.</string>
<string name="frame_gen_fp16">Шейдеры половинной точности</string>
<string name="frame_gen_fp16_description">Использовать 16-битную версию шейдеров. Автоматически переключается на обычную, если драйвер или файл не поддерживают её.</string>
<string name="frame_gen_dump_flow">Сохранить сгенерированный кадр</string>
<string name="frame_gen_dump_flow_description">Однократно записать уровни мип-карт оптического потока и интерполированный кадр в папку lossless/debug для диагностики.</string>
<string name="frame_gen_unsupported">Генерация кадров недоступна</string>
<string name="frame_gen_unsupported_description">Драйвер ГПУ не поддерживает модель памяти Vulkan, требуемую шейдерами Lossless Scaling.</string>
<string name="lossless_scaling_setup_description">Опционально. Укажите свой Lossless.dll для включения генерации кадров позже.</string>
@@ -305,8 +305,6 @@
<string name="frame_gen_target_rate_60">60 FPS</string>
<string name="frame_gen_target_rate_90">90 FPS</string>
<string name="frame_gen_target_rate_120">120 FPS</string>
<string name="frame_gen_target_rate_144">144 FPS</string>
<string name="frame_gen_target_rate_165">165 FPS</string>
<string name="frame_gen_queue_target">帧队列目标</string>
<string name="frame_gen_queue_target_description">在显示之前有多少已完成渲染的帧正在等待。较大的队列可以缓解 GPU 突发的压力,但会增加输入延迟。</string>
<string name="frame_gen_queue_target_0">最低延迟 (无缓冲)</string>
@@ -316,10 +314,6 @@
<string name="frame_gen_flow_scale_auto_description">在游戏实际渲染的分辨率下估算运动,而不是在放大后的输出上。不会影响精确性,因为放大并不会增加运动细节。</string>
<string name="frame_gen_flow_scale">运动预估分辨率</string>
<string name="frame_gen_flow_scale_description">光流通道的分辨率,以输出的比例表示。降低它是提升性能最经济的做法。</string>
<string name="frame_gen_fp16">半精度着色器</string>
<string name="frame_gen_fp16_description">使用 16 位着色器变体。如果驱动或文件不支持会自动回退。</string>
<string name="frame_gen_dump_flow">转储已生成的帧</string>
<string name="frame_gen_dump_flow_description">为了排查问题,把光流 mip 级别和插值帧写入 lossless/debug 文件夹一次</string>
<string name="frame_gen_unsupported">帧生成不可用</string>
<string name="frame_gen_unsupported_description">这个 GPU 驱动不支持无损缩放着色器所需的 Vulkan 内存模型。</string>
<string name="lossless_scaling_setup_description">作为可选项。请提供您自己的 Lossless.dll 以便在之后可以启用帧生成。</string>
@@ -305,8 +305,6 @@
<string name="frame_gen_target_rate_60">60 FPS</string>
<string name="frame_gen_target_rate_90">90 FPS</string>
<string name="frame_gen_target_rate_120">120 FPS</string>
<string name="frame_gen_target_rate_144">144 FPS</string>
<string name="frame_gen_target_rate_165">165 FPS</string>
<string name="frame_gen_queue_target">影格佇列目標</string>
<string name="frame_gen_queue_target_description">最多允許多少個已完成的影格在顯示器前等待,較大的佇列可以吸收 GPU 突發負載,但會增加輸入延遲</string>
<string name="frame_gen_queue_target_0">最低延遲(無緩衝)</string>
@@ -316,10 +314,6 @@
<string name="frame_gen_flow_scale_auto_description">以遊戲實際渲染的解析度而非升頻後的輸出進行運動預測。由於升頻後不會增加任何動態細節,因此不會影響準確度</string>
<string name="frame_gen_flow_scale">運動預測解析度</string>
<string name="frame_gen_flow_scale_description">光流處理的解析度,以輸出解析度的比例表示。降低此設定值是減少效能負載最有效的方法</string>
<string name="frame_gen_fp16">半準確著色器</string>
<string name="frame_gen_fp16_description">使用16位元著色器。如果驅動程式或著色器檔案不支援則會自動切換成其它版本</string>
<string name="frame_gen_dump_flow">傾印生成的著色器</string>
<string name="frame_gen_dump_flow_description">將光流的 MIP 層級與補間影格寫入 Eden 資料夾中的 lossless\debug 資料夾以便進行疑難排解</string>
<string name="frame_gen_unsupported">無法使用影格生成</string>
<string name="frame_gen_unsupported_description">Lossless Scaling 的著色器需要 Vulkan 記憶體模型,所選的驅動程式不支援該功能</string>
<string name="lossless_scaling_setup_description">可選擇安裝自己擁有的 Lossless.dll 以在之後啟用影格生成功能</string>
@@ -174,8 +174,6 @@
<item>@string/frame_gen_target_rate_60</item>
<item>@string/frame_gen_target_rate_90</item>
<item>@string/frame_gen_target_rate_120</item>
<item>@string/frame_gen_target_rate_144</item>
<item>@string/frame_gen_target_rate_165</item>
</string-array>
<integer-array name="frameGenTargetRateValues">
@@ -183,8 +181,12 @@
<item>60</item>
<item>90</item>
<item>120</item>
<item>144</item>
<item>165</item>
</integer-array>
<integer-array name="frameGenFlowScaleValues">
<item>50</item>
<item>75</item>
<item>100</item>
</integer-array>
<string-array name="frameGenQueueTargetNames">
@@ -331,8 +331,13 @@
<string name="frame_gen_target_rate_60">60 FPS</string>
<string name="frame_gen_target_rate_90">90 FPS</string>
<string name="frame_gen_target_rate_120">120 FPS</string>
<string name="frame_gen_target_rate_144">144 FPS</string>
<string name="frame_gen_target_rate_165">165 FPS</string>
<string name="frame_gen_on">On</string>
<string name="frame_gen_off">Off</string>
<string name="frame_gen_fixed">Fixed</string>
<string name="frame_gen_flow_auto">Auto</string>
<string name="frame_gen_quick_description">Turn frame generation on or off and choose the frame multiplier.</string>
<string name="frame_gen_target_rate_quick_description">Generate frames up to a target frame rate. The multiplier adjusts on its own.</string>
<string name="frame_gen_flow_scale_quick_description">Resolution used to estimate motion between frames. Lower values save GPU time.</string>
<string name="frame_gen_queue_target">Frame queue target</string>
<string name="frame_gen_queue_target_description">How many finished frames may wait ahead of the display. Larger queues absorb GPU spikes at the cost of input latency.</string>
<string name="frame_gen_queue_target_0">Lowest latency (Unbuffered)</string>
@@ -342,19 +347,15 @@
<string name="frame_gen_flow_scale_auto_description">Estimate motion at the resolution the game actually renders instead of the upscaled output. Costs nothing in accuracy, since upscaling adds no motion detail.</string>
<string name="frame_gen_flow_scale">Motion estimation resolution</string>
<string name="frame_gen_flow_scale_description">Resolution of the optical flow pass, as a fraction of the output. Lowering it is the cheapest way to reclaim performance.</string>
<string name="frame_gen_fp16">Half precision shaders</string>
<string name="frame_gen_fp16_description">Use the 16-bit shader variant. Falls back automatically if the driver or the file lacks it.</string>
<string name="frame_gen_dump_flow">Dump generated frame</string>
<string name="frame_gen_dump_flow_description">Write the optical flow mip levels and the interpolated frame to the lossless/debug folder once, for troubleshooting</string>
<string name="frame_gen_unsupported">Frame generation unavailable</string>
<string name="frame_gen_unsupported_description">This GPU driver does not support the Vulkan memory model, which the Lossless Scaling shaders require.</string>
<string name="frame_gen_unsupported_description">This GPU driver lacks the Vulkan memory model or half precision (float16) support that the Lossless Scaling shaders require.</string>
<string name="lossless_scaling_setup_description">Optional. Provide your own Lossless.dll to enable frame generation later</string>
<string name="lossless_scaling_install">Install Lossless.dll</string>
<string name="lossless_scaling_install_description">Frame generation needs your own legal copy of Lossless.dll from Lossless Scaling</string>
<string name="lossless_scaling_replace_description">Select a different copy of Lossless.dll</string>
<string name="frame_generation_support">Frame generation</string>
<string name="frame_generation_supported">Supported</string>
<string name="frame_generation_unsupported">Unsupported (no Vulkan memory model)</string>
<string name="frame_generation_unsupported">Unsupported (no Vulkan memory model or float16)</string>
<string name="lossless_scaling">Lossless Scaling</string>
<string name="lossless_scaling_description">Provide your own copy of Lossless.dll to enable frame generation</string>
<string name="lossless_scaling_installed">Installed</string>
+8 -11
View File
@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -12,9 +9,7 @@
namespace AudioCore::Renderer {
Manager::Manager(Core::System& system_)
: system{system_}
, system_manager{std::make_unique<SystemManager>(system)}
{
: system{system_}, system_manager{std::make_unique<SystemManager>(system)} {
std::iota(session_ids.begin(), session_ids.end(), 0);
}
@@ -43,12 +38,14 @@ Result Manager::GetWorkBufferSize(const AudioRendererParameterInternal& params,
s32 Manager::GetSessionId() {
std::scoped_lock l{session_lock};
ASSERT(session_count <= session_ids.size());
auto const session_id = session_ids[session_count];
if (session_id >= 0) {
session_ids[session_count] = -1;
session_count++;
auto session_id{session_ids[session_count]};
if (session_id == -1) {
return -1;
}
session_ids[session_count] = -1;
session_count++;
return session_id;
}
+1 -4
View File
@@ -459,7 +459,7 @@ struct Values {
&frame_gen};
SwitchableSetting<u32, true> frame_gen_queue_target{linkage,
1,
0,
0,
2,
"frame_gen_queue_target",
@@ -469,9 +469,6 @@ struct Values {
false,
&frame_gen};
SwitchableSetting<bool> frame_gen_fp16{linkage, true, "frame_gen_fp16", Category::Renderer,
Specialization::Default, true, false, &frame_gen};
SwitchableSetting<bool> frame_gen_dump_flow{linkage, false, "frame_gen_dump_flow",
Category::Renderer};
+17 -17
View File
@@ -185,26 +185,26 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("aud:a", std::make_shared<IAudioSystemManagerForApplet>(system), 30);
server_manager->RegisterNamedService("aud:d", std::make_shared<IAudioSystemManagerForDebugger>(system), 30);
server_manager->RegisterNamedService("aud:a", std::make_shared<IAudioSystemManagerForApplet>(system));
server_manager->RegisterNamedService("aud:d", std::make_shared<IAudioSystemManagerForDebugger>(system));
server_manager->RegisterNamedService("audout:d", std::make_shared<IAudioOutManagerForDebugger>(system), 30);
server_manager->RegisterNamedService("audin:d", std::make_shared<IAudioInManagerForDebugger>(system), 30);
server_manager->RegisterNamedService("audrec:d", std::make_shared<IFinalOutputRecorderManagerForDebugger>(system), 30);
server_manager->RegisterNamedService("audren:d", std::make_shared<IAudioInManager>(system), 30);
server_manager->RegisterNamedService("audout:d", std::make_shared<IAudioOutManagerForDebugger>(system));
server_manager->RegisterNamedService("audin:d", std::make_shared<IAudioInManagerForDebugger>(system));
server_manager->RegisterNamedService("audrec:d", std::make_shared<IFinalOutputRecorderManagerForDebugger>(system));
server_manager->RegisterNamedService("audren:d", std::make_shared<IAudioInManager>(system));
server_manager->RegisterNamedService("audin:u", std::make_shared<IAudioInManager>(system), 30);
server_manager->RegisterNamedService("audin:a", std::make_shared<IAudioInManagerForApplet>(system), 30);
server_manager->RegisterNamedService("audout:u", std::make_shared<IAudioOutManager>(system), 30);
server_manager->RegisterNamedService("audout:a", std::make_shared<IAudioOutManagerForApplet>(system), 30);
server_manager->RegisterNamedService("auddev", std::make_shared<IAudioSnoopManager>(system), 30);
server_manager->RegisterNamedService("audin:u", std::make_shared<IAudioInManager>(system));
server_manager->RegisterNamedService("audin:a", std::make_shared<IAudioInManagerForApplet>(system));
server_manager->RegisterNamedService("audout:u", std::make_shared<IAudioOutManager>(system));
server_manager->RegisterNamedService("audout:a", std::make_shared<IAudioOutManagerForApplet>(system));
server_manager->RegisterNamedService("auddev", std::make_shared<IAudioSnoopManager>(system));
// Depends on audout:u and audin:u on ctor!
server_manager->RegisterNamedService("audctl", std::make_shared<IAudioController>(system), 30);
server_manager->RegisterNamedService("audrec:a", std::make_shared<IFinalOutputRecorderManagerForApplet>(system), 30);
server_manager->RegisterNamedService("audrec:u", std::make_shared<IFinalOutputRecorderManager>(system), 30);
server_manager->RegisterNamedService("audren:u", std::make_shared<IAudioRendererManager>(system), 30);
server_manager->RegisterNamedService("audren:a", std::make_shared<IAudioRendererManagerForApplet>(system), 30);
server_manager->RegisterNamedService("hwopus", std::make_shared<IHardwareOpusDecoderManager>(system), 25);
server_manager->RegisterNamedService("audctl", std::make_shared<IAudioController>(system));
server_manager->RegisterNamedService("audrec:a", std::make_shared<IFinalOutputRecorderManagerForApplet>(system));
server_manager->RegisterNamedService("audrec:u", std::make_shared<IFinalOutputRecorderManager>(system));
server_manager->RegisterNamedService("audren:u", std::make_shared<IAudioRendererManager>(system));
server_manager->RegisterNamedService("audren:a", std::make_shared<IAudioRendererManagerForApplet>(system));
server_manager->RegisterNamedService("hwopus", std::make_shared<IHardwareOpusDecoderManager>(system));
ServerManager::RunServer(std::move(server_manager));
}
+18 -12
View File
@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -15,16 +12,25 @@ namespace Service::BCAT {
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("bcat:a", std::make_shared<IServiceCreator>(system, "bcat:a"), 32);
server_manager->RegisterNamedService("bcat:m", std::make_shared<IServiceCreator>(system, "bcat:m"), 32);
server_manager->RegisterNamedService("bcat:u", std::make_shared<IServiceCreator>(system, "bcat:u"), 32);
server_manager->RegisterNamedService("bcat:s", std::make_shared<IServiceCreator>(system, "bcat:s"), 32);
server_manager->RegisterNamedService("bcat:a",
std::make_shared<IServiceCreator>(system, "bcat:a"));
server_manager->RegisterNamedService("bcat:m",
std::make_shared<IServiceCreator>(system, "bcat:m"));
server_manager->RegisterNamedService("bcat:u",
std::make_shared<IServiceCreator>(system, "bcat:u"));
server_manager->RegisterNamedService("bcat:s",
std::make_shared<IServiceCreator>(system, "bcat:s"));
server_manager->RegisterNamedService("news:a", std::make_shared<News::IServiceCreator>(system, 0xffffffff, "news:a"), 32);
server_manager->RegisterNamedService("news:p", std::make_shared<News::IServiceCreator>(system, 0x1, "news:p"), 32);
server_manager->RegisterNamedService("news:c", std::make_shared<News::IServiceCreator>(system, 0x2, "news:c"), 32);
server_manager->RegisterNamedService("news:v", std::make_shared<News::IServiceCreator>(system, 0x4, "news:v"), 32);
server_manager->RegisterNamedService("news:m", std::make_shared<News::IServiceCreator>(system, 0xd, "news:m"), 32);
server_manager->RegisterNamedService(
"news:a", std::make_shared<News::IServiceCreator>(system, 0xffffffff, "news:a"));
server_manager->RegisterNamedService(
"news:p", std::make_shared<News::IServiceCreator>(system, 0x1, "news:p"));
server_manager->RegisterNamedService(
"news:c", std::make_shared<News::IServiceCreator>(system, 0x2, "news:c"));
server_manager->RegisterNamedService(
"news:v", std::make_shared<News::IServiceCreator>(system, 0x4, "news:v"));
server_manager->RegisterNamedService(
"news:m", std::make_shared<News::IServiceCreator>(system, 0xd, "news:m"));
ServerManager::RunServer(std::move(server_manager));
}
+5 -19
View File
@@ -101,28 +101,14 @@ public:
}
};
class BPC_AMS final : public ServiceFramework<BPC_AMS> {
public:
explicit BPC_AMS(Core::System& system_) : ServiceFramework{system_, "bpc:ams"} {
// clang-format off
static const FunctionInfo functions[] = {
{65000, nullptr, "RebootToFatalError"},
{65001, nullptr, "SetRebootPayload"},
};
// clang-format on
RegisterHandlers(functions);
}
};
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("bpc", std::make_shared<BPC>(system), 13);
server_manager->RegisterNamedService("bpc:r", std::make_shared<BPC_R>(system), 13);
server_manager->RegisterNamedService("bpc:c", std::make_shared<BPC_C>(system), 13);
server_manager->RegisterNamedService("bpc:b", std::make_shared<BPC_B>(system), 13);
server_manager->RegisterNamedService("bpc:w", std::make_shared<BPC_W>(system), 13);
server_manager->RegisterNamedService("bpc:ams", std::make_shared<BPC_AMS>(system), 4);
server_manager->RegisterNamedService("bpc", std::make_shared<BPC>(system));
server_manager->RegisterNamedService("bpc:r", std::make_shared<BPC_R>(system));
server_manager->RegisterNamedService("bpc:c", std::make_shared<BPC_C>(system));
server_manager->RegisterNamedService("bpc:b", std::make_shared<BPC_B>(system));
server_manager->RegisterNamedService("bpc:w", std::make_shared<BPC_W>(system));
ServerManager::RunServer(std::move(server_manager));
}
@@ -804,9 +804,9 @@ void LoopProcess(Core::System& system) {
const auto FileSystemProxyFactory = [&] { return std::make_shared<FSP_SRV>(system); };
server_manager->RegisterNamedService("fsp-ldr", std::make_shared<FSP_LDR>(system), 61);
server_manager->RegisterNamedService("fsp-pr", std::make_shared<FSP_PR>(system), 61);
server_manager->RegisterNamedService("fsp-srv", std::move(FileSystemProxyFactory), 61);
server_manager->RegisterNamedService("fsp-ldr", std::make_shared<FSP_LDR>(system));
server_manager->RegisterNamedService("fsp-pr", std::make_shared<FSP_PR>(system));
server_manager->RegisterNamedService("fsp-srv", std::move(FileSystemProxyFactory));
ServerManager::RunServer(std::move(server_manager));
}
+20 -15
View File
@@ -36,18 +36,18 @@ std::optional<u64> GetTitleIDForProcessID(Core::System& system, u64 process_id)
ARP_R::ARP_R(Core::System& system_, const ARPManager& manager_)
: ServiceFramework{system_, "arp:r"}, manager{manager_} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"},
{1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"},
{2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"},
{3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"},
{4, nullptr, "GetApplicationInstanceUnregistrationNotifier"},
{5, nullptr, "ListApplicationInstanceId"},
{6, nullptr, "GetMicroApplicationInstanceId"},
{7, nullptr, "GetApplicationCertificate"},
{9998, nullptr, "GetPreomiaApplicationLaunchProperty"},
{9999, nullptr, "GetPreomiaApplicationControlProperty"},
};
static const FunctionInfo functions[] = {
{0, &ARP_R::GetApplicationLaunchProperty, "GetApplicationLaunchProperty"},
{1, &ARP_R::GetApplicationLaunchPropertyWithApplicationId, "GetApplicationLaunchPropertyWithApplicationId"},
{2, &ARP_R::GetApplicationControlProperty, "GetApplicationControlProperty"},
{3, &ARP_R::GetApplicationControlPropertyWithApplicationId, "GetApplicationControlPropertyWithApplicationId"},
{4, nullptr, "GetApplicationInstanceUnregistrationNotifier"},
{5, nullptr, "ListApplicationInstanceId"},
{6, nullptr, "GetMicroApplicationInstanceId"},
{7, nullptr, "GetApplicationCertificate"},
{9998, nullptr, "GetPreomiaApplicationLaunchProperty"},
{9999, nullptr, "GetPreomiaApplicationControlProperty"},
};
// clang-format on
RegisterHandlers(functions);
@@ -191,7 +191,8 @@ private:
}
if (issued) {
LOG_ERROR(Service_ARP, "Attempted to issue registrar, but registrar is already issued!");
LOG_ERROR(Service_ARP,
"Attempted to issue registrar, but registrar is already issued!");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(Glue::ResultAlreadyBound);
return;
@@ -208,7 +209,9 @@ private:
LOG_DEBUG(Service_ARP, "called");
if (issued) {
LOG_ERROR(Service_ARP, "Attempted to set application launch property, but registrar is already issued!");
LOG_ERROR(
Service_ARP,
"Attempted to set application launch property, but registrar is already issued!");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(Glue::ResultAlreadyBound);
return;
@@ -225,7 +228,9 @@ private:
LOG_DEBUG(Service_ARP, "called");
if (issued) {
LOG_ERROR(Service_ARP, "Attempted to set application control property, but registrar is already issued!");
LOG_ERROR(
Service_ARP,
"Attempted to set application control property, but registrar is already issued!");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(Glue::ResultAlreadyBound);
return;
+2 -2
View File
@@ -22,8 +22,8 @@ void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
// ARP
server_manager->RegisterNamedService("arp:r", std::make_shared<ARP_R>(system, system.GetARPManager()), 16);
server_manager->RegisterNamedService("arp:w", std::make_shared<ARP_W>(system, system.GetARPManager()), 8);
server_manager->RegisterNamedService("arp:r", std::make_shared<ARP_R>(system, system.GetARPManager()));
server_manager->RegisterNamedService("arp:w", std::make_shared<ARP_W>(system, system.GetARPManager()));
// BackGround Task Controller
server_manager->RegisterNamedService("bgtc:t", std::make_shared<BGTC_T>(system));
+2 -2
View File
@@ -46,8 +46,8 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("grc:c", std::make_shared<GRC>(system), 4);
server_manager->RegisterNamedService("grc:d", std::make_shared<GRC_D>(system), 4);
server_manager->RegisterNamedService("grc:c", std::make_shared<GRC>(system));
server_manager->RegisterNamedService("grc:d", std::make_shared<GRC_D>(system));
ServerManager::RunServer(std::move(server_manager));
}
+3 -6
View File
@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -59,9 +56,9 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("ldr:dmnt", std::make_shared<DebugMonitor>(system), 3);
server_manager->RegisterNamedService("ldr:pm", std::make_shared<ProcessManager>(system), 1);
server_manager->RegisterNamedService("ldr:shel", std::make_shared<Shell>(system), 3);
server_manager->RegisterNamedService("ldr:dmnt", std::make_shared<DebugMonitor>(system));
server_manager->RegisterNamedService("ldr:pm", std::make_shared<ProcessManager>(system));
server_manager->RegisterNamedService("ldr:shel", std::make_shared<Shell>(system));
ServerManager::RunServer(std::move(server_manager));
}
+3 -3
View File
@@ -169,9 +169,9 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("ngct:u", std::make_shared<IService>(system), 4);
server_manager->RegisterNamedService("ngct:s", std::make_shared<IServiceWithManagementApi>(system), 4);
server_manager->RegisterNamedService("ngc:u", std::make_shared<NgcServiceImpl>(system), 4);
server_manager->RegisterNamedService("ngct:u", std::make_shared<IService>(system));
server_manager->RegisterNamedService("ngct:s", std::make_shared<IServiceWithManagementApi>(system));
server_manager->RegisterNamedService("ngc:u", std::make_shared<NgcServiceImpl>(system));
ServerManager::RunServer(std::move(server_manager));
}
+6 -3
View File
@@ -1144,9 +1144,12 @@ private:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("nifm:a", std::make_shared<NetworkInterface>("nifm:a", system), 2);
server_manager->RegisterNamedService("nifm:s", std::make_shared<NetworkInterface>("nifm:s", system), 16);
server_manager->RegisterNamedService("nifm:u", std::make_shared<NetworkInterface>("nifm:u", system), 5);
server_manager->RegisterNamedService("nifm:a",
std::make_shared<NetworkInterface>("nifm:a", system));
server_manager->RegisterNamedService("nifm:s",
std::make_shared<NetworkInterface>("nifm:s", system));
server_manager->RegisterNamedService("nifm:u",
std::make_shared<NetworkInterface>("nifm:u", system));
ServerManager::RunServer(std::move(server_manager));
}
+9 -9
View File
@@ -81,16 +81,16 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("ns:am2", std::make_shared<IServiceGetterInterface>(system, "ns:am2"), 5);
server_manager->RegisterNamedService("ns:ec", std::make_shared<IServiceGetterInterface>(system, "ns:ec"), 5);
server_manager->RegisterNamedService("ns:rid", std::make_shared<IServiceGetterInterface>(system, "ns:rid"), 5);
server_manager->RegisterNamedService("ns:rt", std::make_shared<IServiceGetterInterface>(system, "ns:rt"), 5);
server_manager->RegisterNamedService("ns:web", std::make_shared<IServiceGetterInterface>(system, "ns:web"), 5);
server_manager->RegisterNamedService("ns:ro", std::make_shared<IServiceGetterInterface>(system, "ns:ro"), 5);
server_manager->RegisterNamedService("ns:am2", std::make_shared<IServiceGetterInterface>(system, "ns:am2"));
server_manager->RegisterNamedService("ns:ec", std::make_shared<IServiceGetterInterface>(system, "ns:ec"));
server_manager->RegisterNamedService("ns:rid", std::make_shared<IServiceGetterInterface>(system, "ns:rid"));
server_manager->RegisterNamedService("ns:rt", std::make_shared<IServiceGetterInterface>(system, "ns:rt"));
server_manager->RegisterNamedService("ns:web", std::make_shared<IServiceGetterInterface>(system, "ns:web"));
server_manager->RegisterNamedService("ns:ro", std::make_shared<IServiceGetterInterface>(system, "ns:ro"));
server_manager->RegisterNamedService("ns:dev", std::make_shared<IDevelopInterface>(system), 5);
server_manager->RegisterNamedService("ns:su", std::make_shared<ISystemUpdateInterface>(system), 5);
server_manager->RegisterNamedService("ns:vm", std::make_shared<IVulnerabilityManagerInterface>(system), 5);
server_manager->RegisterNamedService("ns:dev", std::make_shared<IDevelopInterface>(system));
server_manager->RegisterNamedService("ns:su", std::make_shared<ISystemUpdateInterface>(system));
server_manager->RegisterNamedService("ns:vm", std::make_shared<IVulnerabilityManagerInterface>(system));
server_manager->RegisterNamedService("pdm:ntfy", std::make_shared<INotifyService>(system));
server_manager->RegisterNamedService("pdm:qry", std::make_shared<IQueryService>(system));
+4 -4
View File
@@ -252,10 +252,10 @@ private:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("pm:bm", std::make_shared<BootMode>(system), 4); // Nx = 4, Ams = 8
server_manager->RegisterNamedService("pm:dmnt", std::make_shared<DebugMonitor>(system), 16);
server_manager->RegisterNamedService("pm:shell", std::make_shared<Shell>(system), 3); //Nx = 3, AMS = 8
server_manager->RegisterNamedService("pm:info", std::make_shared<Info>(system), 25); //48-(4+16+3)
server_manager->RegisterNamedService("pm:bm", std::make_shared<BootMode>(system));
server_manager->RegisterNamedService("pm:dmnt", std::make_shared<DebugMonitor>(system));
server_manager->RegisterNamedService("pm:info", std::make_shared<Info>(system));
server_manager->RegisterNamedService("pm:shell", std::make_shared<Shell>(system));
ServerManager::RunServer(std::move(server_manager));
}
+3 -3
View File
@@ -593,9 +593,9 @@ void LoopProcess(Core::System& system) {
return std::make_shared<RoInterface>(system, "ldr:ro", ro, NrrKind::User);
};
server_manager->RegisterNamedService("ldr:ro", std::move(RoInterfaceFactoryForUser), 2);
server_manager->RegisterNamedService("ro:1", std::make_shared<RoInterface>(system, "ro:1", ro, NrrKind::JitPlugin), 2);
server_manager->RegisterNamedService("ro:dmnt", std::make_shared<IDebugMonitorInterface>(system), 2);
server_manager->RegisterNamedService("ldr:ro", std::move(RoInterfaceFactoryForUser));
server_manager->RegisterNamedService("ro:1", std::make_shared<RoInterface>(system, "ro:1", ro, NrrKind::JitPlugin));
server_manager->RegisterNamedService("ro:dmnt", std::make_shared<IDebugMonitorInterface>(system));
ServerManager::RunServer(std::move(server_manager));
}
+7 -7
View File
@@ -1,6 +1,3 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -16,10 +13,13 @@ namespace Service::Set {
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("set", std::make_shared<ISettingsServer>(system), 60);
server_manager->RegisterNamedService("set:cal", std::make_shared<IFactorySettingsServer>(system), 60);
server_manager->RegisterNamedService("set:fd", std::make_shared<IFirmwareDebugSettingsServer>(system), 60);
server_manager->RegisterNamedService("set:sys", std::make_shared<ISystemSettingsServer>(system), 60);
server_manager->RegisterNamedService("set", std::make_shared<ISettingsServer>(system));
server_manager->RegisterNamedService("set:cal",
std::make_shared<IFactorySettingsServer>(system));
server_manager->RegisterNamedService("set:fd",
std::make_shared<IFirmwareDebugSettingsServer>(system));
server_manager->RegisterNamedService("set:sys",
std::make_shared<ISystemSettingsServer>(system));
ServerManager::RunServer(std::move(server_manager));
}
+4 -3
View File
@@ -53,7 +53,8 @@ static Result ValidateServiceName(const std::string& name) {
return ResultSuccess;
}
Result ServiceManager::RegisterService(Kernel::KServerPort** out_server_port, std::string name, u32 max_sessions, SessionRequestHandlerFactory handler) {
Result ServiceManager::RegisterService(Kernel::KServerPort** out_server_port, std::string name,
u32 max_sessions, SessionRequestHandlerFactory handler) {
R_TRY(ValidateServiceName(name));
std::scoped_lock lk{lock};
@@ -63,7 +64,7 @@ Result ServiceManager::RegisterService(Kernel::KServerPort** out_server_port, st
}
auto* port = Kernel::KPort::Create(kernel);
port->Initialize(kernel, max_sessions, false, 0);
port->Initialize(kernel, ServerSessionCountMax, false, 0);
// Register the port.
Kernel::KPort::Register(kernel, port);
@@ -263,7 +264,7 @@ void SM::AtmosphereHasService(HLERequestContext& ctx) {
}
SM::SM(ServiceManager& service_manager_, Core::System& system_)
: ServiceFramework{system_, "sm:", 64}
: ServiceFramework{system_, "sm:", 4}
, service_manager{service_manager_}
, kernel{system_.Kernel()}
{
+7 -7
View File
@@ -64,17 +64,17 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("ethc:c", std::make_shared<ETHC_C>(system), 5);
server_manager->RegisterNamedService("ethc:i", std::make_shared<ETHC_I>(system), 5);
server_manager->RegisterNamedService("bsd:s", std::make_shared<BSD_USA>(system, "bsd:s", false), 0x7E);
server_manager->RegisterNamedService("bsd:u", std::make_shared<BSD_USA>(system, "bsd:u", true), 0x0f);
server_manager->RegisterNamedService("bsd:a", std::make_shared<BSD_USA>(system, "bsd:a", true), 0x17);
server_manager->RegisterNamedService("bsd:nu", std::make_shared<BSD_NU>(system), 4);
server_manager->RegisterNamedService("ethc:c", std::make_shared<ETHC_C>(system));
server_manager->RegisterNamedService("ethc:i", std::make_shared<ETHC_I>(system));
server_manager->RegisterNamedService("bsd:s", std::make_shared<BSD_USA>(system, "bsd:s", false));
server_manager->RegisterNamedService("bsd:u", std::make_shared<BSD_USA>(system, "bsd:u", true));
server_manager->RegisterNamedService("bsd:a", std::make_shared<BSD_USA>(system, "bsd:a", true));
server_manager->RegisterNamedService("bsd:nu", std::make_shared<BSD_NU>(system));
server_manager->RegisterNamedService("bsdcfg", std::make_shared<BSDCFG>(system, "bsdcfg"));
server_manager->RegisterNamedService("ifcfg", std::make_shared<BSDCFG>(system, "ifcfg"));
server_manager->RegisterNamedService("nsd:a", std::make_shared<NSD>(system, "nsd:a"));
server_manager->RegisterNamedService("nsd:u", std::make_shared<NSD>(system, "nsd:u"));
server_manager->RegisterNamedService("sfdnsres", std::make_shared<SFDNSRES>(system), 30);
server_manager->RegisterNamedService("sfdnsres", std::make_shared<SFDNSRES>(system));
server_manager->RegisterNamedService("dns:priv", std::make_shared<DNS_PRIV>(system));
server_manager->RegisterNamedService("eth:nd", std::make_shared<ISfDriverServiceCreator>(system));
+4 -4
View File
@@ -265,17 +265,17 @@ void LoopProcess(Core::System& system) {
server_manager->RegisterNamedService("usb:ds", std::make_shared<IDsRootSession>(system));
server_manager->RegisterNamedService("usb:hs", std::make_shared<IClientRootSession>(system));
server_manager->RegisterNamedService("usb:pd", std::make_shared<IPdManager>(system), 6);
server_manager->RegisterNamedService("usb:pd:c", std::make_shared<IPdCradleManager>(system), 4);
server_manager->RegisterNamedService("usb:pd", std::make_shared<IPdManager>(system));
server_manager->RegisterNamedService("usb:pd:c", std::make_shared<IPdCradleManager>(system));
server_manager->RegisterNamedService("usb:pd:m", std::make_shared<IPdManufactureManager>(system));
server_manager->RegisterNamedService("usb:pm", std::make_shared<IPmMainService>(system), 5);
server_manager->RegisterNamedService("usb:pm", std::make_shared<IPmMainService>(system));
// +7.0.0
if (FirmwareManager::GetFirmwareVersion(system).first.major >= 7) {
server_manager->RegisterNamedService("usb:qdb", std::make_shared<IQdbManager>(system));
}
// +8.0.0
if (FirmwareManager::GetFirmwareVersion(system).first.major >= 8) {
server_manager->RegisterNamedService("usb:obsv", std::make_shared<IPmObserverService>(system), 2);
server_manager->RegisterNamedService("usb:obsv", std::make_shared<IPmObserverService>(system));
}
ServerManager::RunServer(std::move(server_manager));
}
+8 -8
View File
@@ -246,14 +246,14 @@ public:
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("wlan:lcl", std::make_shared<ILocalManager>(system), 10);
server_manager->RegisterNamedService("wlan:lg", std::make_shared<ILocalGetFrame>(system), 10);
server_manager->RegisterNamedService("wlan:lga", std::make_shared<ILocalGetActionFrame>(system), 10);
server_manager->RegisterNamedService("wlan:sg", std::make_shared<ISocketGetFrame>(system), 10);
server_manager->RegisterNamedService("wlan:soc", std::make_shared<ISocketManager>(system), 10);
server_manager->RegisterNamedService("wlan:dtc", std::make_shared<IDetectManager>(system), 4);
server_manager->RegisterNamedService("wlan:p", std::make_shared<IPrivateServiceCreator>(system), 30);
server_manager->RegisterNamedService("wlan:nd", std::make_shared<ISfDriverServiceCreator>(system), 5);
server_manager->RegisterNamedService("wlan:lcl", std::make_shared<ILocalManager>(system));
server_manager->RegisterNamedService("wlan:lg", std::make_shared<ILocalGetFrame>(system));
server_manager->RegisterNamedService("wlan:lga", std::make_shared<ILocalGetActionFrame>(system));
server_manager->RegisterNamedService("wlan:sg", std::make_shared<ISocketGetFrame>(system));
server_manager->RegisterNamedService("wlan:soc", std::make_shared<ISocketManager>(system));
server_manager->RegisterNamedService("wlan:dtc", std::make_shared<IDetectManager>(system));
server_manager->RegisterNamedService("wlan:p", std::make_shared<IPrivateServiceCreator>(system));
server_manager->RegisterNamedService("wlan:nd", std::make_shared<ISfDriverServiceCreator>(system));
ServerManager::RunServer(std::move(server_manager));
}
+15 -44
View File
@@ -45,7 +45,7 @@ constexpr u32 PERFORMANCE_SHADER_ID_FIRST = 280;
constexpr u32 PERFORMANCE_SHADER_ID_LAST = 302;
constexpr u32 CACHE_MAGIC = 0x4746534C;
constexpr u32 CACHE_VERSION = 2;
constexpr u32 CACHE_VERSION = 3;
struct CacheHeader {
u32 magic;
@@ -53,7 +53,6 @@ struct CacheHeader {
u64 source_size;
u64 source_hash;
u32 module_count;
u32 variant;
};
struct Section {
@@ -277,41 +276,19 @@ template <typename Map>
return std::ranges::all_of(ids, [&](u32 id) { return resources.contains(id); });
}
[[nodiscard]] u32 VariantOffset(ShaderVariant variant) {
return variant == ShaderVariant::NativeFp16 ? PerformanceShader::NATIVE_FP16_OFFSET
: PerformanceShader::NATIVE_FP32_OFFSET;
}
template <typename Map>
[[nodiscard]] bool HasNativeVariant(const Map& resources, ShaderVariant variant) {
const u32 offset = VariantOffset(variant);
[[nodiscard]] bool HasNativeShaders(const Map& resources) {
return std::ranges::all_of(PerformanceShaderIds(), [&](u32 id) {
const auto hit = resources.find(id + offset);
const auto hit = resources.find(id + PerformanceShader::NATIVE_FP16_OFFSET);
return hit != resources.end() && IsSpirvModule(hit->second);
});
}
[[nodiscard]] std::optional<ShaderVariant> SelectVariant(const ResourceSpans& resources,
bool allow_fp16, bool prefer_fp16) {
if (prefer_fp16 && HasNativeVariant(resources, ShaderVariant::NativeFp16)) {
return ShaderVariant::NativeFp16;
}
if (HasNativeVariant(resources, ShaderVariant::NativeFp32)) {
return ShaderVariant::NativeFp32;
}
if (allow_fp16 && HasNativeVariant(resources, ShaderVariant::NativeFp16)) {
return ShaderVariant::NativeFp16;
}
return std::nullopt;
}
[[nodiscard]] LosslessStatus TranslateAll(const ResourceSpans& resources,
ShaderModules& out_modules,
ShaderVariant variant) {
const u32 offset = VariantOffset(variant);
ShaderModules& out_modules) {
out_modules.clear();
for (const u32 id : PerformanceShaderIds()) {
const auto hit = resources.find(id + offset);
const auto hit = resources.find(id + PerformanceShader::NATIVE_FP16_OFFSET);
if (hit == resources.end()) {
return LosslessStatus::MissingShaders;
}
@@ -343,7 +320,7 @@ template <typename Map>
}
[[nodiscard]] bool ReadShaderCache(const std::filesystem::path& path, u64 source_size,
u64 source_hash, u32 variant, ShaderModules& out_modules) {
u64 source_hash, ShaderModules& out_modules) {
if (!Common::FS::Exists(path)) {
return false;
}
@@ -355,8 +332,7 @@ template <typename Map>
return false;
}
if (header.magic != CACHE_MAGIC || header.version != CACHE_VERSION ||
header.source_size != source_size || header.source_hash != source_hash ||
header.variant != variant) {
header.source_size != source_size || header.source_hash != source_hash) {
return false;
}
@@ -433,8 +409,10 @@ template <typename Map>
return LosslessStatus::MissingShaders;
}
return HasPerformanceShaders(out_resources) ? LosslessStatus::Ok
: LosslessStatus::MissingShaders;
if (!HasNativeShaders(out_resources)) {
return LosslessStatus::MissingShaders;
}
return LosslessStatus::Ok;
}
} // Anonymous namespace
@@ -483,7 +461,7 @@ LosslessStatus GetInstalledLosslessStatus() {
return ValidateLosslessDll(GetLosslessDllPath());
}
LosslessStatus LoadShaderModules(ShaderModules& out_modules, bool allow_fp16, bool prefer_fp16) {
LosslessStatus LoadShaderModules(ShaderModules& out_modules) {
std::vector<u8> image;
const LosslessStatus read_status = ReadImageFile(GetLosslessDllPath(), image);
if (read_status != LosslessStatus::Ok) {
@@ -501,17 +479,11 @@ LosslessStatus LoadShaderModules(ShaderModules& out_modules, bool allow_fp16, bo
return parse_status;
}
const std::optional<ShaderVariant> variant = SelectVariant(spans, allow_fp16, prefer_fp16);
if (!variant) {
return LosslessStatus::MissingShaders;
}
if (ReadShaderCache(cache_path, source_size, source_hash, static_cast<u32>(*variant),
out_modules)) {
if (ReadShaderCache(cache_path, source_size, source_hash, out_modules)) {
return LosslessStatus::Ok;
}
const LosslessStatus translate_status = TranslateAll(spans, out_modules, *variant);
const LosslessStatus translate_status = TranslateAll(spans, out_modules);
if (translate_status != LosslessStatus::Ok) {
return translate_status;
}
@@ -522,7 +494,6 @@ LosslessStatus LoadShaderModules(ShaderModules& out_modules, bool allow_fp16, bo
.source_size = source_size,
.source_hash = source_hash,
.module_count = static_cast<u32>(out_modules.size()),
.variant = static_cast<u32>(*variant),
};
if (!WriteShaderCache(cache_path, header, out_modules)) {
void(Common::FS::RemoveFile(cache_path));
@@ -534,7 +505,7 @@ LosslessStatus LoadShaderModules(ShaderModules& out_modules, bool allow_fp16, bo
LosslessStatus BuildShaderCache() {
ShaderModules modules;
return LoadShaderModules(modules, true);
return LoadShaderModules(modules);
}
bool RemoveInstalledLosslessDll() {
+1 -9
View File
@@ -28,11 +28,6 @@ enum class LosslessStatus : u32 {
using ShaderResources = std::map<u32, std::vector<u8>>;
using ShaderModules = std::map<u32, std::vector<u32>>;
enum class ShaderVariant : u32 {
NativeFp32 = 1,
NativeFp16 = 2,
};
namespace PerformanceShader {
constexpr u32 MIPMAPS = 255;
constexpr u32 GENERATE = 256;
@@ -42,7 +37,6 @@ constexpr std::array<u32, 5> GAMMA{280, 282, 283, 284, 285};
constexpr std::array<u32, 10> DELTA{280, 286, 287, 288, 289, 281, 294, 295, 296, 297};
constexpr u32 NATIVE_FP16_OFFSET = 49;
constexpr u32 NATIVE_FP32_OFFSET = 98;
} // namespace PerformanceShader
[[nodiscard]] std::filesystem::path GetLosslessDllPath();
@@ -58,9 +52,7 @@ constexpr u32 NATIVE_FP32_OFFSET = 98;
[[nodiscard]] LosslessStatus BuildShaderCache();
[[nodiscard]] LosslessStatus LoadShaderModules(ShaderModules& out_modules,
bool allow_fp16 = false,
bool prefer_fp16 = false);
[[nodiscard]] LosslessStatus LoadShaderModules(ShaderModules& out_modules);
bool RemoveInstalledLosslessDll();
@@ -198,6 +198,10 @@ void FrameGen::Process(const Device& device, Frame* frame, VkFormat format,
VkExtent2D guest_extent) {
generated = false;
if (!shaders) {
shaders.emplace(device);
}
if (unavailable || !Settings::values.frame_gen.GetValue()) {
if (chain) {
scheduler.Finish();
@@ -207,17 +211,14 @@ void FrameGen::Process(const Device& device, Frame* frame, VkFormat format,
return;
}
if (!frame->storage_view) {
if (!shaders->IsValid()) {
unavailable = true;
return;
}
if (!shaders) {
shaders.emplace(device);
if (!shaders->IsValid()) {
unavailable = true;
return;
}
if (!frame->storage_view) {
warm_streak = 0;
return;
}
peak_guest_extent.width = std::max(peak_guest_extent.width, guest_extent.width);
@@ -1,7 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
#include "common/settings.h"
#include "video_core/frame_gen/lossless_dll.h"
#include "video_core/renderer_vulkan/present/lsfg_shaders.h"
#include "video_core/renderer_vulkan/present/util.h"
@@ -10,16 +9,13 @@
namespace Vulkan {
LsfgShaders::LsfgShaders(const Device& device) {
if (!device.IsVulkanMemoryModelSupported() || !device.HasNullDescriptor()) {
if (!device.IsVulkanMemoryModelSupported() || !device.HasNullDescriptor() ||
!device.IsFloat16Supported()) {
return;
}
const bool allow_fp16 = device.IsFloat16Supported();
const bool prefer_fp16 = allow_fp16 && Settings::values.frame_gen_fp16.GetValue();
VideoCore::FrameGen::ShaderModules code;
if (VideoCore::FrameGen::LoadShaderModules(code, allow_fp16, prefer_fp16) !=
VideoCore::FrameGen::LosslessStatus::Ok) {
if (VideoCore::FrameGen::LoadShaderModules(code) != VideoCore::FrameGen::LosslessStatus::Ok) {
return;
}
@@ -8,6 +8,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include <vulkan/vulkan_core.h>
#include "common/settings.h"
#include "video_core/framebuffer_config.h"
#include "video_core/present.h"
#include "video_core/renderer_vulkan/present/filters.h"
@@ -87,13 +88,18 @@ void BlitScreen::SetWindowAdaptPass(const Device& device) {
void BlitScreen::PrepareFrame(const Device& device, Frame* frame,
const Layout::FramebufferLayout& layout) {
if (!window_adapt || (frame->width == layout.width && frame->height == layout.height)) {
if (!window_adapt) {
return;
}
if (frame->width != layout.width || frame->height != layout.height) {
WaitIdle(device);
} else if (!present_manager.NeedsStorage(frame, true)) {
return;
}
WaitIdle(device);
present_manager.RecreateFrame(frame, layout.width, layout.height, swapchain_view_format,
window_adapt->GetRenderPass());
window_adapt->GetRenderPass(), true);
}
void BlitScreen::DrawToFrame(const Device& device, RasterizerVulkan& rasterizer, Frame* frame,
@@ -120,16 +126,20 @@ void BlitScreen::DrawToFrame(const Device& device, RasterizerVulkan& rasterizer,
swapchain_view_format = current_swapchain_view_format;
}
const bool storage_required = Settings::values.frame_gen.GetValue();
if (resource_update_required) {
WaitIdle(device);
SetWindowAdaptPass(device);
if (presentation_recreate_required) {
present_manager.RecreateFrame(frame, layout.width, layout.height, swapchain_view_format,
window_adapt->GetRenderPass());
window_adapt->GetRenderPass(), storage_required);
}
image_index = 0;
} else if (present_manager.NeedsStorage(frame, storage_required)) {
present_manager.RecreateFrame(frame, layout.width, layout.height, swapchain_view_format,
window_adapt->GetRenderPass(), true);
}
const VkExtent2D window_size{
@@ -29,9 +29,6 @@ static_assert(MAX_FRAMES_IN_FLIGHT <= LSFG_MAX_TARGETS);
bool CanStoreToFrame(const vk::PhysicalDevice& physical_device, VkFormat format) {
#ifdef HAS_LSFG
if (!Settings::values.frame_gen.GetValue()) {
return false;
}
const VkFormatProperties props{physical_device.GetFormatProperties(format)};
return (props.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT) != 0;
#else
@@ -160,6 +157,7 @@ PresentManager::PresentManager(const vk::Instance& instance_,
.pNext = nullptr,
.flags = VK_FENCE_CREATE_SIGNALED_BIT,
});
frame.storage_capable = storage_supported;
free_queue.push_back(&frame);
}
@@ -205,15 +203,22 @@ size_t PresentManager::MaxExtraFrames() const {
return image_count - 1;
}
bool PresentManager::NeedsStorage(const Frame* frame, bool required) const {
return required && frame->storage_capable && !frame->storage_view;
}
void PresentManager::RecreateFrame(Frame* frame, u32 width, u32 height, VkFormat image_view_format,
VkRenderPass rd) {
VkRenderPass rd, bool storage) {
auto& dld = device.GetLogical();
frame->width = width;
frame->height = height;
const VkImageUsageFlags storage_usage =
storage_supported ? static_cast<VkImageUsageFlags>(VK_IMAGE_USAGE_STORAGE_BIT) : 0;
const bool with_storage = storage && frame->storage_capable;
VkImageUsageFlags storage_usage = 0;
if (with_storage) {
storage_usage = VK_IMAGE_USAGE_STORAGE_BIT;
}
frame->image = memory_allocator.CreateImage({
.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
@@ -264,7 +269,7 @@ void PresentManager::RecreateFrame(Frame* frame, u32 width, u32 height, VkFormat
});
frame->storage_view = vk::ImageView{};
if (storage_supported) {
if (with_storage) {
frame->storage_view = dld.CreateImageView({
.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
.pNext = nullptr,
@@ -36,6 +36,7 @@ struct Frame {
vk::CommandBuffer cmdbuf;
vk::Semaphore render_ready;
vk::Fence present_done;
bool storage_capable{};
};
class PresentManager {
@@ -57,7 +58,9 @@ public:
/// Recreates the present frame to match the provided parameters
void RecreateFrame(Frame* frame, u32 width, u32 height, VkFormat image_view_format,
VkRenderPass rd);
VkRenderPass rd, bool storage);
[[nodiscard]] bool NeedsStorage(const Frame* frame, bool required) const;
/// Waits for the present thread to finish presenting all queued frames.
void WaitPresent();