summaryrefslogtreecommitdiff
path: root/builtins/tools/generate_builtins.pl
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2010-06-04 15:02:49 -0700
committerKenneth Graunke <kenneth@whitecape.org>2010-06-09 11:14:58 -0700
commit9aefbe838c34aea75ecae0c42f56f8e8fe56d47f (patch)
treeb683691a55060c5e4422c3746d34531da848d8fb /builtins/tools/generate_builtins.pl
parent9d1fc46f0cdf63677aac05f987cdd5b18453da2f (diff)
generate_builtins.pl: Support directiories for each extension.
Diffstat (limited to 'builtins/tools/generate_builtins.pl')
-rwxr-xr-xbuiltins/tools/generate_builtins.pl25
1 files changed, 14 insertions, 11 deletions
diff --git a/builtins/tools/generate_builtins.pl b/builtins/tools/generate_builtins.pl
index 71c0a4d8c0..8fdef2d974 100755
--- a/builtins/tools/generate_builtins.pl
+++ b/builtins/tools/generate_builtins.pl
@@ -1,10 +1,9 @@
#!/usr/bin/env perl
-
sub process_version {
my ($version) = @_;
my @vars;
- print "/* Version $version builtins */\n\n";
+ print "/* $version builtins */\n\n";
my @files = <builtins/$version/*>;
foreach $file (@files) {
@@ -85,7 +84,7 @@ read_builtins(_mesa_glsl_parse_state *st, exec_list *instructions,
EOF
-@versions = sort(<builtins/[1-9][0-9][0-9]*>);
+@versions = sort(<builtins/[1-9A-Z]*>);
foreach $version (@versions) {
$version =~ s!builtins/!!g;
process_version($version);
@@ -99,16 +98,20 @@ _mesa_glsl_initialize_functions(exec_list *instructions,
EOF
foreach $version (@versions) {
- $version_number = $version;
- if ($version =~ m/_vs/) {
- $version_check = " && state->target == vertex_shader";
- } elsif ($version =~ m/_fs/) {
- $version_check = " && state->target == fragment_shader";
+ if ($version =~ /^[1-9][0-9][0-9]/) {
+ $version_number = $version;
+ $version_number =~ s/_[vf]s//g;
+ $check = "state->language_version >= $version_number";
+ if ($version =~ /_vs/) {
+ $check = "$check && state->target == vertex_shader";
+ } elsif ($version =~ /_fs/) {
+ $check = "$check && state->target == fragment_shader";
+ }
} else {
- $version_check = "";
+ # Not a version...an extension name
+ $check = "state->${version}_enable";
}
- $version_number =~ s/_[vf]s//;
- print " if (state->language_version >= $version_number$version_check)\n";
+ print " if ($check)\n";
print " read_builtins(state, instructions, functions_for_$version,\n";
print " sizeof(functions_for_$version) / ";
print "sizeof(const char *));\n\n"