Skip to content

Commit

Permalink
fix build with glfw < 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
DHrpcs3 committed Oct 15, 2024
1 parent 08f73b2 commit 36b986f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions rpcsx/gpu/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,19 @@ static vk::Context createVkContext(Device *device) {
rx::die("failed to reserve userspace memory");
}

auto createWindow = [=] {
device->window = glfwCreateWindow(1920, 1080, "RPCSX", nullptr, nullptr);
};

#ifdef GLFW_PLATFORM_WAYLAND
if (glfwPlatformSupported(GLFW_PLATFORM_WAYLAND)) {
glfwInitHint(GLFW_PLATFORM, GLFW_PLATFORM_WAYLAND);
}

glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);

device->window = glfwCreateWindow(1920, 1080, "RPCSX", nullptr, nullptr);
createWindow();

if (device->window == nullptr) {
glfwTerminate();
Expand All @@ -83,8 +88,11 @@ static vk::Context createVkContext(Device *device) {
glfwInit();

glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
device->window = glfwCreateWindow(1920, 1080, "RPCSX", nullptr, nullptr);
createWindow();
}
#else
createWindow();
#endif

const char **glfwExtensions;
uint32_t glfwExtensionCount = 0;
Expand Down Expand Up @@ -474,8 +482,7 @@ void Device::start() {
}
}

void Device::submitCommand(Ring &ring,
std::span<const std::uint32_t> command) {
void Device::submitCommand(Ring &ring, std::span<const std::uint32_t> command) {
std::scoped_lock lock(writeCommandMtx);
if (ring.wptr + command.size() > ring.base + ring.size) {
while (ring.wptr != ring.rptr) {
Expand Down Expand Up @@ -605,8 +612,8 @@ void Device::onCommandBuffer(std::uint32_t pid, int cmdHeader,
} else if (op == gnm::IT_INDIRECT_BUFFER) {
graphicsPipes[0].setDeQueue(
Ring::createFromRange(process.vmId,
memory.getPointer<std::uint32_t>(address),
size / sizeof(std::uint32_t)),
memory.getPointer<std::uint32_t>(address),
size / sizeof(std::uint32_t)),
1);
} else {
rx::die("unimplemented command buffer %x", cmdHeader);
Expand Down

0 comments on commit 36b986f

Please sign in to comment.