summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2016-02-06 22:19:46 +0100
committerSamuel Pitoiset <[email protected]>2016-02-13 16:01:00 +0100
commite8db4e4e0a2e168d3710f18302e4d4d6218f8005 (patch)
treea3e4a9b6939b7c607133f12cecf67dba0faa6ba6 /src
parentdfa58f0ff08c97f7f13775726c1fedda223aacc6 (diff)
st/mesa: keep track of shared memory declarations
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 741b8d8d05f..9725abe55ef 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -402,6 +402,7 @@ public:
bool native_integers;
bool have_sqrt;
bool have_fma;
+ bool use_shared_memory;
variable_storage *find_variable_storage(ir_variable *var);
@@ -4083,6 +4084,7 @@ glsl_to_tgsi_visitor::glsl_to_tgsi_visitor()
options = NULL;
have_sqrt = false;
have_fma = false;
+ use_shared_memory = false;
}
glsl_to_tgsi_visitor::~glsl_to_tgsi_visitor()
@@ -4128,6 +4130,8 @@ count_resources(glsl_to_tgsi_visitor *v, gl_program *prog)
inst->op == TGSI_OPCODE_STORE)) {
if (inst->buffer.file == PROGRAM_BUFFER)
v->buffers_used |= 1 << inst->buffer.index;
+ if (inst->buffer.file == PROGRAM_MEMORY)
+ v->use_shared_memory = true;
}
}
prog->SamplersUsed = v->samplers_used;
@@ -4911,6 +4915,7 @@ struct st_translate {
struct ureg_src samplers[PIPE_MAX_SAMPLERS];
struct ureg_src buffers[PIPE_MAX_SHADER_BUFFERS];
struct ureg_src systemValues[SYSTEM_VALUE_MAX];
+ struct ureg_src shared_memory;
struct tgsi_texture_offset tex_offsets[MAX_GLSL_TEXTURE_OFFSET];
unsigned *array_sizes;
struct array_decl *input_arrays;
@@ -5399,7 +5404,10 @@ compile_tgsi_instruction(struct st_translate *t,
for (i = num_src - 1; i >= 0; i--)
src[i + 1] = src[i];
num_src++;
- src[0] = t->buffers[inst->buffer.index];
+ if (inst->buffer.file == PROGRAM_MEMORY)
+ src[0] = t->shared_memory;
+ else
+ src[0] = t->buffers[inst->buffer.index];
if (inst->buffer.reladdr)
src[0] = ureg_src_indirect(src[0], ureg_src(t->address[2]));
assert(src[0].File != TGSI_FILE_NULL);
@@ -5408,7 +5416,11 @@ compile_tgsi_instruction(struct st_translate *t,
break;
case TGSI_OPCODE_STORE:
- dst[0] = ureg_writemask(ureg_dst(t->buffers[inst->buffer.index]), inst->dst[0].writemask);
+ if (inst->buffer.file == PROGRAM_MEMORY)
+ dst[0] = ureg_dst(t->shared_memory);
+ else
+ dst[0] = ureg_dst(t->buffers[inst->buffer.index]);
+ dst[0] = ureg_writemask(dst[0], inst->dst[0].writemask);
if (inst->buffer.reladdr)
dst[0] = ureg_dst_indirect(dst[0], ureg_src(t->address[2]));
assert(dst[0].File != TGSI_FILE_NULL);
@@ -6063,7 +6075,8 @@ st_translate_program(
}
}
-
+ if (program->use_shared_memory)
+ t->shared_memory = ureg_DECL_shared_memory(ureg);
/* Emit each instruction in turn:
*/