void emit_interpolation_setup_gen4();
void emit_interpolation_setup_gen6();
void compute_sample_position(fs_reg dst, fs_reg int_sample_pos);
- fs_reg rescale_texcoord(fs_reg coordinate, const glsl_type *coord_type,
+ fs_reg rescale_texcoord(fs_reg coordinate, int coord_components,
bool is_rect, uint32_t sampler, int texunit);
fs_inst *emit_texture_gen4(ir_texture_opcode op, fs_reg dst,
fs_reg coordinate, int coord_components,
fs_reg offset_value);
void emit_texture(ir_texture_opcode op,
const glsl_type *dest_type,
- fs_reg coordinate, const struct glsl_type *coord_type,
+ fs_reg coordinate, int components,
fs_reg shadow_c,
fs_reg lod, fs_reg dpdy, int grad_components,
fs_reg sample_index,
unreachable("not reached");
}
- const glsl_type *coordinate_type;
+ int coord_components;
switch (fpi->TexSrcTarget) {
case TEXTURE_1D_INDEX:
- coordinate_type = glsl_type::float_type;
+ coord_components = 1;
break;
case TEXTURE_2D_INDEX:
case TEXTURE_1D_ARRAY_INDEX:
case TEXTURE_RECT_INDEX:
case TEXTURE_EXTERNAL_INDEX:
- coordinate_type = glsl_type::vec2_type;
+ coord_components = 2;
break;
case TEXTURE_3D_INDEX:
case TEXTURE_2D_ARRAY_INDEX:
- coordinate_type = glsl_type::vec3_type;
+ coord_components = 3;
break;
case TEXTURE_CUBE_INDEX: {
- coordinate_type = glsl_type::vec3_type;
+ coord_components = 4;
fs_reg temp = fs_reg(this, glsl_type::float_type);
fs_reg cubecoord = fs_reg(this, glsl_type::vec3_type);
if (fpi->TexShadow)
shadow_c = offset(coordinate, 2);
- emit_texture(op, glsl_type::vec4_type, coordinate, coordinate_type,
+ emit_texture(op, glsl_type::vec4_type, coordinate, coord_components,
shadow_c, lod, dpdy, 0, sample_index,
reg_undef, 0, /* offset, components */
reg_undef, /* mcs */
}
fs_reg
-fs_visitor::rescale_texcoord(fs_reg coordinate, const glsl_type *coord_type,
+fs_visitor::rescale_texcoord(fs_reg coordinate, int coord_components,
bool is_rect, uint32_t sampler, int texunit)
{
fs_inst *inst = NULL;
* tracking to get the scaling factor.
*/
if (brw->gen < 6 && is_rect) {
- fs_reg dst = fs_reg(this, coord_type);
+ fs_reg dst = fs_reg(GRF, virtual_grf_alloc(coord_components));
fs_reg src = coordinate;
coordinate = dst;
}
}
- if (coord_type && needs_gl_clamp) {
- for (unsigned int i = 0; i < MIN2(coord_type->vector_elements, 3); i++) {
+ if (coord_components > 0 && needs_gl_clamp) {
+ for (int i = 0; i < MIN2(coord_components, 3); i++) {
if (tex->gl_clamp_mask[i] & (1 << sampler)) {
fs_reg chan = coordinate;
chan = offset(chan, i);
void
fs_visitor::emit_texture(ir_texture_opcode op,
const glsl_type *dest_type,
- fs_reg coordinate, const struct glsl_type *coord_type,
+ fs_reg coordinate, int coord_components,
fs_reg shadow_c,
fs_reg lod, fs_reg lod2, int grad_components,
fs_reg sample_index,
/* FINISHME: Texture coordinate rescaling doesn't work with non-constant
* samplers. This should only be a problem with GL_CLAMP on Gen7.
*/
- coordinate = rescale_texcoord(coordinate, coord_type, is_rect,
+ coordinate = rescale_texcoord(coordinate, coord_components, is_rect,
sampler, texunit);
}
*/
fs_reg dst(this, glsl_type::get_instance(dest_type->base_type, 4, 1));
- int coord_components = coord_type ? coord_type->vector_elements : 0;
-
if (brw->gen >= 7) {
inst = emit_texture_gen7(op, dst, coordinate, coord_components,
shadow_c, lod, lod2, grad_components,
* generating these values may involve SEND messages that need the MRFs.
*/
fs_reg coordinate;
- const glsl_type *coord_type = NULL;
+ int coord_components = 0;
if (ir->coordinate) {
- coord_type = ir->coordinate->type;
+ coord_components = ir->coordinate->type->vector_elements;
ir->coordinate->accept(this);
coordinate = this->result;
}
ir->sampler->type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE &&
ir->sampler->type->sampler_array;
- emit_texture(ir->op, ir->type, coordinate, coord_type, shadow_comparitor,
- lod, lod2, grad_components, sample_index, offset_value,
- offset_components, mcs, gather_component,
- is_cube_array, is_rect, sampler, sampler_reg, texunit);
+ emit_texture(ir->op, ir->type, coordinate, coord_components,
+ shadow_comparitor, lod, lod2, grad_components,
+ sample_index, offset_value, offset_components, mcs,
+ gather_component, is_cube_array, is_rect, sampler,
+ sampler_reg, texunit);
}
/**