* false) elements needed to pack a type.
*/
static int
-type_size_xvec4(const struct glsl_type *type, bool as_vec4)
+type_size_xvec4(const struct glsl_type *type, bool as_vec4, bool bindless)
{
unsigned int i;
int size;
}
case GLSL_TYPE_ARRAY:
assert(type->length > 0);
- return type_size_xvec4(type->fields.array, as_vec4) * type->length;
+ return type_size_xvec4(type->fields.array, as_vec4, bindless) *
+ type->length;
case GLSL_TYPE_STRUCT:
+ case GLSL_TYPE_INTERFACE:
size = 0;
for (i = 0; i < type->length; i++) {
- size += type_size_xvec4(type->fields.structure[i].type, as_vec4);
+ size += type_size_xvec4(type->fields.structure[i].type, as_vec4,
+ bindless);
}
return size;
case GLSL_TYPE_SUBROUTINE:
/* Samplers take up no register space, since they're baked in at
* link time.
*/
- return 0;
+ return bindless ? 1 : 0;
case GLSL_TYPE_ATOMIC_UINT:
return 0;
case GLSL_TYPE_IMAGE:
- return DIV_ROUND_UP(BRW_IMAGE_PARAM_SIZE, 4);
+ return bindless ? 1 : DIV_ROUND_UP(BRW_IMAGE_PARAM_SIZE, 4);
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
- case GLSL_TYPE_INTERFACE:
case GLSL_TYPE_FUNCTION:
unreachable("not reached");
}
* store a particular type.
*/
extern "C" int
-type_size_vec4(const struct glsl_type *type)
+type_size_vec4(const struct glsl_type *type, bool bindless)
{
- return type_size_xvec4(type, true);
+ return type_size_xvec4(type, true, bindless);
}
/**
* type fits in one or two vec4 slots.
*/
extern "C" int
-type_size_dvec4(const struct glsl_type *type)
+type_size_dvec4(const struct glsl_type *type, bool bindless)
{
- return type_size_xvec4(type, false);
+ return type_size_xvec4(type, false, bindless);
}
src_reg::src_reg(class vec4_visitor *v, const struct glsl_type *type)
init();
this->file = VGRF;
- this->nr = v->alloc.allocate(type_size_vec4(type));
+ this->nr = v->alloc.allocate(type_size_vec4(type, false));
- if (type->is_array() || type->is_record()) {
+ if (type->is_array() || type->is_struct()) {
this->swizzle = BRW_SWIZZLE_NOOP;
} else {
this->swizzle = brw_swizzle_for_size(type->vector_elements);
init();
this->file = VGRF;
- this->nr = v->alloc.allocate(type_size_vec4(type) * size);
+ this->nr = v->alloc.allocate(type_size_vec4(type, false) * size);
this->swizzle = BRW_SWIZZLE_NOOP;
init();
this->file = VGRF;
- this->nr = v->alloc.allocate(type_size_vec4(type));
+ this->nr = v->alloc.allocate(type_size_vec4(type, false));
- if (type->is_array() || type->is_record()) {
+ if (type->is_array() || type->is_struct()) {
this->writemask = WRITEMASK_XYZW;
} else {
this->writemask = (1 << type->vector_elements) - 1;
return inst;
}
-vec4_instruction *
-vec4_visitor::emit_lrp(const dst_reg &dst,
- const src_reg &x, const src_reg &y, const src_reg &a)
-{
- if (devinfo->gen >= 6 && devinfo->gen <= 10) {
- /* Note that the instruction's argument order is reversed from GLSL
- * and the IR.
- */
- return emit(LRP(dst, fix_3src_operand(a), fix_3src_operand(y),
- fix_3src_operand(x)));
- } else {
- /* Earlier generations don't support three source operations, so we
- * need to emit x*(1-a) + y*a.
- */
- dst_reg y_times_a = dst_reg(this, glsl_type::vec4_type);
- dst_reg one_minus_a = dst_reg(this, glsl_type::vec4_type);
- dst_reg x_times_one_minus_a = dst_reg(this, glsl_type::vec4_type);
- y_times_a.writemask = dst.writemask;
- one_minus_a.writemask = dst.writemask;
- x_times_one_minus_a.writemask = dst.writemask;
-
- emit(MUL(y_times_a, y, a));
- emit(ADD(one_minus_a, negate(a), brw_imm_f(1.0f)));
- emit(MUL(x_times_one_minus_a, x, src_reg(one_minus_a)));
- return emit(ADD(dst, src_reg(x_times_one_minus_a), src_reg(y_times_a)));
- }
-}
-
/**
* Emits the instructions needed to perform a pull constant load. before_block
* and before_inst can be NULL in which case the instruction will be appended
dst_reg(this, glsl_type::uvec4_type));
inst->base_mrf = 2;
inst->src[1] = surface;
- inst->src[2] = surface;
+ inst->src[2] = brw_imm_ud(0); /* sampler */
int param_base;
src = byte_offset(src, 16);
}
- brw_mark_surface_used(&prog_data->base, index);
-
if (is_64bit) {
temp = retype(temp, BRW_REGISTER_TYPE_DF);
shuffle_64bit_data(orig_temp, src_reg(temp), false, block, inst);
this->max_grf = devinfo->gen >= 7 ? GEN7_MRF_HACK_START : BRW_MAX_GRF;
this->uniforms = 0;
+
+ this->nir_locals = NULL;
+ this->nir_ssa_values = NULL;
}