mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-01 08:48:35 +00:00
VideoCommon: add milliseconds elapsed time value to pixel shaders as a uniform to be able to support animation effects in custom shaders
This commit is contained in:
parent
675544ec2b
commit
931a8aa413
7 changed files with 24 additions and 1 deletions
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/DolphinAnalytics.h"
|
||||
#include "Core/HW/SystemTimers.h"
|
||||
#include "Core/System.h"
|
||||
|
||||
#include "VideoCommon/AbstractGfx.h"
|
||||
|
@ -107,6 +108,8 @@ VertexManagerBase::~VertexManagerBase() = default;
|
|||
bool VertexManagerBase::Initialize()
|
||||
{
|
||||
m_frame_end_event = AfterFrameEvent::Register([this] { OnEndFrame(); }, "VertexManagerBase");
|
||||
m_after_present_event = AfterPresentEvent::Register(
|
||||
[this](PresentInfo& pi) { m_ticks_elapsed = pi.emulated_timestamp; }, "VertexManagerBase");
|
||||
m_index_generator.Init();
|
||||
m_custom_shader_cache = std::make_unique<CustomShaderCache>();
|
||||
m_cpu_cull.Init();
|
||||
|
@ -526,6 +529,13 @@ void VertexManagerBase::Flush()
|
|||
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||
|
||||
if (g_ActiveConfig.bGraphicMods)
|
||||
{
|
||||
const double seconds_elapsed =
|
||||
static_cast<double>(m_ticks_elapsed) / SystemTimers::GetTicksPerSecond();
|
||||
pixel_shader_manager.constants.time_ms = seconds_elapsed * 1000;
|
||||
}
|
||||
|
||||
CalculateBinormals(VertexLoaderManager::GetCurrentVertexFormat());
|
||||
// Calculate ZSlope for zfreeze
|
||||
const auto used_textures = UsedTextures();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue