return ureg_create_shader_and_destroy(ureg, pipe);
}
+
+void *
+util_make_geometry_passthrough_shader(struct pipe_context *pipe,
+ uint num_attribs,
+ const ubyte *semantic_names,
+ const ubyte *semantic_indexes)
+{
+ static const unsigned zero[4] = {0, 0, 0, 0};
+
+ struct ureg_program *ureg;
+ struct ureg_dst dst[PIPE_MAX_SHADER_OUTPUTS];
+ struct ureg_src src[PIPE_MAX_SHADER_INPUTS];
+ struct ureg_src imm;
+
+ unsigned i;
+
+ ureg = ureg_create(TGSI_PROCESSOR_GEOMETRY);
+ if (ureg == NULL)
+ return NULL;
+
+ ureg_property(ureg, TGSI_PROPERTY_GS_INPUT_PRIM, PIPE_PRIM_POINTS);
+ ureg_property(ureg, TGSI_PROPERTY_GS_OUTPUT_PRIM, PIPE_PRIM_POINTS);
+ ureg_property(ureg, TGSI_PROPERTY_GS_MAX_OUTPUT_VERTICES, 1);
+ ureg_property(ureg, TGSI_PROPERTY_GS_INVOCATIONS, 1);
+ imm = ureg_DECL_immediate_uint(ureg, zero, 4);
+
+ /**
+ * Loop over all the attribs and declare the corresponding
+ * declarations in the geometry shader
+ */
+ for (i = 0; i < num_attribs; i++) {
+ src[i] = ureg_DECL_input(ureg, semantic_names[i],
+ semantic_indexes[i], 0, 1);
+ src[i] = ureg_src_dimension(src[i], 0);
+ dst[i] = ureg_DECL_output(ureg, semantic_names[i], semantic_indexes[i]);
+ }
+
+ /* MOV dst[i] src[i] */
+ for (i = 0; i < num_attribs; i++) {
+ ureg_MOV(ureg, dst[i], src[i]);
+ }
+
+ /* EMIT IMM[0] */
+ ureg_insn(ureg, TGSI_OPCODE_EMIT, NULL, 0, &imm, 1);
+
+ /* END */
+ ureg_END(ureg);
+
+ return ureg_create_shader_and_destroy(ureg, pipe);
+}
+