This commit is contained in:
Pancake 2025-07-30 21:30:23 +02:00 committed by GitHub
commit 7113d7d02d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 58 additions and 31 deletions

View file

@ -22,7 +22,7 @@ jobs:
packages: git wget xvfb
clang clang-tools llvm rustup
cmake ninja-build pkg-config
libvulkan-dev
libdecor-0-0 libvulkan-dev
libgtk-4-dev libadwaita-1-dev
version: 1.0
execute_install_scripts: true
@ -60,10 +60,17 @@ jobs:
- name: Upload lsfg-vk artifact
uses: actions/upload-artifact@v4
with:
name: lsfg-vk_TEST
name: lsfg-vk
path: |
build-release/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json
build-release/share/applications/lsfg-vk-ui.desktop
build-release/share/icons/hicolor/256x256/apps/gay.pancake.lsfg-vk-ui.png
build-release/lib/liblsfg-vk.so
build-release/bin/lsfg-vk-ui
- name: Upload lsfg-vk artifact (without UI)
uses: actions/upload-artifact@v4
with:
name: lsfg-vk_noui
path: |
build-release/share/vulkan/implicit_layer.d/VkLayer_LS_frame_generation.json
build-release/lib/liblsfg-vk.so

View file

@ -19,6 +19,6 @@ jobs:
- name: Build Flatpak extension (${{ matrix.version }})
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: "org.freedesktop.Platform.VulkanLayer.lsfg_vk_TEST_${{ matrix.version }}.flatpak"
bundle: "org.freedesktop.Platform.VulkanLayer.lsfg_vk_${{ matrix.version }}.flatpak"
manifest-path: "scripts/flatpak/org.freedesktop.Platform.VulkanLayer.lsfgvk_${{ matrix.version }}.yml"
verbose: true

View file

@ -18,7 +18,7 @@ jobs:
- name: Download lsfg-vk artifacts
uses: actions/download-artifact@v4
with:
name: lsfg-vk_TEST
name: lsfg-vk
path: .
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
@ -30,18 +30,18 @@ jobs:
- name: Upload lsfg-vk for dpkg
uses: actions/upload-artifact@v4
with:
name: lsfg-vk.dpkg_TEST
name: lsfg-vk.dpkg
path: |
*.deb
- name: Upload lsfg-vk for rpm
uses: actions/upload-artifact@v4
with:
name: lsfg-vk.rpm_TEST
name: lsfg-vk.rpm
path: |
*.rpm
- name: Upload lsfg-vk for alpm
uses: actions/upload-artifact@v4
with:
name: lsfg-vk.alpm_TEST
name: lsfg-vk.alpm
path: |
*.zst

View file

@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_SKIP_RPATH ON)
set(CMAKE_C_VISIBILITY_PRESET "hidden")
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
# subprojects
add_compile_options(-fPIC
@ -15,7 +17,7 @@ add_subdirectory(framegen)
# main project
project(lsfg-vk
VERSION 0.9.0
VERSION 1.0.0
DESCRIPTION "Lossless Scaling Frame Generation on Linux"
LANGUAGES CXX)

View file

@ -1,5 +1,8 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_C_VISIBILITY_PRESET "hidden")
set(CMAKE_CXX_VISIBILITY_PRESET "hidden")
project(lsfg-vk-framegen
DESCRIPTION "Lossless Scaling Frame Generation Backend"
LANGUAGES CXX)

View file

@ -20,6 +20,7 @@ namespace LSFG_3_1 {
///
/// @throws LSFG::vulkan_error if Vulkan objects fail to initialize.
///
__attribute__((visibility("default")))
void initialize(uint64_t deviceUUID,
bool isHdr, float flowScale, uint64_t generationCount,
const std::function<std::vector<uint8_t>(const std::string&)>& loader);
@ -36,6 +37,7 @@ namespace LSFG_3_1 {
///
/// @throws LSFG::vulkan_error if the context cannot be created.
///
__attribute__((visibility("default")))
int32_t createContext(
int in0, int in1, const std::vector<int>& outN,
VkExtent2D extent, VkFormat format);
@ -49,6 +51,7 @@ namespace LSFG_3_1 {
///
/// @throws LSFG::vulkan_error if the context cannot be presented.
///
__attribute__((visibility("default")))
void presentContext(int32_t id, int inSem, const std::vector<int>& outSem);
///
@ -56,11 +59,13 @@ namespace LSFG_3_1 {
///
/// @param id Unique identifier of the context to delete.
///
__attribute__((visibility("default")))
void deleteContext(int32_t id);
///
/// Deinitialize the LSFG library.
///
__attribute__((visibility("default")))
void finalize();
}

View file

@ -20,6 +20,7 @@ namespace LSFG_3_1P {
///
/// @throws LSFG::vulkan_error if Vulkan objects fail to initialize.
///
__attribute__((visibility("default")))
void initialize(uint64_t deviceUUID,
bool isHdr, float flowScale, uint64_t generationCount,
const std::function<std::vector<uint8_t>(const std::string&)>& loader);
@ -36,6 +37,7 @@ namespace LSFG_3_1P {
///
/// @throws LSFG::vulkan_error if the context cannot be created.
///
__attribute__((visibility("default")))
int32_t createContext(
int in0, int in1, const std::vector<int>& outN,
VkExtent2D extent, VkFormat format);
@ -49,6 +51,7 @@ namespace LSFG_3_1P {
///
/// @throws LSFG::vulkan_error if the context cannot be presented.
///
__attribute__((visibility("default")))
void presentContext(int32_t id, int inSem, const std::vector<int>& outSem);
///
@ -56,11 +59,13 @@ namespace LSFG_3_1P {
///
/// @param id Unique identifier of the context to delete.
///
__attribute__((visibility("default")))
void deleteContext(int32_t id);
///
/// Deinitialize the LSFG library.
///
__attribute__((visibility("default")))
void finalize();
}

View file

@ -318,7 +318,6 @@ void Delta::Dispatch(const Core::CommandBuffer& buf, uint64_t frameCount, uint64
Utils::BarrierBuilder(buf)
.addW2R(this->tempImgs2.at(0))
.addW2R(this->tempImgs2.at(1))
.addW2R(this->optImg3)
.addR2W(this->tempImgs1.at(0))
.addR2W(this->tempImgs1.at(1))
.build();

View file

@ -32,19 +32,20 @@ namespace LSFG_3_1P::Shaders {
/// @param inImg2 Second Input image
/// @param optImg1 Optional image for non-first passes.
/// @param optImg2 Second optional image for non-first passes.
/// @param optImg3 Third optional image for non-first passes.
///
/// @throws LSFG::vulkan_error if resource creation fails.
///
Delta(Vulkan& vk, std::array<std::array<Core::Image, 2>, 3> inImgs1,
Core::Image inImg2,
std::optional<Core::Image> optImg1,
std::optional<Core::Image> optImg2);
std::optional<Core::Image> optImg2,
std::optional<Core::Image> optImg3);
///
/// Dispatch the shaderchain.
///
void Dispatch(const Core::CommandBuffer& buf, uint64_t frameCount, uint64_t pass_idx,
bool last);
void Dispatch(const Core::CommandBuffer& buf, uint64_t frameCount, uint64_t pass_idx);
/// Get the first output image
[[nodiscard]] const auto& getOutImage1() const { return this->outImg1; }
@ -71,7 +72,7 @@ namespace LSFG_3_1P::Shaders {
std::array<std::array<Core::Image, 2>, 3> inImgs1;
Core::Image inImg2;
std::optional<Core::Image> optImg1, optImg2;
std::optional<Core::Image> optImg1, optImg2, optImg3;
std::array<Core::Image, 3> tempImgs1;
std::array<Core::Image, 2> tempImgs2;
Core::Image outImg1, outImg2;

View file

@ -50,7 +50,8 @@ Context::Context(Vulkan& vk,
this->alpha.at(6 - i).getOutImages(),
this->beta.getOutImages().at(6 - i),
(i == 4) ? std::nullopt : std::make_optional(this->gamma.at(i - 1).getOutImage()),
(i == 4) ? std::nullopt : std::make_optional(this->delta.at(i - 5).getOutImage1()));
(i == 4) ? std::nullopt : std::make_optional(this->delta.at(i - 5).getOutImage1()),
(i == 4) ? std::nullopt : std::make_optional(this->delta.at(i - 5).getOutImage2()));
}
this->generate = Shaders::Generate(vk,
this->inImg_0, this->inImg_1,
@ -106,7 +107,7 @@ void Context::present(Vulkan& vk,
for (size_t i = 0; i < 7; i++) {
this->gamma.at(i).Dispatch(buf2, this->frameIdx, pass);
if (i >= 4)
this->delta.at(i - 4).Dispatch(buf2, this->frameIdx, pass, i == 6);
this->delta.at(i - 4).Dispatch(buf2, this->frameIdx, pass);
}
this->generate.Dispatch(buf2, this->frameIdx, pass);

View file

@ -17,9 +17,11 @@ using namespace LSFG_3_1P::Shaders;
Delta::Delta(Vulkan& vk, std::array<std::array<Core::Image, 2>, 3> inImgs1,
Core::Image inImg2,
std::optional<Core::Image> optImg1,
std::optional<Core::Image> optImg2)
std::optional<Core::Image> optImg2,
std::optional<Core::Image> optImg3)
: inImgs1(std::move(inImgs1)), inImg2(std::move(inImg2)),
optImg1(std::move(optImg1)), optImg2(std::move(optImg2)) {
optImg1(std::move(optImg1)), optImg2(std::move(optImg2)),
optImg3(std::move(optImg3)) {
// create resources
this->shaderModules = {{
vk.shaders.getShader(vk.device, "p_delta[0]",
@ -114,7 +116,7 @@ Delta::Delta(Vulkan& vk, std::array<std::array<Core::Image, 2>, 3> inImgs1,
.add(VK_DESCRIPTOR_TYPE_SAMPLER, this->samplers.at(2))
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs1.at((i + 2) % 3))
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->inImgs1.at(i % 3))
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg1)
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->tempImgs1)
.build();
}
@ -194,14 +196,13 @@ Delta::Delta(Vulkan& vk, std::array<std::array<Core::Image, 2>, 3> inImgs1,
.add(VK_DESCRIPTOR_TYPE_SAMPLER, this->samplers.at(0))
.add(VK_DESCRIPTOR_TYPE_SAMPLER, this->samplers.at(2))
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->tempImgs1.at(0))
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE)
.add(VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, this->optImg3)
.add(VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, this->outImg2)
.build();
}
}
void Delta::Dispatch(const Core::CommandBuffer& buf, uint64_t frameCount, uint64_t pass_idx,
bool last) {
void Delta::Dispatch(const Core::CommandBuffer& buf, uint64_t frameCount, uint64_t pass_idx) {
auto& pass = this->passes.at(pass_idx);
// first shader
@ -275,9 +276,6 @@ void Delta::Dispatch(const Core::CommandBuffer& buf, uint64_t frameCount, uint64
pass.sixthDescriptorSet.at(frameCount % 3).bind(buf, this->pipelines.at(5));
buf.dispatch(threadsX, threadsY, 1);
if (!last)
return;
// seventh shader
Utils::BarrierBuilder(buf)
.addW2R(this->tempImgs2)
@ -314,6 +312,7 @@ void Delta::Dispatch(const Core::CommandBuffer& buf, uint64_t frameCount, uint64
Utils::BarrierBuilder(buf)
.addW2R(this->tempImgs1.at(0))
.addW2R(this->tempImgs1.at(1))
.addW2R(this->optImg3)
.addR2W(this->outImg2)
.build();

View file

@ -219,6 +219,8 @@ namespace Layer {
}
/// Symbol definition for Vulkan instance layer.
__attribute__((visibility("default")))
extern "C" PFN_vkVoidFunction layer_vkGetInstanceProcAddr(VkInstance instance, const char* pName);
/// Symbol definition for Vulkan device layer.
__attribute__((visibility("default")))
extern "C" PFN_vkVoidFunction layer_vkGetDeviceProcAddr(VkDevice device, const char* pName);

View file

@ -48,8 +48,9 @@ mv -v target/release/lsfg-vk-ui AppDir/shared/bin
cd AppDir
xvfb-run -a ../sharun-aio l -p -v -e -s -k \
shared/bin/lsfg-vk-ui \
/usr/lib/gdk-pixbuf-*/*/loaders/* \
/usr/lib/gio/modules/libdconfsettings.so
/usr/lib/*/libdecor* \
/usr/lib/*/gdk-pixbuf-*/*/loaders/* \
/usr/lib/*/gio/modules/libdconfsettings.so
ln -fv ./sharun ./AppRun
./sharun -g
cd ..

View file

@ -15,7 +15,9 @@
#include <thread>
namespace {
__attribute__((constructor)) void lsfgvk_init() {
__attribute__((constructor))
__attribute__((visibility("default")))
void lsfgvk_init() {
std::cerr << std::unitbuf;
// read configuration

2
ui/Cargo.lock generated
View file

@ -682,7 +682,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94"
[[package]]
name = "lsfg-vk-ui"
version = "0.9.0"
version = "1.0.0"
dependencies = [
"anyhow",
"glib-build-tools",

View file

@ -1,6 +1,6 @@
[package]
name = "lsfg-vk-ui"
version = "0.9.0"
version = "1.0.0"
edition = "2021"
[dependencies]

View file

@ -44,7 +44,7 @@
<object class="LSPrefEntry" id="profile_name">
<property name="opt-name">Profile name</property>
<property name="opt-subtitle">Command name used for automatically activating in games.</property>
<property name="icon-name">search-symbolic</property>
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
</object>

View file

@ -8,7 +8,7 @@ mod wrapper;
mod config;
mod utils;
const APP_ID: &str = "gay.pancake.lsfg-vk";
const APP_ID: &str = "gay.pancake.lsfg-vk-ui";
#[derive(Debug)]
struct State {