i965: relax brw_texture_offset assert
authorChris Forbes <chrisf@ijw.co.nz>
Tue, 8 Oct 2013 09:09:28 +0000 (22:09 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Sat, 26 Oct 2013 08:54:15 +0000 (21:54 +1300)
Some texturing ops are about to have nonconstant offset support; the
offset in the header in these cases should be zero.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp
src/mesa/drivers/dri/i965/brw_shader.h
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 9f37013bddf587b3d930b7ce93ddcb24c6077d95..7dabc4767dc67664031d1ccbd44ead3f2bbce835 100644 (file)
@@ -1596,7 +1596,7 @@ fs_visitor::visit(ir_texture *ir)
    }
 
    if (ir->offset != NULL && ir->op != ir_txf)
-      inst->texture_offset = brw_texture_offset(ir->offset->as_constant());
+      inst->texture_offset = brw_texture_offset(ctx, ir->offset->as_constant());
 
    if (ir->op == ir_tg4)
       inst->texture_offset |= gather_channel(ir, sampler) << 16; // M0.2:16-17
index 2fb43a6b4e65b50c7ea64d764662d592f12c36cc..df905fbc906975011bc9539b310b5c0a08a9611d 100644 (file)
@@ -372,9 +372,14 @@ brw_math_function(enum opcode op)
 }
 
 uint32_t
-brw_texture_offset(ir_constant *offset)
+brw_texture_offset(struct gl_context *ctx, ir_constant *offset)
 {
-   assert(offset != NULL);
+   /* If the driver does not support GL_ARB_gpu_shader5, the offset
+    * must be constant.
+    */
+   assert(offset != NULL || ctx->Extensions.ARB_gpu_shader5);
+
+   if (!offset) return 0;  /* nonconstant offset; caller will handle it. */
 
    signed char offsets[3];
    for (unsigned i = 0; i < offset->type->vector_elements; i++)
index 7cebf1ffdd1a61d5c7bc33f1c7b675e6c2de36b7..cc76a44493b8a8af223bffcc2bfbde03b7a8680b 100644 (file)
@@ -77,7 +77,7 @@ public:
    void assign_common_binding_table_offsets(uint32_t next_binding_table_offset);
 };
 
-uint32_t brw_texture_offset(ir_constant *offset);
+uint32_t brw_texture_offset(struct gl_context *ctx, ir_constant *offset);
 
 #endif /* __cplusplus */
 
index c163c943680c9325fb664642e8094a058cbecbf3..68d6cd9253201b2e0529d869dbb8ff236fdce833 100644 (file)
@@ -2286,7 +2286,7 @@ vec4_visitor::visit(ir_texture *ir)
    inst->shadow_compare = ir->shadow_comparitor != NULL;
 
    if (use_texture_offset)
-      inst->texture_offset = brw_texture_offset(ir->offset->as_constant());
+      inst->texture_offset = brw_texture_offset(ctx, ir->offset->as_constant());
 
    /* Stuff the channel select bits in the top of the texture offset */
    if (ir->op == ir_tg4)