anv/gen7: DispatchIndirect requires cmd parser 5
authorJordan Justen <jordan.l.justen@intel.com>
Mon, 28 Mar 2016 21:49:56 +0000 (14:49 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Tue, 29 Mar 2016 00:01:35 +0000 (17:01 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
src/intel/vulkan/genX_cmd_buffer.c

index 1b53f85419b2745f0884d9bd808da371f5320554..35c46008a8431079e78eb2df0c99f0406e8585ec 100644 (file)
@@ -638,6 +638,24 @@ void genX(CmdDrawIndexedIndirect)(
       .PrimitiveTopologyType                    = pipeline->topology);
 }
 
+#if GEN_GEN == 7
+
+static bool
+verify_cmd_parser(const struct anv_device *device,
+                  int required_version,
+                  const char *function)
+{
+   if (device->instance->physicalDevice.cmd_parser_version < required_version) {
+      vk_errorf(VK_ERROR_FEATURE_NOT_PRESENT,
+                "cmd parser version %d is required for %s",
+                required_version, function);
+      return false;
+   } else {
+      return true;
+   }
+}
+
+#endif
 
 void genX(CmdDispatch)(
     VkCommandBuffer                             commandBuffer,
@@ -699,6 +717,14 @@ void genX(CmdDispatchIndirect)(
    uint32_t bo_offset = buffer->offset + offset;
    struct anv_batch *batch = &cmd_buffer->batch;
 
+#if GEN_GEN == 7
+   /* Linux 4.4 added command parser version 5 which allows the GPGPU
+    * indirect dispatch registers to be written.
+    */
+   if (verify_cmd_parser(cmd_buffer->device, 5, "vkCmdDispatchIndirect"))
+      return;
+#endif
+
    if (prog_data->uses_num_work_groups) {
       cmd_buffer->state.num_workgroups_offset = bo_offset;
       cmd_buffer->state.num_workgroups_bo = bo;