Vulkan: Uber shader support

This commit is contained in:
Stenzek
2017-07-20 15:25:35 +10:00
parent 4bf5625895
commit 81b4ed2a81
16 changed files with 738 additions and 164 deletions

View File

@ -589,6 +589,9 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
// Clean up stale textures.
TextureCache::GetInstance()->Cleanup(frameCount);
// Pull in now-ready async shaders.
g_shader_cache->RetrieveAsyncShaders();
}
void Renderer::TransitionBuffersForSwap(const TargetRectangle& scaled_rect,
@ -1132,6 +1135,8 @@ void Renderer::CheckForConfigChanges()
bool old_force_filtering = g_ActiveConfig.bForceFiltering;
bool old_use_xfb = g_ActiveConfig.bUseXFB;
bool old_use_realxfb = g_ActiveConfig.bUseRealXFB;
bool old_vertex_ubershaders = g_ActiveConfig.bForceVertexUberShaders;
bool old_pixel_ubershaders = g_ActiveConfig.bForcePixelUberShaders;
// Copy g_Config to g_ActiveConfig.
// NOTE: This can potentially race with the UI thread, however if it does, the changes will be
@ -1145,6 +1150,8 @@ void Renderer::CheckForConfigChanges()
bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio;
bool use_xfb_changed = old_use_xfb != g_ActiveConfig.bUseXFB;
bool use_realxfb_changed = old_use_realxfb != g_ActiveConfig.bUseRealXFB;
bool ubershaders_changed = old_vertex_ubershaders != g_ActiveConfig.bForceVertexUberShaders ||
old_pixel_ubershaders != g_ActiveConfig.bForcePixelUberShaders;
// Update texture cache settings with any changed options.
TextureCache::GetInstance()->OnConfigChanged(g_ActiveConfig);
@ -1190,6 +1197,10 @@ void Renderer::CheckForConfigChanges()
if (anisotropy_changed || force_texture_filtering_changed)
ResetSamplerStates();
// Clear UID state if ubershaders are toggled.
if (ubershaders_changed)
StateTracker::GetInstance()->ClearShaders();
// Check for a changed post-processing shader and recompile if needed.
static_cast<VulkanPostProcessing*>(m_post_processor.get())->UpdateConfig();
}