i965/vs: Use the proper dimensionality for the sampler result register.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 2 Jan 2012 23:51:58 +0000 (15:51 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 4 Jan 2012 23:07:40 +0000 (15:07 -0800)
textureSize() returns an int, ivec2, or ivec3, but never an ivec4.
Creating the destination register as an ivec4 triggered later failures,
even though the register did hold the proper values.

For example, piglit test vs-textureSize-compare calls textureSize on a
2D texture and compares the result to an expected value.  Unfortunately,
our generated code also tried to compare the third and fourth components
which were undefined, and failed.

Fixes piglit test vs-textureSize-compare as well as 19 subcases of
oglconform's glsl-bif-tex-size test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=44339
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 52e63f86b54428826a7173583ac46c20b2efbf7c..20da487399f74e84bc439f5d77dce18f749b45d9 100644 (file)
@@ -1786,7 +1786,7 @@ vec4_visitor::visit(ir_texture *ir)
    inst->base_mrf = 2;
    inst->mlen = inst->header_present + 1; /* always at least one */
    inst->sampler = sampler;
-   inst->dst = dst_reg(this, glsl_type::get_instance(ir->type->base_type,4,1));
+   inst->dst = dst_reg(this, ir->type);
    inst->shadow_compare = ir->shadow_comparitor != NULL;
 
    if (ir->offset != NULL)