VideoCommon: De-globalize GeometryShaderManager class.
This commit is contained in:
parent
1bfecd8003
commit
cb0a603c72
|
@ -20,6 +20,7 @@
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
#include "VideoCommon/CommandProcessor.h"
|
#include "VideoCommon/CommandProcessor.h"
|
||||||
#include "VideoCommon/Fifo.h"
|
#include "VideoCommon/Fifo.h"
|
||||||
|
#include "VideoCommon/GeometryShaderManager.h"
|
||||||
#include "VideoCommon/PixelEngine.h"
|
#include "VideoCommon/PixelEngine.h"
|
||||||
#include "VideoCommon/PixelShaderManager.h"
|
#include "VideoCommon/PixelShaderManager.h"
|
||||||
#include "VideoCommon/VertexShaderManager.h"
|
#include "VideoCommon/VertexShaderManager.h"
|
||||||
|
@ -40,6 +41,7 @@ struct System::Impl
|
||||||
DVDThread::DVDThreadState m_dvd_thread_state;
|
DVDThread::DVDThreadState m_dvd_thread_state;
|
||||||
ExpansionInterface::ExpansionInterfaceState m_expansion_interface_state;
|
ExpansionInterface::ExpansionInterfaceState m_expansion_interface_state;
|
||||||
Fifo::FifoManager m_fifo;
|
Fifo::FifoManager m_fifo;
|
||||||
|
GeometryShaderManager m_geometry_shader_manager;
|
||||||
Memory::MemoryManager m_memory;
|
Memory::MemoryManager m_memory;
|
||||||
MemoryInterface::MemoryInterfaceState m_memory_interface_state;
|
MemoryInterface::MemoryInterfaceState m_memory_interface_state;
|
||||||
PixelEngine::PixelEngineManager m_pixel_engine;
|
PixelEngine::PixelEngineManager m_pixel_engine;
|
||||||
|
@ -133,6 +135,11 @@ Fifo::FifoManager& System::GetFifo() const
|
||||||
return m_impl->m_fifo;
|
return m_impl->m_fifo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GeometryShaderManager& System::GetGeometryShaderManager() const
|
||||||
|
{
|
||||||
|
return m_impl->m_geometry_shader_manager;
|
||||||
|
}
|
||||||
|
|
||||||
Memory::MemoryManager& System::GetMemory() const
|
Memory::MemoryManager& System::GetMemory() const
|
||||||
{
|
{
|
||||||
return m_impl->m_memory;
|
return m_impl->m_memory;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
class GeometryShaderManager;
|
||||||
class PixelShaderManager;
|
class PixelShaderManager;
|
||||||
class SoundStream;
|
class SoundStream;
|
||||||
struct Sram;
|
struct Sram;
|
||||||
|
@ -105,6 +106,7 @@ public:
|
||||||
DVDThread::DVDThreadState& GetDVDThreadState() const;
|
DVDThread::DVDThreadState& GetDVDThreadState() const;
|
||||||
ExpansionInterface::ExpansionInterfaceState& GetExpansionInterfaceState() const;
|
ExpansionInterface::ExpansionInterfaceState& GetExpansionInterfaceState() const;
|
||||||
Fifo::FifoManager& GetFifo() const;
|
Fifo::FifoManager& GetFifo() const;
|
||||||
|
GeometryShaderManager& GetGeometryShaderManager() const;
|
||||||
Memory::MemoryManager& GetMemory() const;
|
Memory::MemoryManager& GetMemory() const;
|
||||||
MemoryInterface::MemoryInterfaceState& GetMemoryInterfaceState() const;
|
MemoryInterface::MemoryInterfaceState& GetMemoryInterfaceState() const;
|
||||||
PixelEngine::PixelEngineManager& GetPixelEngine() const;
|
PixelEngine::PixelEngineManager& GetPixelEngine() const;
|
||||||
|
|
|
@ -272,11 +272,12 @@ void VertexManager::UploadUniforms()
|
||||||
vertex_shader_manager.dirty = false;
|
vertex_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GeometryShaderManager::dirty)
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
if (geometry_shader_manager.dirty)
|
||||||
{
|
{
|
||||||
UpdateConstantBuffer(m_geometry_constant_buffer.Get(), &GeometryShaderManager::constants,
|
UpdateConstantBuffer(m_geometry_constant_buffer.Get(), &geometry_shader_manager.constants,
|
||||||
sizeof(GeometryShaderConstants));
|
sizeof(GeometryShaderConstants));
|
||||||
GeometryShaderManager::dirty = false;
|
geometry_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
|
@ -161,15 +161,18 @@ void VertexManager::UpdateVertexShaderConstants()
|
||||||
|
|
||||||
void VertexManager::UpdateGeometryShaderConstants()
|
void VertexManager::UpdateGeometryShaderConstants()
|
||||||
{
|
{
|
||||||
if (!GeometryShaderManager::dirty || !ReserveConstantStorage())
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
|
||||||
|
if (!geometry_shader_manager.dirty || !ReserveConstantStorage())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Renderer::GetInstance()->SetConstantBuffer(2, m_uniform_stream_buffer.GetCurrentGPUPointer());
|
Renderer::GetInstance()->SetConstantBuffer(2, m_uniform_stream_buffer.GetCurrentGPUPointer());
|
||||||
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer(), &GeometryShaderManager::constants,
|
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer(), &geometry_shader_manager.constants,
|
||||||
sizeof(GeometryShaderConstants));
|
sizeof(GeometryShaderConstants));
|
||||||
m_uniform_stream_buffer.CommitMemory(sizeof(GeometryShaderConstants));
|
m_uniform_stream_buffer.CommitMemory(sizeof(GeometryShaderConstants));
|
||||||
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(GeometryShaderConstants));
|
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(GeometryShaderConstants));
|
||||||
GeometryShaderManager::dirty = false;
|
geometry_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexManager::UpdatePixelShaderConstants()
|
void VertexManager::UpdatePixelShaderConstants()
|
||||||
|
@ -241,6 +244,7 @@ void VertexManager::UploadAllConstants()
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||||
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
|
||||||
// Copy the actual data in
|
// Copy the actual data in
|
||||||
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + pixel_constants_offset,
|
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + pixel_constants_offset,
|
||||||
|
@ -248,7 +252,7 @@ void VertexManager::UploadAllConstants()
|
||||||
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + vertex_constants_offset,
|
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + vertex_constants_offset,
|
||||||
&vertex_shader_manager.constants, sizeof(VertexShaderConstants));
|
&vertex_shader_manager.constants, sizeof(VertexShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + geometry_constants_offset,
|
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + geometry_constants_offset,
|
||||||
&GeometryShaderManager::constants, sizeof(GeometryShaderConstants));
|
&geometry_shader_manager.constants, sizeof(GeometryShaderConstants));
|
||||||
|
|
||||||
// Finally, flush buffer memory after copying
|
// Finally, flush buffer memory after copying
|
||||||
m_uniform_stream_buffer.CommitMemory(allocation_size);
|
m_uniform_stream_buffer.CommitMemory(allocation_size);
|
||||||
|
@ -256,7 +260,7 @@ void VertexManager::UploadAllConstants()
|
||||||
|
|
||||||
// Clear dirty flags
|
// Clear dirty flags
|
||||||
vertex_shader_manager.dirty = false;
|
vertex_shader_manager.dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
geometry_shader_manager.dirty = false;
|
||||||
pixel_shader_manager.dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -848,7 +848,9 @@ void Metal::StateTracker::PrepareRender()
|
||||||
if (!m_flags.has_gx_gs_uniform && pipe->UsesVertexBuffer(2))
|
if (!m_flags.has_gx_gs_uniform && pipe->UsesVertexBuffer(2))
|
||||||
{
|
{
|
||||||
m_flags.has_gx_gs_uniform = true;
|
m_flags.has_gx_gs_uniform = true;
|
||||||
[m_current_render_encoder setVertexBytes:&GeometryShaderManager::constants
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
[m_current_render_encoder setVertexBytes:&geometry_shader_manager.constants
|
||||||
length:sizeof(GeometryShaderConstants)
|
length:sizeof(GeometryShaderConstants)
|
||||||
atIndex:2];
|
atIndex:2];
|
||||||
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(GeometryShaderConstants));
|
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(GeometryShaderConstants));
|
||||||
|
|
|
@ -92,11 +92,12 @@ void Metal::VertexManager::CommitBuffer(u32 num_vertices, u32 vertex_stride, u32
|
||||||
void Metal::VertexManager::UploadUniforms()
|
void Metal::VertexManager::UploadUniforms()
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
|
||||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||||
g_state_tracker->InvalidateUniforms(vertex_shader_manager.dirty, GeometryShaderManager::dirty,
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
g_state_tracker->InvalidateUniforms(vertex_shader_manager.dirty, geometry_shader_manager.dirty,
|
||||||
pixel_shader_manager.dirty);
|
pixel_shader_manager.dirty);
|
||||||
vertex_shader_manager.dirty = false;
|
vertex_shader_manager.dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
geometry_shader_manager.dirty = false;
|
||||||
pixel_shader_manager.dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,8 @@ void ProgramShaderCache::UploadConstants()
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||||
if (pixel_shader_manager.dirty || vertex_shader_manager.dirty || GeometryShaderManager::dirty)
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
if (pixel_shader_manager.dirty || vertex_shader_manager.dirty || geometry_shader_manager.dirty)
|
||||||
{
|
{
|
||||||
auto buffer = s_buffer->Map(s_ubo_buffer_size, s_ubo_align);
|
auto buffer = s_buffer->Map(s_ubo_buffer_size, s_ubo_align);
|
||||||
|
|
||||||
|
@ -235,7 +236,7 @@ void ProgramShaderCache::UploadConstants()
|
||||||
|
|
||||||
memcpy(buffer.first + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align) +
|
memcpy(buffer.first + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align) +
|
||||||
Common::AlignUp(sizeof(VertexShaderConstants), s_ubo_align),
|
Common::AlignUp(sizeof(VertexShaderConstants), s_ubo_align),
|
||||||
&GeometryShaderManager::constants, sizeof(GeometryShaderConstants));
|
&geometry_shader_manager.constants, sizeof(GeometryShaderConstants));
|
||||||
|
|
||||||
s_buffer->Unmap(s_ubo_buffer_size);
|
s_buffer->Unmap(s_ubo_buffer_size);
|
||||||
glBindBufferRange(GL_UNIFORM_BUFFER, 1, s_buffer->m_buffer, buffer.second,
|
glBindBufferRange(GL_UNIFORM_BUFFER, 1, s_buffer->m_buffer, buffer.second,
|
||||||
|
@ -250,7 +251,7 @@ void ProgramShaderCache::UploadConstants()
|
||||||
|
|
||||||
pixel_shader_manager.dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
vertex_shader_manager.dirty = false;
|
vertex_shader_manager.dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
geometry_shader_manager.dirty = false;
|
||||||
|
|
||||||
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, s_ubo_buffer_size);
|
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, s_ubo_buffer_size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,17 +222,20 @@ void VertexManager::UpdateVertexShaderConstants()
|
||||||
|
|
||||||
void VertexManager::UpdateGeometryShaderConstants()
|
void VertexManager::UpdateGeometryShaderConstants()
|
||||||
{
|
{
|
||||||
if (!GeometryShaderManager::dirty || !ReserveConstantStorage())
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
|
||||||
|
if (!geometry_shader_manager.dirty || !ReserveConstantStorage())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StateTracker::GetInstance()->SetGXUniformBuffer(
|
StateTracker::GetInstance()->SetGXUniformBuffer(
|
||||||
UBO_DESCRIPTOR_SET_BINDING_GS, m_uniform_stream_buffer->GetBuffer(),
|
UBO_DESCRIPTOR_SET_BINDING_GS, m_uniform_stream_buffer->GetBuffer(),
|
||||||
m_uniform_stream_buffer->GetCurrentOffset(), sizeof(GeometryShaderConstants));
|
m_uniform_stream_buffer->GetCurrentOffset(), sizeof(GeometryShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer(), &GeometryShaderManager::constants,
|
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer(), &geometry_shader_manager.constants,
|
||||||
sizeof(GeometryShaderConstants));
|
sizeof(GeometryShaderConstants));
|
||||||
m_uniform_stream_buffer->CommitMemory(sizeof(GeometryShaderConstants));
|
m_uniform_stream_buffer->CommitMemory(sizeof(GeometryShaderConstants));
|
||||||
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(GeometryShaderConstants));
|
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(GeometryShaderConstants));
|
||||||
GeometryShaderManager::dirty = false;
|
geometry_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexManager::UpdatePixelShaderConstants()
|
void VertexManager::UpdatePixelShaderConstants()
|
||||||
|
@ -293,6 +296,7 @@ void VertexManager::UploadAllConstants()
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||||
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
|
|
||||||
// Update bindings
|
// Update bindings
|
||||||
StateTracker::GetInstance()->SetGXUniformBuffer(
|
StateTracker::GetInstance()->SetGXUniformBuffer(
|
||||||
|
@ -314,7 +318,7 @@ void VertexManager::UploadAllConstants()
|
||||||
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + vertex_constants_offset,
|
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + vertex_constants_offset,
|
||||||
&vertex_shader_manager.constants, sizeof(VertexShaderConstants));
|
&vertex_shader_manager.constants, sizeof(VertexShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + geometry_constants_offset,
|
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + geometry_constants_offset,
|
||||||
&GeometryShaderManager::constants, sizeof(GeometryShaderConstants));
|
&geometry_shader_manager.constants, sizeof(GeometryShaderConstants));
|
||||||
|
|
||||||
// Finally, flush buffer memory after copying
|
// Finally, flush buffer memory after copying
|
||||||
m_uniform_stream_buffer->CommitMemory(allocation_size);
|
m_uniform_stream_buffer->CommitMemory(allocation_size);
|
||||||
|
@ -322,7 +326,7 @@ void VertexManager::UploadAllConstants()
|
||||||
|
|
||||||
// Clear dirty flags
|
// Clear dirty flags
|
||||||
vertex_shader_manager.dirty = false;
|
vertex_shader_manager.dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
geometry_shader_manager.dirty = false;
|
||||||
pixel_shader_manager.dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,8 @@ void BPInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BPWritten(PixelShaderManager& pixel_shader_manager,
|
static void BPWritten(PixelShaderManager& pixel_shader_manager,
|
||||||
VertexShaderManager& vertex_shader_manager, const BPCmd& bp,
|
VertexShaderManager& vertex_shader_manager,
|
||||||
|
GeometryShaderManager& geometry_shader_manager, const BPCmd& bp,
|
||||||
int cycles_into_future)
|
int cycles_into_future)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -138,10 +139,10 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
|
||||||
case BPMEM_SCISSORBR: // Scissor Rectable Bottom, Right
|
case BPMEM_SCISSORBR: // Scissor Rectable Bottom, Right
|
||||||
case BPMEM_SCISSOROFFSET: // Scissor Offset
|
case BPMEM_SCISSOROFFSET: // Scissor Offset
|
||||||
vertex_shader_manager.SetViewportChanged();
|
vertex_shader_manager.SetViewportChanged();
|
||||||
GeometryShaderManager::SetViewportChanged();
|
geometry_shader_manager.SetViewportChanged();
|
||||||
return;
|
return;
|
||||||
case BPMEM_LINEPTWIDTH: // Line Width
|
case BPMEM_LINEPTWIDTH: // Line Width
|
||||||
GeometryShaderManager::SetLinePtWidthChanged();
|
geometry_shader_manager.SetLinePtWidthChanged();
|
||||||
return;
|
return;
|
||||||
case BPMEM_ZMODE: // Depth Control
|
case BPMEM_ZMODE: // Depth Control
|
||||||
PRIM_LOG("zmode: test={}, func={}, upd={}", bpmem.zmode.testenable, bpmem.zmode.func,
|
PRIM_LOG("zmode: test={}, func={}, upd={}", bpmem.zmode.testenable, bpmem.zmode.func,
|
||||||
|
@ -674,7 +675,7 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager,
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
{
|
{
|
||||||
pixel_shader_manager.SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
|
pixel_shader_manager.SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
|
||||||
GeometryShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
|
geometry_shader_manager.SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -763,8 +764,8 @@ void LoadBPReg(u8 reg, u32 value, int cycles_into_future)
|
||||||
if (reg != BPMEM_BP_MASK)
|
if (reg != BPMEM_BP_MASK)
|
||||||
bpmem.bpMask = 0xFFFFFF;
|
bpmem.bpMask = 0xFFFFFF;
|
||||||
|
|
||||||
BPWritten(system.GetPixelShaderManager(), system.GetVertexShaderManager(), bp,
|
BPWritten(system.GetPixelShaderManager(), system.GetVertexShaderManager(),
|
||||||
cycles_into_future);
|
system.GetGeometryShaderManager(), bp, cycles_into_future);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadBPRegPreprocess(u8 reg, u32 value, int cycles_into_future)
|
void LoadBPRegPreprocess(u8 reg, u32 value, int cycles_into_future)
|
||||||
|
|
|
@ -12,13 +12,7 @@
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
#include "VideoCommon/XFMemory.h"
|
#include "VideoCommon/XFMemory.h"
|
||||||
|
|
||||||
static const int LINE_PT_TEX_OFFSETS[8] = {0, 16, 8, 4, 2, 1, 1, 1};
|
static constexpr int LINE_PT_TEX_OFFSETS[8] = {0, 16, 8, 4, 2, 1, 1, 1};
|
||||||
|
|
||||||
GeometryShaderConstants GeometryShaderManager::constants;
|
|
||||||
bool GeometryShaderManager::dirty;
|
|
||||||
|
|
||||||
static bool s_projection_changed;
|
|
||||||
static bool s_viewport_changed;
|
|
||||||
|
|
||||||
void GeometryShaderManager::Init()
|
void GeometryShaderManager::Init()
|
||||||
{
|
{
|
||||||
|
@ -35,7 +29,7 @@ void GeometryShaderManager::Dirty()
|
||||||
{
|
{
|
||||||
// This function is called after a savestate is loaded.
|
// This function is called after a savestate is loaded.
|
||||||
// Any constants that can changed based on settings should be re-calculated
|
// Any constants that can changed based on settings should be re-calculated
|
||||||
s_projection_changed = true;
|
m_projection_changed = true;
|
||||||
|
|
||||||
// Uses EFB scale config
|
// Uses EFB scale config
|
||||||
SetLinePtWidthChanged();
|
SetLinePtWidthChanged();
|
||||||
|
@ -43,20 +37,20 @@ void GeometryShaderManager::Dirty()
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetVSExpand(VSExpand expand)
|
void GeometryShaderManager::SetVSExpand(VSExpand expand)
|
||||||
{
|
{
|
||||||
if (GeometryShaderManager::constants.vs_expand != expand)
|
if (constants.vs_expand != expand)
|
||||||
{
|
{
|
||||||
GeometryShaderManager::constants.vs_expand = expand;
|
constants.vs_expand = expand;
|
||||||
GeometryShaderManager::dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||||
{
|
{
|
||||||
if (s_projection_changed && g_ActiveConfig.stereo_mode != StereoMode::Off)
|
if (m_projection_changed && g_ActiveConfig.stereo_mode != StereoMode::Off)
|
||||||
{
|
{
|
||||||
s_projection_changed = false;
|
m_projection_changed = false;
|
||||||
|
|
||||||
if (xfmem.projection.type == ProjectionType::Perspective)
|
if (xfmem.projection.type == ProjectionType::Perspective)
|
||||||
{
|
{
|
||||||
|
@ -86,9 +80,9 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||||
SetVSExpand(VSExpand::None);
|
SetVSExpand(VSExpand::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_viewport_changed)
|
if (m_viewport_changed)
|
||||||
{
|
{
|
||||||
s_viewport_changed = false;
|
m_viewport_changed = false;
|
||||||
|
|
||||||
constants.lineptparams[0] = 2.0f * xfmem.viewport.wd;
|
constants.lineptparams[0] = 2.0f * xfmem.viewport.wd;
|
||||||
constants.lineptparams[1] = -2.0f * xfmem.viewport.ht;
|
constants.lineptparams[1] = -2.0f * xfmem.viewport.ht;
|
||||||
|
@ -99,12 +93,12 @@ void GeometryShaderManager::SetConstants(PrimitiveType prim)
|
||||||
|
|
||||||
void GeometryShaderManager::SetViewportChanged()
|
void GeometryShaderManager::SetViewportChanged()
|
||||||
{
|
{
|
||||||
s_viewport_changed = true;
|
m_viewport_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryShaderManager::SetProjectionChanged()
|
void GeometryShaderManager::SetProjectionChanged()
|
||||||
{
|
{
|
||||||
s_projection_changed = true;
|
m_projection_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryShaderManager::SetLinePtWidthChanged()
|
void GeometryShaderManager::SetLinePtWidthChanged()
|
||||||
|
@ -129,8 +123,8 @@ void GeometryShaderManager::SetTexCoordChanged(u8 texmapid)
|
||||||
|
|
||||||
void GeometryShaderManager::DoState(PointerWrap& p)
|
void GeometryShaderManager::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
p.Do(s_projection_changed);
|
p.Do(m_projection_changed);
|
||||||
p.Do(s_viewport_changed);
|
p.Do(m_viewport_changed);
|
||||||
|
|
||||||
p.Do(constants);
|
p.Do(constants);
|
||||||
|
|
||||||
|
|
|
@ -13,16 +13,22 @@ enum class PrimitiveType : u32;
|
||||||
class GeometryShaderManager
|
class GeometryShaderManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init();
|
void Init();
|
||||||
static void Dirty();
|
void Dirty();
|
||||||
static void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
static void SetConstants(PrimitiveType prim);
|
void SetConstants(PrimitiveType prim);
|
||||||
static void SetViewportChanged();
|
void SetViewportChanged();
|
||||||
static void SetProjectionChanged();
|
void SetProjectionChanged();
|
||||||
static void SetLinePtWidthChanged();
|
void SetLinePtWidthChanged();
|
||||||
static void SetTexCoordChanged(u8 texmapid);
|
void SetTexCoordChanged(u8 texmapid);
|
||||||
|
|
||||||
static GeometryShaderConstants constants;
|
GeometryShaderConstants constants{};
|
||||||
static bool dirty;
|
bool dirty = false;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void SetVSExpand(VSExpand expand);
|
||||||
|
|
||||||
|
bool m_projection_changed = false;
|
||||||
|
bool m_viewport_changed = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -320,9 +320,10 @@ void VertexManagerBase::InvalidateConstants()
|
||||||
{
|
{
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||||
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
vertex_shader_manager.dirty = true;
|
vertex_shader_manager.dirty = true;
|
||||||
GeometryShaderManager::dirty = true;
|
geometry_shader_manager.dirty = true;
|
||||||
pixel_shader_manager.dirty = true;
|
pixel_shader_manager.dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +488,7 @@ void VertexManagerBase::Flush()
|
||||||
|
|
||||||
auto& system = Core::System::GetInstance();
|
auto& system = Core::System::GetInstance();
|
||||||
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
auto& geometry_shader_manager = system.GetGeometryShaderManager();
|
||||||
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
auto& vertex_shader_manager = system.GetVertexShaderManager();
|
||||||
|
|
||||||
CalculateBinormals(VertexLoaderManager::GetCurrentVertexFormat());
|
CalculateBinormals(VertexLoaderManager::GetCurrentVertexFormat());
|
||||||
|
@ -566,7 +568,7 @@ void VertexManagerBase::Flush()
|
||||||
g_texture_cache->BindTextures(used_textures);
|
g_texture_cache->BindTextures(used_textures);
|
||||||
|
|
||||||
// Now we can upload uniforms, as nothing else will override them.
|
// Now we can upload uniforms, as nothing else will override them.
|
||||||
GeometryShaderManager::SetConstants(m_current_primitive_type);
|
geometry_shader_manager.SetConstants(m_current_primitive_type);
|
||||||
pixel_shader_manager.SetConstants();
|
pixel_shader_manager.SetConstants();
|
||||||
UploadUniforms();
|
UploadUniforms();
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ void VideoBackendBase::InitializeShared()
|
||||||
BPInit();
|
BPInit();
|
||||||
VertexLoaderManager::Init();
|
VertexLoaderManager::Init();
|
||||||
system.GetVertexShaderManager().Init();
|
system.GetVertexShaderManager().Init();
|
||||||
GeometryShaderManager::Init();
|
system.GetGeometryShaderManager().Init();
|
||||||
system.GetPixelShaderManager().Init();
|
system.GetPixelShaderManager().Init();
|
||||||
TMEM::Init();
|
TMEM::Init();
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ void VideoCommon_DoState(PointerWrap& p)
|
||||||
system.GetVertexShaderManager().DoState(p);
|
system.GetVertexShaderManager().DoState(p);
|
||||||
p.DoMarker("VertexShaderManager");
|
p.DoMarker("VertexShaderManager");
|
||||||
|
|
||||||
GeometryShaderManager::DoState(p);
|
system.GetGeometryShaderManager().DoState(p);
|
||||||
p.DoMarker("GeometryShaderManager");
|
p.DoMarker("GeometryShaderManager");
|
||||||
|
|
||||||
g_vertex_manager->DoState(p);
|
g_vertex_manager->DoState(p);
|
||||||
|
|
|
@ -28,7 +28,8 @@ static void XFMemWritten(VertexShaderManager& vertex_shader_manager, u32 transfe
|
||||||
vertex_shader_manager.InvalidateXFRange(baseAddress, baseAddress + transferSize);
|
vertex_shader_manager.InvalidateXFRange(baseAddress, baseAddress + transferSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void XFRegWritten(VertexShaderManager& vertex_shader_manager, u32 address, u32 value)
|
static void XFRegWritten(Core::System& system, VertexShaderManager& vertex_shader_manager,
|
||||||
|
u32 address, u32 value)
|
||||||
{
|
{
|
||||||
if (address >= XFMEM_REGISTERS_START && address < XFMEM_REGISTERS_END)
|
if (address >= XFMEM_REGISTERS_START && address < XFMEM_REGISTERS_END)
|
||||||
{
|
{
|
||||||
|
@ -119,14 +120,11 @@ static void XFRegWritten(VertexShaderManager& vertex_shader_manager, u32 address
|
||||||
case XFMEM_SETVIEWPORT + 3:
|
case XFMEM_SETVIEWPORT + 3:
|
||||||
case XFMEM_SETVIEWPORT + 4:
|
case XFMEM_SETVIEWPORT + 4:
|
||||||
case XFMEM_SETVIEWPORT + 5:
|
case XFMEM_SETVIEWPORT + 5:
|
||||||
{
|
|
||||||
auto& system = Core::System::GetInstance();
|
|
||||||
g_vertex_manager->Flush();
|
g_vertex_manager->Flush();
|
||||||
vertex_shader_manager.SetViewportChanged();
|
vertex_shader_manager.SetViewportChanged();
|
||||||
system.GetPixelShaderManager().SetViewportChanged();
|
system.GetPixelShaderManager().SetViewportChanged();
|
||||||
GeometryShaderManager::SetViewportChanged();
|
system.GetGeometryShaderManager().SetViewportChanged();
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
case XFMEM_SETPROJECTION:
|
case XFMEM_SETPROJECTION:
|
||||||
case XFMEM_SETPROJECTION + 1:
|
case XFMEM_SETPROJECTION + 1:
|
||||||
|
@ -137,7 +135,7 @@ static void XFRegWritten(VertexShaderManager& vertex_shader_manager, u32 address
|
||||||
case XFMEM_SETPROJECTION + 6:
|
case XFMEM_SETPROJECTION + 6:
|
||||||
g_vertex_manager->Flush();
|
g_vertex_manager->Flush();
|
||||||
vertex_shader_manager.SetProjectionChanged();
|
vertex_shader_manager.SetProjectionChanged();
|
||||||
GeometryShaderManager::SetProjectionChanged();
|
system.GetGeometryShaderManager().SetProjectionChanged();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens
|
case XFMEM_SETNUMTEXGENS: // GXSetNumTexGens
|
||||||
|
@ -249,7 +247,7 @@ void LoadXFReg(u16 base_address, u8 transfer_size, const u8* data)
|
||||||
{
|
{
|
||||||
const u32 value = Common::swap32(data);
|
const u32 value = Common::swap32(data);
|
||||||
|
|
||||||
XFRegWritten(vertex_shader_manager, address, value);
|
XFRegWritten(system, vertex_shader_manager, address, value);
|
||||||
((u32*)&xfmem)[address] = value;
|
((u32*)&xfmem)[address] = value;
|
||||||
|
|
||||||
data += 4;
|
data += 4;
|
||||||
|
|
Loading…
Reference in New Issue