VideoBackends: allow custom pixel uniforms to be passed to the vertex shader as well

This commit is contained in:
iwubcode
2025-08-16 15:07:24 -05:00
parent 52806b3dc8
commit 0e73a01279
14 changed files with 62 additions and 38 deletions

View File

@ -290,24 +290,23 @@ void VertexManager::UploadUniforms()
if (pixel_shader_manager.custom_constants_dirty)
{
if (m_last_custom_pixel_buffer_size < pixel_shader_manager.custom_constants.size())
if (m_last_custom_buffer_size < pixel_shader_manager.custom_constants.size())
{
m_custom_pixel_constant_buffer =
m_custom_constant_buffer =
AllocateConstantBuffer(static_cast<u32>(pixel_shader_manager.custom_constants.size()));
}
UpdateConstantBuffer(m_custom_pixel_constant_buffer.Get(),
UpdateConstantBuffer(m_custom_constant_buffer.Get(),
pixel_shader_manager.custom_constants.data(),
static_cast<u32>(pixel_shader_manager.custom_constants.size()));
m_last_custom_pixel_buffer_size = pixel_shader_manager.custom_constants.size();
m_last_custom_buffer_size = pixel_shader_manager.custom_constants.size();
pixel_shader_manager.custom_constants_dirty = false;
}
D3D::stateman->SetPixelConstants(
m_pixel_constant_buffer.Get(),
g_ActiveConfig.bEnablePixelLighting ? m_vertex_constant_buffer.Get() : nullptr,
pixel_shader_manager.custom_constants.empty() ? nullptr :
m_custom_pixel_constant_buffer.Get());
g_ActiveConfig.bEnablePixelLighting ? m_vertex_constant_buffer.Get() : nullptr);
D3D::stateman->SetVertexConstants(m_vertex_constant_buffer.Get());
D3D::stateman->SetGeometryConstants(m_geometry_constant_buffer.Get());
D3D::stateman->SetCustomConstants(m_custom_constant_buffer.Get());
}
} // namespace DX11