Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++
1.7 KB
Raw Blame
// SPDX-License-Identifier: GPL-3.0-only
// Host adapter for lmxxf's MIT C ABI; third_party/lmxxf/ records the pinned source.
#pragma once
#include <d3d12.h>
#include <filesystem>
#include <cstdint>
#include <string>
#include "../../../third_party/lmxxf/LmxxfNrApi.h"
#include "veyra/pipeline/AmdNrBackend.h"

namespace veyra::pipeline {
class LmxxfNrBackend : public AmdNrBackend {
public:
    ~LmxxfNrBackend() { close(); }
    LmxxfNrBackend() = default;
    LmxxfNrBackend(const LmxxfNrBackend&) = delete;
    LmxxfNrBackend& operator=(const LmxxfNrBackend&) = delete;
    bool open(const std::filesystem::path& directory, ID3D12Device*, ID3D12CommandQueue*, uint32_t vendor, bool performance = true);
    void close() noexcept;
    bool ready() const { return context_ != nullptr; }
    bool admits(uint32_t width, uint32_t height) const;
    bool recordInputs(ID3D12GraphicsCommandList*, ID3D12Resource* color, uint64_t frame, bool reset, float intensity = 1);
    bool enqueue(); // immediately after the producer submission, on the session queue
    bool recordOutputs(ID3D12GraphicsCommandList*, ID3D12Resource* destination);
    bool retireSubmitted(); // after the list containing RecordOutputs was submitted
    const std::string& error() const { return error_; }
private:
    bool result(int32_t code, const char* operation);
    HMODULE module_ = nullptr;
    LmxxfNrApi api_{};
    LmxxfNrCapabilities caps_{};
    LmxxfNrJob job_{};
    void* context_ = nullptr;
    ID3D12CommandQueue* queue_ = nullptr; // graph owns it and outlives the adapter
    uint64_t session_ = 0;
    bool enqueued_ = false, outputsRecorded_ = false, diagnosticsLogged_ = false;
    std::string error_;
};
}