vc4: Use a defined t value for 1D textures.
authorEric Anholt <eric@anholt.net>
Sat, 20 Jun 2015 02:47:44 +0000 (19:47 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 20 Jun 2015 07:16:32 +0000 (00:16 -0700)
This doesn't fix the broken 1D cases of texsubimage, but it does prevent
segfaulting when dumping the QIR code generated in fbo-1d.

src/gallium/drivers/vc4/vc4_program.c

index bb45eb1288ee27381bd89ee5360b4418487f1347..ba47c51d9bd28e42f94c3eef2176cb7526f11e6b 100644 (file)
@@ -325,7 +325,9 @@ ntq_emit_tex(struct vc4_compile *c, nir_tex_instr *instr)
                 switch (instr->src[i].src_type) {
                 case nir_tex_src_coord:
                         s = ntq_get_src(c, instr->src[i].src, 0);
-                        if (instr->sampler_dim != GLSL_SAMPLER_DIM_1D)
+                        if (instr->sampler_dim == GLSL_SAMPLER_DIM_1D)
+                                t = qir_uniform_f(c, 0.5);
+                        else
                                 t = ntq_get_src(c, instr->src[i].src, 1);
                         if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE)
                                 r = ntq_get_src(c, instr->src[i].src, 2);