Fix vulkan scaling issue (#3489)
This commit is contained in:
@@ -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<vk::DynamicState> PipelineInfo::getDynamicStates(const RendererBackend& backend) const {
|
||||
@@ -434,6 +448,11 @@ std::vector<vk::DynamicState> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user