aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c5
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp21
-rw-r--r--mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c12
3 files changed, 26 insertions, 12 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index b19dc67bf..6c287b3d4 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -1120,7 +1120,10 @@ copy_image_data_to_texture(struct st_context *st,
assert(src_level <= stImage->pt->last_level);
assert(u_minify(stImage->pt->width0, src_level) == stImage->base.Width);
- assert(u_minify(stImage->pt->height0, src_level) == stImage->base.Height);
+ assert(stImage->pt->target == PIPE_TEXTURE_1D_ARRAY ||
+ u_minify(stImage->pt->height0, src_level) == stImage->base.Height);
+ assert(stImage->pt->target == PIPE_TEXTURE_2D_ARRAY ||
+ u_minify(stImage->pt->depth0, src_level) == stImage->base.Depth);
st_texture_image_copy(st->pipe,
stObj->pt, dstLevel, /* dest texture, level */
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 705f2b055..14b72dc80 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -630,6 +630,11 @@ glsl_to_tgsi_visitor::get_opcode(ir_instruction *ir, unsigned op,
{
int type = GLSL_TYPE_FLOAT;
+ assert(src0.type != GLSL_TYPE_ARRAY);
+ assert(src0.type != GLSL_TYPE_STRUCT);
+ assert(src1.type != GLSL_TYPE_ARRAY);
+ assert(src1.type != GLSL_TYPE_STRUCT);
+
if (src0.type == GLSL_TYPE_FLOAT || src1.type == GLSL_TYPE_FLOAT)
type = GLSL_TYPE_FLOAT;
else if (native_integers)
@@ -1071,8 +1076,12 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
assert(index == storage->index + (int)i);
}
} else {
- st_src_reg src(PROGRAM_STATE_VAR, index,
- native_integers ? ir->type->base_type : GLSL_TYPE_FLOAT);
+ /* We use GLSL_TYPE_FLOAT here regardless of the actual type of
+ * the data being moved since MOV does not care about the type of
+ * data it is moving, and we don't want to declare registers with
+ * array or struct types.
+ */
+ st_src_reg src(PROGRAM_STATE_VAR, index, GLSL_TYPE_FLOAT);
src.swizzle = slots[i].swizzle;
emit(ir, TGSI_OPCODE_MOV, dst, src);
/* even a float takes up a whole vec4 reg in a struct/array. */
@@ -2039,6 +2048,9 @@ glsl_to_tgsi_visitor::visit(ir_dereference_array *ir)
else
src.swizzle = SWIZZLE_NOOP;
+ /* Change the register type to the element type of the array. */
+ src.type = ir->type->base_type;
+
this->result = src;
}
@@ -2064,6 +2076,7 @@ glsl_to_tgsi_visitor::visit(ir_dereference_record *ir)
this->result.swizzle = SWIZZLE_NOOP;
this->result.index += offset;
+ this->result.type = ir->type->base_type;
}
/**
@@ -2283,6 +2296,10 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
inst->dead_mask = inst->dst.writemask;
} else {
for (i = 0; i < type_size(ir->lhs->type); i++) {
+ if (ir->rhs->type->is_array())
+ r.type = ir->rhs->type->element_type()->base_type;
+ else if (ir->rhs->type->is_record())
+ r.type = ir->rhs->type->fields.structure[i].type->base_type;
emit(ir, TGSI_OPCODE_MOV, l, r);
l.index++;
r.index++;
diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
index a023058d0..0acab4340 100644
--- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
+++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c
@@ -118,11 +118,8 @@ static unsigned *get_label( struct st_translate *t,
unsigned i;
if (t->labels_count + 1 >= t->labels_size) {
- unsigned old_size = t->labels_size;
t->labels_size = 1 << (util_logbase2(t->labels_size) + 1);
- t->labels = REALLOC( t->labels,
- old_size * sizeof t->labels[0],
- t->labels_size * sizeof t->labels[0] );
+ t->labels = realloc(t->labels, t->labels_size * sizeof t->labels[0]);
if (t->labels == NULL) {
static unsigned dummy;
t->error = TRUE;
@@ -146,11 +143,8 @@ static void set_insn_start( struct st_translate *t,
unsigned start )
{
if (t->insn_count + 1 >= t->insn_size) {
- unsigned old_size = t->insn_size;
t->insn_size = 1 << (util_logbase2(t->insn_size) + 1);
- t->insn = REALLOC( t->insn,
- old_size * sizeof t->insn[0],
- t->insn_size * sizeof t->insn[0] );
+ t->insn = realloc(t->insn, t->insn_size * sizeof t->insn[0]);
if (t->insn == NULL) {
t->error = TRUE;
return;
@@ -1265,5 +1259,5 @@ out:
void
st_free_tokens(const struct tgsi_token *tokens)
{
- free((void *)tokens);
+ ureg_free_tokens(tokens);
}