Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
CamilleLaVey
e46c19391d Add small_vector to CopyMSAA with reserve image on upload path 2026-08-22 23:18:10 -04:00
CamilleLaVey
3d453e6236 [TEST] Unify another section of the blits on MSAA path 2026-08-22 23:13:20 -04:00
CamilleLaVey
9392ccf124 color write meows 2026-08-22 21:55:02 -04:00
CamilleLaVey
16b9b5aa0c Revert "[TEST] Save space with Sync2" 2026-08-22 21:41:04 -04:00
CamilleLaVey
2df4744b53 Some meows 2026-08-22 21:40:47 -04:00
CamilleLaVey
faf82ccdd7 [TEST] Unify paths on MSAA part 2 2026-08-22 20:13:10 -04:00
CamilleLaVey
8f18e82931 [TEST] Unify blit helpers of msaa and depth stencil msaa 2026-08-22 16:03:44 -04:00
CamilleLaVey
7102ff8ecb Disable msaa tiler resolve + removal dead code from branch 2026-08-22 15:27:03 -04:00
CamilleLaVey
385b844e2a Remove additional feedback loop checks 2026-08-22 14:58:23 -04:00
CamilleLaVey
518f571fcf [TEST] Save space with Sync2 2026-08-22 04:42:36 -04:00
CamilleLaVey
e0d4318042 Fix build 2026-08-22 03:51:12 -04:00
CamilleLaVey
06ac01adb0 [TEST] MSAA unification paths on MSAA and DepthMSAA 2026-08-22 03:41:54 -04:00
CamilleLaVey
a6d49872a1 [TEST] Adjustments on the pipeline cache + optimized vertex buffer refinement 2026-08-22 03:34:01 -04:00
CamilleLaVey
b0b4817162 [TEST] Adjustments on MSAA 2026-08-22 02:49:06 -04:00
CamilleLaVey
9f776cfca7 [TEST] Adjustments on color write enable 2026-08-22 01:22:01 -04:00
CamilleLaVey
5b1613087c Changes requested by reviewer meower 2026-08-22 01:07:34 -04:00
CamilleLaVey
b22a796f4b Remove strings from rescale hack 2026-08-22 00:51:44 -04:00
CamilleLaVey
04cfc60756 Fix licenses 2026-08-22 00:48:13 -04:00
CamilleLaVey
6a3ff818e0 Revert "Extract pitch unswizzle pass from vk-experiments7" 2026-08-22 00:45:54 -04:00
CamilleLaVey
22b51d0c61 Extract pitch unswizzle pass from vk-experiments7 2026-08-21 23:19:49 -04:00
CamilleLaVey
78ce48e4ca add finish on block linear pass 2026-08-21 23:00:15 -04:00
CamilleLaVey
9510516e68 Fix build 2026-08-21 22:41:03 -04:00
CamilleLaVey
33ae95f4ae [TEST] Add Exchange initialization on 3D pass for linear unswizzling 2026-08-21 22:30:07 -04:00
CamilleLaVey
1cd118eccc [TEST] Return FP16 + FP32 SZ nan-preserve on QCOM 2026-08-21 21:32:19 -04:00
CamilleLaVey
4bf30b41a6 ASDÑlasfu mfudgh rq 2026-08-20 19:49:12 -04:00
CamilleLaVey
6390edb76d Remove FP32 sz nan preserve on QCOM 2026-08-20 16:33:14 -04:00
CamilleLaVey
f0ba93d75f Here we go again 2026-08-20 15:36:22 -04:00
CamilleLaVey
68ff82679f GIVE ME SOMETHING 2026-08-20 02:54:02 -04:00
CamilleLaVey
543d4dfc8e [TEST] Bypass unresolved render 2026-08-20 01:48:16 -04:00
CamilleLaVey
e3be392b8a [TEST] Wondering around cbuf live route 2026-08-19 23:58:21 -04:00
CamilleLaVey
b754fcc49c [TEST] Ensure resolve shadow reads on msaa + shader extencil fallback 2026-08-19 22:40:54 -04:00
CamilleLaVey
a4c37b5117 Flush deferred clears tied to scissor entries on framebuffer 2026-08-19 20:49:54 -04:00
CamilleLaVey
8206c7abac [TEST] Add clipping distances to GS 2026-08-19 19:05:47 -04:00
CamilleLaVey
faacc62b10 [TEST] Prune on passthrough stores 2026-08-19 17:42:09 -04:00
CamilleLaVey
b0a01ca629 [TEST] Add varyings to the legacy fallback when no gemoetry shader passthrough is available 2026-08-19 15:43:19 -04:00
CamilleLaVey
945d5c373b [TEST] Added another MSAA depth stencil shaders to convert into non msaa + sanitize MSAA UINT/SINT path 2026-08-19 03:13:47 -04:00
CamilleLaVey
cb04b133ea [TEST] Ported fix from tiled-gpu-v2 for ZBCTable 2026-08-19 02:54:25 -04:00
CamilleLaVey
ff3de66bab Quick adjustment on deferred clears order 2026-08-19 02:33:19 -04:00
CamilleLaVey
3ce788b09c Forcing off rescale hack 2026-08-19 01:55:02 -04:00
CamilleLaVey
2a1b9278b9 [TEST] MSAA depth stencil discard again 2026-08-19 00:41:14 -04:00
CamilleLaVey
842b5e0b3a [TEST] New MSAA shader for UINT/SINT color 2026-08-18 23:03:37 -04:00
CamilleLaVey
2f83399798 [TEST] Removal of IsSafeDownload death path 2026-08-18 22:35:04 -04:00
CamilleLaVey
2e52ca5753 [TEST] Corroborating the dowload/copy on MSAA path 2026-08-18 21:22:25 -04:00
CamilleLaVey
69cd5ee0d1 [TEST] Improve the geometry shader handling 2026-08-18 20:51:29 -04:00
CamilleLaVey
1f0605c35d [TEST] Remove the whole geometry shader changes 2026-08-18 20:07:28 -04:00
CamilleLaVey
b9c28ef6a1 [TEST] Return the previous geometry shader passthrough handling 2026-08-18 16:25:31 -04:00
CamilleLaVey
809a61f600 [TEST] Quick revert on MSAA clamp 2026-08-17 22:11:43 -04:00
CamilleLaVey
c7b24bad1a [TEST] Vertex, Samplers limits adjustments based on hardware support + MSAA Sample Counts degradation 2026-08-17 20:00:06 -04:00
CamilleLaVey
4244a6418d Fix license header + removal of ternary on depth stencil routes for msaa uploads 2026-08-17 17:57:13 -04:00
CamilleLaVey
26044e18e1 Re-apply commit 2026-08-17 00:57:17 -04:00
CamilleLaVey
04d08f0cf1 [TEST] Blitting on MSAA 2026-08-16 22:41:06 -04:00
CamilleLaVey
2bf037c7bb [TEST] Swizzling adjustment on the new fast path 2026-08-16 20:52:37 -04:00
CamilleLaVey
f6668ef01b [TEST] Adjustments over the vkformat undefined and border color swizzle 2026-08-16 19:59:23 -04:00
CamilleLaVey
20a775ed08 Another meow 2026-08-16 19:34:45 -04:00
CamilleLaVey
3379556d89 [TEST] Return Xenoblade workaround + extend srgb handling on border colors 2026-08-16 18:57:37 -04:00
CamilleLaVey
8e687924b8 Funny meows 2026-08-16 18:38:56 -04:00
CamilleLaVey
d3e8c5e977 [TEST] CustomBoderColor changes 2026-08-16 18:38:56 -04:00
CamilleLaVey
95e67e6533 [TEST] Aniso fixes 2026-08-16 18:38:56 -04:00
CamilleLaVey
bdd1785b04 [TEST] Quick change on depth's handling 2026-08-16 18:38:56 -04:00
CamilleLaVey
f9e5ac191e [TEST] Depth stencil resolve + MSAA depth stencil 2026-08-16 18:38:56 -04:00
CamilleLaVey
f3a674c064 [TEST] MSAA uploads 2026-08-16 18:38:56 -04:00
CamilleLaVey
4aa35bc835 [TEST] Fix vkFormat accessors 2026-08-16 18:38:56 -04:00
CamilleLaVey
894f2544a0 [TEST] Geometry shader changes + barrier fixes 2026-08-16 18:38:56 -04:00
CamilleLaVey
ceffda663c [TEST] Fix TFB subdependency 2026-08-16 18:38:56 -04:00
CamilleLaVey
27e7fa10d9 [TEST] Fix missing barrier + removal of required aligments checks inside swizzle textures 2026-08-16 18:38:56 -04:00
CamilleLaVey
d3bd4f42cf [TEST] Adjustments on pipeline hash collisions 2026-08-16 18:38:56 -04:00
CamilleLaVey
5a8fb951dd [TEST] Remove subpass dependency 2026-08-16 18:38:56 -04:00
CamilleLaVey
27942142cf [TEST] Ported PSO optimizations from tiled-gpu-v2 2026-08-16 18:38:56 -04:00
CamilleLaVey
db647f9a40 [TEST] Another bind vertex buffer optimization from previous handling 2026-08-16 18:38:56 -04:00
CamilleLaVey
35aeb0cf55 [TEST] Playing with SGSR 2026-08-16 18:38:56 -04:00
CamilleLaVey
3423d3c6a5 [TEST] fast path on swizzle decoding 2026-08-16 18:38:56 -04:00
CamilleLaVey
607bc18ad4 [TEST] Bring the unswizzle work from tiled-gpu-v2 2026-08-16 18:38:55 -04:00
88 changed files with 3702 additions and 1210 deletions

View file

@ -18,7 +18,6 @@ enum class BooleanSetting(override val key: String) : AbstractBooleanSetting {
SKIP_CPU_INNER_INVALIDATION("skip_cpu_inner_invalidation"),
FIX_BLOOM_EFFECTS("fix_bloom_effects"),
EMULATE_BGR565("emulate_bgr565"),
RESCALE_HACK("rescale_hack"),
CPUOPT_UNSAFE_HOST_MMU("cpuopt_unsafe_host_mmu"),
USE_DOCKED_MODE("use_docked_mode"),
USE_AUTO_STUB("use_auto_stub"),

View file

@ -624,6 +624,7 @@ abstract class SettingsItem(
IntSetting.FSR_SHARPENING_SLIDER,
titleId = R.string.fsr_sharpness,
descriptionId = R.string.fsr_sharpness_description,
max = 200,
units = "%"
)
)
@ -876,13 +877,6 @@ abstract class SettingsItem(
descriptionId = R.string.fix_bloom_effects_description
)
)
put(
SwitchSetting(
BooleanSetting.RESCALE_HACK,
titleId = R.string.rescale_hack,
descriptionId = R.string.rescale_hack_description
)
)
put(
SwitchSetting(
BooleanSetting.EMULATE_BGR565,

View file

@ -1182,7 +1182,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
container,
IntSetting.FSR_SHARPENING_SLIDER,
minValue = 0,
maxValue = 100,
maxValue = 200,
units = "%"
)
}

View file

@ -33,6 +33,7 @@ void AndroidConfig::SaveAllValues() {
}
void AndroidConfig::ReadAndroidValues() {
Settings::values.rescale_hack.SetValue(false);
ReadAndroidUIValues();
if (global) {
ReadUIValues();

View file

@ -514,8 +514,6 @@
<string name="fix_bloom_effects_description">يقلل من ضبابية التوهج في LA/EOW (Adreno A6XX - A7XX/ Turnip)، ويزيل التوهج في Burnout. تحذير: قد يسبب تشوهات رسومية في ألعاب أخرى.</string>
<string name="emulate_bgr565">محاكاة BGR565</string>
<string name="emulate_bgr565_description">يُصلح مشاكل انعكاس الألوان في الألعاب أو ظهور تشوهات غريبة أو ظلال غريبة.</string>
<string name="rescale_hack">تفعيل ميزة إعادة التحجيم القديمة</string>
<string name="rescale_hack_description">يُمكّن هذا الخيار من التعامل مع عملية إعادة تحجيم الألعاب بطريقة تقليدية باستخدام مسار إعادة التحجيم السريع</string>
<string name="renderer_asynchronous_shaders">استخدم تظليل غير متزامن</string>
<string name="renderer_asynchronous_shaders_description">يقوم بتجميع التظليل بشكل غير متزامن. قد يقلل ذلك من التقطعات ولكنه قد يؤدي أيضًا إلى حدوث أخطاء.</string>
<string name="gpu_unswizzle_settings">إعدادات إلغاء ترتيب بيانات وحدة معالجة الرسومات</string>
@ -1088,7 +1086,6 @@
<string name="theme_mode_light">فاتح</string>
<string name="theme_mode_dark">داكن</string>
<string name="multiplier_none">لا شيء</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">خلفيات سوداء</string>

View file

@ -1004,7 +1004,6 @@ Wirklich fortfahren?</string>
<string name="theme_mode_light">Hell</string>
<string name="theme_mode_dark">Dunkel</string>
<string name="multiplier_none">Keine</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Schwarze Hintergründe</string>

View file

@ -506,8 +506,6 @@
<string name="fix_bloom_effects_description">Reduce el efecto de resplandor en LA/EOW (Adreno A6XX - A7XX/ Turnip), elimina el resplandor en Burnout. Advertencia: puede causar artefactos gráficos en otros juegos.</string>
<string name="emulate_bgr565">Emular BGR565</string>
<string name="emulate_bgr565_description">Soluciona problemas con colores invertidos en juegos, artefactos o sombras extrañas.</string>
<string name="rescale_hack">Activar la pasada de reescalado heredada</string>
<string name="rescale_hack_description">Permite el manejo de versiones anteriores para el paso de configuración de reescalado para juegos mediante el uso de una ruta de reescalado rápida.</string>
<string name="renderer_asynchronous_shaders">Usar sombreadores asíncronos</string>
<string name="renderer_asynchronous_shaders_description">Compila los sombreadores de forma asíncrona. Esto puede reducir los tirones, pero también puede introducir errores gráficos.</string>
<string name="gpu_unswizzle_settings">Ajustes de desentrelazado de la GPU</string>
@ -1080,7 +1078,6 @@
<string name="theme_mode_light">Claro</string>
<string name="theme_mode_dark">Oscuro</string>
<string name="multiplier_none">Nada</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Fondos oscuros</string>

View file

@ -808,9 +808,6 @@
<string name="multiplier_x4">x4</string>
<string name="multiplier_x8">x8</string>
<string name="multiplier_x16">x16</string>
<string name="multiplier_x32">x32</string>
<string name="multiplier_x64">x64</string>
<string name="multiplier_none">None</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">پس‌زمینه مشکی</string>

View file

@ -1016,7 +1016,6 @@
<string name="theme_mode_light">Lumineux</string>
<string name="theme_mode_dark">Sombre</string>
<string name="multiplier_none">Aucun</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Arrière-plan noir</string>

View file

@ -948,7 +948,6 @@
<string name="theme_mode_light">Jasny</string>
<string name="theme_mode_dark">Ciemny</string>
<string name="multiplier_none">Brak</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Czarne tła</string>

View file

@ -897,7 +897,6 @@
<string name="theme_mode_light">Claro</string>
<string name="theme_mode_dark">Escuro</string>
<string name="multiplier_none">Nenhum</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Planos de fundo pretos</string>

View file

@ -510,8 +510,6 @@
<string name="fix_bloom_effects_description">Частично убирает размытие в LA/EOW (Adreno A6XX - A7XX/ Turnip), полностью отключает его в Burnout. Внимание: может вызывать графические артефакты в других играх.</string>
<string name="emulate_bgr565">Эмулировать BGR565</string>
<string name="emulate_bgr565_description">Исправляет проблемы с инвертированными цветами в играх, а также со странными артефактами или некорректными тенями.</string>
<string name="rescale_hack">Включить старый метод изменения разрешения</string>
<string name="rescale_hack_description">Включает старый метод обработки этапа перенастройки масштабирования для игр за счёт использования быстрого алгоритма перемасштабирования.</string>
<string name="renderer_asynchronous_shaders">Использовать асинхронные шейдеры</string>
<string name="renderer_asynchronous_shaders_description">Компилирует шейдеры асинхронно. Это может уменьшить подтормаживания, но также может вызвать графические артефакты.</string>
<string name="gpu_unswizzle_settings">Настройки распаковки текстур (Unswizzle)</string>
@ -1084,7 +1082,6 @@
<string name="theme_mode_light">Светлая</string>
<string name="theme_mode_dark">Темная</string>
<string name="multiplier_none">Отключено</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Чёрный фон</string>

View file

@ -505,8 +505,6 @@
<string name="fix_bloom_effects_description">Зменшує розмиття світіння в LA/EOW (Adreno A6XX–A7XX / Turnip), прибирає світіння в Burnout. Увага: може спричинити графічні артефакти в інших іграх.</string>
<string name="emulate_bgr565">Емулювати BGR565</string>
<string name="emulate_bgr565_description">Виправляє проблеми з інвертованими кольорами в іграх або дивними артефактами чи тінями.</string>
<string name="rescale_hack">Увімкнути застаріле масштабування</string>
<string name="rescale_hack_description">Вмикає застарілу обробку масштабування для ігор, використовуючи швидкий шлях масштабування</string>
<string name="renderer_asynchronous_shaders">Асинхронні шейдери</string>
<string name="renderer_asynchronous_shaders_description">Компілює шейдери асинхронно. Це може зменшити затримки, але також може спричинити графічні баги.</string>
<string name="gpu_unswizzle_settings">Налаштування розпакування за допомогою ГП</string>
@ -1066,7 +1064,6 @@
<string name="theme_mode_light">Світла</string>
<string name="theme_mode_dark">Темна</string>
<string name="multiplier_none">Жодного</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Чорний фон</string>

View file

@ -504,8 +504,6 @@
<string name="fix_bloom_effects_description">减少《智慧的再现》和《众神的三角力量2》(Adreno A6XX - A7XX/ Turnip)中的 bloom 模糊,并移除《Burnout》中的 bloom 效果。警告:可能会导致在其他游戏中出现图形异常。</string>
<string name="emulate_bgr565">模拟 BGR565</string>
<string name="emulate_bgr565_description">修复游戏中的颜色反转或是异常的画面瑕疵或阴影问题</string>
<string name="rescale_hack">启用旧版缩放处理</string>
<string name="rescale_hack_description">启用通过使用快速缩放路径,来为游戏提供缩放配置处理的传统处理方式</string>
<string name="renderer_asynchronous_shaders">使用异步着色器</string>
<string name="renderer_asynchronous_shaders_description">以异步方式编译着色器。采用此方式或可减少卡顿,但也可能引入故障点。</string>
<string name="gpu_unswizzle_settings">GPU Unswizzle 设置</string>
@ -1078,7 +1076,6 @@
<string name="theme_mode_light">浅色</string>
<string name="theme_mode_dark">深色</string>
<string name="multiplier_none">无</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">使用黑色背景</string>

View file

@ -926,7 +926,6 @@
<string name="theme_mode_light">淺色</string>
<string name="theme_mode_dark">深色</string>
<string name="multiplier_none">無</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">黑色背景</string>

View file

@ -513,9 +513,6 @@
<item>@string/multiplier_x4</item>
<item>@string/multiplier_x8</item>
<item>@string/multiplier_x16</item>
<item>@string/multiplier_x32</item>
<item>@string/multiplier_x64</item>
<item>@string/multiplier_none</item>
</string-array>
<integer-array name="anisoValues">
<item>0</item>
@ -524,9 +521,6 @@
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
</integer-array>
<string-array name="verticalAlignmentEntries">

View file

@ -581,8 +581,6 @@
<string name="fix_bloom_effects_description">Reduces bloom blur in LA/EOW (Adreno A6XX - A7XX/ Turnip), removes bloom in Burnout. Warning: may cause graphical artifacts in other games.</string>
<string name="emulate_bgr565">Emulate BGR565</string>
<string name="emulate_bgr565_description">Fixes problems with inverted colors in games or strange artifacts or strange shadows.</string>
<string name="rescale_hack">Enable Legacy Rescale Pass</string>
<string name="rescale_hack_description">Enables a legacy handling for the rescale configuration pass for games by using a quick rescale path</string>
<string name="renderer_asynchronous_shaders">Use asynchronous shaders</string>
<string name="renderer_asynchronous_shaders_description">Compiles shaders asynchronously. This may reduce stutters but may also introduce glitches.</string>
<string name="gpu_unswizzle_settings">GPU Unswizzle Settings</string>
@ -1246,9 +1244,6 @@
<string name="multiplier_x4" translatable="false">x4</string>
<string name="multiplier_x8" translatable="false">x8</string>
<string name="multiplier_x16" translatable="false">x16</string>
<string name="multiplier_x32" translatable="false">x32</string>
<string name="multiplier_x64" translatable="false">x64</string>
<string name="multiplier_none">None</string>
<!-- Black backgrounds theme -->
<string name="use_black_backgrounds">Black backgrounds</string>

View file

@ -128,7 +128,7 @@ ENUM(TimeZone, Auto, Default, Cet, Cst6Cdt, Cuba, Eet, Egypt, Eire, Est, Est5Edt
GmtPlusZero, GmtMinusZero, GmtZero, Greenwich, Hongkong, Hst, Iceland, Iran, Israel, Jamaica,
Japan, Kwajalein, Libya, Met, Mst, Mst7Mdt, Navajo, Nz, NzChat, Poland, Portugal, Prc, Pst8Pdt,
Roc, Rok, Singapore, Turkey, Uct, Universal, Utc, WSu, Wet, Zulu);
ENUM(AnisotropyMode, Automatic, Default, X2, X4, X8, X16, X32, X64, None);
ENUM(AnisotropyMode, Automatic, Default, X2, X4, X8, X16);
ENUM(AstcDecodeMode, Cpu, Gpu, CpuAsynchronous);
ENUM(AstcRecompression, Uncompressed, Bc1, Bc3);
ENUM(FramePacingMode, Target_Auto, Target_30, Target_60, Target_90, Target_120);

View file

@ -4,6 +4,7 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
#include <cstring>
#include "common/assert.h"
#include "common/logging.h"
@ -264,7 +265,7 @@ NvResult nvhost_ctrl_gpu::ZCullGetInfo(IoctlNvgpuGpuZcullGetInfoArgs& params) {
}
NvResult nvhost_ctrl_gpu::ZBCSetTable(IoctlZbcSetTable& params) {
if (params.type > supported_types) {
if (params.type == 0 || params.type > supported_types) {
LOG_ERROR(Service_NVDRV, "ZBCSetTable: invalid type {:#x}", params.type);
return NvResult::BadParameter;
}
@ -279,42 +280,61 @@ NvResult nvhost_ctrl_gpu::ZBCSetTable(IoctlZbcSetTable& params) {
color_entry.format = params.format;
color_entry.ref_cnt = 1u;
auto color_it = std::ranges::find_if(zbc_colors,
[&](const ZbcColorEntry& color_in_question) {
return color_entry.format == color_in_question.format &&
color_entry.color_ds == color_in_question.color_ds &&
color_entry.color_l2 == color_in_question.color_l2;
});
const auto color_end = zbc_colors.begin() + zbc_used_color_entries;
auto color_it = std::find_if(zbc_colors.begin(), color_end,
[&](const ZbcColorEntry& color_in_question) {
return color_entry.format == color_in_question.format &&
color_entry.color_ds == color_in_question.color_ds &&
color_entry.color_l2 == color_in_question.color_l2;
});
if (color_it != zbc_colors.end()) {
if (color_it != color_end) {
++color_it->ref_cnt;
LOG_DEBUG(Service_NVDRV, "ZBCSetTable: reused color entry fmt={:#x}, ref_cnt={:#x}",
params.format, color_it->ref_cnt);
} else {
zbc_colors.push_back(color_entry);
LOG_DEBUG(Service_NVDRV, "ZBCSetTable: added color entry fmt={:#x}, index={:#x}",
params.format, zbc_colors.size() - 1);
break;
}
if (zbc_used_color_entries >= ZBC_TABLE_SIZE) {
LOG_WARNING(Service_NVDRV, "ZBCSetTable: color table is full, fmt={:#x}",
params.format);
return NvResult::InsufficientMemory;
}
zbc_colors[zbc_used_color_entries] = color_entry;
LOG_DEBUG(Service_NVDRV, "ZBCSetTable: added color entry fmt={:#x}, index={:#x}",
params.format, zbc_used_color_entries);
++zbc_used_color_entries;
break;
}
case ZBCTypes::depth: {
ZbcDepthEntry depth_entry{params.depth, params.format, 1u};
auto depth_it = std::ranges::find_if(zbc_depths,
[&](const ZbcDepthEntry& depth_entry_in_question) {
return depth_entry.format == depth_entry_in_question.format &&
depth_entry.depth == depth_entry_in_question.depth;
});
const auto depth_end = zbc_depths.begin() + zbc_used_depth_entries;
auto depth_it = std::find_if(zbc_depths.begin(), depth_end,
[&](const ZbcDepthEntry& depth_entry_in_question) {
return depth_entry.format == depth_entry_in_question.format &&
depth_entry.depth == depth_entry_in_question.depth;
});
if (depth_it != zbc_depths.end()) {
if (depth_it != depth_end) {
++depth_it->ref_cnt;
LOG_DEBUG(Service_NVDRV, "ZBCSetTable: reused depth entry fmt={:#x}, ref_cnt={:#x}",
depth_entry.format, depth_it->ref_cnt);
} else {
zbc_depths.push_back(depth_entry);
LOG_DEBUG(Service_NVDRV, "ZBCSetTable: added depth entry fmt={:#x}, index={:#x}",
depth_entry.format, zbc_depths.size() - 1);
break;
}
if (zbc_used_depth_entries >= ZBC_TABLE_SIZE) {
LOG_WARNING(Service_NVDRV, "ZBCSetTable: depth table is full, fmt={:#x}",
depth_entry.format);
return NvResult::InsufficientMemory;
}
zbc_depths[zbc_used_depth_entries] = depth_entry;
LOG_DEBUG(Service_NVDRV, "ZBCSetTable: added depth entry fmt={:#x}, index={:#x}",
depth_entry.format, zbc_used_depth_entries);
++zbc_used_depth_entries;
break;
}
}
@ -329,10 +349,16 @@ NvResult nvhost_ctrl_gpu::ZBCQueryTable(IoctlZbcQueryTable& params) {
std::scoped_lock lk(zbc_mutex);
if (params.type == 0) {
params.index_size = ZBC_TABLE_SIZE;
return NvResult::Success;
}
switch (static_cast<ZBCTypes>(params.type)) {
case ZBCTypes::color: {
if (params.index_size >= zbc_colors.size()) {
LOG_ERROR(Service_NVDRV, "ZBCQueryTable: invalid color index {:#x}", params.index_size);
if (params.index_size >= zbc_used_color_entries) {
LOG_ERROR(Service_NVDRV, "ZBCQueryTable: invalid color index {:#x}",
params.index_size);
return NvResult::BadParameter;
}
@ -342,12 +368,13 @@ NvResult nvhost_ctrl_gpu::ZBCQueryTable(IoctlZbcQueryTable& params) {
params.depth = 0;
params.ref_cnt = colors.ref_cnt;
params.format = colors.format;
params.index_size = static_cast<u32>(zbc_colors.size());
params.index_size = zbc_used_color_entries;
break;
}
case ZBCTypes::depth: {
if (params.index_size >= zbc_depths.size()) {
LOG_ERROR(Service_NVDRV, "ZBCQueryTable: invalid depth index {:#x}", params.index_size);
if (params.index_size >= zbc_used_depth_entries) {
LOG_ERROR(Service_NVDRV, "ZBCQueryTable: invalid depth index {:#x}",
params.index_size);
return NvResult::BadParameter;
}
@ -357,7 +384,8 @@ NvResult nvhost_ctrl_gpu::ZBCQueryTable(IoctlZbcQueryTable& params) {
params.depth = depth_entry.depth;
params.ref_cnt = depth_entry.ref_cnt;
params.format = depth_entry.format;
params.index_size = static_cast<u32>(zbc_depths.size());
params.index_size = zbc_used_depth_entries;
break;
}
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <vector>
#include <array>
#include "common/common_funcs.h"
#include "common/common_types.h"
@ -212,10 +212,14 @@ private:
Kernel::KEvent* unknown_event;
// ZBC Tables
static constexpr u32 ZBC_TABLE_SIZE = 15u;
static constexpr u32 supported_types = 2u;
std::mutex zbc_mutex{};
std::vector<ZbcColorEntry> zbc_colors{};
std::vector<ZbcDepthEntry> zbc_depths{};
const u32 supported_types = 2u;
std::array<ZbcColorEntry, ZBC_TABLE_SIZE> zbc_colors{};
std::array<ZbcDepthEntry, ZBC_TABLE_SIZE> zbc_depths{};
u32 zbc_used_color_entries{};
u32 zbc_used_depth_entries{};
};
} // namespace Service::Nvidia::Devices

Some files were not shown because too many files have changed in this diff Show more