diff options
author | Marek Olšák <[email protected]> | 2017-09-29 02:38:53 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-10-06 02:56:11 +0200 |
commit | 8602c6a32666c1cb1b4f20d2d6efa5a925726d39 (patch) | |
tree | 0e8ec06be705d867436d5f294cb7bf012f1f4cf9 /src/mesa | |
parent | 985338e2cb63156fc7abfc605716a0354db50c5c (diff) |
glsl_to_tgsi: each reladdr object should have only one parent
required by rename_temp_registers.
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp | 66 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi_private.h | 4 |
2 files changed, 65 insertions, 5 deletions
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 0075ae86766..b664fa7ec3f 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi_private.cpp @@ -44,6 +44,22 @@ static int swizzle_for_type(const glsl_type *type, int component = 0) return swizzle; } +static st_src_reg * +dup_reladdr(const st_src_reg *input) +{ + if (!input) + return NULL; + + st_src_reg *reg = ralloc(input, st_src_reg); + if (!reg) { + assert(!"can't create reladdr, expect shader breakage"); + return NULL; + } + + *reg = *input; + return reg; +} + st_src_reg::st_src_reg(gl_register_file file, int index, const glsl_type *type, int component, unsigned array_id) { @@ -116,6 +132,28 @@ st_src_reg::st_src_reg() this->is_double_vertex_input = false; } +st_src_reg::st_src_reg(const st_src_reg ®) +{ + *this = reg; +} + +void st_src_reg::operator=(const st_src_reg ®) +{ + this->type = reg.type; + this->file = reg.file; + this->index = reg.index; + this->index2D = reg.index2D; + this->swizzle = reg.swizzle; + this->negate = reg.negate; + this->abs = reg.abs; + this->reladdr = dup_reladdr(reg.reladdr); + this->reladdr2 = dup_reladdr(reg.reladdr2); + this->has_index2 = reg.has_index2; + this->double_reg2 = reg.double_reg2; + this->array_id = reg.array_id; + this->is_double_vertex_input = reg.is_double_vertex_input; +} + st_src_reg::st_src_reg(st_dst_reg reg) { this->type = reg.type; @@ -124,9 +162,9 @@ st_src_reg::st_src_reg(st_dst_reg reg) this->swizzle = SWIZZLE_XYZW; this->negate = 0; this->abs = 0; - this->reladdr = reg.reladdr; + this->reladdr = dup_reladdr(reg.reladdr); this->index2D = reg.index2D; - this->reladdr2 = reg.reladdr2; + this->reladdr2 = dup_reladdr(reg.reladdr2); this->has_index2 = reg.has_index2; this->double_reg2 = false; this->array_id = reg.array_id; @@ -147,9 +185,9 @@ st_dst_reg::st_dst_reg(st_src_reg reg) this->file = reg.file; this->index = reg.index; this->writemask = WRITEMASK_XYZW; - this->reladdr = reg.reladdr; + this->reladdr = dup_reladdr(reg.reladdr); this->index2D = reg.index2D; - this->reladdr2 = reg.reladdr2; + this->reladdr2 = dup_reladdr(reg.reladdr2); this->has_index2 = reg.has_index2; this->array_id = reg.array_id; } @@ -193,4 +231,22 @@ st_dst_reg::st_dst_reg() this->reladdr2 = NULL; this->has_index2 = false; this->array_id = 0; -}
\ No newline at end of file +} + +st_dst_reg::st_dst_reg(const st_dst_reg ®) +{ + *this = reg; +} + +void st_dst_reg::operator=(const st_dst_reg ®) +{ + this->type = reg.type; + this->file = reg.file; + this->index = reg.index; + this->writemask = reg.writemask; + this->reladdr = dup_reladdr(reg.reladdr); + this->index2D = reg.index2D; + this->reladdr2 = dup_reladdr(reg.reladdr2); + this->has_index2 = reg.has_index2; + this->array_id = reg.array_id; +} 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 c92d96cf6c3..b9112e5e030 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi_private.h +++ b/src/mesa/state_tracker/st_glsl_to_tgsi_private.h @@ -47,6 +47,8 @@ public: st_src_reg(gl_register_file file, int index, enum glsl_base_type type, int index2D); st_src_reg(); + st_src_reg(const st_src_reg ®); + void operator=(const st_src_reg ®); explicit st_src_reg(st_dst_reg reg); @@ -81,6 +83,8 @@ public: st_dst_reg(gl_register_file file, int writemask, enum glsl_base_type type); st_dst_reg(); + st_dst_reg(const st_dst_reg ®); + void operator=(const st_dst_reg ®); explicit st_dst_reg(st_src_reg reg); |