mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
The last of the Winlator lineage rewritten out; rumble on the phone
The five files the audit measured as Winlator's are replaced: a one-method callback interface by java.util.function.Consumer, the component base by SessionPart (attach an application context, start, stop), the environment list by HostEnvironment, the process starter by HostProcess, and the pad's state holder by PadState with named sticks, triggers, directions and buttons. The frame-generation tree is framegen/ (its contents were never Winlator's: lsfg-vk's port and Bannerlator's Win-FG), the log tags are the app's, and the fake pad's rumble socket is now one the app actually serves: RumbleComponent turns a game's force-feedback effects into the phone's vibrator, which used to go nowhere. The two design notes describing Bannerlator's X11 path are gone, and the README and credits say what is whose.
This commit is contained in:
1 parent
2fb79735c3
commit
9cfb96e358
84 files changed
+493
-1771
No files matched your search
@@ -0,0 +1,111 @@
|
||||
#pragma once
|
||||
// ============================================================================
|
||||
// lsfg_probe - capability gate for native (compositor-side) LSFG frame
|
||||
// generation.
|
||||
//
|
||||
// The Lossless Scaling chain is 25 compute shaders that DXVK's DXBC translator
|
||||
// emits as SPIR-V 1.6 with OpCapability VulkanMemoryModel and
|
||||
// StorageImageWriteWithoutFormat. Three consequences, all checked here:
|
||||
//
|
||||
// * SPIR-V 1.6 will not load on a Vulkan 1.1 device, so the DEVICE (not just
|
||||
// the instance) must report 1.3+ ... OR, on the experimental Vulkan 1.1
|
||||
// compat path, offer VK_KHR_spirv_1_4 + VK_KHR_vulkan_memory_model so the
|
||||
// same modules can be handed over as SPIR-V 1.4 (see downgradeSpirv in
|
||||
// lsfg_dll.h). The stock Qualcomm driver on Adreno 7xx phones reports
|
||||
// 1.1.128 yet carries every one of those extensions (measured on an
|
||||
// Adreno 710 / HyperOS device with `cmd gpu vkjson`).
|
||||
// * vulkanMemoryModel, shaderStorageImageWriteWithoutFormat and
|
||||
// shaderStorageImageExtendedFormats must be ENABLED at device creation.
|
||||
// Today the renderer enables no features at all, so all three are off.
|
||||
// * `generate` writes into a storage image, and Android swapchain formats
|
||||
// are frequently not storage-capable - so the format is probed separately
|
||||
// once the swapchain has picked one.
|
||||
//
|
||||
// A device failing any gate reports unsupported UP FRONT, with a reason, so
|
||||
// the UI can grey the engine out instead of failing later inside
|
||||
// vkCreateShaderModule or vkCreateComputePipelines.
|
||||
// ============================================================================
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "lsfg_dll.h" // kSpirv14/15/16
|
||||
|
||||
struct VkTable;
|
||||
|
||||
namespace lsfg {
|
||||
|
||||
// Which of the three required features the physical device OFFERS. Queried
|
||||
// before vkCreateDevice; what we actually enable is recorded in Caps below.
|
||||
struct FeatureSupport {
|
||||
bool queried = false; // vkGetPhysicalDeviceFeatures2 resolved
|
||||
bool apiAtLeast13 = false;
|
||||
bool vulkanMemoryModel = false;
|
||||
bool vulkanMemoryModelDeviceScope= false;
|
||||
bool storageImageWriteWithoutFormat = false;
|
||||
bool storageImageExtendedFormats = false;
|
||||
uint32_t deviceApiVersion = 0;
|
||||
|
||||
// Experimental Vulkan 1.1 compat: the device is below 1.3 but offers the
|
||||
// extensions that make the chain loadable. When set, the renderer must
|
||||
// enable those extensions at device creation (see extensionNames) and the
|
||||
// modules are downgraded to `spirvTarget` at load.
|
||||
bool extensionPath = false;
|
||||
bool hasSpirv14 = false; // VK_KHR_spirv_1_4
|
||||
bool hasFloatControls = false; // VK_KHR_shader_float_controls (spirv_1_4 depends on it)
|
||||
bool hasMemoryModelExt = false; // VK_KHR_vulkan_memory_model
|
||||
uint32_t spirvTarget = kSpirv16;
|
||||
|
||||
// Every hard device-level gate passes (format is checked separately).
|
||||
bool deviceGatesPass() const {
|
||||
return queried && (apiAtLeast13 || extensionPath) && vulkanMemoryModel
|
||||
&& storageImageWriteWithoutFormat && storageImageExtendedFormats;
|
||||
}
|
||||
};
|
||||
|
||||
// What was actually enabled + the running verdict. Owned by the renderer.
|
||||
struct Caps {
|
||||
FeatureSupport features;
|
||||
bool featuresEnabled = false; // the chain was passed to vkCreateDevice
|
||||
bool storageOnSwapchainFormat = false;
|
||||
// The swapchain format blits with VK_FILTER_LINEAR (needs
|
||||
// SAMPLED_IMAGE_FILTER_LINEAR on the source). Not a gate: without it the
|
||||
// capture-resolution upscale falls back to NEAREST.
|
||||
bool linearBlitOnSwapchainFormat = false;
|
||||
VkFormat probedFormat = VK_FORMAT_UNDEFINED;
|
||||
char reason[160] = "not probed";
|
||||
|
||||
// The single question the UI and the render path ask.
|
||||
bool supported() const {
|
||||
return featuresEnabled && features.deviceGatesPass() && storageOnSwapchainFormat;
|
||||
}
|
||||
};
|
||||
|
||||
// Ask the physical device which of the required features it offers.
|
||||
// Safe on any driver: if vkGetPhysicalDeviceFeatures2 cannot be resolved, or
|
||||
// the device reports below Vulkan 1.2 and `allowVk11` is false, nothing is
|
||||
// chained and `queried` is left false - the caller then creates the device
|
||||
// exactly as it always has. With `allowVk11`, a 1.1 device is accepted when
|
||||
// `deviceExtensions` lists VK_KHR_spirv_1_4, VK_KHR_shader_float_controls and
|
||||
// VK_KHR_vulkan_memory_model, and the memory-model features are queried
|
||||
// through the KHR struct instead of VkPhysicalDeviceVulkan12Features.
|
||||
FeatureSupport queryFeatures(const VkTable& vk, VkPhysicalDevice pd,
|
||||
const std::vector<VkExtensionProperties>& deviceExtensions,
|
||||
bool allowVk11);
|
||||
|
||||
// The device extensions the extension path needs enabled, in the order they
|
||||
// should be pushed onto VkDeviceCreateInfo. Empty unless extensionPath.
|
||||
std::vector<const char*> extensionNames(const FeatureSupport& f);
|
||||
|
||||
// Probe VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT on the live swapchain format.
|
||||
// `generate` writes into an image of this format via a compute dispatch.
|
||||
bool probeStorageFormat(const VkTable& vk, VkPhysicalDevice pd, VkFormat fmt);
|
||||
|
||||
// Whether the format may be the source of a VK_FILTER_LINEAR blit.
|
||||
bool probeLinearBlit(const VkTable& vk, VkPhysicalDevice pd, VkFormat fmt);
|
||||
|
||||
// Fill caps.reason with the FIRST gate that failed (or "supported").
|
||||
void explain(Caps& caps);
|
||||
|
||||
} // namespace lsfg
|
||||
Reference in new issue
Block a user