summaryrefslogtreecommitdiff
path: root/src/mesa/shader
diff options
context:
space:
mode:
authorBrian <brian@yutani.localnet.net>2007-03-27 15:18:17 -0600
committerBrian <brian@yutani.localnet.net>2007-03-27 16:06:47 -0600
commit17238f1ee52ddb9d9ef4282498de3b4406245a7f (patch)
treedd1d00095577fa609b43c1e9e1281587920e8925 /src/mesa/shader
parentf407cada8aa0bfea1b8dfae766392162c702aaa4 (diff)
added _slang_label_new_unique()
Diffstat (limited to 'src/mesa/shader')
-rw-r--r--src/mesa/shader/slang/slang_label.c21
-rw-r--r--src/mesa/shader/slang/slang_label.h3
2 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/shader/slang/slang_label.c b/src/mesa/shader/slang/slang_label.c
index 4d35d2e72a..e6a03f9e4f 100644
--- a/src/mesa/shader/slang/slang_label.c
+++ b/src/mesa/shader/slang/slang_label.c
@@ -21,6 +21,27 @@ _slang_label_new(const char *name)
return l;
}
+/**
+ * As above, but suffix the name with a unique number.
+ */
+slang_label *
+_slang_label_new_unique(const char *name)
+{
+ static int id = 1;
+ slang_label *l = (slang_label *) _mesa_calloc(sizeof(slang_label));
+ if (l) {
+ l->Name = (char *) _mesa_malloc(_mesa_strlen(name) + 10);
+ if (!l->Name) {
+ _mesa_free(l);
+ return NULL;
+ }
+ _mesa_sprintf(l->Name, "%s_%d", name, id);
+ id++;
+ l->Location = -1;
+ }
+ return l;
+}
+
void
_slang_label_delete(slang_label *l)
{
diff --git a/src/mesa/shader/slang/slang_label.h b/src/mesa/shader/slang/slang_label.h
index 661624f173..0f1a45b30f 100644
--- a/src/mesa/shader/slang/slang_label.h
+++ b/src/mesa/shader/slang/slang_label.h
@@ -25,6 +25,9 @@ typedef struct slang_label_ slang_label;
extern slang_label *
_slang_label_new(const char *name);
+extern slang_label *
+_slang_label_new_unique(const char *name);
+
extern void
_slang_label_delete(slang_label *l);