Compare commits

...

3 Commits

Author SHA1 Message Date
Berk 0535783f46 Update README with project details and usage instructions 2026-07-26 15:13:17 +03:00
Berk 99004a3ccd [GPU] Host cached guest buffer (#649) 2026-07-26 04:28:32 +03:00
Berk e1a3b92567 [CPU] Fix Sema ORBIS_GEN2_ERROR_BUSY loop (#621) 2026-07-25 14:42:35 +03:00
3 changed files with 25 additions and 18 deletions
-10
View File
@@ -13,16 +13,6 @@ SPDX-License-Identifier: GPL-2.0-or-later
An experimental PlayStation 5 emulator for Windows, Linux and macOS.
</p>
<p align="center">
<a href="https://discord.gg/6GejPEDqpc">
<img src="https://img.shields.io/badge/Discord-Join%20our%20Community-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord">
</a>
</p>
<p align="center">
<strong>Join our Discord for development updates, compatibility discussions, support, and community chat.</strong>
</p>
---
<p align="center">
@@ -1449,6 +1449,9 @@ public sealed partial class DirectExecutionBackend
var expectedSemaphoreTrywaitAgain =
string.Equals(nid, "H2a+IN9TP0E", StringComparison.Ordinal) &&
result == OrbisGen2Result.ORBIS_GEN2_ERROR_TRY_AGAIN;
var expectedPollSemaBusy =
string.Equals(nid, "12wOHk8ywb0", StringComparison.Ordinal) &&
result == OrbisGen2Result.ORBIS_GEN2_ERROR_BUSY;
var expectedNetAcceptWouldBlock =
string.Equals(nid, "PIWqhn9oSxc", StringComparison.Ordinal) &&
resultValue == unchecked((int)0x80410123);
@@ -1463,6 +1466,7 @@ public sealed partial class DirectExecutionBackend
!expectedEqueueTimeout &&
!expectedMutexTrylockBusy &&
!expectedSemaphoreTrywaitAgain &&
!expectedPollSemaBusy &&
!expectedNetAcceptWouldBlock &&
!expectedUserServiceNoEvent &&
!expectedPrivacyInvalidParameter)
@@ -9445,7 +9445,8 @@ internal static unsafe class VulkanVideoPresenter
size,
BufferUsageFlags.StorageBufferBit,
MemoryPropertyFlags.HostVisibleBit | MemoryPropertyFlags.HostCoherentBit,
out var memory);
out var memory,
preferredMemoryFlags: MemoryPropertyFlags.HostCachedBit);
void* mapped;
Check(_vk.MapMemory(_device, memory, 0, size, 0, &mapped), "vkMapMemory(guest buffer)");
var shadow = new byte[checked((int)size)];
@@ -10254,7 +10255,8 @@ internal static unsafe class VulkanVideoPresenter
ulong size,
BufferUsageFlags usage,
MemoryPropertyFlags memoryFlags,
out DeviceMemory memory)
out DeviceMemory memory,
MemoryPropertyFlags preferredMemoryFlags = 0)
{
var bufferInfo = new BufferCreateInfo
{
@@ -10270,7 +10272,10 @@ internal static unsafe class VulkanVideoPresenter
{
SType = StructureType.MemoryAllocateInfo,
AllocationSize = requirements.Size,
MemoryTypeIndex = FindMemoryType(requirements.MemoryTypeBits, memoryFlags),
MemoryTypeIndex = FindMemoryType(
requirements.MemoryTypeBits,
memoryFlags,
preferredMemoryFlags),
};
Check(_vk.AllocateMemory(_device, &memoryInfo, null, out memory), "vkAllocateMemory");
Check(_vk.BindBufferMemory(_device, buffer, memory, 0), "vkBindBufferMemory");
@@ -10307,18 +10312,26 @@ internal static unsafe class VulkanVideoPresenter
}
}
private uint FindMemoryType(uint typeBits, MemoryPropertyFlags requiredFlags)
private uint FindMemoryType(
uint typeBits,
MemoryPropertyFlags requiredFlags,
MemoryPropertyFlags preferredFlags = 0)
{
_vk.GetPhysicalDeviceMemoryProperties(_physicalDevice, out var properties);
var memoryTypes = &properties.MemoryTypes.Element0;
for (var pass = preferredFlags != 0 ? 0 : 1; pass < 2; pass++)
{
var wanted = pass == 0 ? requiredFlags | preferredFlags : requiredFlags;
for (uint index = 0; index < properties.MemoryTypeCount; index++)
{
if ((typeBits & (1u << (int)index)) != 0 &&
(memoryTypes[index].PropertyFlags & requiredFlags) == requiredFlags)
(memoryTypes[index].PropertyFlags & wanted) == wanted)
{
return index;
}
}
}
throw new InvalidOperationException("No compatible Vulkan host-visible memory type was found.");
}