vk: API bug fixes - Improve spec conformity

explicitly request anisotropic filtering and BC compression

clean up a leaking framebuffer handle reference when using debug overlay

Wait for device instead of queue to ensure no conflict during renderer shutdown

Clip scissor regions when doing surface clears
This commit is contained in:
kd-11 2017-06-07 22:45:02 +03:00
parent 444c64ae75
commit 12da498001
2 changed files with 34 additions and 3 deletions

View File

@ -635,8 +635,8 @@ VKGSRender::~VKGSRender()
m_current_command_buffer->reset();
//Wait for queue
vkQueueWaitIdle(m_swap_chain->get_present_queue());
//Wait for device to finish up with resources
vkDeviceWaitIdle(*m_device);
//Sync objects
if (m_present_semaphore)
@ -1048,6 +1048,26 @@ void VKGSRender::clear_surface(u32 mask)
u16 scissor_y = rsx::method_registers.scissor_origin_y();
u16 scissor_h = rsx::method_registers.scissor_height();
const u32 fb_width = m_framebuffer_to_clean.back()->width();
const u32 fb_height = m_framebuffer_to_clean.back()->height();
//clip region
//TODO: Move clipping logic to shared code. Its used in other places as well
if (scissor_x >= fb_width)
scissor_x = 0;
if (scissor_y >= fb_height)
scissor_y = 0;
const u32 scissor_limit_x = scissor_x + scissor_w;
const u32 scissor_limit_y = scissor_y + scissor_h;
if (scissor_limit_x > fb_width)
scissor_w = fb_width - scissor_x;
if (scissor_limit_y > fb_height)
scissor_h = fb_height - scissor_y;
VkClearRect region = { { { scissor_x, scissor_y },{ scissor_w, scissor_h } }, 0, 1 };
auto targets = vk::get_draw_buffers(rsx::method_registers.surface_color_target());
@ -1821,6 +1841,7 @@ void VKGSRender::flip(int buffer)
vk::change_image_layout(*m_current_command_buffer, target_image, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, subres);
}
m_framebuffer_to_clean.push_back(std::move(direct_fbo));
queue_swap_request();
}
else

View File

@ -189,6 +189,16 @@ namespace vk
if (g_cfg.video.debug_output)
layers.push_back("VK_LAYER_LUNARG_standard_validation");
//Enable hardware features manually
//Currently we require:
//1. Anisotropic sampling
//2. DXT support
VkPhysicalDeviceFeatures available_features;
vkGetPhysicalDeviceFeatures(*pgpu, &available_features);
available_features.samplerAnisotropy = VK_TRUE;
available_features.textureCompressionBC = VK_TRUE;
VkDeviceCreateInfo device = {};
device.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
device.pNext = NULL;
@ -198,7 +208,7 @@ namespace vk
device.ppEnabledLayerNames = layers.data();
device.enabledExtensionCount = 1;
device.ppEnabledExtensionNames = requested_extensions;
device.pEnabledFeatures = nullptr;
device.pEnabledFeatures = &available_features;
CHECK_RESULT(vkCreateDevice(*pgpu, &device, nullptr, &dev));
}