diff options
author | marha <marha@users.sourceforge.net> | 2010-11-22 19:42:40 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-11-22 19:42:40 +0000 |
commit | 85ef9930f56bf15181f9a0b238f03d55303cf411 (patch) | |
tree | 63b43286956ebd1c35c96e9b3d5305aabdf71a0f /mesalib/src/mesa/shader/slang/slang_label.c | |
parent | 94810d19989336862251dbf69c3f3acb18a9b06d (diff) | |
download | vcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.tar.gz vcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.tar.bz2 vcxsrv-85ef9930f56bf15181f9a0b238f03d55303cf411.zip |
Updated to mesalib 7.9
Diffstat (limited to 'mesalib/src/mesa/shader/slang/slang_label.c')
-rw-r--r-- | mesalib/src/mesa/shader/slang/slang_label.c | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/mesalib/src/mesa/shader/slang/slang_label.c b/mesalib/src/mesa/shader/slang/slang_label.c deleted file mode 100644 index 225612a93..000000000 --- a/mesalib/src/mesa/shader/slang/slang_label.c +++ /dev/null @@ -1,104 +0,0 @@ - - -/** - * Functions for managing instruction labels. - * Basically, this is used to manage the problem of forward branches where - * we have a branch instruciton but don't know the target address yet. - */ - - -#include "slang_label.h" -#include "slang_mem.h" - - - -slang_label * -_slang_label_new(const char *name) -{ - slang_label *l = (slang_label *) _slang_alloc(sizeof(slang_label)); - if (l) { - l->Name = _slang_strdup(name); - l->Location = -1; - } - 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 *) _slang_alloc(sizeof(slang_label)); - if (l) { - l->Name = (char *) _slang_alloc(strlen(name) + 10); - if (!l->Name) { - free(l); - return NULL; - } - sprintf(l->Name, "%s_%d", name, id); - id++; - l->Location = -1; - } - return l; -} - -void -_slang_label_delete(slang_label *l) -{ - if (l->Name) { - _slang_free(l->Name); - l->Name = NULL; - } - if (l->References) { - _slang_free(l->References); - l->References = NULL; - } - _slang_free(l); -} - - -void -_slang_label_add_reference(slang_label *l, GLuint inst) -{ - const GLuint oldSize = l->NumReferences * sizeof(GLuint); - assert(l->Location < 0); - l->References = _slang_realloc(l->References, - oldSize, oldSize + sizeof(GLuint)); - if (l->References) { - l->References[l->NumReferences] = inst; - l->NumReferences++; - } -} - - -GLint -_slang_label_get_location(const slang_label *l) -{ - return l->Location; -} - - -void -_slang_label_set_location(slang_label *l, GLint location, - struct gl_program *prog) -{ - GLuint i; - - assert(l->Location < 0); - assert(location >= 0); - - l->Location = location; - - /* for the instructions that were waiting to learn the label's location: */ - for (i = 0; i < l->NumReferences; i++) { - const GLuint j = l->References[i]; - prog->Instructions[j].BranchTarget = location; - } - - if (l->References) { - _slang_free(l->References); - l->References = NULL; - } -} |