mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-01-11 03:00:16 +01:00
fix for nvidia 580 driver
This commit is contained in:
parent
7a2cf11754
commit
9a193b11b0
|
|
@ -309,7 +309,15 @@ Device::~Device() {
|
|||
}
|
||||
|
||||
void Device::start() {
|
||||
vk::context->createSwapchain();
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
vk::context->createSwapchain({
|
||||
.width = static_cast<uint32_t>(width),
|
||||
.height = static_cast<uint32_t>(height),
|
||||
});
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < std::size(dmemFd); ++i) {
|
||||
if (dmemFd[i] != -1) {
|
||||
|
|
@ -900,13 +908,23 @@ bool Device::flip(std::uint32_t pid, int bufferIndex, std::uint64_t arg,
|
|||
}
|
||||
|
||||
void Device::flip(std::uint32_t pid, int bufferIndex, std::uint64_t arg) {
|
||||
auto recreateSwapchain = [this] {
|
||||
int width;
|
||||
int height;
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
vk::context->recreateSwapchain({
|
||||
.width = static_cast<uint32_t>(width),
|
||||
.height = static_cast<uint32_t>(height),
|
||||
});
|
||||
};
|
||||
|
||||
if (!isImageAcquired) {
|
||||
while (true) {
|
||||
auto acquireNextImageResult = vkAcquireNextImageKHR(
|
||||
vk::context->device, vk::context->swapchain, UINT64_MAX,
|
||||
vk::context->presentCompleteSemaphore, VK_NULL_HANDLE, &imageIndex);
|
||||
if (acquireNextImageResult == VK_ERROR_OUT_OF_DATE_KHR) {
|
||||
vk::context->recreateSwapchain();
|
||||
recreateSwapchain();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -951,7 +969,7 @@ void Device::flip(std::uint32_t pid, int bufferIndex, std::uint64_t arg) {
|
|||
|
||||
if (vkQueuePresentResult == VK_ERROR_OUT_OF_DATE_KHR ||
|
||||
vkQueuePresentResult == VK_SUBOPTIMAL_KHR) {
|
||||
vk::context->recreateSwapchain();
|
||||
recreateSwapchain();
|
||||
} else {
|
||||
VK_VERIFY(vkQueuePresentResult);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ struct Context {
|
|||
}
|
||||
|
||||
bool hasDeviceExtension(std::string_view ext);
|
||||
void createSwapchain();
|
||||
void recreateSwapchain();
|
||||
void createSwapchain(VkExtent2D extent);
|
||||
void recreateSwapchain(VkExtent2D extent);
|
||||
void createDevice(VkSurfaceKHR surface, int gpuIndex,
|
||||
std::vector<const char *> requiredExtensions,
|
||||
std::vector<const char *> optionalExtensions);
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ bool vk::Context::hasDeviceExtension(std::string_view ext) {
|
|||
deviceExtensions.end();
|
||||
}
|
||||
|
||||
void vk::Context::createSwapchain() {
|
||||
void vk::Context::createSwapchain(VkExtent2D extent) {
|
||||
uint32_t formatCount;
|
||||
VK_VERIFY(vkGetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface,
|
||||
&formatCount, nullptr));
|
||||
|
|
@ -196,7 +196,7 @@ void vk::Context::createSwapchain() {
|
|||
}
|
||||
}
|
||||
|
||||
recreateSwapchain();
|
||||
recreateSwapchain(extent);
|
||||
|
||||
{
|
||||
VkSemaphoreCreateInfo semaphoreCreateInfo{};
|
||||
|
|
@ -209,7 +209,7 @@ void vk::Context::createSwapchain() {
|
|||
}
|
||||
}
|
||||
|
||||
void vk::Context::recreateSwapchain() {
|
||||
void vk::Context::recreateSwapchain(VkExtent2D extent) {
|
||||
VkSwapchainKHR oldSwapchain = swapchain;
|
||||
|
||||
VkSurfaceCapabilitiesKHR surfCaps;
|
||||
|
|
@ -225,6 +225,8 @@ void vk::Context::recreateSwapchain() {
|
|||
|
||||
if (surfCaps.currentExtent.width != (uint32_t)-1) {
|
||||
swapchainExtent = surfCaps.currentExtent;
|
||||
} else {
|
||||
swapchainExtent = extent;
|
||||
}
|
||||
|
||||
VkPresentModeKHR swapchainPresentMode = VK_PRESENT_MODE_FIFO_KHR;
|
||||
|
|
|
|||
Loading…
Reference in a new issue