mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-15 13:16:43 +00:00
372bdfccbc
This is the first step into the conversion on full GPU video decoding for Android; currently due to the VIC structure, I couldn't set it on surface mode to prevent the latency when sending video decoded (which is processed by GPU now), because currently we convert YUV420 into the Nvidia's format each frame constantly on CPU, aside the requirements from other extensions to work + VIC rewrite, which is a work currently not planned to happen on this PR; the actual configuration for video decoding is ByteBuffer, using GPU to decode NVDEC data (all codecs supported, h264, vp8 and vp9) and send it to CPU for display purposes, which is more faster than relying purely on CPU for any drawing task, saving devices resources/ heating, the downside on this will be the slight latency when a new frame is displayed, which is gonna be a black frame for less than a second, nothing major to harm the experience rather than actually trying our best to take advantage on hardware accelerated. Aside this, I also added a bunch of minor Vulkan fixes to grant drivers less thinkering when receiving spir-v instructions, meaning this has new bans for extensions on QCOM (following reported issues on other projects working around Adreno driver behavior), this more than providing performance aims to enhance the stability on the driver, performance it's gonna likely to be hit based on the UBO's (StorageBufferAccess) operations and SSBO (uniformStorageBufferAccess), there was an already existing path for the emulation which forces to wide them into 32bit packed operations. I also included some smaller changes/ bugs + VUID's fixes from earlier changes on my work. Special Thanks: -> Mr. Smoly Gidolard (@gidoly) Sources: 1.- https://github.com/microsoft/DirectXShaderCompiler/issues/2842 2.- https://github.com/mlc-ai/web-llm/issues/836 3.- https://github.com/ggml-org/llama.cpp/issues/5186 4.- https://github.com/encounter/aurora/pull/202 Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4191
121 lines
3.5 KiB
C++
121 lines
3.5 KiB
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <future>
|
|
#include <jni.h>
|
|
#include <network/network.h>
|
|
|
|
#include "video_core/rasterizer_interface.h"
|
|
|
|
namespace Common::Android {
|
|
|
|
JNIEnv* GetEnvForThread();
|
|
|
|
/**
|
|
* Starts a new thread to run JNI. Intended to be used when you must run JNI from a fiber.
|
|
* @tparam T Typename of the return value for the work param
|
|
* @param work Lambda that runs JNI code. This function will take care of attaching this thread to
|
|
* the JVM
|
|
* @return The result from the work lambda param
|
|
*/
|
|
template <typename T = void>
|
|
T RunJNIOnFiber(const std::function<T(JNIEnv*)>& work) {
|
|
std::future<T> j_result = std::async(std::launch::async, [&] {
|
|
auto env = GetEnvForThread();
|
|
return work(env);
|
|
});
|
|
return j_result.get();
|
|
}
|
|
|
|
jclass GetNativeLibraryClass();
|
|
|
|
jclass GetDiskCacheProgressClass();
|
|
jclass GetDiskCacheLoadCallbackStageClass();
|
|
jclass GetGameDirClass();
|
|
jmethodID GetGameDirConstructor();
|
|
jmethodID GetDiskCacheLoadProgress();
|
|
jmethodID GetCopyToStorage();
|
|
jmethodID GetFileExists();
|
|
jmethodID GetFileExtension();
|
|
|
|
jmethodID GetExitEmulationActivity();
|
|
jmethodID GetOnEmulationStarted();
|
|
jmethodID GetOnEmulationStopped();
|
|
jmethodID GetOnProgramChanged();
|
|
|
|
jclass GetGameClass();
|
|
jmethodID GetGameConstructor();
|
|
jfieldID GetGameTitleField();
|
|
jfieldID GetGamePathField();
|
|
jfieldID GetGameProgramIdField();
|
|
jfieldID GetGameDeveloperField();
|
|
jfieldID GetGameVersionField();
|
|
jfieldID GetGameIsHomebrewField();
|
|
|
|
jclass GetStringClass();
|
|
jclass GetPairClass();
|
|
jmethodID GetPairConstructor();
|
|
jfieldID GetPairFirstField();
|
|
jfieldID GetPairSecondField();
|
|
|
|
jclass GetOverlayControlDataClass();
|
|
jmethodID GetOverlayControlDataConstructor();
|
|
jfieldID GetOverlayControlDataIdField();
|
|
jfieldID GetOverlayControlDataEnabledField();
|
|
jfieldID GetOverlayControlDataIndividualScaleField();
|
|
jfieldID GetOverlayControlDataLandscapePositionField();
|
|
jfieldID GetOverlayControlDataPortraitPositionField();
|
|
jfieldID GetOverlayControlDataFoldablePositionField();
|
|
|
|
jclass GetPatchClass();
|
|
jmethodID GetPatchConstructor();
|
|
jfieldID GetPatchEnabledField();
|
|
jfieldID GetPatchNameField();
|
|
jfieldID GetPatchVersionField();
|
|
jfieldID GetPatchTypeField();
|
|
jfieldID GetPatchProgramIdField();
|
|
jfieldID GetPatchTitleIdField();
|
|
|
|
jclass GetDoubleClass();
|
|
jmethodID GetDoubleConstructor();
|
|
jfieldID GetDoubleValueField();
|
|
|
|
jclass GetIntegerClass();
|
|
jmethodID GetIntegerConstructor();
|
|
jfieldID GetIntegerValueField();
|
|
|
|
jclass GetBooleanClass();
|
|
jmethodID GetBooleanConstructor();
|
|
jfieldID GetBooleanValueField();
|
|
|
|
jclass GetPlayerInputClass();
|
|
jmethodID GetPlayerInputConstructor();
|
|
jfieldID GetPlayerInputConnectedField();
|
|
jfieldID GetPlayerInputButtonsField();
|
|
jfieldID GetPlayerInputAnalogsField();
|
|
jfieldID GetPlayerInputMotionsField();
|
|
jfieldID GetPlayerInputVibrationEnabledField();
|
|
jfieldID GetPlayerInputVibrationStrengthField();
|
|
jfieldID GetPlayerInputBodyColorLeftField();
|
|
jfieldID GetPlayerInputBodyColorRightField();
|
|
jfieldID GetPlayerInputButtonColorLeftField();
|
|
jfieldID GetPlayerInputButtonColorRightField();
|
|
jfieldID GetPlayerInputProfileNameField();
|
|
jfieldID GetPlayerInputUseSystemVibratorField();
|
|
|
|
jclass GetYuzuInputDeviceInterface();
|
|
jmethodID GetYuzuDeviceGetName();
|
|
jmethodID GetYuzuDeviceGetGUID();
|
|
jmethodID GetYuzuDeviceGetPort();
|
|
jmethodID GetYuzuDeviceGetSupportsVibration();
|
|
jmethodID GetYuzuDeviceVibrate();
|
|
jmethodID GetYuzuDeviceGetAxes();
|
|
jmethodID GetYuzuDeviceHasKeys();
|
|
jmethodID GetAddNetPlayMessage();
|
|
jmethodID ClearChat();
|
|
|
|
|
|
} // namespace Common::Android
|