core: Fix dynamic texture resource management (#4337)
This commit is contained in:
@@ -146,7 +146,11 @@ void Context::initFrameResources() {
|
||||
void Context::destroyResources() {
|
||||
MBGL_VERIFY_THREAD(tid);
|
||||
|
||||
backend.getDevice()->waitIdle(backend.getDispatcher());
|
||||
try {
|
||||
backend.getDevice()->waitIdle(backend.getDispatcher());
|
||||
} catch (const vk::DeviceLostError& error) {
|
||||
Log::Error(mbgl::Event::Render, "Vulkan device lost during context shutdown");
|
||||
}
|
||||
|
||||
for (auto& frame : frameResources) {
|
||||
frame.runDeletionQueue(*this);
|
||||
@@ -767,8 +771,23 @@ const vk::UniquePipelineLayout& Context::getPushConstantPipelineLayout() {
|
||||
const auto stages = vk::ShaderStageFlags() | vk::ShaderStageFlagBits::eVertex | vk::ShaderStageFlagBits::eFragment;
|
||||
const auto pushConstant = vk::PushConstantRange().setSize(sizeof(matf4)).setStageFlags(stages);
|
||||
|
||||
auto layoutInfo = vk::PipelineLayoutCreateInfo().setPushConstantRanges(pushConstant);
|
||||
|
||||
#ifdef ENABLE_VULKAN_GPU_ASSISTED_VALIDATION
|
||||
// GPU assisted validation crashes when using a pipeline without descriptors.
|
||||
// Use a compatible layout with the general pipeline when enabled
|
||||
const std::vector<vk::DescriptorSetLayout> layouts = {
|
||||
globalUniformDescriptorSetLayout.get(),
|
||||
layerUniformDescriptorSetLayout.get(),
|
||||
drawableUniformDescriptorSetLayout.get(),
|
||||
drawableImageDescriptorSetLayout.get(),
|
||||
};
|
||||
|
||||
layoutInfo.setSetLayouts(layouts);
|
||||
#endif
|
||||
|
||||
pushConstantPipelineLayout = backend.getDevice()->createPipelineLayoutUnique(
|
||||
vk::PipelineLayoutCreateInfo().setPushConstantRanges(pushConstant), nullptr, backend.getDispatcher());
|
||||
layoutInfo, nullptr, backend.getDispatcher());
|
||||
|
||||
backend.setDebugName(pushConstantPipelineLayout.get(), "PipelineLayout_pushConstants");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user