Merge pull request #11384 from AdmiralCurtiss/globals-pixelshadermanager
VideoCommon: De-globalize PixelShaderManager class.
This commit is contained in:
commit
0900e68986
|
@ -21,6 +21,7 @@
|
||||||
#include "VideoCommon/CommandProcessor.h"
|
#include "VideoCommon/CommandProcessor.h"
|
||||||
#include "VideoCommon/Fifo.h"
|
#include "VideoCommon/Fifo.h"
|
||||||
#include "VideoCommon/PixelEngine.h"
|
#include "VideoCommon/PixelEngine.h"
|
||||||
|
#include "VideoCommon/PixelShaderManager.h"
|
||||||
|
|
||||||
namespace Core
|
namespace Core
|
||||||
{
|
{
|
||||||
|
@ -41,6 +42,7 @@ struct System::Impl
|
||||||
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;
|
||||||
|
PixelShaderManager m_pixel_shader_manager;
|
||||||
SerialInterface::SerialInterfaceState m_serial_interface_state;
|
SerialInterface::SerialInterfaceState m_serial_interface_state;
|
||||||
Sram m_sram;
|
Sram m_sram;
|
||||||
VideoInterface::VideoInterfaceState m_video_interface_state;
|
VideoInterface::VideoInterfaceState m_video_interface_state;
|
||||||
|
@ -144,6 +146,11 @@ PixelEngine::PixelEngineManager& System::GetPixelEngine() const
|
||||||
return m_impl->m_pixel_engine;
|
return m_impl->m_pixel_engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PixelShaderManager& System::GetPixelShaderManager() const
|
||||||
|
{
|
||||||
|
return m_impl->m_pixel_shader_manager;
|
||||||
|
}
|
||||||
|
|
||||||
SerialInterface::SerialInterfaceState& System::GetSerialInterfaceState() const
|
SerialInterface::SerialInterfaceState& System::GetSerialInterfaceState() const
|
||||||
{
|
{
|
||||||
return m_impl->m_serial_interface_state;
|
return m_impl->m_serial_interface_state;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
class PixelShaderManager;
|
||||||
class SoundStream;
|
class SoundStream;
|
||||||
struct Sram;
|
struct Sram;
|
||||||
|
|
||||||
|
@ -106,6 +107,7 @@ public:
|
||||||
Memory::MemoryManager& GetMemory() const;
|
Memory::MemoryManager& GetMemory() const;
|
||||||
MemoryInterface::MemoryInterfaceState& GetMemoryInterfaceState() const;
|
MemoryInterface::MemoryInterfaceState& GetMemoryInterfaceState() const;
|
||||||
PixelEngine::PixelEngineManager& GetPixelEngine() const;
|
PixelEngine::PixelEngineManager& GetPixelEngine() const;
|
||||||
|
PixelShaderManager& GetPixelShaderManager() const;
|
||||||
SerialInterface::SerialInterfaceState& GetSerialInterfaceState() const;
|
SerialInterface::SerialInterfaceState& GetSerialInterfaceState() const;
|
||||||
Sram& GetSRAM() const;
|
Sram& GetSRAM() const;
|
||||||
VideoInterface::VideoInterfaceState& GetVideoInterfaceState() const;
|
VideoInterface::VideoInterfaceState& GetVideoInterfaceState() const;
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoBackends/D3D/D3DBase.h"
|
#include "VideoBackends/D3D/D3DBase.h"
|
||||||
#include "VideoBackends/D3D/D3DBoundingBox.h"
|
#include "VideoBackends/D3D/D3DBoundingBox.h"
|
||||||
#include "VideoBackends/D3D/D3DRender.h"
|
#include "VideoBackends/D3D/D3DRender.h"
|
||||||
|
@ -260,6 +262,8 @@ void VertexManager::CommitBuffer(u32 num_vertices, u32 vertex_stride, u32 num_in
|
||||||
|
|
||||||
void VertexManager::UploadUniforms()
|
void VertexManager::UploadUniforms()
|
||||||
{
|
{
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
|
||||||
if (VertexShaderManager::dirty)
|
if (VertexShaderManager::dirty)
|
||||||
{
|
{
|
||||||
UpdateConstantBuffer(m_vertex_constant_buffer.Get(), &VertexShaderManager::constants,
|
UpdateConstantBuffer(m_vertex_constant_buffer.Get(), &VertexShaderManager::constants,
|
||||||
|
@ -272,11 +276,13 @@ void VertexManager::UploadUniforms()
|
||||||
sizeof(GeometryShaderConstants));
|
sizeof(GeometryShaderConstants));
|
||||||
GeometryShaderManager::dirty = false;
|
GeometryShaderManager::dirty = false;
|
||||||
}
|
}
|
||||||
if (PixelShaderManager::dirty)
|
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
if (pixel_shader_manager.dirty)
|
||||||
{
|
{
|
||||||
UpdateConstantBuffer(m_pixel_constant_buffer.Get(), &PixelShaderManager::constants,
|
UpdateConstantBuffer(m_pixel_constant_buffer.Get(), &pixel_shader_manager.constants,
|
||||||
sizeof(PixelShaderConstants));
|
sizeof(PixelShaderConstants));
|
||||||
PixelShaderManager::dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
D3D::stateman->SetPixelConstants(
|
D3D::stateman->SetPixelConstants(
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoBackends/D3D12/D3D12Renderer.h"
|
#include "VideoBackends/D3D12/D3D12Renderer.h"
|
||||||
#include "VideoBackends/D3D12/D3D12StreamBuffer.h"
|
#include "VideoBackends/D3D12/D3D12StreamBuffer.h"
|
||||||
#include "VideoBackends/D3D12/DX12Context.h"
|
#include "VideoBackends/D3D12/DX12Context.h"
|
||||||
|
@ -169,15 +171,18 @@ void VertexManager::UpdateGeometryShaderConstants()
|
||||||
|
|
||||||
void VertexManager::UpdatePixelShaderConstants()
|
void VertexManager::UpdatePixelShaderConstants()
|
||||||
{
|
{
|
||||||
if (!PixelShaderManager::dirty || !ReserveConstantStorage())
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
||||||
|
if (!pixel_shader_manager.dirty || !ReserveConstantStorage())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Renderer::GetInstance()->SetConstantBuffer(0, m_uniform_stream_buffer.GetCurrentGPUPointer());
|
Renderer::GetInstance()->SetConstantBuffer(0, m_uniform_stream_buffer.GetCurrentGPUPointer());
|
||||||
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer(), &PixelShaderManager::constants,
|
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer(), &pixel_shader_manager.constants,
|
||||||
sizeof(PixelShaderConstants));
|
sizeof(PixelShaderConstants));
|
||||||
m_uniform_stream_buffer.CommitMemory(sizeof(PixelShaderConstants));
|
m_uniform_stream_buffer.CommitMemory(sizeof(PixelShaderConstants));
|
||||||
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(PixelShaderConstants));
|
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(PixelShaderConstants));
|
||||||
PixelShaderManager::dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VertexManager::ReserveConstantStorage()
|
bool VertexManager::ReserveConstantStorage()
|
||||||
|
@ -230,9 +235,12 @@ void VertexManager::UploadAllConstants()
|
||||||
Renderer::GetInstance()->SetConstantBuffer(2, m_uniform_stream_buffer.GetCurrentGPUPointer() +
|
Renderer::GetInstance()->SetConstantBuffer(2, m_uniform_stream_buffer.GetCurrentGPUPointer() +
|
||||||
geometry_constants_offset);
|
geometry_constants_offset);
|
||||||
|
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
||||||
// 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,
|
||||||
&PixelShaderManager::constants, sizeof(PixelShaderConstants));
|
&pixel_shader_manager.constants, sizeof(PixelShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + vertex_constants_offset,
|
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + vertex_constants_offset,
|
||||||
&VertexShaderManager::constants, sizeof(VertexShaderConstants));
|
&VertexShaderManager::constants, sizeof(VertexShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + geometry_constants_offset,
|
std::memcpy(m_uniform_stream_buffer.GetCurrentHostPointer() + geometry_constants_offset,
|
||||||
|
@ -245,7 +253,7 @@ void VertexManager::UploadAllConstants()
|
||||||
// Clear dirty flags
|
// Clear dirty flags
|
||||||
VertexShaderManager::dirty = false;
|
VertexShaderManager::dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
GeometryShaderManager::dirty = false;
|
||||||
PixelShaderManager::dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexManager::UploadUtilityUniforms(const void* data, u32 data_size)
|
void VertexManager::UploadUtilityUniforms(const void* data, u32 data_size)
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoBackends/Metal/MTLObjectCache.h"
|
#include "VideoBackends/Metal/MTLObjectCache.h"
|
||||||
#include "VideoBackends/Metal/MTLPerfQuery.h"
|
#include "VideoBackends/Metal/MTLPerfQuery.h"
|
||||||
#include "VideoBackends/Metal/MTLPipeline.h"
|
#include "VideoBackends/Metal/MTLPipeline.h"
|
||||||
|
@ -853,7 +855,9 @@ void Metal::StateTracker::PrepareRender()
|
||||||
{
|
{
|
||||||
m_flags.has_gx_ps_uniform = true;
|
m_flags.has_gx_ps_uniform = true;
|
||||||
Map map = Allocate(UploadBuffer::Uniform, sizeof(PixelShaderConstants), AlignMask::Uniform);
|
Map map = Allocate(UploadBuffer::Uniform, sizeof(PixelShaderConstants), AlignMask::Uniform);
|
||||||
memcpy(map.cpu_buffer, &PixelShaderManager::constants, sizeof(PixelShaderConstants));
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
memcpy(map.cpu_buffer, &pixel_shader_manager.constants, sizeof(PixelShaderConstants));
|
||||||
SetFragmentBufferNow(0, map.gpu_buffer, map.gpu_offset);
|
SetFragmentBufferNow(0, map.gpu_buffer, map.gpu_offset);
|
||||||
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed,
|
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed,
|
||||||
Align(sizeof(PixelShaderConstants), AlignMask::Uniform));
|
Align(sizeof(PixelShaderConstants), AlignMask::Uniform));
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "VideoBackends/Metal/MTLVertexManager.h"
|
#include "VideoBackends/Metal/MTLVertexManager.h"
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoBackends/Metal/MTLStateTracker.h"
|
#include "VideoBackends/Metal/MTLStateTracker.h"
|
||||||
|
|
||||||
#include "VideoCommon/GeometryShaderManager.h"
|
#include "VideoCommon/GeometryShaderManager.h"
|
||||||
|
@ -89,9 +91,11 @@ 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& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
g_state_tracker->InvalidateUniforms(VertexShaderManager::dirty, GeometryShaderManager::dirty,
|
g_state_tracker->InvalidateUniforms(VertexShaderManager::dirty, GeometryShaderManager::dirty,
|
||||||
PixelShaderManager::dirty);
|
pixel_shader_manager.dirty);
|
||||||
VertexShaderManager::dirty = false;
|
VertexShaderManager::dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
GeometryShaderManager::dirty = false;
|
||||||
PixelShaderManager::dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "Common/Version.h"
|
#include "Common/Version.h"
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoBackends/OGL/OGLRender.h"
|
#include "VideoBackends/OGL/OGLRender.h"
|
||||||
#include "VideoBackends/OGL/OGLShader.h"
|
#include "VideoBackends/OGL/OGLShader.h"
|
||||||
|
@ -220,11 +221,13 @@ u32 ProgramShaderCache::GetUniformBufferAlignment()
|
||||||
|
|
||||||
void ProgramShaderCache::UploadConstants()
|
void ProgramShaderCache::UploadConstants()
|
||||||
{
|
{
|
||||||
if (PixelShaderManager::dirty || VertexShaderManager::dirty || GeometryShaderManager::dirty)
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
if (pixel_shader_manager.dirty || VertexShaderManager::dirty || GeometryShaderManager::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);
|
||||||
|
|
||||||
memcpy(buffer.first, &PixelShaderManager::constants, sizeof(PixelShaderConstants));
|
memcpy(buffer.first, &pixel_shader_manager.constants, sizeof(PixelShaderConstants));
|
||||||
|
|
||||||
memcpy(buffer.first + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align),
|
memcpy(buffer.first + Common::AlignUp(sizeof(PixelShaderConstants), s_ubo_align),
|
||||||
&VertexShaderManager::constants, sizeof(VertexShaderConstants));
|
&VertexShaderManager::constants, sizeof(VertexShaderConstants));
|
||||||
|
@ -244,7 +247,7 @@ void ProgramShaderCache::UploadConstants()
|
||||||
Common::AlignUp(sizeof(VertexShaderConstants), s_ubo_align),
|
Common::AlignUp(sizeof(VertexShaderConstants), s_ubo_align),
|
||||||
sizeof(GeometryShaderConstants));
|
sizeof(GeometryShaderConstants));
|
||||||
|
|
||||||
PixelShaderManager::dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
VertexShaderManager::dirty = false;
|
VertexShaderManager::dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
GeometryShaderManager::dirty = false;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
|
|
||||||
#include "Common/ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoBackends/Software/EfbInterface.h"
|
#include "VideoBackends/Software/EfbInterface.h"
|
||||||
#include "VideoBackends/Software/SWBoundingBox.h"
|
#include "VideoBackends/Software/SWBoundingBox.h"
|
||||||
#include "VideoBackends/Software/TextureSampler.h"
|
#include "VideoBackends/Software/TextureSampler.h"
|
||||||
|
@ -396,13 +399,16 @@ void Tev::Draw()
|
||||||
|
|
||||||
INCSTAT(g_stats.this_frame.tev_pixels_in);
|
INCSTAT(g_stats.this_frame.tev_pixels_in);
|
||||||
|
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
||||||
// initial color values
|
// initial color values
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
Reg[static_cast<TevOutput>(i)].r = PixelShaderManager::constants.colors[i][0];
|
Reg[static_cast<TevOutput>(i)].r = pixel_shader_manager.constants.colors[i][0];
|
||||||
Reg[static_cast<TevOutput>(i)].g = PixelShaderManager::constants.colors[i][1];
|
Reg[static_cast<TevOutput>(i)].g = pixel_shader_manager.constants.colors[i][1];
|
||||||
Reg[static_cast<TevOutput>(i)].b = PixelShaderManager::constants.colors[i][2];
|
Reg[static_cast<TevOutput>(i)].b = pixel_shader_manager.constants.colors[i][2];
|
||||||
Reg[static_cast<TevOutput>(i)].a = PixelShaderManager::constants.colors[i][3];
|
Reg[static_cast<TevOutput>(i)].a = pixel_shader_manager.constants.colors[i][3];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int stageNum = 0; stageNum < bpmem.genMode.numindstages; stageNum++)
|
for (unsigned int stageNum = 0; stageNum < bpmem.genMode.numindstages; stageNum++)
|
||||||
|
@ -694,11 +700,14 @@ void Tev::Draw()
|
||||||
|
|
||||||
void Tev::SetKonstColors()
|
void Tev::SetKonstColors()
|
||||||
{
|
{
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
KonstantColors[i].r = PixelShaderManager::constants.kcolors[i][0];
|
KonstantColors[i].r = pixel_shader_manager.constants.kcolors[i][0];
|
||||||
KonstantColors[i].g = PixelShaderManager::constants.kcolors[i][1];
|
KonstantColors[i].g = pixel_shader_manager.constants.kcolors[i][1];
|
||||||
KonstantColors[i].b = PixelShaderManager::constants.kcolors[i][2];
|
KonstantColors[i].b = pixel_shader_manager.constants.kcolors[i][2];
|
||||||
KonstantColors[i].a = PixelShaderManager::constants.kcolors[i][3];
|
KonstantColors[i].a = pixel_shader_manager.constants.kcolors[i][3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
|
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoBackends/Vulkan/CommandBufferManager.h"
|
#include "VideoBackends/Vulkan/CommandBufferManager.h"
|
||||||
#include "VideoBackends/Vulkan/StateTracker.h"
|
#include "VideoBackends/Vulkan/StateTracker.h"
|
||||||
#include "VideoBackends/Vulkan/VKRenderer.h"
|
#include "VideoBackends/Vulkan/VKRenderer.h"
|
||||||
|
@ -232,17 +234,20 @@ void VertexManager::UpdateGeometryShaderConstants()
|
||||||
|
|
||||||
void VertexManager::UpdatePixelShaderConstants()
|
void VertexManager::UpdatePixelShaderConstants()
|
||||||
{
|
{
|
||||||
if (!PixelShaderManager::dirty || !ReserveConstantStorage())
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
||||||
|
if (!pixel_shader_manager.dirty || !ReserveConstantStorage())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
StateTracker::GetInstance()->SetGXUniformBuffer(
|
StateTracker::GetInstance()->SetGXUniformBuffer(
|
||||||
UBO_DESCRIPTOR_SET_BINDING_PS, m_uniform_stream_buffer->GetBuffer(),
|
UBO_DESCRIPTOR_SET_BINDING_PS, m_uniform_stream_buffer->GetBuffer(),
|
||||||
m_uniform_stream_buffer->GetCurrentOffset(), sizeof(PixelShaderConstants));
|
m_uniform_stream_buffer->GetCurrentOffset(), sizeof(PixelShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer(), &PixelShaderManager::constants,
|
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer(), &pixel_shader_manager.constants,
|
||||||
sizeof(PixelShaderConstants));
|
sizeof(PixelShaderConstants));
|
||||||
m_uniform_stream_buffer->CommitMemory(sizeof(PixelShaderConstants));
|
m_uniform_stream_buffer->CommitMemory(sizeof(PixelShaderConstants));
|
||||||
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(PixelShaderConstants));
|
ADDSTAT(g_stats.this_frame.bytes_uniform_streamed, sizeof(PixelShaderConstants));
|
||||||
PixelShaderManager::dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VertexManager::ReserveConstantStorage()
|
bool VertexManager::ReserveConstantStorage()
|
||||||
|
@ -282,6 +287,9 @@ void VertexManager::UploadAllConstants()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
||||||
// Update bindings
|
// Update bindings
|
||||||
StateTracker::GetInstance()->SetGXUniformBuffer(
|
StateTracker::GetInstance()->SetGXUniformBuffer(
|
||||||
UBO_DESCRIPTOR_SET_BINDING_PS, m_uniform_stream_buffer->GetBuffer(),
|
UBO_DESCRIPTOR_SET_BINDING_PS, m_uniform_stream_buffer->GetBuffer(),
|
||||||
|
@ -298,7 +306,7 @@ void VertexManager::UploadAllConstants()
|
||||||
|
|
||||||
// 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,
|
||||||
&PixelShaderManager::constants, sizeof(PixelShaderConstants));
|
&pixel_shader_manager.constants, sizeof(PixelShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + vertex_constants_offset,
|
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + vertex_constants_offset,
|
||||||
&VertexShaderManager::constants, sizeof(VertexShaderConstants));
|
&VertexShaderManager::constants, sizeof(VertexShaderConstants));
|
||||||
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + geometry_constants_offset,
|
std::memcpy(m_uniform_stream_buffer->GetCurrentHostPointer() + geometry_constants_offset,
|
||||||
|
@ -311,7 +319,7 @@ void VertexManager::UploadAllConstants()
|
||||||
// Clear dirty flags
|
// Clear dirty flags
|
||||||
VertexShaderManager::dirty = false;
|
VertexShaderManager::dirty = false;
|
||||||
GeometryShaderManager::dirty = false;
|
GeometryShaderManager::dirty = false;
|
||||||
PixelShaderManager::dirty = false;
|
pixel_shader_manager.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexManager::UploadUtilityUniforms(const void* data, u32 data_size)
|
void VertexManager::UploadUtilityUniforms(const void* data, u32 data_size)
|
||||||
|
|
|
@ -54,7 +54,8 @@ void BPInit()
|
||||||
bpmem.bpMask = 0xFFFFFF;
|
bpmem.bpMask = 0xFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
static void BPWritten(PixelShaderManager& pixel_shader_manager, const BPCmd& bp,
|
||||||
|
int cycles_into_future)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
----------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -103,7 +104,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
bpmem.genMode.zfreeze);
|
bpmem.genMode.zfreeze);
|
||||||
|
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetGenModeChanged();
|
pixel_shader_manager.SetGenModeChanged();
|
||||||
|
|
||||||
// Only call SetGenerationMode when cull mode changes.
|
// Only call SetGenerationMode when cull mode changes.
|
||||||
if (bp.changes & 0xC000)
|
if (bp.changes & 0xC000)
|
||||||
|
@ -119,15 +120,15 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
case BPMEM_IND_MTXB + 6:
|
case BPMEM_IND_MTXB + 6:
|
||||||
case BPMEM_IND_MTXC + 6:
|
case BPMEM_IND_MTXC + 6:
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetIndMatrixChanged((bp.address - BPMEM_IND_MTXA) / 3);
|
pixel_shader_manager.SetIndMatrixChanged((bp.address - BPMEM_IND_MTXA) / 3);
|
||||||
return;
|
return;
|
||||||
case BPMEM_RAS1_SS0: // Index Texture Coordinate Scale 0
|
case BPMEM_RAS1_SS0: // Index Texture Coordinate Scale 0
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetIndTexScaleChanged(false);
|
pixel_shader_manager.SetIndTexScaleChanged(false);
|
||||||
return;
|
return;
|
||||||
case BPMEM_RAS1_SS1: // Index Texture Coordinate Scale 1
|
case BPMEM_RAS1_SS1: // Index Texture Coordinate Scale 1
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetIndTexScaleChanged(true);
|
pixel_shader_manager.SetIndTexScaleChanged(true);
|
||||||
return;
|
return;
|
||||||
// ----------------
|
// ----------------
|
||||||
// Scissor Control
|
// Scissor Control
|
||||||
|
@ -145,7 +146,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
PRIM_LOG("zmode: test={}, func={}, upd={}", bpmem.zmode.testenable, bpmem.zmode.func,
|
PRIM_LOG("zmode: test={}, func={}, upd={}", bpmem.zmode.testenable, bpmem.zmode.func,
|
||||||
bpmem.zmode.updateenable);
|
bpmem.zmode.updateenable);
|
||||||
SetDepthMode();
|
SetDepthMode();
|
||||||
PixelShaderManager::SetZModeControl();
|
pixel_shader_manager.SetZModeControl();
|
||||||
return;
|
return;
|
||||||
case BPMEM_BLENDMODE: // Blending Control
|
case BPMEM_BLENDMODE: // Blending Control
|
||||||
if (bp.changes & 0xFFFF)
|
if (bp.changes & 0xFFFF)
|
||||||
|
@ -157,15 +158,15 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
|
|
||||||
SetBlendMode();
|
SetBlendMode();
|
||||||
|
|
||||||
PixelShaderManager::SetBlendModeChanged();
|
pixel_shader_manager.SetBlendModeChanged();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case BPMEM_CONSTANTALPHA: // Set Destination Alpha
|
case BPMEM_CONSTANTALPHA: // Set Destination Alpha
|
||||||
PRIM_LOG("constalpha: alp={}, en={}", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
|
PRIM_LOG("constalpha: alp={}, en={}", bpmem.dstalpha.alpha, bpmem.dstalpha.enable);
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetAlpha();
|
pixel_shader_manager.SetAlpha();
|
||||||
PixelShaderManager::SetDestAlphaChanged();
|
pixel_shader_manager.SetDestAlphaChanged();
|
||||||
}
|
}
|
||||||
if (bp.changes & 0x100)
|
if (bp.changes & 0x100)
|
||||||
SetBlendMode();
|
SetBlendMode();
|
||||||
|
@ -279,7 +280,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
if (PE_copy.copy_to_xfb == 1)
|
if (PE_copy.copy_to_xfb == 1)
|
||||||
{
|
{
|
||||||
// Make sure we disable Bounding box to match the side effects of the non-failure path
|
// Make sure we disable Bounding box to match the side effects of the non-failure path
|
||||||
g_renderer->BBoxDisable();
|
g_renderer->BBoxDisable(pixel_shader_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -310,7 +311,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
// We should be able to get away with deactivating the current bbox tracking
|
// We should be able to get away with deactivating the current bbox tracking
|
||||||
// here. Not sure if there's a better spot to put this.
|
// here. Not sure if there's a better spot to put this.
|
||||||
// the number of lines copied is determined by the y scale * source efb height
|
// the number of lines copied is determined by the y scale * source efb height
|
||||||
g_renderer->BBoxDisable();
|
g_renderer->BBoxDisable(pixel_shader_manager);
|
||||||
|
|
||||||
float yScale;
|
float yScale;
|
||||||
if (PE_copy.scale_invert)
|
if (PE_copy.scale_invert)
|
||||||
|
@ -390,42 +391,42 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
case BPMEM_FOGRANGE + 4:
|
case BPMEM_FOGRANGE + 4:
|
||||||
case BPMEM_FOGRANGE + 5:
|
case BPMEM_FOGRANGE + 5:
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetFogRangeAdjustChanged();
|
pixel_shader_manager.SetFogRangeAdjustChanged();
|
||||||
return;
|
return;
|
||||||
case BPMEM_FOGPARAM0:
|
case BPMEM_FOGPARAM0:
|
||||||
case BPMEM_FOGBMAGNITUDE:
|
case BPMEM_FOGBMAGNITUDE:
|
||||||
case BPMEM_FOGBEXPONENT:
|
case BPMEM_FOGBEXPONENT:
|
||||||
case BPMEM_FOGPARAM3:
|
case BPMEM_FOGPARAM3:
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetFogParamChanged();
|
pixel_shader_manager.SetFogParamChanged();
|
||||||
return;
|
return;
|
||||||
case BPMEM_FOGCOLOR: // Fog Color
|
case BPMEM_FOGCOLOR: // Fog Color
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetFogColorChanged();
|
pixel_shader_manager.SetFogColorChanged();
|
||||||
return;
|
return;
|
||||||
case BPMEM_ALPHACOMPARE: // Compare Alpha Values
|
case BPMEM_ALPHACOMPARE: // Compare Alpha Values
|
||||||
PRIM_LOG("alphacmp: ref0={}, ref1={}, comp0={}, comp1={}, logic={}", bpmem.alpha_test.ref0,
|
PRIM_LOG("alphacmp: ref0={}, ref1={}, comp0={}, comp1={}, logic={}", bpmem.alpha_test.ref0,
|
||||||
bpmem.alpha_test.ref1, bpmem.alpha_test.comp0, bpmem.alpha_test.comp1,
|
bpmem.alpha_test.ref1, bpmem.alpha_test.comp0, bpmem.alpha_test.comp1,
|
||||||
bpmem.alpha_test.logic);
|
bpmem.alpha_test.logic);
|
||||||
if (bp.changes & 0xFFFF)
|
if (bp.changes & 0xFFFF)
|
||||||
PixelShaderManager::SetAlpha();
|
pixel_shader_manager.SetAlpha();
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetAlphaTestChanged();
|
pixel_shader_manager.SetAlphaTestChanged();
|
||||||
SetBlendMode();
|
SetBlendMode();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case BPMEM_BIAS: // BIAS
|
case BPMEM_BIAS: // BIAS
|
||||||
PRIM_LOG("ztex bias={:#x}", bpmem.ztex1.bias);
|
PRIM_LOG("ztex bias={:#x}", bpmem.ztex1.bias);
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetZTextureBias();
|
pixel_shader_manager.SetZTextureBias();
|
||||||
return;
|
return;
|
||||||
case BPMEM_ZTEX2: // Z Texture type
|
case BPMEM_ZTEX2: // Z Texture type
|
||||||
{
|
{
|
||||||
if (bp.changes & 3)
|
if (bp.changes & 3)
|
||||||
PixelShaderManager::SetZTextureTypeChanged();
|
pixel_shader_manager.SetZTextureTypeChanged();
|
||||||
if (bp.changes & 12)
|
if (bp.changes & 12)
|
||||||
PixelShaderManager::SetZTextureOpChanged();
|
pixel_shader_manager.SetZTextureOpChanged();
|
||||||
PRIM_LOG("ztex op={}, type={}", bpmem.ztex2.op, bpmem.ztex2.type);
|
PRIM_LOG("ztex op={}, type={}", bpmem.ztex2.op, bpmem.ztex2.type);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -478,7 +479,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
case BPMEM_CLEARBBOX2:
|
case BPMEM_CLEARBBOX2:
|
||||||
{
|
{
|
||||||
const u8 offset = bp.address & 2;
|
const u8 offset = bp.address & 2;
|
||||||
g_renderer->BBoxEnable();
|
g_renderer->BBoxEnable(pixel_shader_manager);
|
||||||
|
|
||||||
g_renderer->BBoxWrite(offset, bp.newvalue & 0x3ff);
|
g_renderer->BBoxWrite(offset, bp.newvalue & 0x3ff);
|
||||||
g_renderer->BBoxWrite(offset + 1, bp.newvalue >> 10);
|
g_renderer->BBoxWrite(offset + 1, bp.newvalue >> 10);
|
||||||
|
@ -492,7 +493,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
OnPixelFormatChange();
|
OnPixelFormatChange();
|
||||||
if (bp.changes & 7)
|
if (bp.changes & 7)
|
||||||
SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
|
SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
|
||||||
PixelShaderManager::SetZModeControl();
|
pixel_shader_manager.SetZModeControl();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
|
case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel
|
||||||
|
@ -510,7 +511,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
case BPMEM_IREF:
|
case BPMEM_IREF:
|
||||||
{
|
{
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
PixelShaderManager::SetTevIndirectChanged();
|
pixel_shader_manager.SetTevIndirectChanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +523,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
case BPMEM_TEV_KSEL + 5: // Texture Environment Swap Mode Table 5
|
case BPMEM_TEV_KSEL + 5: // Texture Environment Swap Mode Table 5
|
||||||
case BPMEM_TEV_KSEL + 6: // Texture Environment Swap Mode Table 6
|
case BPMEM_TEV_KSEL + 6: // Texture Environment Swap Mode Table 6
|
||||||
case BPMEM_TEV_KSEL + 7: // Texture Environment Swap Mode Table 7
|
case BPMEM_TEV_KSEL + 7: // Texture Environment Swap Mode Table 7
|
||||||
PixelShaderManager::SetTevKSel(bp.address - BPMEM_TEV_KSEL, bp.newvalue);
|
pixel_shader_manager.SetTevKSel(bp.address - BPMEM_TEV_KSEL, bp.newvalue);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* This Register can be used to limit to which bits of BP registers is
|
/* This Register can be used to limit to which bits of BP registers is
|
||||||
|
@ -619,13 +620,13 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
int num = (bp.address >> 1) & 0x3;
|
int num = (bp.address >> 1) & 0x3;
|
||||||
if (bpmem.tevregs[num].ra.type == TevRegType::Constant)
|
if (bpmem.tevregs[num].ra.type == TevRegType::Constant)
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetTevKonstColor(num, 0, bpmem.tevregs[num].ra.red);
|
pixel_shader_manager.SetTevKonstColor(num, 0, bpmem.tevregs[num].ra.red);
|
||||||
PixelShaderManager::SetTevKonstColor(num, 3, bpmem.tevregs[num].ra.alpha);
|
pixel_shader_manager.SetTevKonstColor(num, 3, bpmem.tevregs[num].ra.alpha);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetTevColor(num, 0, bpmem.tevregs[num].ra.red);
|
pixel_shader_manager.SetTevColor(num, 0, bpmem.tevregs[num].ra.red);
|
||||||
PixelShaderManager::SetTevColor(num, 3, bpmem.tevregs[num].ra.alpha);
|
pixel_shader_manager.SetTevColor(num, 3, bpmem.tevregs[num].ra.alpha);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -638,13 +639,13 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
int num = (bp.address >> 1) & 0x3;
|
int num = (bp.address >> 1) & 0x3;
|
||||||
if (bpmem.tevregs[num].bg.type == TevRegType::Constant)
|
if (bpmem.tevregs[num].bg.type == TevRegType::Constant)
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetTevKonstColor(num, 1, bpmem.tevregs[num].bg.green);
|
pixel_shader_manager.SetTevKonstColor(num, 1, bpmem.tevregs[num].bg.green);
|
||||||
PixelShaderManager::SetTevKonstColor(num, 2, bpmem.tevregs[num].bg.blue);
|
pixel_shader_manager.SetTevKonstColor(num, 2, bpmem.tevregs[num].bg.blue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetTevColor(num, 1, bpmem.tevregs[num].bg.green);
|
pixel_shader_manager.SetTevColor(num, 1, bpmem.tevregs[num].bg.green);
|
||||||
PixelShaderManager::SetTevColor(num, 2, bpmem.tevregs[num].bg.blue);
|
pixel_shader_manager.SetTevColor(num, 2, bpmem.tevregs[num].bg.blue);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +661,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
// -------------------------
|
// -------------------------
|
||||||
case BPMEM_TREF:
|
case BPMEM_TREF:
|
||||||
case BPMEM_TREF + 4:
|
case BPMEM_TREF + 4:
|
||||||
PixelShaderManager::SetTevOrder(bp.address - BPMEM_TREF, bp.newvalue);
|
pixel_shader_manager.SetTevOrder(bp.address - BPMEM_TREF, bp.newvalue);
|
||||||
return;
|
return;
|
||||||
// ----------------------
|
// ----------------------
|
||||||
// Set wrap size
|
// Set wrap size
|
||||||
|
@ -671,7 +672,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
case BPMEM_SU_SSIZE + 12:
|
case BPMEM_SU_SSIZE + 12:
|
||||||
if (bp.changes)
|
if (bp.changes)
|
||||||
{
|
{
|
||||||
PixelShaderManager::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);
|
GeometryShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -725,7 +726,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
// Indirect Tev
|
// Indirect Tev
|
||||||
// --------------
|
// --------------
|
||||||
case BPMEM_IND_CMD:
|
case BPMEM_IND_CMD:
|
||||||
PixelShaderManager::SetTevIndirectChanged();
|
pixel_shader_manager.SetTevIndirectChanged();
|
||||||
return;
|
return;
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
// Set Color/Alpha of a Tev
|
// Set Color/Alpha of a Tev
|
||||||
|
@ -734,8 +735,8 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
case BPMEM_TEV_COLOR_ENV: // Texture Environment 1
|
case BPMEM_TEV_COLOR_ENV: // Texture Environment 1
|
||||||
case BPMEM_TEV_COLOR_ENV + 16:
|
case BPMEM_TEV_COLOR_ENV + 16:
|
||||||
PixelShaderManager::SetTevCombiner((bp.address - BPMEM_TEV_COLOR_ENV) >> 1,
|
pixel_shader_manager.SetTevCombiner((bp.address - BPMEM_TEV_COLOR_ENV) >> 1,
|
||||||
(bp.address - BPMEM_TEV_COLOR_ENV) & 1, bp.newvalue);
|
(bp.address - BPMEM_TEV_COLOR_ENV) & 1, bp.newvalue);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -749,6 +750,8 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
|
||||||
// Call browser: OpcodeDecoding.cpp RunCallback::OnBP()
|
// Call browser: OpcodeDecoding.cpp RunCallback::OnBP()
|
||||||
void LoadBPReg(u8 reg, u32 value, int cycles_into_future)
|
void LoadBPReg(u8 reg, u32 value, int cycles_into_future)
|
||||||
{
|
{
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
|
||||||
int oldval = ((u32*)&bpmem)[reg];
|
int oldval = ((u32*)&bpmem)[reg];
|
||||||
int newval = (oldval & ~bpmem.bpMask) | (value & bpmem.bpMask);
|
int newval = (oldval & ~bpmem.bpMask) | (value & bpmem.bpMask);
|
||||||
int changes = (oldval ^ newval) & 0xFFFFFF;
|
int changes = (oldval ^ newval) & 0xFFFFFF;
|
||||||
|
@ -759,7 +762,7 @@ 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(bp, cycles_into_future);
|
BPWritten(system.GetPixelShaderManager(), bp, cycles_into_future);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadBPRegPreprocess(u8 reg, u32 value, int cycles_into_future)
|
void LoadBPRegPreprocess(u8 reg, u32 value, int cycles_into_future)
|
||||||
|
|
|
@ -13,16 +13,16 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
void BoundingBox::Enable()
|
void BoundingBox::Enable(PixelShaderManager& pixel_shader_manager)
|
||||||
{
|
{
|
||||||
m_is_active = true;
|
m_is_active = true;
|
||||||
PixelShaderManager::SetBoundingBoxActive(m_is_active);
|
pixel_shader_manager.SetBoundingBoxActive(m_is_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoundingBox::Disable()
|
void BoundingBox::Disable(PixelShaderManager& pixel_shader_manager)
|
||||||
{
|
{
|
||||||
m_is_active = false;
|
m_is_active = false;
|
||||||
PixelShaderManager::SetBoundingBoxActive(m_is_active);
|
pixel_shader_manager.SetBoundingBoxActive(m_is_active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoundingBox::Flush()
|
void BoundingBox::Flush()
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
|
|
||||||
|
class PixelShaderManager;
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
using BBoxType = s32;
|
using BBoxType = s32;
|
||||||
|
@ -20,8 +21,8 @@ public:
|
||||||
virtual ~BoundingBox() = default;
|
virtual ~BoundingBox() = default;
|
||||||
|
|
||||||
bool IsEnabled() const { return m_is_active; }
|
bool IsEnabled() const { return m_is_active; }
|
||||||
void Enable();
|
void Enable(PixelShaderManager& pixel_shader_manager);
|
||||||
void Disable();
|
void Disable(PixelShaderManager& pixel_shader_manager);
|
||||||
|
|
||||||
void Flush();
|
void Flush();
|
||||||
|
|
||||||
|
|
|
@ -146,8 +146,9 @@ void PixelEngineManager::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
|
||||||
// BBOX registers, readonly and need to update a flag.
|
// BBOX registers, readonly and need to update a flag.
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
mmio->Register(base | (PE_BBOX_LEFT + 2 * i), MMIO::ComplexRead<u16>([i](Core::System&, u32) {
|
mmio->Register(base | (PE_BBOX_LEFT + 2 * i),
|
||||||
g_renderer->BBoxDisable();
|
MMIO::ComplexRead<u16>([i](Core::System& system, u32) {
|
||||||
|
g_renderer->BBoxDisable(system.GetPixelShaderManager());
|
||||||
return g_video_backend->Video_GetBoundingBox(i);
|
return g_video_backend->Video_GetBoundingBox(i);
|
||||||
}),
|
}),
|
||||||
MMIO::InvalidWrite<u16>());
|
MMIO::InvalidWrite<u16>());
|
||||||
|
|
|
@ -12,21 +12,13 @@
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
#include "VideoCommon/XFMemory.h"
|
#include "VideoCommon/XFMemory.h"
|
||||||
|
|
||||||
bool PixelShaderManager::s_bFogRangeAdjustChanged;
|
|
||||||
bool PixelShaderManager::s_bViewPortChanged;
|
|
||||||
bool PixelShaderManager::s_bIndirectDirty;
|
|
||||||
bool PixelShaderManager::s_bDestAlphaDirty;
|
|
||||||
|
|
||||||
PixelShaderConstants PixelShaderManager::constants;
|
|
||||||
bool PixelShaderManager::dirty;
|
|
||||||
|
|
||||||
void PixelShaderManager::Init()
|
void PixelShaderManager::Init()
|
||||||
{
|
{
|
||||||
constants = {};
|
constants = {};
|
||||||
|
|
||||||
// Init any intial constants which aren't zero when bpmem is zero.
|
// Init any intial constants which aren't zero when bpmem is zero.
|
||||||
s_bFogRangeAdjustChanged = true;
|
m_fog_range_adjusted_changed = true;
|
||||||
s_bViewPortChanged = false;
|
m_viewport_changed = false;
|
||||||
|
|
||||||
SetIndMatrixChanged(0);
|
SetIndMatrixChanged(0);
|
||||||
SetIndMatrixChanged(1);
|
SetIndMatrixChanged(1);
|
||||||
|
@ -80,7 +72,7 @@ void PixelShaderManager::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_bFogRangeAdjustChanged = true;
|
m_fog_range_adjusted_changed = true;
|
||||||
|
|
||||||
SetEfbScaleChanged(g_renderer->EFBToScaledXf(1), g_renderer->EFBToScaledYf(1));
|
SetEfbScaleChanged(g_renderer->EFBToScaledXf(1), g_renderer->EFBToScaledYf(1));
|
||||||
SetFogParamChanged();
|
SetFogParamChanged();
|
||||||
|
@ -90,7 +82,7 @@ void PixelShaderManager::Dirty()
|
||||||
|
|
||||||
void PixelShaderManager::SetConstants()
|
void PixelShaderManager::SetConstants()
|
||||||
{
|
{
|
||||||
if (s_bFogRangeAdjustChanged)
|
if (m_fog_range_adjusted_changed)
|
||||||
{
|
{
|
||||||
// set by two components, so keep changed flag here
|
// set by two components, so keep changed flag here
|
||||||
// TODO: try to split both registers and move this logic to the shader
|
// TODO: try to split both registers and move this logic to the shader
|
||||||
|
@ -129,18 +121,18 @@ void PixelShaderManager::SetConstants()
|
||||||
}
|
}
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
||||||
s_bFogRangeAdjustChanged = false;
|
m_fog_range_adjusted_changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_bViewPortChanged)
|
if (m_viewport_changed)
|
||||||
{
|
{
|
||||||
constants.zbias[1][0] = (s32)xfmem.viewport.farZ;
|
constants.zbias[1][0] = (s32)xfmem.viewport.farZ;
|
||||||
constants.zbias[1][1] = (s32)xfmem.viewport.zRange;
|
constants.zbias[1][1] = (s32)xfmem.viewport.zRange;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
s_bViewPortChanged = false;
|
m_viewport_changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_bIndirectDirty)
|
if (m_indirect_dirty)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
constants.pack1[i][3] = 0;
|
constants.pack1[i][3] = 0;
|
||||||
|
@ -162,10 +154,10 @@ void PixelShaderManager::SetConstants()
|
||||||
}
|
}
|
||||||
|
|
||||||
dirty = true;
|
dirty = true;
|
||||||
s_bIndirectDirty = false;
|
m_indirect_dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s_bDestAlphaDirty)
|
if (m_dest_alpha_dirty)
|
||||||
{
|
{
|
||||||
// Destination alpha is only enabled if alpha writes are enabled. Force entire uniform to zero
|
// Destination alpha is only enabled if alpha writes are enabled. Force entire uniform to zero
|
||||||
// when disabled.
|
// when disabled.
|
||||||
|
@ -240,7 +232,7 @@ void PixelShaderManager::SetTevCombiner(int index, int alpha, u32 combiner)
|
||||||
|
|
||||||
void PixelShaderManager::SetTevIndirectChanged()
|
void PixelShaderManager::SetTevIndirectChanged()
|
||||||
{
|
{
|
||||||
s_bIndirectDirty = true;
|
m_indirect_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelShaderManager::SetAlpha()
|
void PixelShaderManager::SetAlpha()
|
||||||
|
@ -268,7 +260,7 @@ void PixelShaderManager::SetAlphaTestChanged()
|
||||||
|
|
||||||
void PixelShaderManager::SetDestAlphaChanged()
|
void PixelShaderManager::SetDestAlphaChanged()
|
||||||
{
|
{
|
||||||
s_bDestAlphaDirty = true;
|
m_dest_alpha_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height)
|
void PixelShaderManager::SetTexDims(int texmapid, u32 width, u32 height)
|
||||||
|
@ -299,8 +291,8 @@ void PixelShaderManager::SetZTextureBias()
|
||||||
|
|
||||||
void PixelShaderManager::SetViewportChanged()
|
void PixelShaderManager::SetViewportChanged()
|
||||||
{
|
{
|
||||||
s_bViewPortChanged = true;
|
m_viewport_changed = true;
|
||||||
s_bFogRangeAdjustChanged =
|
m_fog_range_adjusted_changed =
|
||||||
true; // TODO: Shouldn't be necessary with an accurate fog range adjust implementation
|
true; // TODO: Shouldn't be necessary with an accurate fog range adjust implementation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +422,7 @@ void PixelShaderManager::SetFogRangeAdjustChanged()
|
||||||
if (g_ActiveConfig.bDisableFog)
|
if (g_ActiveConfig.bDisableFog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s_bFogRangeAdjustChanged = true;
|
m_fog_range_adjusted_changed = true;
|
||||||
|
|
||||||
if (constants.fogRangeBase != bpmem.fogRange.Base.hex)
|
if (constants.fogRangeBase != bpmem.fogRange.Base.hex)
|
||||||
{
|
{
|
||||||
|
@ -442,7 +434,7 @@ void PixelShaderManager::SetFogRangeAdjustChanged()
|
||||||
void PixelShaderManager::SetGenModeChanged()
|
void PixelShaderManager::SetGenModeChanged()
|
||||||
{
|
{
|
||||||
constants.genmode = bpmem.genMode.hex;
|
constants.genmode = bpmem.genMode.hex;
|
||||||
s_bIndirectDirty = true;
|
m_indirect_dirty = true;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,7 +454,7 @@ void PixelShaderManager::SetZModeControl()
|
||||||
constants.dither = dither;
|
constants.dither = dither;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
s_bDestAlphaDirty = true;
|
m_dest_alpha_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelShaderManager::SetBlendModeChanged()
|
void PixelShaderManager::SetBlendModeChanged()
|
||||||
|
@ -520,7 +512,7 @@ void PixelShaderManager::SetBlendModeChanged()
|
||||||
constants.logic_op_mode = state.logicmode;
|
constants.logic_op_mode = state.logicmode;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
s_bDestAlphaDirty = true;
|
m_dest_alpha_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PixelShaderManager::SetBoundingBoxActive(bool active)
|
void PixelShaderManager::SetBoundingBoxActive(bool active)
|
||||||
|
@ -535,10 +527,10 @@ void PixelShaderManager::SetBoundingBoxActive(bool active)
|
||||||
|
|
||||||
void PixelShaderManager::DoState(PointerWrap& p)
|
void PixelShaderManager::DoState(PointerWrap& p)
|
||||||
{
|
{
|
||||||
p.Do(s_bFogRangeAdjustChanged);
|
p.Do(m_fog_range_adjusted_changed);
|
||||||
p.Do(s_bViewPortChanged);
|
p.Do(m_viewport_changed);
|
||||||
p.Do(s_bIndirectDirty);
|
p.Do(m_indirect_dirty);
|
||||||
p.Do(s_bDestAlphaDirty);
|
p.Do(m_dest_alpha_dirty);
|
||||||
|
|
||||||
p.Do(constants);
|
p.Do(constants);
|
||||||
|
|
||||||
|
|
|
@ -9,51 +9,52 @@
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
|
||||||
// The non-API dependent parts.
|
// The non-API dependent parts.
|
||||||
class PixelShaderManager
|
class PixelShaderManager final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init();
|
void Init();
|
||||||
static void Dirty();
|
void Dirty();
|
||||||
static void DoState(PointerWrap& p);
|
void DoState(PointerWrap& p);
|
||||||
|
|
||||||
static void SetConstants(); // sets pixel shader constants
|
void SetConstants(); // sets pixel shader constants
|
||||||
|
|
||||||
// constant management
|
// constant management
|
||||||
// Some of these functions grab the constant values from global state,
|
// Some of these functions grab the constant values from global state,
|
||||||
// so make sure to call them after memory is committed
|
// so make sure to call them after memory is committed
|
||||||
static void SetTevColor(int index, int component, s32 value);
|
void SetTevColor(int index, int component, s32 value);
|
||||||
static void SetTevKonstColor(int index, int component, s32 value);
|
void SetTevKonstColor(int index, int component, s32 value);
|
||||||
static void SetTevOrder(int index, u32 order);
|
void SetTevOrder(int index, u32 order);
|
||||||
static void SetTevKSel(int index, u32 ksel);
|
void SetTevKSel(int index, u32 ksel);
|
||||||
static void SetTevCombiner(int index, int alpha, u32 combiner);
|
void SetTevCombiner(int index, int alpha, u32 combiner);
|
||||||
static void SetAlpha();
|
void SetAlpha();
|
||||||
static void SetAlphaTestChanged();
|
void SetAlphaTestChanged();
|
||||||
static void SetDestAlphaChanged();
|
void SetDestAlphaChanged();
|
||||||
static void SetTexDims(int texmapid, u32 width, u32 height);
|
void SetTexDims(int texmapid, u32 width, u32 height);
|
||||||
static void SetSamplerState(int texmapid, u32 tm0, u32 tm1);
|
void SetSamplerState(int texmapid, u32 tm0, u32 tm1);
|
||||||
static void SetZTextureBias();
|
void SetZTextureBias();
|
||||||
static void SetViewportChanged();
|
void SetViewportChanged();
|
||||||
static void SetEfbScaleChanged(float scalex, float scaley);
|
void SetEfbScaleChanged(float scalex, float scaley);
|
||||||
static void SetZSlope(float dfdx, float dfdy, float f0);
|
void SetZSlope(float dfdx, float dfdy, float f0);
|
||||||
static void SetIndMatrixChanged(int matrixidx);
|
void SetIndMatrixChanged(int matrixidx);
|
||||||
static void SetTevIndirectChanged();
|
void SetTevIndirectChanged();
|
||||||
static void SetZTextureTypeChanged();
|
void SetZTextureTypeChanged();
|
||||||
static void SetZTextureOpChanged();
|
void SetZTextureOpChanged();
|
||||||
static void SetIndTexScaleChanged(bool high);
|
void SetIndTexScaleChanged(bool high);
|
||||||
static void SetTexCoordChanged(u8 texmapid);
|
void SetTexCoordChanged(u8 texmapid);
|
||||||
static void SetFogColorChanged();
|
void SetFogColorChanged();
|
||||||
static void SetFogParamChanged();
|
void SetFogParamChanged();
|
||||||
static void SetFogRangeAdjustChanged();
|
void SetFogRangeAdjustChanged();
|
||||||
static void SetGenModeChanged();
|
void SetGenModeChanged();
|
||||||
static void SetZModeControl();
|
void SetZModeControl();
|
||||||
static void SetBlendModeChanged();
|
void SetBlendModeChanged();
|
||||||
static void SetBoundingBoxActive(bool active);
|
void SetBoundingBoxActive(bool active);
|
||||||
|
|
||||||
static PixelShaderConstants constants;
|
PixelShaderConstants constants{};
|
||||||
static bool dirty;
|
bool dirty = false;
|
||||||
|
|
||||||
static bool s_bFogRangeAdjustChanged;
|
private:
|
||||||
static bool s_bViewPortChanged;
|
bool m_fog_range_adjusted_changed = false;
|
||||||
static bool s_bIndirectDirty;
|
bool m_viewport_changed = false;
|
||||||
static bool s_bDestAlphaDirty;
|
bool m_indirect_dirty = false;
|
||||||
|
bool m_dest_alpha_dirty = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -218,14 +218,14 @@ bool Renderer::IsBBoxEnabled() const
|
||||||
return m_bounding_box->IsEnabled();
|
return m_bounding_box->IsEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::BBoxEnable()
|
void Renderer::BBoxEnable(PixelShaderManager& pixel_shader_manager)
|
||||||
{
|
{
|
||||||
m_bounding_box->Enable();
|
m_bounding_box->Enable(pixel_shader_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::BBoxDisable()
|
void Renderer::BBoxDisable(PixelShaderManager& pixel_shader_manager)
|
||||||
{
|
{
|
||||||
m_bounding_box->Disable();
|
m_bounding_box->Disable(pixel_shader_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 Renderer::BBoxRead(u32 index)
|
u16 Renderer::BBoxRead(u32 index)
|
||||||
|
@ -421,7 +421,9 @@ bool Renderer::CalculateTargetSize()
|
||||||
{
|
{
|
||||||
m_target_width = new_efb_width;
|
m_target_width = new_efb_width;
|
||||||
m_target_height = new_efb_height;
|
m_target_height = new_efb_height;
|
||||||
PixelShaderManager::SetEfbScaleChanged(EFBToScaledXf(1), EFBToScaledYf(1));
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
pixel_shader_manager.SetEfbScaleChanged(EFBToScaledXf(1), EFBToScaledYf(1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -42,6 +42,7 @@ class AbstractStagingTexture;
|
||||||
class BoundingBox;
|
class BoundingBox;
|
||||||
class NativeVertexFormat;
|
class NativeVertexFormat;
|
||||||
class NetPlayChatUI;
|
class NetPlayChatUI;
|
||||||
|
class PixelShaderManager;
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
struct TextureConfig;
|
struct TextureConfig;
|
||||||
struct ComputePipelineConfig;
|
struct ComputePipelineConfig;
|
||||||
|
@ -216,8 +217,8 @@ public:
|
||||||
virtual void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points);
|
virtual void PokeEFB(EFBAccessType type, const EfbPokeData* points, size_t num_points);
|
||||||
|
|
||||||
bool IsBBoxEnabled() const;
|
bool IsBBoxEnabled() const;
|
||||||
void BBoxEnable();
|
void BBoxEnable(PixelShaderManager& pixel_shader_manager);
|
||||||
void BBoxDisable();
|
void BBoxDisable(PixelShaderManager& pixel_shader_manager);
|
||||||
u16 BBoxRead(u32 index);
|
u16 BBoxRead(u32 index);
|
||||||
void BBoxWrite(u32 index, u16 value);
|
void BBoxWrite(u32 index, u16 value);
|
||||||
void BBoxFlush();
|
void BBoxFlush();
|
||||||
|
|
|
@ -1054,18 +1054,22 @@ static void SetSamplerState(u32 index, float custom_tex_scale, bool custom_tex,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_renderer->SetSamplerState(index, state);
|
g_renderer->SetSamplerState(index, state);
|
||||||
PixelShaderManager::SetSamplerState(index, state.tm0.hex, state.tm1.hex);
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
pixel_shader_manager.SetSamplerState(index, state.tm0.hex, state.tm1.hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCacheBase::BindTextures(BitSet32 used_textures)
|
void TextureCacheBase::BindTextures(BitSet32 used_textures)
|
||||||
{
|
{
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
for (u32 i = 0; i < bound_textures.size(); i++)
|
for (u32 i = 0; i < bound_textures.size(); i++)
|
||||||
{
|
{
|
||||||
const TCacheEntry* tentry = bound_textures[i];
|
const TCacheEntry* tentry = bound_textures[i];
|
||||||
if (used_textures[i] && tentry)
|
if (used_textures[i] && tentry)
|
||||||
{
|
{
|
||||||
g_renderer->SetTexture(i, tentry->texture.get());
|
g_renderer->SetTexture(i, tentry->texture.get());
|
||||||
PixelShaderManager::SetTexDims(i, tentry->native_width, tentry->native_height);
|
pixel_shader_manager.SetTexDims(i, tentry->native_width, tentry->native_height);
|
||||||
|
|
||||||
const float custom_tex_scale = tentry->GetWidth() / float(tentry->native_width);
|
const float custom_tex_scale = tentry->GetWidth() / float(tentry->native_width);
|
||||||
SetSamplerState(i, custom_tex_scale, tentry->is_custom_tex, tentry->has_arbitrary_mips);
|
SetSamplerState(i, custom_tex_scale, tentry->is_custom_tex, tentry->has_arbitrary_mips);
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/DolphinAnalytics.h"
|
#include "Core/DolphinAnalytics.h"
|
||||||
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoCommon/BPMemory.h"
|
#include "VideoCommon/BPMemory.h"
|
||||||
#include "VideoCommon/BoundingBox.h"
|
#include "VideoCommon/BoundingBox.h"
|
||||||
|
@ -317,9 +318,11 @@ void VertexManagerBase::UploadUniforms()
|
||||||
|
|
||||||
void VertexManagerBase::InvalidateConstants()
|
void VertexManagerBase::InvalidateConstants()
|
||||||
{
|
{
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
VertexShaderManager::dirty = true;
|
VertexShaderManager::dirty = true;
|
||||||
GeometryShaderManager::dirty = true;
|
GeometryShaderManager::dirty = true;
|
||||||
PixelShaderManager::dirty = true;
|
pixel_shader_manager.dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexManagerBase::UploadUtilityUniforms(const void* uniforms, u32 uniforms_size)
|
void VertexManagerBase::UploadUtilityUniforms(const void* uniforms, u32 uniforms_size)
|
||||||
|
@ -481,6 +484,9 @@ void VertexManagerBase::Flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto& system = Core::System::GetInstance();
|
||||||
|
auto& pixel_shader_manager = system.GetPixelShaderManager();
|
||||||
|
|
||||||
CalculateBinormals(VertexLoaderManager::GetCurrentVertexFormat());
|
CalculateBinormals(VertexLoaderManager::GetCurrentVertexFormat());
|
||||||
// Calculate ZSlope for zfreeze
|
// Calculate ZSlope for zfreeze
|
||||||
const auto used_textures = UsedTextures();
|
const auto used_textures = UsedTextures();
|
||||||
|
@ -514,7 +520,7 @@ void VertexManagerBase::Flush()
|
||||||
}
|
}
|
||||||
else if (m_zslope.dirty && !m_cull_all) // or apply any dirty ZSlopes
|
else if (m_zslope.dirty && !m_cull_all) // or apply any dirty ZSlopes
|
||||||
{
|
{
|
||||||
PixelShaderManager::SetZSlope(m_zslope.dfdx, m_zslope.dfdy, m_zslope.f0);
|
pixel_shader_manager.SetZSlope(m_zslope.dfdx, m_zslope.dfdy, m_zslope.f0);
|
||||||
m_zslope.dirty = false;
|
m_zslope.dirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,7 +565,7 @@ void VertexManagerBase::Flush()
|
||||||
|
|
||||||
// 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);
|
GeometryShaderManager::SetConstants(m_current_primitive_type);
|
||||||
PixelShaderManager::SetConstants();
|
pixel_shader_manager.SetConstants();
|
||||||
UploadUniforms();
|
UploadUniforms();
|
||||||
|
|
||||||
// Update the pipeline, or compile one if needed.
|
// Update the pipeline, or compile one if needed.
|
||||||
|
|
|
@ -330,7 +330,7 @@ void VideoBackendBase::InitializeShared()
|
||||||
VertexLoaderManager::Init();
|
VertexLoaderManager::Init();
|
||||||
VertexShaderManager::Init();
|
VertexShaderManager::Init();
|
||||||
GeometryShaderManager::Init();
|
GeometryShaderManager::Init();
|
||||||
PixelShaderManager::Init();
|
system.GetPixelShaderManager().Init();
|
||||||
TMEM::Init();
|
TMEM::Init();
|
||||||
|
|
||||||
g_Config.VerifyValidity();
|
g_Config.VerifyValidity();
|
||||||
|
|
|
@ -73,7 +73,7 @@ void VideoCommon_DoState(PointerWrap& p)
|
||||||
|
|
||||||
// the old way of replaying current bpmem as writes to push side effects to pixel shader manager
|
// the old way of replaying current bpmem as writes to push side effects to pixel shader manager
|
||||||
// doesn't really work.
|
// doesn't really work.
|
||||||
PixelShaderManager::DoState(p);
|
system.GetPixelShaderManager().DoState(p);
|
||||||
p.DoMarker("PixelShaderManager");
|
p.DoMarker("PixelShaderManager");
|
||||||
|
|
||||||
VertexShaderManager::DoState(p);
|
VertexShaderManager::DoState(p);
|
||||||
|
|
|
@ -118,11 +118,14 @@ static void XFRegWritten(u32 address, u32 value)
|
||||||
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();
|
||||||
VertexShaderManager::SetViewportChanged();
|
VertexShaderManager::SetViewportChanged();
|
||||||
PixelShaderManager::SetViewportChanged();
|
system.GetPixelShaderManager().SetViewportChanged();
|
||||||
GeometryShaderManager::SetViewportChanged();
|
GeometryShaderManager::SetViewportChanged();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case XFMEM_SETPROJECTION:
|
case XFMEM_SETPROJECTION:
|
||||||
case XFMEM_SETPROJECTION + 1:
|
case XFMEM_SETPROJECTION + 1:
|
||||||
|
|
Loading…
Reference in New Issue