radv: Implement indirect dispatch for the MEC.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 12 Dec 2016 07:45:21 +0000 (08:45 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sun, 18 Dec 2016 19:52:33 +0000 (20:52 +0100)
Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c

index 7d7f55a145b02751e33ef643d3a7df65d866a45f..3c5fe25ce6f7aebc25689b9d29a8c66cd9f3d2cd 100644 (file)
@@ -2217,16 +2217,24 @@ void radv_CmdDispatchIndirect(
                }
        }
 
-       radeon_emit(cmd_buffer->cs, PKT3(PKT3_SET_BASE, 2, 0) |
-                                   PKT3_SHADER_TYPE_S(1));
-       radeon_emit(cmd_buffer->cs, 1);
-       radeon_emit(cmd_buffer->cs, va);
-       radeon_emit(cmd_buffer->cs, va >> 32);
+       if (radv_cmd_buffer_uses_mec(cmd_buffer)) {
+               radeon_emit(cmd_buffer->cs, PKT3(PKT3_DISPATCH_INDIRECT, 2, 0) |
+                                       PKT3_SHADER_TYPE_S(1));
+               radeon_emit(cmd_buffer->cs, va);
+               radeon_emit(cmd_buffer->cs, va >> 32);
+               radeon_emit(cmd_buffer->cs, 1);
+       } else {
+               radeon_emit(cmd_buffer->cs, PKT3(PKT3_SET_BASE, 2, 0) |
+                                       PKT3_SHADER_TYPE_S(1));
+               radeon_emit(cmd_buffer->cs, 1);
+               radeon_emit(cmd_buffer->cs, va);
+               radeon_emit(cmd_buffer->cs, va >> 32);
 
-       radeon_emit(cmd_buffer->cs, PKT3(PKT3_DISPATCH_INDIRECT, 1, 0) |
-                                   PKT3_SHADER_TYPE_S(1));
-       radeon_emit(cmd_buffer->cs, 0);
-       radeon_emit(cmd_buffer->cs, 1);
+               radeon_emit(cmd_buffer->cs, PKT3(PKT3_DISPATCH_INDIRECT, 1, 0) |
+                                       PKT3_SHADER_TYPE_S(1));
+               radeon_emit(cmd_buffer->cs, 0);
+               radeon_emit(cmd_buffer->cs, 1);
+       }
 
        assert(cmd_buffer->cs->cdw <= cdw_max);
 }