anv: Move the brw_compiler from anv_compiler to physical_device
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 20 Oct 2015 03:21:45 +0000 (20:21 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 20 Oct 2015 20:02:03 +0000 (13:02 -0700)
src/vulkan/anv_compiler.cpp
src/vulkan/anv_device.c
src/vulkan/anv_private.h

index 5d74f0f131e69491c17dadd83ba238eeb38cedea..1ecd88a03319ec700c20643da15ee119fe0a25ec 100644 (file)
@@ -460,7 +460,7 @@ anv_compiler_create(struct anv_device *device)
 
    brw_process_intel_debug_variable();
 
-   compiler->screen->compiler = brw_compiler_create(compiler, &device->info);
+   compiler->screen->compiler = device->instance->physicalDevice.compiler;
 
    ctx = &compiler->brw->ctx;
    _mesa_init_shader_object_functions(&ctx->Driver);
index 75fbe691c5fa6f177600f681204948c3b56dbe98..e0bb7f6e4bcf10853f9ddac2717120a1a2b499be 100644 (file)
@@ -91,6 +91,12 @@ anv_physical_device_init(struct anv_physical_device *device,
    
    close(fd);
 
+   device->compiler = brw_compiler_create(NULL, device->info);
+   if (device->compiler == NULL) {
+      result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+      goto fail;
+   }
+
    return VK_SUCCESS;
    
 fail:
@@ -98,6 +104,12 @@ fail:
    return result;
 }
 
+static void
+anv_physical_device_finish(struct anv_physical_device *device)
+{
+   ralloc_free(device->compiler);
+}
+
 static void *default_alloc(
     void*                                       pUserData,
     size_t                                      size,
@@ -193,6 +205,7 @@ void anv_DestroyInstance(
 {
    ANV_FROM_HANDLE(anv_instance, instance, _instance);
 
+   anv_physical_device_finish(&instance->physicalDevice);
    anv_finish_wsi(instance);
 
    VG(VALGRIND_DESTROY_MEMPOOL(instance));
index c0d9373b64377abe08e1a4909eb629aa907e8af6..8c48a9c2b0ac69bcfd8eadd723e85001c44126bf 100644 (file)
@@ -427,6 +427,7 @@ struct anv_physical_device {
     const char *                                name;
     const struct brw_device_info *              info;
     uint64_t                                    aperture_size;
+    struct brw_compiler *                       compiler;
 };
 
 struct anv_instance {