diff --git a/src/mbgl/vulkan/pipeline.cpp b/src/mbgl/vulkan/pipeline.cpp index 29042131d..db1d2645a 100644 --- a/src/mbgl/vulkan/pipeline.cpp +++ b/src/mbgl/vulkan/pipeline.cpp @@ -6,6 +6,8 @@ namespace mbgl { namespace vulkan { +#define USE_DYNAMIC_VIEWPORT 0 + vk::Format PipelineInfo::vulkanFormat(const gfx::AttributeDataType& value) { switch (value) { case gfx::AttributeDataType::Byte: @@ -398,6 +400,10 @@ std::size_t PipelineInfo::hash() const { stencilDepthFail, wideLines, VkRenderPass(renderPass), +#if !USE_DYNAMIC_VIEWPORT + viewExtent.width, + viewExtent.height, +#endif vertexInputHash); } @@ -415,6 +421,14 @@ void PipelineInfo::setDynamicValues(const RendererBackend& backend, const vk::Un if (backend.getDeviceFeatures().wideLines && wideLines) { buffer->setLineWidth(dynamicValues.lineWidth); } + +#if USE_DYNAMIC_VIEWPORT + const vk::Viewport viewport(0.0f, 0.0f, viewExtent.width, viewExtent.height, 0.0f, 1.0f); + const vk::Rect2D scissorRect({}, {viewExtent.width, viewExtent.height}); + + buffer->setViewport(0, viewport); + buffer->setScissor(0, scissorRect); +#endif } std::vector PipelineInfo::getDynamicStates(const RendererBackend& backend) const { @@ -434,6 +448,11 @@ std::vector PipelineInfo::getDynamicStates(const RendererBacke dynamicStates.push_back(vk::DynamicState::eLineWidth); } +#if USE_DYNAMIC_VIEWPORT + dynamicStates.push_back(vk::DynamicState::eViewport); + dynamicStates.push_back(vk::DynamicState::eScissor); +#endif + return dynamicStates; } diff --git a/src/mbgl/vulkan/renderable_resource.cpp b/src/mbgl/vulkan/renderable_resource.cpp index 5174c6415..f9bc99120 100644 --- a/src/mbgl/vulkan/renderable_resource.cpp +++ b/src/mbgl/vulkan/renderable_resource.cpp @@ -230,7 +230,7 @@ void SurfaceRenderableResource::initDepthStencil() { depthAllocation->imageView = device->createImageViewUnique(imageViewCreateInfo); - backend.setDebugName(vk::Image(depthAllocation->image), "SwapchainDepthImage"); + backend.setDebugName(depthAllocation->image, "SwapchainDepthImage"); backend.setDebugName(depthAllocation->imageView.get(), "SwapchainDepthImageView"); } @@ -309,8 +309,8 @@ void SurfaceRenderableResource::init(uint32_t w, uint32_t h) { swapchainImageViews.push_back(device->createImageViewUnique(imageViewCreateInfo)); const size_t index = swapchainImageViews.size() - 1; - backend.setDebugName(vk::Image(image), "SwapchainImage_" + std::to_string(index)); - backend.setDebugName(vk::Image(image), "SwapchainImageView_" + std::to_string(index)); + backend.setDebugName(image, "SwapchainImage_" + std::to_string(index)); + backend.setDebugName(image, "SwapchainImageView_" + std::to_string(index)); } // depth resources diff --git a/src/mbgl/vulkan/renderer_backend.cpp b/src/mbgl/vulkan/renderer_backend.cpp index 9f4de91b3..a1c7d3ba7 100644 --- a/src/mbgl/vulkan/renderer_backend.cpp +++ b/src/mbgl/vulkan/renderer_backend.cpp @@ -331,8 +331,7 @@ void RendererBackend::initDebug() { const vk::DebugUtilsMessageTypeFlagsEXT type = vk::DebugUtilsMessageTypeFlagsEXT() | vk::DebugUtilsMessageTypeFlagBitsEXT::eGeneral | vk::DebugUtilsMessageTypeFlagBitsEXT::eValidation | - vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance | - vk::DebugUtilsMessageTypeFlagBitsEXT::eDeviceAddressBinding; + vk::DebugUtilsMessageTypeFlagBitsEXT::ePerformance; const auto createInfo = vk::DebugUtilsMessengerCreateInfoEXT().setMessageSeverity(severity).setMessageType(type).setPfnUserCallback(