2018-02-03 11:26 GMT+01:00 Erik Faye-Lund <kusmab...@gmail.com>: > > > On Feb 1, 2018 04:35, "Dave Airlie" <airl...@gmail.com> wrote: > > From: Dave Airlie <airl...@redhat.com> > > In order to deal with conversions properly we need to extract > non-64bit sources from vectors instead of expanding them as > the 64-bit code does. > > We need non-64bit sources for the 32->64 conversion functions. > > Signed-off-by: Dave Airlie <airl...@redhat.com> > --- > src/compiler/glsl/lower_64bit.cpp | 38 ++++++++++++++++++++++++++++++ > ++++---- > 1 file changed, 34 insertions(+), 4 deletions(-) > > diff --git a/src/compiler/glsl/lower_64bit.cpp > b/src/compiler/glsl/lower_64bit.cpp > index ac62d1db1e..c7c6d1cb31 100644 > --- a/src/compiler/glsl/lower_64bit.cpp > +++ b/src/compiler/glsl/lower_64bit.cpp > @@ -52,6 +52,7 @@ using namespace ir_builder; > > namespace lower_64bit { > void expand_source(ir_factory &, ir_rvalue *val, ir_variable > **expanded_src); > +void extract_source(ir_factory &, ir_rvalue *val, ir_variable > **extracted_src); > > ir_dereference_variable *compact_destination(ir_factory &, > const glsl_type *type, > @@ -226,6 +227,25 @@ lower_64bit::expand_source(ir_factory &body, > expanded_src[i] = expanded_src[0]; > } > > +void > +lower_64bit::extract_source(ir_factory &body, > + ir_rvalue *val, > + ir_variable **extracted_src) > +{ > + ir_variable *const temp = body.make_temp(val->type, "tmp"); > + > + body.emit(assign(temp, val)); > + unsigned i; > + for (i = 0; i < val->type->vector_elements; i++) { > + extracted_src[i] = body.make_temp(val->type->get_scalar_type(), > "extracted_source"); > + > + body.emit(assign(extracted_src[i], swizzle(temp, i, 1))); > + } > + > + for (/* empty */; i < 4; i++) > + extracted_src[i] = extracted_src[0]; > +} > + > /** > * Convert a series of uvec2 results into a single 64-bit integer vector > */ > @@ -262,14 +282,24 @@ lower_64bit::lower_op_to_function_call(ir_instruction > *base_ir, > void *const mem_ctx = ralloc_parent(ir); > exec_list instructions; > unsigned source_components = 0; > - const glsl_type *const result_type = > - ir->type->base_type == GLSL_TYPE_UINT64 > - ? glsl_type::uvec2_type : glsl_type::ivec2_type; > + const glsl_type *result_type; > + > + if (ir->type->is_64bit()) { > + if (ir->type->base_type == GLSL_TYPE_UINT64 || > + ir->type->base_type == GLSL_TYPE_DOUBLE) > + result_type = glsl_type::uvec2_type; > + else > + result_type = glsl_type::ivec2_type; > + } else > + result_type = ir->type->get_scalar_type(); > > ir_factory body(&instructions, mem_ctx); > > for (unsigned i = 0; i < num_operands; i++) { > - expand_source(body, ir->operands[i], src[i]); > + if (ir->operands[i]->type->is_64bit()) > + expand_source(body, ir->operands[i], src[i]); > + else > + extract_source(body, ir->operands[i], src[i]); > > > This change looks like a nop to me. Was the different sides of the else > supposed to do different things? >
Hi, just passing by. Though they look very similarly, one is ex-pand-_source and the other is ex-tract-_source. Regards, Gustaw Smolarczyk
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev