diff options
Diffstat (limited to 'Source/Core/VideoCommon/VertexManagerBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexManagerBase.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index a93a9b34f1..bb23a468ea 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -453,6 +453,7 @@ void VertexManagerBase::Flush() } } + CalculateBinormals(VertexLoaderManager::GetCurrentVertexFormat()); // Calculate ZSlope for zfreeze VertexShaderManager::SetConstants(); if (!bpmem.genMode.zfreeze) @@ -595,6 +596,31 @@ void VertexManagerBase::CalculateZSlope(NativeVertexFormat* format) m_zslope.dirty = true; } +void VertexManagerBase::CalculateBinormals(NativeVertexFormat* format) +{ + const PortableVertexDeclaration vert_decl = format->GetVertexDeclaration(); + + // Only update the binormal/tangent vertex shader constants if the vertex format lacks binormals + // (VertexLoaderManager::binormal_cache gets updated by the vertex loader when binormals are + // present, though) + if (vert_decl.normals[1].enable) + return; + + VertexLoaderManager::tangent_cache[3] = 0; + VertexLoaderManager::binormal_cache[3] = 0; + + if (VertexShaderManager::constants.cached_tangent != VertexLoaderManager::tangent_cache) + { + VertexShaderManager::constants.cached_tangent = VertexLoaderManager::tangent_cache; + VertexShaderManager::dirty = true; + } + if (VertexShaderManager::constants.cached_binormal != VertexLoaderManager::binormal_cache) + { + VertexShaderManager::constants.cached_binormal = VertexLoaderManager::binormal_cache; + VertexShaderManager::dirty = true; + } +} + void VertexManagerBase::UpdatePipelineConfig() { NativeVertexFormat* vertex_format = VertexLoaderManager::GetCurrentVertexFormat(); |
