summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_compute.c
diff options
context:
space:
mode:
authorChristian Inci <[email protected]>2016-12-19 23:26:35 +0100
committerNicolai Hähnle <[email protected]>2016-12-22 17:11:43 +0100
commit7a4ea95f1c5257e79a7a207eccff81c558c04d46 (patch)
tree5c5cac8f65ade019974b19cdabbc800d9c3f1667 /src/gallium/drivers/radeonsi/si_compute.c
parenteca57f85ee1f47b32daa641a19d8d386c58eb1de (diff)
radeonsi: Bugfix needed for hashcat
Hashcat needs MAX_GLOBAL_BUFFERS to be 21 or even 22 for some modes. It'll crash otherwise. I'm adding an assert to see if programs need it to be even higher. Signed-off-by: Christian Inci <[email protected]> [Handle first properly; should be NFC, since clover always uses first == 0.] Signed-off-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_compute.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_compute.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 9d83cb3a736..cb14a35d754 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -32,7 +32,7 @@
#include "si_pipe.h"
#include "sid.h"
-#define MAX_GLOBAL_BUFFERS 20
+#define MAX_GLOBAL_BUFFERS 22
struct si_compute {
unsigned ir_type;
@@ -196,17 +196,19 @@ static void si_set_global_binding(
struct si_context *sctx = (struct si_context*)ctx;
struct si_compute *program = sctx->cs_shader_state.program;
+ assert(first + n <= MAX_GLOBAL_BUFFERS);
+
if (!resources) {
- for (i = first; i < first + n; i++) {
- pipe_resource_reference(&program->global_buffers[i], NULL);
+ for (i = 0; i < n; i++) {
+ pipe_resource_reference(&program->global_buffers[first + i], NULL);
}
return;
}
- for (i = first; i < first + n; i++) {
+ for (i = 0; i < n; i++) {
uint64_t va;
uint32_t offset;
- pipe_resource_reference(&program->global_buffers[i], resources[i]);
+ pipe_resource_reference(&program->global_buffers[first + i], resources[i]);
va = r600_resource(resources[i])->gpu_address;
offset = util_le32_to_cpu(*handles[i]);
va += offset;