[Mesa-dev] Incorrect assertion in ir_assignment?

Iago Toral itoral at igalia.com
Thu Feb 12 06:19:20 PST 2015


Hi,

is this assertion in ir_assignment::ir_assignment() src/glsl/ir.cpp
correct?

assert(lhs_components == this->rhs->type->vector_elements);

We will hit this any time we emit code such as this:

assign(var1, expr, WRITEMASK_XY)

where expr and var1 are vec3. At least if we emit that code from
lowering passes inside the driver. There is an example of this situation
in the i965 code (see brw_lower_texture_gradients.cpp).

It feels like that assertion makes it so that the writemask parameter is
useless, since we always have to write all the elements available in the
rhs... I was tempted to rewrite that assertion as:

assert(lhs_components <= this->rhs->type->vector_elements);

or even remove it completely (just comparing the element count and not
the channels we are writing to does not seem to give us much...), but
the commit that introduced the assertion was willing to force that
behavior for some reason.

If we want to keep the assertion then we have to rewrite the code in
brw_lower_texture_gradients.cpp (that is trivial because we don't really
need to restrict the offending assignment to XY only, I already have a
patch for that), but I wonder if that is really what we want to do here.

Any thoughts?

Iago



More information about the mesa-dev mailing list