[vulkan] Add functions to associate ColorBuffers
bug: 122080810
Change-Id: Ic226f57444e78572539f486da4acc03c4c082f48
diff --git a/system/vulkan/func_table.cpp b/system/vulkan/func_table.cpp
index e3079c5..3099285 100644
--- a/system/vulkan/func_table.cpp
+++ b/system/vulkan/func_table.cpp
@@ -3354,6 +3354,28 @@
return vkMapMemoryIntoAddressSpaceGOOGLE_VkResult_return;
}
#endif
+#ifdef VK_GOOGLE_color_buffer
+static VkResult entry_vkRegisterImageColorBufferGOOGLE(
+ VkDevice device,
+ VkImage image,
+ uint32_t colorBuffer)
+{
+ auto vkEnc = HostConnection::get()->vkEncoder();
+ VkResult vkRegisterImageColorBufferGOOGLE_VkResult_return = (VkResult)0;
+ vkRegisterImageColorBufferGOOGLE_VkResult_return = vkEnc->vkRegisterImageColorBufferGOOGLE(device, image, colorBuffer);
+ return vkRegisterImageColorBufferGOOGLE_VkResult_return;
+}
+static VkResult entry_vkRegisterBufferColorBufferGOOGLE(
+ VkDevice device,
+ VkBuffer buffer,
+ uint32_t colorBuffer)
+{
+ auto vkEnc = HostConnection::get()->vkEncoder();
+ VkResult vkRegisterBufferColorBufferGOOGLE_VkResult_return = (VkResult)0;
+ vkRegisterBufferColorBufferGOOGLE_VkResult_return = vkEnc->vkRegisterBufferColorBufferGOOGLE(device, buffer, colorBuffer);
+ return vkRegisterBufferColorBufferGOOGLE_VkResult_return;
+}
+#endif
void* goldfish_vulkan_get_proc_address(const char* name){
#ifdef VK_VERSION_1_0
if (!strcmp(name, "vkCreateInstance"))
@@ -4755,6 +4777,16 @@
return nullptr;
}
#endif
+#ifdef VK_GOOGLE_color_buffer
+ if (!strcmp(name, "vkRegisterImageColorBufferGOOGLE"))
+ {
+ return nullptr;
+ }
+ if (!strcmp(name, "vkRegisterBufferColorBufferGOOGLE"))
+ {
+ return nullptr;
+ }
+#endif
return nullptr;
}
void* goldfish_vulkan_get_instance_proc_address(VkInstance instance, const char* name){
@@ -6313,6 +6345,18 @@
return hasExt ? (void*)entry_vkMapMemoryIntoAddressSpaceGOOGLE : nullptr;
}
#endif
+#ifdef VK_GOOGLE_color_buffer
+ if (!strcmp(name, "vkRegisterImageColorBufferGOOGLE"))
+ {
+ bool hasExt = resources->hasInstanceExtension(instance, "VK_GOOGLE_color_buffer");
+ return hasExt ? (void*)entry_vkRegisterImageColorBufferGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkRegisterBufferColorBufferGOOGLE"))
+ {
+ bool hasExt = resources->hasInstanceExtension(instance, "VK_GOOGLE_color_buffer");
+ return hasExt ? (void*)entry_vkRegisterBufferColorBufferGOOGLE : nullptr;
+ }
+#endif
return nullptr;
}
void* goldfish_vulkan_get_device_proc_address(VkDevice device, const char* name){
@@ -7871,6 +7915,18 @@
return hasExt ? (void*)entry_vkMapMemoryIntoAddressSpaceGOOGLE : nullptr;
}
#endif
+#ifdef VK_GOOGLE_color_buffer
+ if (!strcmp(name, "vkRegisterImageColorBufferGOOGLE"))
+ {
+ bool hasExt = resources->hasDeviceExtension(device, "VK_GOOGLE_color_buffer");
+ return hasExt ? (void*)entry_vkRegisterImageColorBufferGOOGLE : nullptr;
+ }
+ if (!strcmp(name, "vkRegisterBufferColorBufferGOOGLE"))
+ {
+ bool hasExt = resources->hasDeviceExtension(device, "VK_GOOGLE_color_buffer");
+ return hasExt ? (void*)entry_vkRegisterBufferColorBufferGOOGLE : nullptr;
+ }
+#endif
return nullptr;
}
diff --git a/system/vulkan/func_table.h b/system/vulkan/func_table.h
index 09446c4..3dbca4c 100644
--- a/system/vulkan/func_table.h
+++ b/system/vulkan/func_table.h
@@ -278,6 +278,8 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
void* goldfish_vulkan_get_proc_address(const char* name);
void* goldfish_vulkan_get_instance_proc_address(VkInstance instance, const char* name);
void* goldfish_vulkan_get_device_proc_address(VkDevice device, const char* name);
diff --git a/system/vulkan_enc/VkEncoder.cpp b/system/vulkan_enc/VkEncoder.cpp
index dc1ad44..210459c 100644
--- a/system/vulkan_enc/VkEncoder.cpp
+++ b/system/vulkan_enc/VkEncoder.cpp
@@ -21181,5 +21181,103 @@
}
#endif
+#ifdef VK_GOOGLE_color_buffer
+VkResult VkEncoder::vkRegisterImageColorBufferGOOGLE(
+ VkDevice device,
+ VkImage image,
+ uint32_t colorBuffer)
+{
+ mImpl->log("start vkRegisterImageColorBufferGOOGLE");
+ auto stream = mImpl->stream();
+ auto countingStream = mImpl->countingStream();
+ auto resources = mImpl->resources();
+ auto pool = mImpl->pool();
+ stream->setHandleMapping(resources->unwrapMapping());
+ VkDevice local_device;
+ VkImage local_image;
+ uint32_t local_colorBuffer;
+ local_device = device;
+ local_image = image;
+ local_colorBuffer = colorBuffer;
+ countingStream->rewind();
+ {
+ uint64_t cgen_var_1480;
+ countingStream->handleMapping()->mapHandles_VkDevice_u64(&local_device, &cgen_var_1480, 1);
+ countingStream->write((uint64_t*)&cgen_var_1480, 1 * 8);
+ uint64_t cgen_var_1481;
+ countingStream->handleMapping()->mapHandles_VkImage_u64(&local_image, &cgen_var_1481, 1);
+ countingStream->write((uint64_t*)&cgen_var_1481, 1 * 8);
+ countingStream->write((uint32_t*)&local_colorBuffer, sizeof(uint32_t));
+ }
+ uint32_t packetSize_vkRegisterImageColorBufferGOOGLE = 4 + 4 + (uint32_t)countingStream->bytesWritten();
+ countingStream->rewind();
+ uint32_t opcode_vkRegisterImageColorBufferGOOGLE = OP_vkRegisterImageColorBufferGOOGLE;
+ stream->write(&opcode_vkRegisterImageColorBufferGOOGLE, sizeof(uint32_t));
+ stream->write(&packetSize_vkRegisterImageColorBufferGOOGLE, sizeof(uint32_t));
+ uint64_t cgen_var_1482;
+ stream->handleMapping()->mapHandles_VkDevice_u64(&local_device, &cgen_var_1482, 1);
+ stream->write((uint64_t*)&cgen_var_1482, 1 * 8);
+ uint64_t cgen_var_1483;
+ stream->handleMapping()->mapHandles_VkImage_u64(&local_image, &cgen_var_1483, 1);
+ stream->write((uint64_t*)&cgen_var_1483, 1 * 8);
+ stream->write((uint32_t*)&local_colorBuffer, sizeof(uint32_t));
+ VkResult vkRegisterImageColorBufferGOOGLE_VkResult_return = (VkResult)0;
+ stream->read(&vkRegisterImageColorBufferGOOGLE_VkResult_return, sizeof(VkResult));
+ countingStream->clearPool();
+ stream->clearPool();
+ pool->freeAll();
+ mImpl->log("finish vkRegisterImageColorBufferGOOGLE");;
+ return vkRegisterImageColorBufferGOOGLE_VkResult_return;
+}
+
+VkResult VkEncoder::vkRegisterBufferColorBufferGOOGLE(
+ VkDevice device,
+ VkBuffer buffer,
+ uint32_t colorBuffer)
+{
+ mImpl->log("start vkRegisterBufferColorBufferGOOGLE");
+ auto stream = mImpl->stream();
+ auto countingStream = mImpl->countingStream();
+ auto resources = mImpl->resources();
+ auto pool = mImpl->pool();
+ stream->setHandleMapping(resources->unwrapMapping());
+ VkDevice local_device;
+ VkBuffer local_buffer;
+ uint32_t local_colorBuffer;
+ local_device = device;
+ local_buffer = buffer;
+ local_colorBuffer = colorBuffer;
+ countingStream->rewind();
+ {
+ uint64_t cgen_var_1484;
+ countingStream->handleMapping()->mapHandles_VkDevice_u64(&local_device, &cgen_var_1484, 1);
+ countingStream->write((uint64_t*)&cgen_var_1484, 1 * 8);
+ uint64_t cgen_var_1485;
+ countingStream->handleMapping()->mapHandles_VkBuffer_u64(&local_buffer, &cgen_var_1485, 1);
+ countingStream->write((uint64_t*)&cgen_var_1485, 1 * 8);
+ countingStream->write((uint32_t*)&local_colorBuffer, sizeof(uint32_t));
+ }
+ uint32_t packetSize_vkRegisterBufferColorBufferGOOGLE = 4 + 4 + (uint32_t)countingStream->bytesWritten();
+ countingStream->rewind();
+ uint32_t opcode_vkRegisterBufferColorBufferGOOGLE = OP_vkRegisterBufferColorBufferGOOGLE;
+ stream->write(&opcode_vkRegisterBufferColorBufferGOOGLE, sizeof(uint32_t));
+ stream->write(&packetSize_vkRegisterBufferColorBufferGOOGLE, sizeof(uint32_t));
+ uint64_t cgen_var_1486;
+ stream->handleMapping()->mapHandles_VkDevice_u64(&local_device, &cgen_var_1486, 1);
+ stream->write((uint64_t*)&cgen_var_1486, 1 * 8);
+ uint64_t cgen_var_1487;
+ stream->handleMapping()->mapHandles_VkBuffer_u64(&local_buffer, &cgen_var_1487, 1);
+ stream->write((uint64_t*)&cgen_var_1487, 1 * 8);
+ stream->write((uint32_t*)&local_colorBuffer, sizeof(uint32_t));
+ VkResult vkRegisterBufferColorBufferGOOGLE_VkResult_return = (VkResult)0;
+ stream->read(&vkRegisterBufferColorBufferGOOGLE_VkResult_return, sizeof(VkResult));
+ countingStream->clearPool();
+ stream->clearPool();
+ pool->freeAll();
+ mImpl->log("finish vkRegisterBufferColorBufferGOOGLE");;
+ return vkRegisterBufferColorBufferGOOGLE_VkResult_return;
+}
+
+#endif
} // namespace goldfish_vk
diff --git a/system/vulkan_enc/VkEncoder.h b/system/vulkan_enc/VkEncoder.h
index 77e08ce..2e72833 100644
--- a/system/vulkan_enc/VkEncoder.h
+++ b/system/vulkan_enc/VkEncoder.h
@@ -1747,6 +1747,16 @@
VkDeviceMemory memory,
uint64_t* pAddress);
#endif
+#ifdef VK_GOOGLE_color_buffer
+ VkResult vkRegisterImageColorBufferGOOGLE(
+ VkDevice device,
+ VkImage image,
+ uint32_t colorBuffer);
+ VkResult vkRegisterBufferColorBufferGOOGLE(
+ VkDevice device,
+ VkBuffer buffer,
+ uint32_t colorBuffer);
+#endif
private:
class Impl;
diff --git a/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp b/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp
index 7c2bf8c..68ff572 100644
--- a/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_deepcopy_guest.cpp
@@ -6346,6 +6346,8 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
void deepcopy_extension_struct(
Pool* pool,
const void* structExtension,
diff --git a/system/vulkan_enc/goldfish_vk_deepcopy_guest.h b/system/vulkan_enc/goldfish_vk_deepcopy_guest.h
index 08600d3..4a89c03 100644
--- a/system/vulkan_enc/goldfish_vk_deepcopy_guest.h
+++ b/system/vulkan_enc/goldfish_vk_deepcopy_guest.h
@@ -2010,5 +2010,7 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
} // namespace goldfish_vk
diff --git a/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp b/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp
index 6947c7e..668d3ac 100644
--- a/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_extension_structs_guest.cpp
@@ -276,6 +276,8 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
uint32_t goldfish_vk_struct_type(
const void* structExtension)
{
diff --git a/system/vulkan_enc/goldfish_vk_extension_structs_guest.h b/system/vulkan_enc/goldfish_vk_extension_structs_guest.h
index 97d7547..9d09bb8 100644
--- a/system/vulkan_enc/goldfish_vk_extension_structs_guest.h
+++ b/system/vulkan_enc/goldfish_vk_extension_structs_guest.h
@@ -293,5 +293,7 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
} // namespace goldfish_vk
diff --git a/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp b/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp
index de85c43..bd9ae86 100644
--- a/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_handlemap_guest.cpp
@@ -4718,6 +4718,8 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
void handlemap_extension_struct(
VulkanHandleMapping* handlemap,
void* structExtension_out)
diff --git a/system/vulkan_enc/goldfish_vk_handlemap_guest.h b/system/vulkan_enc/goldfish_vk_handlemap_guest.h
index d056f63..08c5564 100644
--- a/system/vulkan_enc/goldfish_vk_handlemap_guest.h
+++ b/system/vulkan_enc/goldfish_vk_handlemap_guest.h
@@ -1665,5 +1665,7 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
} // namespace goldfish_vk
diff --git a/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp b/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
index ca08465..b4f2ead 100644
--- a/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_marshaling_guest.cpp
@@ -13365,6 +13365,8 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
void marshal_extension_struct(
VulkanStream* vkStream,
const void* structExtension)
diff --git a/system/vulkan_enc/goldfish_vk_marshaling_guest.h b/system/vulkan_enc/goldfish_vk_marshaling_guest.h
index db92431..ef3ee5c 100644
--- a/system/vulkan_enc/goldfish_vk_marshaling_guest.h
+++ b/system/vulkan_enc/goldfish_vk_marshaling_guest.h
@@ -3361,5 +3361,9 @@
#ifdef VK_GOOGLE_address_space
#define OP_vkMapMemoryIntoAddressSpaceGOOGLE 20317
#endif
+#ifdef VK_GOOGLE_color_buffer
+#define OP_vkRegisterImageColorBufferGOOGLE 20318
+#define OP_vkRegisterBufferColorBufferGOOGLE 20319
+#endif
} // namespace goldfish_vk
diff --git a/system/vulkan_enc/goldfish_vk_private_defs.h b/system/vulkan_enc/goldfish_vk_private_defs.h
index 92f648e..f1d066d 100644
--- a/system/vulkan_enc/goldfish_vk_private_defs.h
+++ b/system/vulkan_enc/goldfish_vk_private_defs.h
@@ -88,6 +88,11 @@
typedef VkResult (VKAPI_PTR *PFN_vkMapMemoryIntoAddressSpaceGOOGLE)(VkDevice device, VkDeviceMemory memory, uint64_t* pAddress);
+#define VK_GOOGLE_color_buffer 1
+
+typedef VkResult (VKAPI_PTR *PFN_vkRegisterImageColorBufferGOOGLE)(VkDevice device, VkImage image, uint32_t colorBuffer);
+typedef VkResult (VKAPI_PTR *PFN_vkRegisterBufferColorBufferGOOGLE)(VkDevice device, VkBuffer image, uint32_t colorBuffer);
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/system/vulkan_enc/goldfish_vk_transform_guest.cpp b/system/vulkan_enc/goldfish_vk_transform_guest.cpp
index b413863..cf9cdc6 100644
--- a/system/vulkan_enc/goldfish_vk_transform_guest.cpp
+++ b/system/vulkan_enc/goldfish_vk_transform_guest.cpp
@@ -8891,6 +8891,8 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
void transform_tohost_extension_struct(
ResourceTracker* resourceTracker,
void* structExtension_out)
diff --git a/system/vulkan_enc/goldfish_vk_transform_guest.h b/system/vulkan_enc/goldfish_vk_transform_guest.h
index e2d33de..0ef2144 100644
--- a/system/vulkan_enc/goldfish_vk_transform_guest.h
+++ b/system/vulkan_enc/goldfish_vk_transform_guest.h
@@ -3045,5 +3045,7 @@
#endif
#ifdef VK_GOOGLE_address_space
#endif
+#ifdef VK_GOOGLE_color_buffer
+#endif
} // namespace goldfish_vk