Always use GESPMBuffer for GEVulkanDrawCall::m_materials key
This commit is contained in:
parent
23470bbde2
commit
bf8a411f01
@ -225,12 +225,7 @@ void GEVulkanDrawCall::generate()
|
|||||||
const irr::video::ITexture** list = &textures[0];
|
const irr::video::ITexture** list = &textures[0];
|
||||||
const int material_id = m_texture_descriptor->getTextureID(list);
|
const int material_id = m_texture_descriptor->getTextureID(list);
|
||||||
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce())
|
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce())
|
||||||
{
|
m_materials[p.first] = material_id;
|
||||||
if (use_base_vertex)
|
|
||||||
m_materials[p.first->getVBOOffset()] = material_id;
|
|
||||||
else
|
|
||||||
m_materials[(size_t)p.first] = material_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool skinning = p.first->hasSkinning();
|
const bool skinning = p.first->hasSkinning();
|
||||||
for (auto& q : p.second)
|
for (auto& q : p.second)
|
||||||
@ -271,24 +266,11 @@ void GEVulkanDrawCall::generate()
|
|||||||
}
|
}
|
||||||
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce())
|
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce())
|
||||||
{
|
{
|
||||||
if (use_base_vertex)
|
std::stable_sort(m_cmds.begin(), m_cmds.end(),
|
||||||
{
|
[this](const DrawCallData& a, const DrawCallData& b)
|
||||||
std::stable_sort(m_cmds.begin(), m_cmds.end(),
|
{
|
||||||
[this](const DrawCallData& a, const DrawCallData& b)
|
return m_materials[a.m_mb] < m_materials[b.m_mb];
|
||||||
{
|
});
|
||||||
return m_materials[a.m_cmd.vertexOffset] <
|
|
||||||
m_materials[b.m_cmd.vertexOffset];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::stable_sort(m_cmds.begin(), m_cmds.end(),
|
|
||||||
[this](const DrawCallData& a, const DrawCallData& b)
|
|
||||||
{
|
|
||||||
return m_materials[(size_t)a.m_mb] <
|
|
||||||
m_materials[(size_t)b.m_mb];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stable_sort(m_cmds.begin(), m_cmds.end(),
|
std::stable_sort(m_cmds.begin(), m_cmds.end(),
|
||||||
@ -1036,11 +1018,7 @@ void GEVulkanDrawCall::render(GEVulkanDriver* vk, GEVulkanCameraSceneNode* cam,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int cur_mid = 0;
|
int cur_mid = m_materials[m_cmds[0].m_mb];
|
||||||
if (use_base_vertex)
|
|
||||||
cur_mid = m_materials[m_cmds[0].m_cmd.vertexOffset];
|
|
||||||
else
|
|
||||||
cur_mid = m_materials[(size_t)m_cmds[0].m_mb];
|
|
||||||
bindPipeline(cmd, cur_pipeline);
|
bindPipeline(cmd, cur_pipeline);
|
||||||
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce())
|
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce())
|
||||||
{
|
{
|
||||||
@ -1077,11 +1055,7 @@ void GEVulkanDrawCall::render(GEVulkanDriver* vk, GEVulkanCameraSceneNode* cam,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int mid = 0;
|
int mid = m_materials[m_cmds[i].m_mb];
|
||||||
if (use_base_vertex)
|
|
||||||
mid = m_materials[cur_cmd.vertexOffset];
|
|
||||||
else
|
|
||||||
mid = m_materials[(size_t)m_cmds[i].m_mb];
|
|
||||||
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce() &&
|
if (!GEVulkanFeatures::supportsBindMeshTexturesAtOnce() &&
|
||||||
cur_mid != mid)
|
cur_mid != mid)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ private:
|
|||||||
std::unordered_map<std::string, std::pair<VkPipeline, PipelineSettings> >
|
std::unordered_map<std::string, std::pair<VkPipeline, PipelineSettings> >
|
||||||
m_graphics_pipelines;
|
m_graphics_pipelines;
|
||||||
|
|
||||||
std::unordered_map<size_t, int> m_materials;
|
std::unordered_map<GESPMBuffer*, int> m_materials;
|
||||||
|
|
||||||
GEVulkanTextureDescriptor* m_texture_descriptor;
|
GEVulkanTextureDescriptor* m_texture_descriptor;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user