Changeset 60040 in vbox for trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_evaluators.c
- Timestamp:
- Mar 15, 2016 1:17:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_evaluators.c
r33540 r60040 898 898 sizeof(*from->eval1D[i].coeff); 899 899 if (from->eval1D[i].order != to->eval1D[i].order || 900 from->eval1D[i].u1 != from->eval1D[i].u1 ||901 from->eval1D[i].u2 != from->eval1D[i].u2 ||902 903 900 from->eval1D[i].u1 != to->eval1D[i].u1 || 901 from->eval1D[i].u2 != to->eval1D[i].u2 || 902 crMemcmp((const void *) from->eval1D[i].coeff, 903 (const void *) to->eval1D[i].coeff, size)) { 904 904 diff_api.Map1f(i + GL_MAP1_COLOR_4, to->eval1D[i].u1, 905 906 905 to->eval1D[i].u2, gleval_sizes[i], to->eval1D[i].order, 906 to->eval1D[i].coeff); 907 907 FILLDIRTY(e->dirty); 908 908 FILLDIRTY(e->eval1D[i]); … … 914 914 for (i = 0; i < GLEVAL_TOT; i++) { 915 915 if (CHECKDIRTY(e->eval2D[i], bitID)) { 916 int size = from->eval2D[i].uorder * from->eval2D[i].vorder *917 916 int size = from->eval2D[i].uorder * from->eval2D[i].vorder 917 * gleval_sizes[i] * sizeof(*from->eval2D[i].coeff); 918 918 if (from->eval2D[i].uorder != to->eval2D[i].uorder || 919 920 from->eval2D[i].u1 != from->eval2D[i].u1 ||921 from->eval2D[i].u2 != from->eval2D[i].u2 ||922 from->eval2D[i].v1 != from->eval2D[i].v1 ||923 from->eval2D[i].v2 != from->eval2D[i].v2 ||924 925 919 from->eval2D[i].vorder != to->eval2D[i].vorder || 920 from->eval2D[i].u1 != to->eval2D[i].u1 || 921 from->eval2D[i].u2 != to->eval2D[i].u2 || 922 from->eval2D[i].v1 != to->eval2D[i].v1 || 923 from->eval2D[i].v2 != to->eval2D[i].v2 || 924 crMemcmp((const void *) from->eval2D[i].coeff, 925 (const void *) to->eval2D[i].coeff, size)) { 926 926 diff_api.Map2f(i + GL_MAP2_COLOR_4, 927 928 929 930 931 927 to->eval2D[i].u1, to->eval2D[i].u2, 928 gleval_sizes[i], to->eval2D[i].uorder, 929 to->eval2D[i].v1, to->eval2D[i].v2, 930 gleval_sizes[i], to->eval2D[i].vorder, 931 to->eval2D[i].coeff); 932 932 FILLDIRTY(e->dirty); 933 933 FILLDIRTY(e->eval2D[i]); … … 938 938 if (CHECKDIRTY(e->grid1D, bitID)) { 939 939 if (from->u11D != to->u11D || 940 from->u21D != to->u21D || from->un1D != to->un1D) { 940 from->u21D != to->u21D || 941 from->un1D != to->un1D) { 941 942 diff_api.MapGrid1d(to->un1D, to->u11D, to->u21D); 942 943 FILLDIRTY(e->dirty); 943 944 FILLDIRTY(e->grid1D); 945 } 946 CLEARDIRTY(e->grid1D, nbitID); 947 } 948 if (CHECKDIRTY(e->grid2D, bitID)) { 949 if (from->u12D != to->u12D || 950 from->u22D != to->u22D || 951 from->un2D != to->un2D || 952 from->v12D != to->v12D || 953 from->v22D != to->v22D || 954 from->vn2D != to->vn2D) { 955 diff_api.MapGrid2d(to->un2D, to->u12D, to->u22D, 956 to->vn2D, to->v12D, to->v22D); 957 FILLDIRTY(e->dirty); 958 FILLDIRTY(e->grid1D); 959 } 960 CLEARDIRTY(e->grid1D, nbitID); 961 } 962 CLEARDIRTY(e->dirty, nbitID); 963 } 964 965 void 966 crStateEvaluatorDiff(CREvaluatorBits *e, CRbitvalue *bitID, 967 CRContext *fromCtx, CRContext *toCtx) 968 { 969 CREvaluatorState *from = &(fromCtx->eval); 970 CREvaluatorState *to = &(toCtx->eval); 971 glAble able[2]; 972 int i, j; 973 CRbitvalue nbitID[CR_MAX_BITARRAY]; 974 975 for (j = 0; j < CR_MAX_BITARRAY; j++) 976 nbitID[j] = ~bitID[j]; 977 978 able[0] = diff_api.Disable; 979 able[1] = diff_api.Enable; 980 981 if (CHECKDIRTY(e->enable, bitID)) { 982 if (from->autoNormal != to->autoNormal) { 983 able[to->autoNormal] (GL_AUTO_NORMAL); 984 from->autoNormal = to->autoNormal; 985 } 986 CLEARDIRTY(e->enable, nbitID); 987 } 988 for (i = 0; i < GLEVAL_TOT; i++) { 989 if (CHECKDIRTY(e->enable1D[i], bitID)) { 990 if (from->enable1D[i] != to->enable1D[i]) { 991 able[to->enable1D[i]] (i + GL_MAP1_COLOR_4); 992 from->enable1D[i] = to->enable1D[i]; 993 } 994 CLEARDIRTY(e->enable1D[i], nbitID); 995 } 996 if (to->enable1D[i] && CHECKDIRTY(e->eval1D[i], bitID)) { 997 int size = from->eval1D[i].order * gleval_sizes[i] * 998 sizeof(*from->eval1D[i].coeff); 999 if (from->eval1D[i].order != to->eval1D[i].order || 1000 from->eval1D[i].u1 != to->eval1D[i].u1 || 1001 from->eval1D[i].u2 != to->eval1D[i].u2 || 1002 crMemcmp((const void *) from->eval1D[i].coeff, 1003 (const void *) to->eval1D[i].coeff, size)) { 1004 diff_api.Map1f(i + GL_MAP1_COLOR_4, to->eval1D[i].u1, 1005 to->eval1D[i].u2, gleval_sizes[i], to->eval1D[i].order, 1006 to->eval1D[i].coeff); 1007 from->eval1D[i].order = to->eval1D[i].order; 1008 from->eval1D[i].u1 = to->eval1D[i].u1; 1009 from->eval1D[i].u2 = to->eval1D[i].u2; 1010 crMemcpy((void *) from->eval1D[i].coeff, 1011 (const void *) to->eval1D[i].coeff, size); 1012 } 1013 CLEARDIRTY(e->eval1D[i], nbitID); 1014 } 1015 } 1016 1017 for (i = 0; i < GLEVAL_TOT; i++) { 1018 if (CHECKDIRTY(e->enable2D[i], bitID)) { 1019 if (from->enable2D[i] != to->enable2D[i]) { 1020 able[to->enable2D[i]] (i + GL_MAP2_COLOR_4); 1021 from->enable2D[i] = to->enable2D[i]; 1022 } 1023 CLEARDIRTY(e->enable2D[i], nbitID); 1024 } 1025 if (to->enable2D[i] && CHECKDIRTY(e->eval2D[i], bitID)) { 1026 int size = from->eval2D[i].uorder * from->eval2D[i].vorder 1027 * gleval_sizes[i] * sizeof(*from->eval2D[i].coeff); 1028 if (from->eval2D[i].uorder != to->eval2D[i].uorder || 1029 from->eval2D[i].vorder != to->eval2D[i].vorder || 1030 from->eval2D[i].u1 != to->eval2D[i].u1 || 1031 from->eval2D[i].u2 != to->eval2D[i].u2 || 1032 from->eval2D[i].v1 != to->eval2D[i].v1 || 1033 from->eval2D[i].v2 != to->eval2D[i].v2 || 1034 crMemcmp((const void *) from->eval2D[i].coeff, 1035 (const void *) to->eval2D[i].coeff, size)) { 1036 diff_api.Map2f(i + GL_MAP2_COLOR_4, 1037 to->eval2D[i].u1, to->eval2D[i].u2, 1038 gleval_sizes[i], to->eval2D[i].uorder, 1039 to->eval2D[i].v1, to->eval2D[i].v2, 1040 gleval_sizes[i], to->eval2D[i].vorder, 1041 to->eval2D[i].coeff); 1042 from->eval2D[i].uorder = to->eval2D[i].uorder; 1043 from->eval2D[i].vorder = to->eval2D[i].vorder; 1044 from->eval2D[i].u1 = to->eval2D[i].u1; 1045 from->eval2D[i].u2 = to->eval2D[i].u2; 1046 from->eval2D[i].v1 = to->eval2D[i].v1; 1047 from->eval2D[i].v2 = to->eval2D[i].v2; 1048 crMemcpy((void *) from->eval2D[i].coeff, 1049 (const void *) to->eval2D[i].coeff, size); 1050 } 1051 CLEARDIRTY(e->eval2D[i], nbitID); 1052 } 1053 } 1054 if (CHECKDIRTY(e->grid1D, bitID)) { 1055 if (from->u11D != to->u11D || 1056 from->u21D != to->u21D || 1057 from->un1D != to->un1D) { 1058 diff_api.MapGrid1d(to->un1D, to->u11D, to->u21D); 1059 from->u11D = to->u11D; 1060 from->u21D = to->u21D; 1061 from->un1D = to->un1D; 944 1062 } 945 1063 CLEARDIRTY(e->grid1D, nbitID); … … 950 1068 from->un2D != to->un2D || 951 1069 from->v12D != to->v12D || 952 from->v22D != to->v22D || from->vn2D != to->vn2D) { 1070 from->v22D != to->v22D || 1071 from->vn2D != to->vn2D) { 953 1072 diff_api.MapGrid2d(to->un2D, to->u12D, to->u22D, 954 to->vn2D, to->v12D, to->v22D); 955 FILLDIRTY(e->dirty); 956 FILLDIRTY(e->grid1D); 957 } 958 CLEARDIRTY(e->grid1D, nbitID); 959 } 960 CLEARDIRTY(e->dirty, nbitID); 961 } 962 963 void 964 crStateEvaluatorDiff(CREvaluatorBits *e, CRbitvalue *bitID, 965 CRContext *fromCtx, CRContext *toCtx) 966 { 967 CREvaluatorState *from = &(fromCtx->eval); 968 CREvaluatorState *to = &(toCtx->eval); 969 glAble able[2]; 970 int i, j; 971 CRbitvalue nbitID[CR_MAX_BITARRAY]; 972 973 for (j = 0; j < CR_MAX_BITARRAY; j++) 974 nbitID[j] = ~bitID[j]; 975 976 able[0] = diff_api.Disable; 977 able[1] = diff_api.Enable; 978 979 if (CHECKDIRTY(e->enable, bitID)) { 980 if (from->autoNormal != to->autoNormal) { 981 able[to->autoNormal] (GL_AUTO_NORMAL); 982 from->autoNormal = to->autoNormal; 983 } 984 CLEARDIRTY(e->enable, nbitID); 985 } 986 for (i = 0; i < GLEVAL_TOT; i++) { 987 if (CHECKDIRTY(e->enable1D[i], bitID)) { 988 if (from->enable1D[i] != to->enable1D[i]) { 989 able[to->enable1D[i]] (i + GL_MAP1_COLOR_4); 990 from->enable1D[i] = to->enable1D[i]; 991 } 992 CLEARDIRTY(e->enable1D[i], nbitID); 993 } 994 if (to->enable1D[i] && CHECKDIRTY(e->eval1D[i], bitID)) { 995 int size = from->eval1D[i].order * gleval_sizes[i] * 996 sizeof(*from->eval1D[i].coeff); 997 if (from->eval1D[i].order != to->eval1D[i].order || 998 from->eval1D[i].u1 != from->eval1D[i].u1 || 999 from->eval1D[i].u2 != from->eval1D[i].u2 || 1000 crMemcmp((const void *) from->eval1D[i].coeff, 1001 (const void *) to->eval1D[i].coeff, size)) { 1002 diff_api.Map1f(i + GL_MAP1_COLOR_4, to->eval1D[i].u1, 1003 to->eval1D[i].u2, gleval_sizes[i], to->eval1D[i].order, 1004 to->eval1D[i].coeff); 1005 from->eval1D[i].order = to->eval1D[i].order; 1006 from->eval1D[i].u1 = from->eval1D[i].u1; 1007 from->eval1D[i].u2 = from->eval1D[i].u2; 1008 crMemcpy((void *) from->eval1D[i].coeff, 1009 (const void *) to->eval1D[i].coeff, size); 1010 } 1011 CLEARDIRTY(e->eval1D[i], nbitID); 1012 } 1013 } 1014 1015 for (i = 0; i < GLEVAL_TOT; i++) { 1016 if (CHECKDIRTY(e->enable2D[i], bitID)) { 1017 if (from->enable2D[i] != to->enable2D[i]) { 1018 able[to->enable2D[i]] (i + GL_MAP2_COLOR_4); 1019 from->enable2D[i] = to->enable2D[i]; 1020 } 1021 CLEARDIRTY(e->enable2D[i], nbitID); 1022 } 1023 if (to->enable2D[i] && CHECKDIRTY(e->eval2D[i], bitID)) { 1024 int size = from->eval2D[i].uorder * from->eval2D[i].vorder * 1025 gleval_sizes[i] * sizeof(*from->eval2D[i].coeff); 1026 if (from->eval2D[i].uorder != to->eval2D[i].uorder || 1027 from->eval2D[i].vorder != to->eval2D[i].vorder || 1028 from->eval2D[i].u1 != from->eval2D[i].u1 || 1029 from->eval2D[i].u2 != from->eval2D[i].u2 || 1030 from->eval2D[i].v1 != from->eval2D[i].v1 || 1031 from->eval2D[i].v2 != from->eval2D[i].v2 || 1032 crMemcmp((const void *) from->eval2D[i].coeff, 1033 (const void *) to->eval2D[i].coeff, size)) { 1034 diff_api.Map2f(i + GL_MAP2_COLOR_4, 1035 to->eval2D[i].u1, to->eval2D[i].u2, 1036 gleval_sizes[i], to->eval2D[i].uorder, 1037 to->eval2D[i].v1, to->eval2D[i].v2, 1038 gleval_sizes[i], to->eval2D[i].vorder, 1039 to->eval2D[i].coeff); 1040 from->eval2D[i].uorder = to->eval2D[i].uorder; 1041 from->eval2D[i].vorder = to->eval2D[i].vorder; 1042 from->eval2D[i].u1 = from->eval2D[i].u1; 1043 from->eval2D[i].u2 = from->eval2D[i].u2; 1044 from->eval2D[i].v1 = from->eval2D[i].v1; 1045 from->eval2D[i].v2 = from->eval2D[i].v2; 1046 crMemcpy((void *) from->eval2D[i].coeff, 1047 (const void *) to->eval2D[i].coeff, size); 1048 } 1049 CLEARDIRTY(e->eval2D[i], nbitID); 1050 } 1051 } 1052 if (CHECKDIRTY(e->grid1D, bitID)) { 1053 if (from->u11D != to->u11D || 1054 from->u21D != to->u21D || from->un1D != to->un1D) { 1055 diff_api.MapGrid1d(to->un1D, to->u11D, to->u21D); 1056 from->u11D = to->u11D; 1057 from->u21D = to->u21D; 1058 from->un1D = to->un1D; 1059 } 1060 CLEARDIRTY(e->grid1D, nbitID); 1061 } 1062 if (CHECKDIRTY(e->grid2D, bitID)) { 1063 if (from->u12D != to->u12D || 1064 from->u22D != to->u22D || 1065 from->un2D != to->un2D || 1066 from->v12D != to->v12D || 1067 from->v22D != to->v22D || from->vn2D != to->vn2D) { 1068 diff_api.MapGrid2d(to->un2D, to->u12D, to->u22D, 1069 to->vn2D, to->v12D, to->v22D); 1073 to->vn2D, to->v12D, to->v22D); 1070 1074 from->u12D = to->u12D; 1071 1075 from->u22D = to->u22D;
Note:
See TracChangeset
for help on using the changeset viewer.