mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b44ac8ea99 |
No files matched your search
@@ -162,6 +162,9 @@ When it is active:
|
||||
- `DROIDDECK_MALI_COMPAT=1` forces it on, `0` off. `DROIDDECK_MALI_COMPAT_DISABLE=1` keeps the loader from loading it.
|
||||
- Wine's own `explorer.exe` uses Zink, so it gets the layer too.
|
||||
- It logs one line per device: `droiddeck-mali-compat: emulating …`.
|
||||
- Where the driver has no entry for a core command, `vkGetDeviceProcAddr` gives the command's KHR or EXT entry instead, as Mesa does.
|
||||
- Wine's win32u calls the host's `vkGetDeviceBufferMemoryRequirements` for `vkGetDeviceBufferMemoryRequirementsKHR`.
|
||||
- On a Vulkan 1.1 instance with `VK_KHR_maintenance4` (vkd3d-proton 2.7), the Mali bridge gives only the KHR name, and Wine called NULL.
|
||||
|
||||
How it ships:
|
||||
- `build-apk.sh` copies `layer/` into the APK's `assets/linuxfs/usr/local/…`.
|
||||
|
||||
@@ -337,6 +337,22 @@ static void VKAPI_CALL mock_set_blend_equation(VkCommandBuffer cmd, uint32_t fir
|
||||
driver_equation_count = first + count;
|
||||
}
|
||||
|
||||
static void VKAPI_CALL mock_buffer_requirements_khr(VkDevice device, const VkDeviceBufferMemoryRequirements *info,
|
||||
VkMemoryRequirements2 *requirements)
|
||||
{
|
||||
requirements->memoryRequirements.memoryTypeBits = 1;
|
||||
}
|
||||
|
||||
static VkDeviceAddress VKAPI_CALL mock_buffer_address(VkDevice device, const VkBufferDeviceAddressInfo *info)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static VkDeviceAddress VKAPI_CALL mock_buffer_address_khr(VkDevice device, const VkBufferDeviceAddressInfo *info)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
#define MOCK(name, function) if (!strcmp(requested, name)) return (PFN_vkVoidFunction)function
|
||||
static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL mock_gipa(VkInstance instance, const char *requested)
|
||||
{
|
||||
@@ -364,6 +380,9 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL mock_gdpa(VkDevice device, const
|
||||
MOCK("vkBeginCommandBuffer", mock_begin_command_buffer);
|
||||
MOCK("vkCmdSetDepthTestEnable", mock_set_depth_test);
|
||||
MOCK("vkCmdSetDepthCompareOp", mock_set_depth_op);
|
||||
MOCK("vkGetDeviceBufferMemoryRequirementsKHR", mock_buffer_requirements_khr);
|
||||
MOCK("vkGetBufferDeviceAddress", mock_buffer_address);
|
||||
MOCK("vkGetBufferDeviceAddressKHR", mock_buffer_address_khr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -567,6 +586,27 @@ static void test_depth_compare_op(void)
|
||||
destroy_device(device);
|
||||
}
|
||||
|
||||
static void test_promoted_command_aliases(void)
|
||||
{
|
||||
VkDevice device;
|
||||
VkPhysicalDeviceFeatures enabled = {.dualSrcBlend = VK_TRUE};
|
||||
assert(create_device((VkPhysicalDevice)&mock_lacking, NULL, &enabled, &device) == VK_SUCCESS);
|
||||
assert(layer_gdpa(device, "vkGetDeviceBufferMemoryRequirements") ==
|
||||
(PFN_vkVoidFunction)mock_buffer_requirements_khr);
|
||||
assert(layer_gdpa(device, "vkGetDeviceBufferMemoryRequirementsKHR") ==
|
||||
(PFN_vkVoidFunction)mock_buffer_requirements_khr);
|
||||
assert(layer_gdpa(device, "vkGetBufferDeviceAddress") == (PFN_vkVoidFunction)mock_buffer_address);
|
||||
assert(layer_gdpa(device, "vkGetBufferDeviceAddressKHR") == (PFN_vkVoidFunction)mock_buffer_address_khr);
|
||||
assert(layer_gdpa(device, "vkCmdBeginRendering") == NULL);
|
||||
destroy_device(device);
|
||||
|
||||
assert(create_device((VkPhysicalDevice)&mock_capable, NULL, NULL, &device) == VK_SUCCESS);
|
||||
assert(layer_gdpa(device, "vkGetDeviceBufferMemoryRequirements") == NULL);
|
||||
assert(layer_gdpa(device, "vkGetDeviceBufferMemoryRequirementsKHR") ==
|
||||
(PFN_vkVoidFunction)mock_buffer_requirements_khr);
|
||||
destroy_device(device);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
test_spirv(argc > 1 ? argv[1] : NULL);
|
||||
@@ -590,6 +630,7 @@ int main(int argc, char **argv)
|
||||
test_lacking_device();
|
||||
test_capable_device();
|
||||
test_depth_compare_op();
|
||||
test_promoted_command_aliases();
|
||||
|
||||
((PFN_vkDestroyInstance)layer_gipa(instance, "vkDestroyInstance"))(instance, NULL);
|
||||
free(driver_code);
|
||||
|
||||
@@ -758,6 +758,17 @@ static const struct hook device_hooks[] = {
|
||||
|
||||
static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *name);
|
||||
|
||||
static PFN_vkVoidFunction next_device_proc(const struct device *dev, VkDevice device, const char *name)
|
||||
{
|
||||
PFN_vkVoidFunction next = dev->gdpa(device, name);
|
||||
static const char *const suffixes[] = {"KHR", "EXT"};
|
||||
char alias[256];
|
||||
for (size_t i = 0; !next && dev->active && i < sizeof(suffixes) / sizeof(suffixes[0]); i++)
|
||||
if (snprintf(alias, sizeof(alias), "%s%s", name, suffixes[i]) < (int)sizeof(alias))
|
||||
next = dev->gdpa(device, alias);
|
||||
return next;
|
||||
}
|
||||
|
||||
static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice device, const char *name)
|
||||
{
|
||||
if (!strcmp(name, "vkGetDeviceProcAddr"))
|
||||
@@ -767,7 +778,7 @@ static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice devic
|
||||
return NULL;
|
||||
if (!strcmp(name, "vkDestroyDevice"))
|
||||
return (PFN_vkVoidFunction)DestroyDevice;
|
||||
PFN_vkVoidFunction next = dev->gdpa(device, name);
|
||||
PFN_vkVoidFunction next = next_device_proc(dev, device, name);
|
||||
if (!next)
|
||||
return NULL;
|
||||
for (size_t i = 0; i < sizeof(device_hooks) / sizeof(device_hooks[0]); i++) {
|
||||
|
||||
Reference in new issue
Block a user