bool
brw_shader_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
{
- if (!brw_fs_precompile(ctx, prog))
+ struct brw_context *brw = brw_context(ctx);
+
+ if (brw->precompile && !brw_fs_precompile(ctx, prog))
return false;
if (!brw_vs_precompile(ctx, prog))
struct intel_context *intel = &brw->intel;
unsigned int stage;
+ if (!_mesa_ir_link_shader(ctx, prog))
+ return false;
+
for (stage = 0; stage < ARRAY_SIZE(prog->_LinkedShaders); stage++) {
struct brw_shader *shader =
(struct brw_shader *)prog->_LinkedShaders[stage];
false /* loops */
) || progress;
- progress = do_common_optimization(shader->ir, true, 32) || progress;
+ progress = do_common_optimization(shader->ir, true, true, 32)
+ || progress;
} while (progress);
validate_ir_tree(shader->ir);
ralloc_free(mem_ctx);
}
- if (!_mesa_ir_link_shader(ctx, prog))
- return GL_FALSE;
-
if (!brw_shader_precompile(ctx, prog))
- return GL_FALSE;
+ return false;
- return GL_TRUE;
+ return true;
}
case GLSL_TYPE_UINT:
return BRW_REGISTER_TYPE_UD;
case GLSL_TYPE_ARRAY:
+ return brw_type_for_base_type(type->fields.array);
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_SAMPLER:
/* These should be overridden with the type of the member when
return 0;
}
}
+
+uint32_t
+brw_texture_offset(ir_constant *offset)
+{
+ assert(offset != NULL);
+
+ signed char offsets[3];
+ for (unsigned i = 0; i < offset->type->vector_elements; i++)
+ offsets[i] = (signed char) offset->value.i[i];
+
+ /* Combine all three offsets into a single unsigned dword:
+ *
+ * bits 11:8 - U Offset (X component)
+ * bits 7:4 - V Offset (Y component)
+ * bits 3:0 - R Offset (Z component)
+ */
+ unsigned offset_bits = 0;
+ for (unsigned i = 0; i < offset->type->vector_elements; i++) {
+ const unsigned shift = 4 * (2 - i);
+ offset_bits |= (offsets[i] << shift) & (0xF << shift);
+ }
+ return offset_bits;
+}