summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins/tools/generate_builtins.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl/builtins/tools/generate_builtins.py')
-rwxr-xr-xsrc/glsl/builtins/tools/generate_builtins.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
index 691a318c1cb..9bde17157af 100755
--- a/src/glsl/builtins/tools/generate_builtins.py
+++ b/src/glsl/builtins/tools/generate_builtins.py
@@ -25,13 +25,25 @@ def get_builtin_definitions():
return fs
def stringify(s):
+ # Work around MSVC's 65535 byte limit by outputting an array of characters
+ # rather than actual string literals.
+ if len(s) >= 65535:
+ #t = "/* Warning: length " + repr(len(s)) + " too large */\n"
+ t = ""
+ for c in re.sub('\s\s+', ' ', s):
+ if c == '\n':
+ t += '\n'
+ else:
+ t += "'" + c + "',"
+ return '{' + t[:-1] + '}'
+
t = s.replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n"\n "')
return ' "' + t + '"\n'
def write_function_definitions():
fs = get_builtin_definitions()
for k, v in sorted(fs.iteritems()):
- print 'static const char *builtin_' + k + ' ='
+ print 'static const char builtin_' + k + '[] ='
print stringify(v), ';'
def run_compiler(args):
@@ -64,7 +76,7 @@ def write_profile(filename, profile):
# clutter the diff output.
proto_ir = re.sub(r'@0x[0-9a-f]+', '', proto_ir);
- print 'static const char *prototypes_for_' + profile + ' ='
+ print 'static const char prototypes_for_' + profile + '[] ='
print stringify(proto_ir), ';'
# Print a table of all the functions (not signatures) referenced.
@@ -123,12 +135,12 @@ if __name__ == "__main__":
#include "ast.h"
extern "C" struct gl_shader *
-_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
+_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
gl_shader *
read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
{
- GLcontext fakeCtx;
+ struct gl_context fakeCtx;
fakeCtx.API = API_OPENGL;
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
struct _mesa_glsl_parse_state *st =