gallium glsl: Fix crash with piglit fs-deref-literal-array-of-structs.shader_test
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>
Thu, 17 Apr 2014 08:34:10 +0000 (10:34 +0200)
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>
Thu, 17 Apr 2014 08:34:10 +0000 (10:34 +0200)
This allows the following shader code to work without a weird crash:

struct Foo {
  int value[1];
};

int actual_value = Foo[2](Foo(int[1](100)), Foo(int[1](200)))[i].value[0];

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index edd0aa7658db6657be600d1d634376f8dbc99f85..15b5279b8f5f13cee5c1d3d2fb2f4ec10474f0b1 100644 (file)
@@ -632,7 +632,10 @@ glsl_to_tgsi_visitor::get_opcode(ir_instruction *ir, unsigned op,
                         st_src_reg src0, st_src_reg src1)
 {
    int type = GLSL_TYPE_FLOAT;
-   
+
+   if (op == TGSI_OPCODE_MOV)
+       return op;
+
    assert(src0.type != GLSL_TYPE_ARRAY);
    assert(src0.type != GLSL_TYPE_STRUCT);
    assert(src1.type != GLSL_TYPE_ARRAY);