tgsi: Add ureg_property_gs_input_prim().
authorMichal Krol <michal@vmware.com>
Fri, 15 Jan 2010 13:05:04 +0000 (14:05 +0100)
committerMichal Krol <michal@vmware.com>
Fri, 15 Jan 2010 18:00:06 +0000 (19:00 +0100)
src/gallium/auxiliary/tgsi/tgsi_ureg.c
src/gallium/auxiliary/tgsi/tgsi_ureg.h

index ae67c322bbedc7746545e9a44456d0ac0147de4f..8bd6f68dcc088b93c258ccf82f40f0a0a96eb9fa 100644 (file)
@@ -40,6 +40,8 @@ union tgsi_any_token {
    struct tgsi_header header;
    struct tgsi_processor processor;
    struct tgsi_token token;
+   struct tgsi_property prop;
+   struct tgsi_property_data prop_data;
    struct tgsi_declaration decl;
    struct tgsi_declaration_range decl_range;
    struct tgsi_declaration_semantic decl_semantic;
@@ -131,6 +133,8 @@ struct ureg_program
    } constant_range[UREG_MAX_CONSTANT_RANGE];
    unsigned nr_constant_ranges;
 
+   unsigned property_gs_input_prim;
+
    unsigned nr_addrs;
    unsigned nr_preds;
    unsigned nr_loops;
@@ -256,6 +260,14 @@ ureg_src_register( unsigned file,
 
 
 
+void
+ureg_property_gs_input_prim(struct ureg_program *ureg,
+                            unsigned gs_input_prim)
+{
+   ureg->property_gs_input_prim = gs_input_prim;
+}
+
+
 
 struct ureg_src 
 ureg_DECL_fs_input( struct ureg_program *ureg,
@@ -1064,13 +1076,34 @@ emit_immediate( struct ureg_program *ureg,
    out[4].imm_data.Uint = v[3];
 }
 
+static void
+emit_property(struct ureg_program *ureg,
+              unsigned name,
+              unsigned data)
+{
+   union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 2);
+
+   out[0].value = 0;
+   out[0].prop.Type = TGSI_TOKEN_TYPE_PROPERTY;
+   out[0].prop.NrTokens = 2;
+   out[0].prop.PropertyName = name;
 
+   out[1].prop_data.Data = data;
+}
 
 
 static void emit_decls( struct ureg_program *ureg )
 {
    unsigned i;
 
+   if (ureg->property_gs_input_prim != ~0) {
+      assert(ureg->processor == TGSI_PROCESSOR_GEOMETRY);
+
+      emit_property(ureg,
+                    TGSI_PROPERTY_GS_INPUT_PRIM,
+                    ureg->property_gs_input_prim);
+   }
+
    if (ureg->processor == TGSI_PROCESSOR_VERTEX) {
       for (i = 0; i < UREG_MAX_INPUT; i++) {
          if (ureg->vs_inputs[i/32] & (1 << (i%32))) {
@@ -1280,6 +1313,7 @@ struct ureg_program *ureg_create( unsigned processor )
       return NULL;
 
    ureg->processor = processor;
+   ureg->property_gs_input_prim = ~0;
    return ureg;
 }
 
index e9e901d6ec34f40ee940dd06cbeb8b0403ec3d8b..03eaf24854c331ebb7eaacadddbf011bdc0c6b52 100644 (file)
@@ -119,6 +119,14 @@ ureg_create_shader_and_destroy( struct ureg_program *p,
 }
 
 
+/***********************************************************************
+ * Build shader properties:
+ */
+
+void
+ureg_property_gs_input_prim(struct ureg_program *ureg,
+                            unsigned gs_input_prim);
+
 
 /***********************************************************************
  * Build shader declarations: