Fixed relative addressing in GLSL profile. trunk
authorRyan C. Gordon <icculus@icculus.org>
Sat, 03 May 2008 20:08:46 -0400
branchtrunk
changeset 279 f06f4ea3d751
parent 278 5c432d216078
child 280 61b2abd9c927
Fixed relative addressing in GLSL profile. It was using wrong variable name ("a0" instead of "vs_a0").
mojoshader.c
--- a/mojoshader.c	Sat May 03 15:28:30 2008 -0400
+++ b/mojoshader.c	Sat May 03 20:08:46 2008 -0400
@@ -1836,7 +1836,6 @@
     const char *rel_lbracket = "";
     const char *rel_rbracket = "";
     char rel_swizzle[4] = { '\0' };
-    char rel_regnum_str[16] = { '\0' };
     const char *rel_regtype_str = "";
     if (arg->relative)
     {
@@ -1845,10 +1844,8 @@
         rel_swizzle[2] = '\0';
         rel_lbracket = "[";
         rel_rbracket = "]";
-        rel_regtype_str = get_GLSL_register_string(ctx, arg->relative_regtype,
-                                                   arg->relative_regnum,
-                                                   rel_regnum_str,
-                                                   sizeof (rel_regnum_str));
+        rel_regtype_str = get_GLSL_varname(ctx, arg->relative_regtype,
+                                           arg->relative_regnum);
 
         if (regtype_str == NULL)
         {
@@ -1873,9 +1870,9 @@
 
     const char *shader_type_str = get_shader_type_string(ctx);
     char *retval = get_scratch_buffer(ctx);
-    snprintf(retval, SCRATCH_BUFFER_SIZE, "%s%s_%s%s%s%s%s%s%s%s%s",
+    snprintf(retval, SCRATCH_BUFFER_SIZE, "%s%s_%s%s%s%s%s%s%s%s",
              premod_str, shader_type_str, regtype_str, regnum_str,
-             rel_lbracket, rel_regtype_str, rel_regnum_str, rel_swizzle,
+             rel_lbracket, rel_regtype_str, rel_swizzle,
              rel_rbracket, swiz_str, postmod_str);
     // !!! FIXME: make sure the scratch buffer was large enough.
     return retval;