mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2025-01-17 09:02:13 +01:00
dfa2fd0e0d
* code: Prepare frontend for vulkan support * citra_qt: Add vulkan options to the GUI * vk_instance: Collect tooling info * renderer_vulkan: Add vulkan backend * qt: Fix fullscreen and resize issues on macOS. (#47) * qt: Fix bugged macOS full screen transition. * renderer/vulkan: Fix swapchain recreation destroying in-use semaphore. * renderer/vulkan: Make gl_Position invariant. (#48) This fixes an issue with black artifacts in Pokemon games on Apple GPUs. If the vertex calculations differ slightly between render passes, it can cause parts of model faces to fail depth test. * vk_renderpass_cache: Bump pixel format count * android: Custom driver code * vk_instance: Set moltenvk configuration * rasterizer_cache: Proper surface unregister * citra_qt: Fix invalid characters * vk_rasterizer: Correct special unbind * android: Allow async presentation toggle * vk_graphics_pipeline: Fix async shader compilation * We were actually waiting for the pipelines regardless of the setting, oops * vk_rasterizer: More robust attribute loading * android: Move PollEvents to OpenGL window * Vulkan does not need this and it causes problems * vk_instance: Enable robust buffer access * Improves stability on mali devices * vk_renderpass_cache: Bring back renderpass flushing * externals: Update vulkan-headers * gl_rasterizer: Separable shaders for everyone * vk_blit_helper: Corect depth to color convertion * renderer_vulkan: Implement reinterpretation with copy * Allows reinterpreteration with simply copy on AMD * vk_graphics_pipeline: Only fast compile if no shaders are pending * With this shaders weren't being compiled in parallel * vk_swapchain: Ensure vsync doesn't lock framerate * vk_present_window: Match guest swapchain size to vulkan image count * Less latency and fixes crashes that were caused by images being deleted before free * vk_instance: Blacklist VK_EXT_pipeline_creation_cache_control with nvidia gpus * Resolves crashes when async shader compilation is enabled * vk_rasterizer: Bump async threshold to 6 * Many games have fullscreen quads with 6 vertices. Fixes pokemon textures missing with async shaders * android: More robust surface recreation * renderer_vulkan: Fix dynamic state being lost * vk_pipeline_cache: Skip cache save when no pipeline cache exists * This is the cache when loading a save state * sdl: Fix surface initialization on macOS. (#49) * sdl: Fix surface initialization on macOS. * sdl: Fix render window events not being handled under Vulkan. * renderer/vulkan: Fix binding/unbinding of shadow rendering buffer. * vk_stream_buffer: Respect non coherent access alignment * Required by nvidia GPUs on MacOS * renderer/vulkan: Support VK_EXT_fragment_shader_interlock for shadow rendering. (#51) * renderer_vulkan: Port some recent shader fixes * vk_pipeline_cache: Improve shadow detection * vk_swapchain: Add missing check * renderer_vulkan: Fix hybrid screen * Revert "gl_rasterizer: Separable shaders for everyone" Causes crashes on mali GPUs, will need separate PR This reverts commit d22d556d30ff641b62dfece85738c96b7fbf7061. * renderer_vulkan: Fix flipped screenshot --------- Co-authored-by: Steveice10 <1269164+Steveice10@users.noreply.github.com>
119 lines
3.4 KiB
C++
119 lines
3.4 KiB
C++
// Copyright 2014 Citra Emulator Project
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include "common/common_types.h"
|
|
#include "core/frontend/framebuffer_layout.h"
|
|
#include "video_core/rasterizer_interface.h"
|
|
|
|
namespace Frontend {
|
|
class EmuWindow;
|
|
}
|
|
|
|
namespace Core {
|
|
class System;
|
|
}
|
|
|
|
namespace VideoCore {
|
|
|
|
enum class ScreenId : u32 {
|
|
TopLeft,
|
|
TopRight,
|
|
Bottom,
|
|
};
|
|
|
|
struct RendererSettings {
|
|
// Screenshot
|
|
std::atomic_bool screenshot_requested{false};
|
|
void* screenshot_bits{};
|
|
std::function<void()> screenshot_complete_callback;
|
|
Layout::FramebufferLayout screenshot_framebuffer_layout;
|
|
// Renderer
|
|
std::atomic_bool bg_color_update_requested{false};
|
|
std::atomic_bool shader_update_requested{false};
|
|
};
|
|
|
|
class RendererBase : NonCopyable {
|
|
public:
|
|
explicit RendererBase(Core::System& system, Frontend::EmuWindow& window,
|
|
Frontend::EmuWindow* secondary_window);
|
|
virtual ~RendererBase();
|
|
|
|
/// Returns the rasterizer owned by the renderer
|
|
virtual VideoCore::RasterizerInterface* Rasterizer() = 0;
|
|
|
|
/// Finalize rendering the guest frame and draw into the presentation texture
|
|
virtual void SwapBuffers() = 0;
|
|
|
|
/// Draws the latest frame to the window waiting timeout_ms for a frame to arrive (Renderer
|
|
/// specific implementation)
|
|
virtual void TryPresent(int timeout_ms, bool is_secondary) = 0;
|
|
virtual void TryPresent(int timeout_ms) {
|
|
TryPresent(timeout_ms, false);
|
|
}
|
|
|
|
/// Prepares for video dumping (e.g. create necessary buffers, etc)
|
|
virtual void PrepareVideoDumping() {}
|
|
|
|
/// Cleans up after video dumping is ended
|
|
virtual void CleanupVideoDumping() {}
|
|
|
|
/// Synchronizes fixed function renderer state
|
|
virtual void Sync() {}
|
|
|
|
/// This is called to notify the rendering backend of a surface change
|
|
virtual void NotifySurfaceChanged() {}
|
|
|
|
/// Returns the resolution scale factor relative to the native 3DS screen resolution
|
|
u32 GetResolutionScaleFactor();
|
|
|
|
/// Updates the framebuffer layout of the contained render window handle.
|
|
void UpdateCurrentFramebufferLayout(bool is_portrait_mode = {});
|
|
|
|
/// Ends the current frame
|
|
void EndFrame();
|
|
|
|
f32 GetCurrentFPS() const {
|
|
return current_fps;
|
|
}
|
|
|
|
s32 GetCurrentFrame() const {
|
|
return current_frame;
|
|
}
|
|
|
|
Frontend::EmuWindow& GetRenderWindow() {
|
|
return render_window;
|
|
}
|
|
|
|
const Frontend::EmuWindow& GetRenderWindow() const {
|
|
return render_window;
|
|
}
|
|
|
|
[[nodiscard]] RendererSettings& Settings() {
|
|
return settings;
|
|
}
|
|
|
|
[[nodiscard]] const RendererSettings& Settings() const {
|
|
return settings;
|
|
}
|
|
|
|
/// Returns true if a screenshot is being processed
|
|
[[nodiscard]] bool IsScreenshotPending() const;
|
|
|
|
/// Request a screenshot of the next frame
|
|
void RequestScreenshot(void* data, std::function<void()> callback,
|
|
const Layout::FramebufferLayout& layout);
|
|
|
|
protected:
|
|
Core::System& system;
|
|
RendererSettings settings;
|
|
Frontend::EmuWindow& render_window; ///< Reference to the render window handle.
|
|
Frontend::EmuWindow* secondary_window; ///< Reference to the secondary render window handle.
|
|
f32 current_fps = 0.0f; ///< Current framerate, should be set by the renderer
|
|
s32 current_frame = 0; ///< Current frame, should be set by the renderer
|
|
};
|
|
|
|
} // namespace VideoCore
|