Vulkan: Use an enumeration to index pipeline layouts

This commit is contained in:
Stenzek
2016-11-13 15:24:55 +10:00
parent cd3481fbc7
commit 4bc0e14995
10 changed files with 96 additions and 112 deletions

View File

@ -75,7 +75,7 @@ bool StateTracker::Initialize()
m_pipeline_state.rasterization_state.depth_clamp = VK_TRUE;
// BBox is disabled by default.
m_pipeline_state.pipeline_layout = g_object_cache->GetStandardPipelineLayout();
m_pipeline_state.pipeline_layout = g_object_cache->GetPipelineLayout(PIPELINE_LAYOUT_STANDARD);
m_num_active_descriptor_sets = NUM_GX_DRAW_DESCRIPTOR_SETS;
m_bbox_enabled = false;
@ -164,8 +164,8 @@ bool StateTracker::PrecachePipelineUID(const SerializedPipelineUID& uid)
// vertex loader that uses this format, since we need it to create a pipeline.
pinfo.vertex_format = VertexFormat::GetOrCreateMatchingFormat(uid.vertex_decl);
pinfo.pipeline_layout = uid.ps_uid.GetUidData()->bounding_box ?
g_object_cache->GetBBoxPipelineLayout() :
g_object_cache->GetStandardPipelineLayout();
g_object_cache->GetPipelineLayout(PIPELINE_LAYOUT_BBOX) :
g_object_cache->GetPipelineLayout(PIPELINE_LAYOUT_STANDARD);
pinfo.vs = g_object_cache->GetVertexShaderForUid(uid.vs_uid);
if (pinfo.vs == VK_NULL_HANDLE)
{
@ -544,7 +544,7 @@ void StateTracker::SetBBoxEnable(bool enable)
// Change the number of active descriptor sets, as well as the pipeline layout
if (enable)
{
m_pipeline_state.pipeline_layout = g_object_cache->GetBBoxPipelineLayout();
m_pipeline_state.pipeline_layout = g_object_cache->GetPipelineLayout(PIPELINE_LAYOUT_BBOX);
m_num_active_descriptor_sets = NUM_GX_DRAW_WITH_BBOX_DESCRIPTOR_SETS;
// The bbox buffer never changes, so we defer descriptor updates until it is enabled.
@ -553,7 +553,7 @@ void StateTracker::SetBBoxEnable(bool enable)
}
else
{
m_pipeline_state.pipeline_layout = g_object_cache->GetStandardPipelineLayout();
m_pipeline_state.pipeline_layout = g_object_cache->GetPipelineLayout(PIPELINE_LAYOUT_STANDARD);
m_num_active_descriptor_sets = NUM_GX_DRAW_DESCRIPTOR_SETS;
}