aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/r600/evergreen_compute.c4
-rw-r--r--src/gallium/drivers/radeonsi/si_compute.c4
-rw-r--r--src/gallium/include/pipe/p_state.h1
-rw-r--r--src/gallium/state_trackers/clover/spirv/invocation.cpp3
4 files changed, 4 insertions, 8 deletions
diff --git a/src/gallium/drivers/r600/evergreen_compute.c b/src/gallium/drivers/r600/evergreen_compute.c
index 0dad0f04c1a..0f6c5c2f2ff 100644
--- a/src/gallium/drivers/r600/evergreen_compute.c
+++ b/src/gallium/drivers/r600/evergreen_compute.c
@@ -430,7 +430,6 @@ static void *evergreen_create_compute_state(struct pipe_context *ctx,
struct r600_pipe_compute *shader = CALLOC_STRUCT(r600_pipe_compute);
#ifdef HAVE_OPENCL
const struct pipe_llvm_program_header *header;
- const char *code;
void *p;
boolean use_kill;
#endif
@@ -449,9 +448,8 @@ static void *evergreen_create_compute_state(struct pipe_context *ctx,
#ifdef HAVE_OPENCL
COMPUTE_DBG(rctx->screen, "*** evergreen_create_compute_state\n");
header = cso->prog;
- code = cso->prog + sizeof(struct pipe_llvm_program_header);
radeon_shader_binary_init(&shader->binary);
- r600_elf_read(code, header->num_bytes, &shader->binary);
+ r600_elf_read(header->blob, header->num_bytes, &shader->binary);
r600_create_shader(&shader->bc, &shader->binary, &use_kill);
/* Upload code + ROdata */
diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
index 3acc1c69a0a..037b1927189 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -257,9 +257,7 @@ static void *si_create_compute_state(
program, si_create_compute_state_async);
} else {
const struct pipe_llvm_program_header *header;
- const char *code;
header = cso->prog;
- code = cso->prog + sizeof(struct pipe_llvm_program_header);
program->shader.binary.elf_size = header->num_bytes;
program->shader.binary.elf_buffer = malloc(header->num_bytes);
@@ -267,7 +265,7 @@ static void *si_create_compute_state(
FREE(program);
return NULL;
}
- memcpy((void *)program->shader.binary.elf_buffer, code, header->num_bytes);
+ memcpy((void *)program->shader.binary.elf_buffer, header->blob, header->num_bytes);
const amd_kernel_code_t *code_object =
si_compute_get_code_object(program, 0);
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 41c37402823..4b23824f3de 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -884,6 +884,7 @@ struct pipe_grid_info
struct pipe_llvm_program_header
{
uint32_t num_bytes; /**< Number of bytes in the LLVM bytecode program. */
+ char blob[];
};
struct pipe_compute_state
diff --git a/src/gallium/state_trackers/clover/spirv/invocation.cpp b/src/gallium/state_trackers/clover/spirv/invocation.cpp
index fa5b4dba606..86916117b48 100644
--- a/src/gallium/state_trackers/clover/spirv/invocation.cpp
+++ b/src/gallium/state_trackers/clover/spirv/invocation.cpp
@@ -625,8 +625,7 @@ clover::spirv::link_program(const std::vector<module> &modules,
sec.type == module::section::text_library;
}, mod.secs);
- const auto c_il = msec.data.data() +
- sizeof(struct pipe_llvm_program_header);
+ const auto c_il = ((struct pipe_llvm_program_header*)msec.data.data())->blob;
const auto length = msec.size;
sections.push_back(reinterpret_cast<const uint32_t *>(c_il));