[Mesa-dev] [PATCH] i965/vs: Use the proper dimensionality for the sampler result register.

Kenneth Graunke kenneth at whitecape.org
Wed Jan 4 04:07:24 PST 2012


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 at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

I was originally seeing a few oglconform regressions from this patch, but
it appears that those tests give completely random results.  At any rate,
this patch does reliably fix a lot of tests, so I'm inclined to apply it.

diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 52e63f8..20da487 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -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)
-- 
1.7.8.1



More information about the mesa-dev mailing list