Closed Vinjul1704 closed 4 years ago
would be nice to start offering eventually a list of which of this Mantle games work with GRVK.. I would love to be able to run Battlefield 4 and Thief via GRVK as these were the ones I tried Mantle on a 7950 GPU few years ago :-)..
At time I can say that the following crash with the same error ~(can't remember it right now, something with wsi if I'm not mistaken)~
EDIT:
=== GRVK 0.2.0 ===
I/grInitAndEnumerateGpus: app "Star Swarm" (00000002), engine "Nitrous by Oxide Games" (00000002), api 00000001
W/grInitAndEnumerateGpus: unhandled alloc callbacks
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
W/grGetExtensionSupport: STUB
I/grCreateDevice: 10DE:1F08 "GeForce RTX 2060" (Vulkan 1.2.155, driver 460.39.0)
W/grWsiWinGetDisplays: STUB
wine: Unhandled page fault on read access to FFFFFFFFFFFFFFFF at address 0000000070BC8981 (thread 00f8), starting debugger...
thanks for sharing current status.. hope wsi issue can be resolved without much work and guess then unmerged features of https://github.com/libcg/grvk/pull/7 may help also, right?
No games are expected to work at this moment. I'm working towards getting Star Swarm to run first, but it could take months.
(off topic)
FWIW you can stop Star Swarm from crashing by returning 0 displays in grWsiWinGetDisplays
. Additionally it tries to access a weird (and invalid) address in grGetMemoryHeapInfo
once.
With this dirty hack it stops crashing on my system. It doesn't render anything (obvious).
diff --git a/src/mantle/mantle_memory_man.c b/src/mantle/mantle_memory_man.c
index 744d575..1d0d056 100644
--- a/src/mantle/mantle_memory_man.c
+++ b/src/mantle/mantle_memory_man.c
@@ -34,7 +34,7 @@ GR_RESULT grGetMemoryHeapInfo(
LOGT("%p %u 0x%X %p %p\n", device, heapId, infoType, pDataSize, pData);
GrDevice* grDevice = (GrDevice*)device;
- if (grDevice == NULL) {
+ if (grDevice == NULL || grDevice == (GrDevice *)0x0000000001182b60) {
return GR_ERROR_INVALID_HANDLE;
} else if (grDevice->sType != GR_STRUCT_TYPE_DEVICE) {
return GR_ERROR_INVALID_OBJECT_TYPE;
diff --git a/src/mantle/mantle_wsi.c b/src/mantle/mantle_wsi.c
index c43fa23..eb7b2b3 100644
--- a/src/mantle/mantle_wsi.c
+++ b/src/mantle/mantle_wsi.c
@@ -484,3 +484,59 @@ fail_present:
}
return GR_ERROR_UNKNOWN;
}
+
+GR_RESULT grWsiWinGetDisplays(
+ GR_DEVICE device,
+ GR_UINT *pDisplayCount,
+ GR_WSI_WIN_DISPLAY *pDisplayList)
+{
+ LOGT("%p %p %p\n", device, pDisplayCount, pDisplayList);
+
+ GrDevice *grDevice = (GrDevice *)device;
+ VkResult vkRes;
+
+ if (grDevice == NULL)
+ return GR_ERROR_INVALID_HANDLE;
+ if (grDevice->sType != GR_STRUCT_TYPE_DEVICE)
+ return GR_ERROR_INVALID_OBJECT_TYPE;
+ if (pDisplayCount == NULL)
+ return GR_ERROR_INVALID_POINTER;
+ if (*pDisplayCount != 0 && !pDisplayList)
+ return GR_ERROR_INVALID_MEMORY_SIZE;
+
+ // uint32_t pPropertyCount;
+ // vkRes = vki.vkGetPhysicalDeviceDisplayPropertiesKHR(grDevice->physicalDevice, &pPropertyCount, NULL);
+ // if (vkRes != VK_SUCCESS)
+ // return GR_ERROR_INVALID_HANDLE;
+ // // LOGW("got %d / %d displays\n", pPropertyCount, *pDisplayCount);
+
+ // VkDisplayPropertiesKHR *pProperties = malloc(sizeof(VkDisplayPropertiesKHR) * pPropertyCount);
+ // vkRes = vki.vkGetPhysicalDeviceDisplayPropertiesKHR(grDevice->physicalDevice, &pPropertyCount, pProperties);
+ // if (vkRes != VK_SUCCESS)
+ // return GR_ERROR_INVALID_HANDLE;
+
+ // for (int i = 0; i < *pDisplayCount; i++)
+ // {
+ // LOGW(" - %s\n", pProperties[i].displayName);
+ // }
+
+ // VkDisplayPropertiesKHR *pProperties = malloc(sizeof(VkDisplayPropertiesKHR));
+ // memset(pProperties, 0xdeadbeef, sizeof(VkDisplayPropertiesKHR));
+ // pProperties->displayName = malloc(5);
+ // memcpy(pProperties->displayName, "fake\0", 5);
+ // pProperties->physicalDimensions.height = 100;
+ // pProperties->physicalDimensions.width = 100;
+ // pProperties->physicalResolution.width = 1920;
+ // pProperties->physicalResolution.height = 1080;
+
+ // LOGW("%p\n", pProperties);
+
+ // *pDisplayCount = 1;
+ // pDisplayList[0] = (GR_WSI_WIN_DISPLAY *)pProperties;
+
+ *pDisplayCount = 0;
+ pDisplayList[0] = 0;
+ return GR_SUCCESS;
+
+ // return GR_UNSUPPORTED;
+}
\ No newline at end of file
diff --git a/src/mantle/stub.c b/src/mantle/stub.c
index fdf4e25..eb66f73 100644
--- a/src/mantle/stub.c
+++ b/src/mantle/stub.c
@@ -340,14 +340,14 @@ GR_VOID GR_STDCALL grCmdDbgMarkerEnd(
// WSI Functions
-GR_RESULT grWsiWinGetDisplays(
- GR_DEVICE device,
- GR_UINT* pDisplayCount,
- GR_WSI_WIN_DISPLAY* pDisplayList)
-{
- LOGW("STUB\n");
- return GR_UNSUPPORTED;
-}
+// GR_RESULT grWsiWinGetDisplays(
+// GR_DEVICE device,
+// GR_UINT* pDisplayCount,
+// GR_WSI_WIN_DISPLAY* pDisplayList)
+// {
+// LOGW("STUB\n");
+// return GR_UNSUPPORTED;
+// }
GR_RESULT grWsiWinGetDisplayModeList(
GR_WSI_WIN_DISPLAY display,
The link ("a few games") https://en.wikipedia.org/wiki/Category:Video_games_that_support_Mantle in the readme does not exist anymore and has been changed to https://en.wikipedia.org/wiki/Category:Video_games_that_support_Mantle_(API)