Files
DroidDeck/app/src/main/cpp/vkbridge/server_misc.c
T
The412Banner ee0fb08268 Mali bridge (#517, by ASEbrahim) on the non-Adreno test branch
Squash of Droid-Deck/DroidDeck#517 (ASEbrahim/DroidDeck mali-bridge @ 6b823341): the Vulkan
bridge (tools/vkbridge) that runs the guest's Vulkan on the phone's own driver, with BC1-BC7,
clip/cull distance, vertex-divisor and depth-clip emulation and dma-heap memory sharing for Mali.
All of the bridge is ASEbrahim's work; squashed only to carry it on this test branch.

Combined with #570 on this branch, a device draws through exactly one path:
- Adreno: Turnip, unchanged (checked first; the bridge setting is ignored there).
- PowerVR / Xclipse with the system HAL and a render node: the system-Vulkan path (#570).
- Anything else with the Setup toggle on (Mali): the bridge.
2026-10-12 18:34:49 -04:00

54 lines
1.7 KiB
C

/* SPDX-License-Identifier: GPL-3.0-or-later
*
* Descriptor update templates. The client repacks the app's data to the layout of the template
* it created on the server (entries rewritten to packed offsets), so the blob is used as is.
*/
#define _GNU_SOURCE
#include "vkb_server.h"
#include <string.h>
void vkb_sv_vkbDescUpdateRaw(vkb_srv_call *c)
{
VkDevice dev = (VkDevice)(uintptr_t)vkb_dec_u64(&c->d);
VkDescriptorSet set;
VkDescriptorUpdateTemplate tmpl;
vkb_dec_bytes(&c->d, &set, sizeof(set));
vkb_dec_bytes(&c->d, &tmpl, sizeof(tmpl));
size_t n = 0;
const void *data = vkb_dec_blob(&c->d, &n);
if (c->d.err || !c->table) {
vkb_srv_bad_message(c);
return;
}
if (!c->dt->vkUpdateDescriptorSetWithTemplate) {
vkb_srv_missing(c, "vkUpdateDescriptorSetWithTemplate");
return;
}
c->dt->vkUpdateDescriptorSetWithTemplate(dev, set, tmpl, data);
}
void vkb_sv_vkbPushDescRaw(vkb_srv_call *c)
{
VkCommandBuffer cb = (VkCommandBuffer)(uintptr_t)vkb_dec_u64(&c->d);
VkDescriptorUpdateTemplate tmpl;
VkPipelineLayout layout;
vkb_dec_bytes(&c->d, &tmpl, sizeof(tmpl));
vkb_dec_bytes(&c->d, &layout, sizeof(layout));
uint32_t set = vkb_dec_u32(&c->d);
size_t n = 0;
const void *data = vkb_dec_blob(&c->d, &n);
if (c->d.err || !c->table) {
vkb_srv_bad_message(c);
return;
}
if (!c->dt->vkCmdPushDescriptorSetWithTemplate) {
vkb_srv_missing(c, "vkCmdPushDescriptorSetWithTemplate");
return;
}
extern __thread size_t vkb_emu_push_size;
vkb_emu_push_size = n;
c->dt->vkCmdPushDescriptorSetWithTemplate(cb, tmpl, layout, set, data);
vkb_emu_push_size = 0;
}