summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi.cpp11
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp7
-rw-r--r--src/mesa/state_tracker/st_glsl_to_tgsi_private.h1
3 files changed, 12 insertions, 7 deletions
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index dea91c7a189..a61d4ddaf14 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -2084,7 +2084,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
emit_asm(ir, TGSI_OPCODE_USHR, st_dst_reg(index_reg), offset,
st_src_reg_for_int(4));
cbuf.reladdr = ralloc(mem_ctx, st_src_reg);
- memcpy(cbuf.reladdr, &index_reg, sizeof(index_reg));
+ *cbuf.reladdr = index_reg;
}
if (const_uniform_block) {
@@ -2093,7 +2093,7 @@ glsl_to_tgsi_visitor::visit_expression(ir_expression* ir, st_src_reg *op)
} else {
/* Relative/variable constant buffer */
cbuf.reladdr2 = ralloc(mem_ctx, st_src_reg);
- memcpy(cbuf.reladdr2, &op[0], sizeof(st_src_reg));
+ *cbuf.reladdr2 = op[0];
}
cbuf.has_index2 = true;
@@ -2804,12 +2804,12 @@ glsl_to_tgsi_visitor::visit(ir_dereference_array *ir)
if (is_2D) {
src.reladdr2 = ralloc(mem_ctx, st_src_reg);
- memcpy(src.reladdr2, &index_reg, sizeof(index_reg));
+ *src.reladdr2 = index_reg;
src.index2D = 0;
src.has_index2 = true;
} else {
src.reladdr = ralloc(mem_ctx, st_src_reg);
- memcpy(src.reladdr, &index_reg, sizeof(index_reg));
+ *src.reladdr = index_reg;
}
}
@@ -4146,8 +4146,7 @@ glsl_to_tgsi_visitor::get_deref_offsets(ir_dereference *ir,
unsigned location = 0;
ir_variable *var = ir->variable_referenced();
- memset(reladdr, 0, sizeof(*reladdr));
- reladdr->file = PROGRAM_UNDEFINED;
+ reladdr->reset();
*base = 0;
*array_size = 1;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp
index dabb0362a77..fd3941b3cc3 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp
@@ -116,7 +116,7 @@ st_src_reg::st_src_reg(gl_register_file file, int index, enum glsl_base_type typ
this->is_double_vertex_input = false;
}
-st_src_reg::st_src_reg()
+void st_src_reg::reset()
{
this->type = GLSL_TYPE_ERROR;
this->file = PROGRAM_UNDEFINED;
@@ -133,6 +133,11 @@ st_src_reg::st_src_reg()
this->is_double_vertex_input = false;
}
+st_src_reg::st_src_reg()
+{
+ reset();
+}
+
st_src_reg::st_src_reg(const st_src_reg &reg)
{
*this = reg;
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi_private.h b/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
index 356d029f470..c82de951427 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi_private.h
@@ -51,6 +51,7 @@ public:
st_src_reg();
st_src_reg(const st_src_reg &reg);
void operator=(const st_src_reg &reg);
+ void reset();
explicit st_src_reg(st_dst_reg reg);