gallium: add compute shader IR type
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 17 Mar 2016 13:15:39 +0000 (14:15 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fri, 1 Apr 2016 23:49:57 +0000 (01:49 +0200)
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/trace/tr_dump_state.c
src/gallium/include/pipe/p_state.h
src/gallium/state_trackers/clover/core/kernel.cpp
src/gallium/tests/trivial/compute.c
src/mesa/state_tracker/st_program.c

index 0627e5ab5d7555c7cd8a9a3cbc101f8416e70404..b53d7dbec2f52d95a4a672b61b66e43b6d922a8d 100644 (file)
@@ -317,8 +317,10 @@ void trace_dump_compute_state(const struct pipe_compute_state *state)
 
    trace_dump_struct_begin("pipe_compute_state");
 
+   trace_dump_member(uint, state, ir_type);
+
    trace_dump_member_begin("prog");
-   if (state->prog) {
+   if (state->prog && state->ir_type == PIPE_SHADER_IR_TGSI) {
       static char str[64 * 1024];
       tgsi_dump_str(state->prog, 0, str, sizeof(str));
       trace_dump_string(str);
index 2e720ce25f3505c9ad6418d077e91cf5a4feec60..5ab53728e82c3b1b24b41dca22e47577ae59cc8d 100644 (file)
@@ -727,6 +727,7 @@ struct pipe_llvm_program_header
 
 struct pipe_compute_state
 {
+   enum pipe_shader_ir ir_type; /**< IR type contained in prog. */
    const void *prog; /**< Compute program to be executed. */
    unsigned req_local_mem; /**< Required size of the LOCAL resource. */
    unsigned req_private_mem; /**< Required size of the PRIVATE resource. */
index c12755b0420a8bf47d4e146b857374acfb1c34e6..bce3b525b139efdb8723ad805d2bb28bad710cce 100644 (file)
@@ -223,6 +223,7 @@ kernel::exec_context::bind(intrusive_ptr<command_queue> _q,
       if (st)
          _q->pipe->delete_compute_state(_q->pipe, st);
 
+      cs.ir_type = q->device().ir_format();
       cs.prog = &(msec.data[0]);
       cs.req_local_mem = mem_local;
       cs.req_input_mem = input.size();
index 5d5e0b0b8c3dfd361c47f4fa5e09bc3c2f3026b8..2ddfc42e9cd17efd73fe26eb33bf085a3a96eb0d 100644 (file)
@@ -144,6 +144,7 @@ static void init_prog(struct context *ctx, unsigned local_sz,
         struct pipe_context *pipe = ctx->pipe;
         struct tgsi_token prog[1024];
         struct pipe_compute_state cs = {
+                .ir_type = PIPE_SHADER_IR_TGSI,
                 .prog = prog,
                 .req_local_mem = local_sz,
                 .req_private_mem = private_sz,
index 94dc48971ec181e62e434d59dd5ae31b4e09e66b..d2d68ac05bfb7f63684fa3d1b76277a8dea84c6d 100644 (file)
@@ -1463,6 +1463,7 @@ st_translate_compute_program(struct st_context *st,
    st_translate_program_common(st, &stcp->Base.Base, stcp->glsl_to_tgsi, ureg,
                                TGSI_PROCESSOR_COMPUTE, &prog);
 
+   stcp->tgsi.ir_type = PIPE_SHADER_IR_TGSI;
    stcp->tgsi.prog = prog.tokens;
    stcp->tgsi.req_local_mem = stcp->Base.SharedSize;
    stcp->tgsi.req_private_mem = 0;