]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
fixing the messup of MUL_FV and _VF being swapped - getting rid of additions that...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 12 Aug 2012 09:34:41 +0000 (11:34 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 12 Aug 2012 09:34:55 +0000 (11:34 +0200)
ast.h
gmqcc.h
ir.c
ir.h

diff --git a/ast.h b/ast.h
index a5eee195eff07d168b9f774e3e0a29831ebae73e..29f3061d70d56632cf944ac2a8ed5052dba272ee 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -133,8 +133,6 @@ struct ast_value_s
         const char   *vstring;
         int           ventity;
         ast_function *vfunc;
         const char   *vstring;
         int           ventity;
         ast_function *vfunc;
-        quaternion    vquat;
-        matrix        vmat;
     } constval;
 
     ir_value *ir_v;
     } constval;
 
     ir_value *ir_v;
diff --git a/gmqcc.h b/gmqcc.h
index b27998b1262ce1426c0f2cdb0ab8a1e3943998e8..beca3504a3bb4a5448b2ade23797d6c1dcb9267d 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -279,8 +279,6 @@ enum {
     TYPE_FUNCTION ,
     TYPE_POINTER  ,
     TYPE_INTEGER  ,
     TYPE_FUNCTION ,
     TYPE_POINTER  ,
     TYPE_INTEGER  ,
-    TYPE_QUATERNION  ,
-    TYPE_MATRIX  ,
     TYPE_VARIANT  ,
 
     TYPE_COUNT
     TYPE_VARIANT  ,
 
     TYPE_COUNT
@@ -400,8 +398,8 @@ enum {
     INSTR_DONE,
     INSTR_MUL_F,
     INSTR_MUL_V,
     INSTR_DONE,
     INSTR_MUL_F,
     INSTR_MUL_V,
-    INSTR_MUL_VF,
     INSTR_MUL_FV,
     INSTR_MUL_FV,
+    INSTR_MUL_VF,
     INSTR_DIV_F,
     INSTR_ADD_F,
     INSTR_ADD_V,
     INSTR_DIV_F,
     INSTR_ADD_F,
     INSTR_ADD_V,
@@ -464,23 +462,6 @@ enum {
     INSTR_BITAND,
     INSTR_BITOR,
 
     INSTR_BITAND,
     INSTR_BITOR,
 
-/* warning: will be reordered */
-    INSTR_MUL_Q,
-    INSTR_MUL_QF,
-    INSTR_MUL_M,
-    INSTR_MUL_MF,
-    INSTR_EQ_Q,
-    INSTR_EQ_M,
-    INSTR_NE_Q,
-    INSTR_NE_M,
-    INSTR_LOAD_Q,
-    INSTR_LOAD_M,
-    INSTR_STORE_Q,
-    INSTR_STORE_M,
-    INSTR_STOREP_Q,
-    INSTR_STOREP_M,
-    INSTR_INV_Q,
-    INSTR_INV_M,
     /*
      * Virtual instructions used by the assembler
      * keep at the end but before virtual instructions
     /*
      * Virtual instructions used by the assembler
      * keep at the end but before virtual instructions
@@ -540,8 +521,8 @@ static const struct {
     { "DONE"      , 1, 4 },
     { "MUL_F"     , 3, 5 },
     { "MUL_V"     , 3, 5 },
     { "DONE"      , 1, 4 },
     { "MUL_F"     , 3, 5 },
     { "MUL_V"     , 3, 5 },
-    { "MUL_VF"    , 3, 6 },
     { "MUL_FV"    , 3, 6 },
     { "MUL_FV"    , 3, 6 },
+    { "MUL_VF"    , 3, 6 },
     { "DIV"       , 0, 3 },
     { "ADD_F"     , 3, 5 },
     { "ADD_V"     , 3, 5 },
     { "DIV"       , 0, 3 },
     { "ADD_F"     , 3, 5 },
     { "ADD_V"     , 3, 5 },
@@ -604,23 +585,6 @@ static const struct {
     { "BITAND"    , 0, 6 },
     { "BITOR"     , 0, 5 },
 
     { "BITAND"    , 0, 6 },
     { "BITOR"     , 0, 5 },
 
-    { "MUL_Q"     , 3, 5 },
-    { "MUL_QF"    , 3, 6 },
-    { "MUL_M"     , 3, 5 },
-    { "MUL_MF"    , 3, 6 },
-    { "EQ_Q"      , 0, 4 },
-    { "EQ_M"      , 0, 4 },
-    { "NE_Q"      , 0, 4 },
-    { "NE_M"      , 0, 4 },
-    { "FIELD_Q"   , 0, 7 },
-    { "FIELD_M"   , 0, 7 },
-    { "STORE_Q"   , 0, 7 },
-    { "STORE_M"   , 0, 7 },
-    { "STOREP_Q"  , 0, 8 },
-    { "STOREP_M"  , 0, 8 },
-    { "INV_Q"     , 0, 5 },
-    { "INV_M"     , 0, 5 },
-
     { "END"       , 0, 3 } /* virtual assembler instruction */
 };
 
     { "END"       , 0, 3 } /* virtual assembler instruction */
 };
 
@@ -812,14 +776,6 @@ typedef struct {
     float x, y, z;
 } vector;
 
     float x, y, z;
 } vector;
 
-typedef float matrix[4][4]; /* OpenGL layout */
-typedef float quaternion[4]; /* order: x, y, z, w */
-#define MATRIX(axis, elem) ((4*(axis)) + (elem))
-#define QUAT_X 0
-#define QUAT_Y 1
-#define QUAT_Z 2
-#define QUAT_W 3
-
 /*
  * A shallow copy of a lex_file to remember where which ast node
  * came from.
 /*
  * A shallow copy of a lex_file to remember where which ast node
  * came from.
diff --git a/ir.c b/ir.c
index 81830bebad9e37da56fe26f2b729482c49094646..cbceb6d9499076ac1f592cdda6ad8cabee378a78 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -41,8 +41,6 @@ const char *type_name[TYPE_COUNT] = {
 #if 0
     "integer",
 #endif
 #if 0
     "integer",
 #endif
-    "quaternion",
-    "matrix",
     "variant"
 };
 
     "variant"
 };
 
@@ -58,9 +56,7 @@ size_t type_sizeof[TYPE_COUNT] = {
 #if 0
     1, /* TYPE_INTEGER  */
 #endif
 #if 0
     1, /* TYPE_INTEGER  */
 #endif
-    4, /* TYPE_QUATERNION */
-    16, /* TYPE_MATRIX */
-    16, /* TYPE_VARIANT  */
+    3, /* TYPE_VARIANT  */
 };
 
 uint16_t type_store_instr[TYPE_COUNT] = {
 };
 
 uint16_t type_store_instr[TYPE_COUNT] = {
@@ -75,10 +71,8 @@ uint16_t type_store_instr[TYPE_COUNT] = {
 #if 0
     INSTR_STORE_I, /* integer type */
 #endif
 #if 0
     INSTR_STORE_I, /* integer type */
 #endif
-    INSTR_STORE_Q,
-    INSTR_STORE_M,
 
 
-    INSTR_STORE_M, /* variant, should never be accessed */
+    INSTR_STORE_V, /* variant, should never be accessed */
 };
 
 uint16_t type_storep_instr[TYPE_COUNT] = {
 };
 
 uint16_t type_storep_instr[TYPE_COUNT] = {
@@ -93,10 +87,8 @@ uint16_t type_storep_instr[TYPE_COUNT] = {
 #if 0
     INSTR_STOREP_ENT, /* integer type */
 #endif
 #if 0
     INSTR_STOREP_ENT, /* integer type */
 #endif
-    INSTR_STOREP_Q,
-    INSTR_STOREP_M,
 
 
-    INSTR_STOREP_M, /* variant, should never be accessed */
+    INSTR_STOREP_V, /* variant, should never be accessed */
 };
 
 MEM_VEC_FUNCTIONS(ir_value_vector, ir_value*, v)
 };
 
 MEM_VEC_FUNCTIONS(ir_value_vector, ir_value*, v)
@@ -694,24 +686,6 @@ bool ir_value_set_vector(ir_value *self, vector v)
     return true;
 }
 
     return true;
 }
 
-bool ir_value_set_quaternion(ir_value *self, quaternion v)
-{
-    if (self->vtype != TYPE_QUATERNION)
-        return false;
-    memcpy(&self->constval.vquat, v, sizeof(self->constval.vquat));
-    self->isconst = true;
-    return true;
-}
-
-bool ir_value_set_matrix(ir_value *self, matrix v)
-{
-    if (self->vtype != TYPE_MATRIX)
-        return false;
-    memcpy(&self->constval.vmat, v, sizeof(self->constval.vmat));
-    self->isconst = true;
-    return true;
-}
-
 bool ir_value_set_field(ir_value *self, ir_value *fld)
 {
     if (self->vtype != TYPE_FIELD)
 bool ir_value_set_field(ir_value *self, ir_value *fld)
 {
     if (self->vtype != TYPE_FIELD)
@@ -1432,8 +1406,6 @@ ir_value* ir_block_create_load_from_ent(ir_block *self, const char *label, ir_va
         case TYPE_POINTER: op = INSTR_LOAD_I;   break;
         case TYPE_INTEGER: op = INSTR_LOAD_I;   break;
 #endif
         case TYPE_POINTER: op = INSTR_LOAD_I;   break;
         case TYPE_INTEGER: op = INSTR_LOAD_I;   break;
 #endif
-        case TYPE_QUATERNION: op = INSTR_LOAD_Q; break;
-        case TYPE_MATRIX:     op = INSTR_LOAD_M; break;
         default:
             return NULL;
     }
         default:
             return NULL;
     }
@@ -1537,22 +1509,12 @@ ir_value* ir_block_create_mul(ir_block *self,
             case TYPE_VECTOR:
                 op = INSTR_MUL_V;
                 break;
             case TYPE_VECTOR:
                 op = INSTR_MUL_V;
                 break;
-            case TYPE_QUATERNION:
-                op = INSTR_MUL_Q;
-                break;
-            case TYPE_MATRIX:
-                op = INSTR_MUL_M;
-                break;
         }
     } else {
         if ( (l == TYPE_VECTOR && r == TYPE_FLOAT) )
             op = INSTR_MUL_VF;
         else if ( (l == TYPE_FLOAT && r == TYPE_VECTOR) )
             op = INSTR_MUL_FV;
         }
     } else {
         if ( (l == TYPE_VECTOR && r == TYPE_FLOAT) )
             op = INSTR_MUL_VF;
         else if ( (l == TYPE_FLOAT && r == TYPE_VECTOR) )
             op = INSTR_MUL_FV;
-        else if ( (l == TYPE_QUATERNION && r == TYPE_FLOAT) )
-            op = INSTR_MUL_QF;
-        else if ( (l == TYPE_MATRIX && r == TYPE_FLOAT) )
-            op = INSTR_MUL_MF;
 #if 0
         else if ( (l == TYPE_VECTOR && r == TYPE_INTEGER) )
             op = INSTR_MUL_VI;
 #if 0
         else if ( (l == TYPE_VECTOR && r == TYPE_INTEGER) )
             op = INSTR_MUL_VI;
@@ -2618,8 +2580,6 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global)
         return global->code.globaladdr >= 0;
     }
     case TYPE_VECTOR:
         return global->code.globaladdr >= 0;
     }
     case TYPE_VECTOR:
-    case TYPE_QUATERNION:
-    case TYPE_MATRIX:
     {
         size_t d;
         if (code_defs_add(def) < 0)
     {
         size_t d;
         if (code_defs_add(def) < 0)
diff --git a/ir.h b/ir.h
index 66336d6ae5a6b64a5a8e9a2ff64c2e54c48d22ed..dccc970f3a632b0dc3fc1167574905b8e78a3ee7 100644 (file)
--- a/ir.h
+++ b/ir.h
@@ -55,8 +55,6 @@ typedef struct ir_value_s {
         char    *vstring;
         struct ir_value_s *vpointer;
         struct ir_function_s *vfunc;
         char    *vstring;
         struct ir_value_s *vpointer;
         struct ir_function_s *vfunc;
-        quaternion vquat;
-        matrix     vmat;
     } constval;
 
     struct {
     } constval;
 
     struct {
@@ -100,8 +98,6 @@ bool GMQCC_WARN ir_value_set_vector(ir_value*, vector v);
 bool GMQCC_WARN ir_value_set_field(ir_value*, ir_value *fld);
 /*bool   ir_value_set_pointer_v(ir_value*, ir_value* p); */
 /*bool   ir_value_set_pointer_i(ir_value*, int i);       */
 bool GMQCC_WARN ir_value_set_field(ir_value*, ir_value *fld);
 /*bool   ir_value_set_pointer_v(ir_value*, ir_value* p); */
 /*bool   ir_value_set_pointer_i(ir_value*, int i);       */
-bool GMQCC_WARN ir_value_set_quaternion(ir_value*, quaternion v);
-bool GMQCC_WARN ir_value_set_matrix(ir_value*, matrix v);
 
 MEM_VECTOR_PROTO(ir_value, ir_life_entry_t, life);
 /* merge an instruction into the life-range */
 
 MEM_VECTOR_PROTO(ir_value, ir_life_entry_t, life);
 /* merge an instruction into the life-range */