[Mesa-dev] [PATCH v2 12/11] i965: Add scalar geometry shader support.

Kenneth Graunke kenneth at whitecape.org
Thu Oct 15 16:03:06 PDT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20151015/82f527f3/attachment.sig>


More information about the mesa-dev mailing list