tgsi: add info fields for fragcoord origin, center, etc

This commit is contained in:
Brian Paul 2011-07-21 09:55:22 -06:00
parent 9c1319d31d
commit 2253906da3
2 changed files with 31 additions and 10 deletions

View File

@ -200,19 +200,20 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
info->file_max[file] = MAX2(info->file_max[file], (int)reg); info->file_max[file] = MAX2(info->file_max[file], (int)reg);
} }
break; break;
case TGSI_TOKEN_TYPE_PROPERTY: case TGSI_TOKEN_TYPE_PROPERTY:
{ {
const struct tgsi_full_property *fullprop const struct tgsi_full_property *fullprop
= &parse.FullToken.FullProperty; = &parse.FullToken.FullProperty;
info->properties[info->num_properties].name = info->properties[info->num_properties].name =
fullprop->Property.PropertyName; fullprop->Property.PropertyName;
memcpy(info->properties[info->num_properties].data, memcpy(info->properties[info->num_properties].data,
fullprop->u, 8 * sizeof(unsigned));; fullprop->u, 8 * sizeof(unsigned));;
++info->num_properties; ++info->num_properties;
} }
break; break;
default: default:
assert( 0 ); assert( 0 );
@ -222,6 +223,23 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
info->uses_kill = (info->opcode_count[TGSI_OPCODE_KIL] || info->uses_kill = (info->opcode_count[TGSI_OPCODE_KIL] ||
info->opcode_count[TGSI_OPCODE_KILP]); info->opcode_count[TGSI_OPCODE_KILP]);
/* extract simple properties */
for (i = 0; i < info->num_properties; ++i) {
switch (info->properties[i].name) {
case TGSI_PROPERTY_FS_COORD_ORIGIN:
info->origin_lower_left = info->properties[i].data[0];
break;
case TGSI_PROPERTY_FS_COORD_PIXEL_CENTER:
info->pixel_center_integer = info->properties[i].data[0];
break;
case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS:
info->color0_writes_all_cbufs = info->properties[i].data[0];
break;
default:
;
}
}
tgsi_parse_free (&parse); tgsi_parse_free (&parse);
} }

View File

@ -68,6 +68,9 @@ struct tgsi_shader_info
boolean writes_edgeflag; /**< vertex shader outputs edgeflag */ boolean writes_edgeflag; /**< vertex shader outputs edgeflag */
boolean uses_kill; /**< KIL or KILP instruction used? */ boolean uses_kill; /**< KIL or KILP instruction used? */
boolean uses_instanceid; boolean uses_instanceid;
boolean origin_lower_left;
boolean pixel_center_integer;
boolean color0_writes_all_cbufs;
/** /**
* Bitmask indicating which register files are accessed with * Bitmask indicating which register files are accessed with