From cc249f79e7df5fa45b119e57cdc9a4887add712b Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 8 Jun 2010 16:01:41 -0700 Subject: [PATCH] generate_builtins.pl: Support stage-specific builtins even for extensions. --- builtins/tools/generate_builtins.pl | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/builtins/tools/generate_builtins.pl b/builtins/tools/generate_builtins.pl index 8fdef2d9743..8b640ab8ff9 100755 --- a/builtins/tools/generate_builtins.pl +++ b/builtins/tools/generate_builtins.pl @@ -97,23 +97,26 @@ _mesa_glsl_initialize_functions(exec_list *instructions, { EOF -foreach $version (@versions) { +foreach $version_xs (@versions) { + $check = ""; + if ($version_xs =~ /_vs/) { + $check = "state->target == vertex_shader && "; + } elsif ($version_xs =~ /_fs/) { + $check = "state->target == fragment_shader && "; + } + $version = $version_xs; + $version =~ s/_[vf]s//g; + 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"; - } + $check = "${check}state->language_version >= $version"; } else { # Not a version...an extension name - $check = "state->${version}_enable"; + $check = "${check}state->${version}_enable"; } print " if ($check)\n"; - print " read_builtins(state, instructions, functions_for_$version,\n"; - print " sizeof(functions_for_$version) / "; + print " read_builtins(state, instructions,\n"; + print " functions_for_$version_xs,\n"; + print " sizeof(functions_for_$version_xs) / "; print "sizeof(const char *));\n\n" } -- 2.30.2