nulldrv: Add minimal support for pipeline cache objects.
authorChris Forbes <chrisforbes@google.com>
Tue, 29 Dec 2015 21:49:29 +0000 (10:49 +1300)
committerJon Ashburn <jon@lunarg.com>
Thu, 14 Jan 2016 22:26:00 +0000 (15:26 -0700)
It's not really OK to claim success but leave junk in the caller's memory rather than a real handle. This prevents object tracker randomly exploding when running against the null driver.

Signed-off-by: Chris Forbes <chrisforbes@google.com>
icd/nulldrv/nulldrv.c
icd/nulldrv/nulldrv.h

index a15fdb85d8fa21740c9d0d7b78cc460d1710c26a..0403da8c9426618ca134b06c34056b4039c07c66 100644 (file)
@@ -1716,6 +1716,17 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(
 {
 
     NULLDRV_LOG_FUNC;
+
+    struct nulldrv_dev *dev = nulldrv_dev(device);
+    struct nulldrv_pipeline_cache *pipeline_cache;
+
+    pipeline_cache = (struct nulldrv_pipeline_cache *) nulldrv_base_create(dev,
+            sizeof(*pipeline_cache), VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT);
+    if (!pipeline_cache)
+        return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+    *pPipelineCache = (VkPipelineCache) pipeline_cache;
+
     return VK_SUCCESS;
 }
 
index d2d71beab858b9b58e4b467f56e87747f81a2575..3865258706e6429d7ce327d139c061413360348d 100644 (file)
@@ -113,6 +113,10 @@ struct nulldrv_sampler {
     struct nulldrv_obj obj;
 };
 
+struct nulldrv_pipeline_cache {
+    struct nulldrv_obj obj;
+};
+
 struct nulldrv_img_view {
     struct nulldrv_obj obj;
     struct nulldrv_img *img;