On Monday, October 12, 2015 02:55:32 PM Kenneth Graunke wrote: > +void > +fs_visitor::emit_gs_input_load(const fs_reg &dst, > + const nir_src &vertex_src, > + unsigned input_offset, > + unsigned num_components) > +{ > + const brw_vue_prog_data *vue_prog_data = (const brw_vue_prog_data *) > prog_data; > + const unsigned vertex = nir_src_as_const_value(vertex_src)->u[0]; > + > + const unsigned array_stride = vue_prog_data->urb_read_length * 8; > + > + const bool pushed = 4 * input_offset < array_stride; > + > + if (input_offset == 0) { > + /* This is the VUE header, containing VARYING_SLOT_LAYER [.y], > + * VARYING_SLOT_VIEWPORT [.z], and VARYING_SLOT_PSIZ [.w]. > + * Only gl_PointSize is available as a GS input, so they must > + * be asking for that input. > + */ > + if (pushed) { > + bld.MOV(dst, fs_reg(ATTR, array_stride * vertex + 3, dst.type)); > + } else { > + fs_reg tmp = bld.vgrf(dst.type, 4); > + fs_inst *inst = bld.emit(SHADER_OPCODE_URB_READ_SIMD8, tmp, > + fs_reg(vertex), fs_reg(0)); > + inst->regs_written = 4; > + bld.MOV(dst, offset(tmp, bld, 3)); > + } > + } else { > + if (pushed) { > + int index = vertex * array_stride + 4 * input_offset; > + for (unsigned i = 0; i < num_components; i++) { > + bld.MOV(offset(dst, bld, i), fs_reg(ATTR, index + i, dst.type)); > + } > + } else { > + fs_inst *inst = bld.emit(SHADER_OPCODE_URB_READ_SIMD8, dst, > + fs_reg(vertex), fs_reg(input_offset)); > + inst->regs_written = num_components; > + } > + } > +} > +
Kristian pointed out that for instanced geometry shaders, the input VUE handles are packed into a single register, rather than in 6 separate registers. So, this will probably not work out for ARB_gpu_shader5 GS instancing. I don't remember failing any Piglit tests in that area, but I should make sure this works. It doesn't necessarily need to block this landing, as this support is still hidden behind an environment variable and most of it is still good. --Ken
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev