Changeset 46515 in vbox for trunk/src/VBox/GuestHost/OpenGL
- Timestamp:
- Jun 12, 2013 10:47:50 PM (12 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/Makefile.kmk
r46401 r46515 191 191 192 192 ifdef VBOX_WITH_CRDUMPER 193 $(VBOX_PATH_CROGL_GENFILES)/dump_gen.cpp: $(PATH_SUB_CURRENT)/state_tracker/dump_gen.py $(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.py $(addprefix $(PATH_SUB_CURRENT)/state_tracker/, state_isenabled.txt state_extensions_isenabled.txt) $(VBOX_CROGL_API_FILES) | $$(dir $$@)193 $(VBOX_PATH_CROGL_GENFILES)/dump_gen.cpp: $(PATH_SUB_CURRENT)/state_tracker/dump_gen.py $(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib/get_sizes.py $(PATH_ROOT)/src/VBox/HostServices/SharedOpenGL/crserverlib/get_components.py $(addprefix $(PATH_SUB_CURRENT)/state_tracker/, state_isenabled.txt state_extensions_isenabled.txt) $(VBOX_CROGL_API_FILES) | $$(dir $$@) 194 194 $(call MSG_GENERATE,python,$@,$<) 195 195 $(QUIET)$(call VBOX_CROGL_PYTHON_ENV,$(VBOX_PATH_CROGL_PYTHON_INCLUDE),$@) $(VBOX_BLD_PYTHON) $< $(VBOX_PATH_CROGL_GLAPI) $(<D) -
trunk/src/VBox/GuestHost/OpenGL/include/cr_dump.h
r46453 r46515 129 129 VBOXDUMPDECL(void) crRecDumpShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid); 130 130 VBOXDUMPDECL(void) crRecDumpProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid); 131 VBOXDUMPDECL(void) crRecRecompileShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid); 132 VBOXDUMPDECL(void) crRecRecompileProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid); 131 133 VBOXDUMPDECL(void) crRecDumpCurrentProgram(CR_RECORDER *pRec, CRContext *ctx); 132 134 VBOXDUMPDECL(void) crRecDumpProgramUniforms(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid); 133 135 VBOXDUMPDECL(void) crRecDumpCurrentProgramUniforms(CR_RECORDER *pRec, CRContext *ctx); 136 VBOXDUMPDECL(void) crRecRecompileCurrentProgram(CR_RECORDER *pRec, CRContext *ctx); 137 VBOXDUMPDECL(void) crRecDumpProgramAttribs(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid); 138 VBOXDUMPDECL(void) crRecDumpCurrentProgramAttribs(CR_RECORDER *pRec, CRContext *ctx); 134 139 VBOXDUMPDECL(void) crRecDumpGlGetState(CR_RECORDER *pRec, CRContext *ctx); 135 140 VBOXDUMPDECL(void) crRecDumpGlEnableState(CR_RECORDER *pRec, CRContext *ctx); … … 137 142 VBOXDUMPDECL(void) crRecDumpVertAttrF(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, ...); 138 143 VBOXDUMPDECL(void) crRecDumpVertAttrV(CR_RECORDER *pRec, CRContext *ctx, const char*pszFormat, va_list pArgList); 144 VBOXDUMPDECL(void) crRecDumpTexParam(CR_RECORDER *pRec, CRContext *ctx, GLenum enmTarget); 145 VBOXDUMPDECL(void) crRecDumpTexEnv(CR_RECORDER *pRec, CRContext *ctx); 146 VBOXDUMPDECL(void) crRecDumpTexGen(CR_RECORDER *pRec, CRContext *ctx); 139 147 140 148 typedef DECLCALLBACKPTR(GLuint, PFNCRDUMPGETHWID)(void *pvObj); -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump.cpp
r46453 r46515 483 483 switch (enmType) 484 484 { 485 CR_DUMP_MAKE_CASE(GL_BYTE); 486 CR_DUMP_MAKE_CASE(GL_UNSIGNED_BYTE); 487 CR_DUMP_MAKE_CASE(GL_SHORT); 488 CR_DUMP_MAKE_CASE(GL_UNSIGNED_SHORT); 485 489 CR_DUMP_MAKE_CASE(GL_FLOAT); 490 CR_DUMP_MAKE_CASE(GL_DOUBLE); 486 491 CR_DUMP_MAKE_CASE(GL_FLOAT_VEC2); 487 492 CR_DUMP_MAKE_CASE(GL_FLOAT_VEC3); 488 493 CR_DUMP_MAKE_CASE(GL_FLOAT_VEC4); 489 494 CR_DUMP_MAKE_CASE(GL_INT); 495 CR_DUMP_MAKE_CASE(GL_UNSIGNED_INT); 490 496 CR_DUMP_MAKE_CASE(GL_INT_VEC2); 491 497 CR_DUMP_MAKE_CASE(GL_INT_VEC3); … … 681 687 crFree(pShaders); 682 688 689 GLsizei cbLog = 0; 690 691 pRec->pDispatch->GetObjectParameterivARB(hwid, GL_OBJECT_INFO_LOG_LENGTH_ARB, &cbLog); 692 if (cbLog) 693 { 694 char *pszLog = (char *)crCalloc(cbLog+1); 695 pRec->pDispatch->GetInfoLogARB(hwid, cbLog, NULL, pszLog); 696 crDmpStrF(pRec->pDumper, "==LOG=="); 697 crRecDumpStrByLine(pRec->pDumper, pszLog, cbLog); 698 crDmpStrF(pRec->pDumper, "==Done LOG=="); 699 crFree(pszLog); 700 } 701 else 702 { 703 crDmpStrF(pRec->pDumper, "==No LOG=="); 704 } 705 683 706 crDmpStr(pRec->pDumper, "===END PROGRAM===="); 707 } 708 709 void crRecRecompileShader(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid) 710 { 711 GLint length = 0; 712 GLint type = 0; 713 GLint compileStatus = 0; 714 CRGLSLShader *pShad; 715 716 if (!id) 717 { 718 unsigned long tstKey = 0; 719 Assert(hwid); 720 pShad = (CRGLSLShader *)crDmpHashtableSearchByHwid(ctx->glsl.shaders, hwid, crDmpGetHwidShaderCB, &tstKey); 721 Assert(pShad); 722 if (!pShad) 723 return; 724 id = pShad->id; 725 Assert(tstKey == id); 726 } 727 else 728 { 729 pShad = (CRGLSLShader *)crHashtableSearch(ctx->glsl.shaders, id); 730 Assert(pShad); 731 if (!pShad) 732 return; 733 } 734 735 if (!hwid) 736 hwid = pShad->hwid; 737 738 Assert(pShad->hwid == hwid); 739 Assert(pShad->id == id); 740 741 pRec->pDispatch->GetObjectParameterivARB(hwid, GL_OBJECT_SUBTYPE_ARB, &type); 742 pRec->pDispatch->GetObjectParameterivARB(hwid, GL_OBJECT_COMPILE_STATUS_ARB, &compileStatus); 743 crDmpStrF(pRec->pDumper, "==RECOMPILE SHADER ctx(%d) id(%d) hwid(%d) type(%s) status(%d)==", ctx->id, id, hwid, crRecDumpShaderTypeString(type, pRec->pDumper), compileStatus); 744 745 compileStatus = 0; 746 GLenum status; 747 while ((status = pRec->pDispatch->GetError()) != GL_NO_ERROR) {/*Assert(0);*/} 748 pRec->pDispatch->CompileShader(hwid); 749 while ((status = pRec->pDispatch->GetError()) != GL_NO_ERROR) {Assert(0);} 750 pRec->pDispatch->GetObjectParameterivARB(hwid, GL_OBJECT_COMPILE_STATUS_ARB, &compileStatus); 751 752 crDmpStrF(pRec->pDumper, "==Done RECOMPILE SHADER, status(%d)==", compileStatus); 753 } 754 755 void crRecRecompileProgram(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid) 756 { 757 GLint cShaders = 0, linkStatus = 0; 758 char *source = NULL; 759 CRGLSLProgram *pProg; 760 761 if (!id) 762 { 763 unsigned long tstKey = 0; 764 Assert(hwid); 765 pProg = (CRGLSLProgram*)crDmpHashtableSearchByHwid(ctx->glsl.programs, hwid, crDmpGetHwidProgramCB, &tstKey); 766 Assert(pProg); 767 if (!pProg) 768 return; 769 id = pProg->id; 770 Assert(tstKey == id); 771 } 772 else 773 { 774 pProg = (CRGLSLProgram *) crHashtableSearch(ctx->glsl.programs, id); 775 Assert(pProg); 776 if (!pProg) 777 return; 778 } 779 780 if (!hwid) 781 hwid = pProg->hwid; 782 783 Assert(pProg->hwid == hwid); 784 Assert(pProg->id == id); 785 786 pRec->pDispatch->GetObjectParameterivARB(hwid, GL_OBJECT_ATTACHED_OBJECTS_ARB, &cShaders); 787 pRec->pDispatch->GetObjectParameterivARB(hwid, GL_OBJECT_LINK_STATUS_ARB, &linkStatus); 788 789 crDmpStrF(pRec->pDumper, "==RECOMPILE PROGRAM ctx(%d) id(%d) hwid(%d) status(%d) shaders(%d)==", ctx->id, id, hwid, linkStatus, cShaders); 790 791 GLhandleARB *pShaders = (GLhandleARB*)crCalloc(cShaders * sizeof (*pShaders)); 792 if (!pShaders) 793 { 794 crWarning("crCalloc failed"); 795 crDmpStrF(pRec->pDumper, "WARNING: crCalloc failed"); 796 return; 797 } 798 799 pRec->pDispatch->GetAttachedObjectsARB(hwid, cShaders, NULL, pShaders); 800 for (GLint i = 0; i < cShaders; ++i) 801 { 802 crRecRecompileShader(pRec, ctx, 0, pShaders[i]); 803 } 804 805 crFree(pShaders); 806 807 linkStatus = 0; 808 GLenum status; 809 while ((status = pRec->pDispatch->GetError()) != GL_NO_ERROR) {/*Assert(0);*/} 810 pRec->pDispatch->LinkProgram(hwid); 811 while ((status = pRec->pDispatch->GetError()) != GL_NO_ERROR) {Assert(0);} 812 pRec->pDispatch->GetObjectParameterivARB(hwid, GL_OBJECT_LINK_STATUS_ARB, &linkStatus); 813 814 crDmpStrF(pRec->pDumper, "==Done RECOMPILE PROGRAM, status(%d)==", linkStatus); 684 815 } 685 816 … … 813 944 { 814 945 case 1: 815 crDmpStrF(pRec->pDumper, "%s = %d; ", pszName, idata[0]);946 crDmpStrF(pRec->pDumper, "%s = %d; //location %d", pszName, idata[0], location); 816 947 break; 817 948 case 2: 818 crDmpStrF(pRec->pDumper, "%s = {%d, %d}; ", pszName, idata[0], idata[1]);949 crDmpStrF(pRec->pDumper, "%s = {%d, %d}; //location %d", pszName, idata[0], idata[1], location); 819 950 break; 820 951 case 3: 821 crDmpStrF(pRec->pDumper, "%s = {%d, %d, %d}; ", pszName, idata[0], idata[1], idata[2]);952 crDmpStrF(pRec->pDumper, "%s = {%d, %d, %d}; //location %d", pszName, idata[0], idata[1], idata[2], location); 822 953 break; 823 954 case 4: 824 crDmpStrF(pRec->pDumper, "%s = {%d, %d, %d, %d}; ", pszName, idata[0], idata[1], idata[2], idata[3]);955 crDmpStrF(pRec->pDumper, "%s = {%d, %d, %d, %d}; //location %d", pszName, idata[0], idata[1], idata[2], idata[3], location); 825 956 break; 826 957 default: 827 958 for (GLint k = 0; k < uniformTypeSize; ++k) 828 959 { 829 crDmpStrF(pRec->pDumper, "%s[%d] = %d; ", pszName, k, idata[k]);960 crDmpStrF(pRec->pDumper, "%s[%d] = %d; //location %d", pszName, k, idata[k], location); 830 961 } 831 962 break; … … 838 969 { 839 970 case 1: 840 crDmpStrF(pRec->pDumper, "%s = %f; ", pszName, fdata[0]);971 crDmpStrF(pRec->pDumper, "%s = %f; //location %d", pszName, fdata[0], location); 841 972 break; 842 973 case 2: 843 crDmpStrF(pRec->pDumper, "%s = {%f, %f}; ", pszName, fdata[0], fdata[1]);974 crDmpStrF(pRec->pDumper, "%s = {%f, %f}; //location %d", pszName, fdata[0], fdata[1], location); 844 975 break; 845 976 case 3: 846 crDmpStrF(pRec->pDumper, "%s = {%f, %f, %f}; ", pszName, fdata[0], fdata[1], fdata[2]);977 crDmpStrF(pRec->pDumper, "%s = {%f, %f, %f}; //location %d", pszName, fdata[0], fdata[1], fdata[2], location); 847 978 break; 848 979 case 4: 849 crDmpStrF(pRec->pDumper, "%s = {%f, %f, %f, %f}; ", pszName, fdata[0], fdata[1], fdata[2], fdata[3]);980 crDmpStrF(pRec->pDumper, "%s = {%f, %f, %f, %f}; //location %d", pszName, fdata[0], fdata[1], fdata[2], fdata[3], location); 850 981 break; 851 982 default: 852 983 for (GLint k = 0; k < uniformTypeSize; ++k) 853 984 { 854 crDmpStrF(pRec->pDumper, "%s[%d] = %f;", pszName, k, fdata[k]); 985 crDmpStrF(pRec->pDumper, "%s[%d] = %f; //location %d", pszName, k, fdata[k], location); 986 } 987 break; 988 } 989 } 990 } 991 } 992 993 crFree(pszName); 994 } 995 } 996 997 void crRecDumpProgramAttribs(CR_RECORDER *pRec, CRContext *ctx, GLint id, GLint hwid) 998 { 999 CRGLSLProgram *pProg; 1000 1001 if (!id) 1002 { 1003 unsigned long tstKey = 0; 1004 Assert(hwid); 1005 pProg = (CRGLSLProgram*)crDmpHashtableSearchByHwid(ctx->glsl.programs, hwid, crDmpGetHwidProgramCB, &tstKey); 1006 Assert(pProg); 1007 if (!pProg) 1008 return; 1009 id = pProg->id; 1010 Assert(tstKey == id); 1011 } 1012 else 1013 { 1014 pProg = (CRGLSLProgram *) crHashtableSearch(ctx->glsl.programs, id); 1015 Assert(pProg); 1016 if (!pProg) 1017 return; 1018 } 1019 1020 if (!hwid) 1021 hwid = pProg->hwid; 1022 1023 Assert(pProg->hwid == hwid); 1024 Assert(pProg->id == id); 1025 1026 GLint maxAttribLen = 0, activeAttrib = 0, i, j, attribCount = 0; 1027 GLenum type; 1028 GLint size, location; 1029 GLchar *pszName = NULL; 1030 pRec->pDispatch->GetProgramiv(hwid, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttribLen); 1031 pRec->pDispatch->GetProgramiv(hwid, GL_ACTIVE_ATTRIBUTES, &activeAttrib); 1032 1033 if (!maxAttribLen) 1034 { 1035 if (activeAttrib) 1036 { 1037 crWarning("activeAttrib (%d), while maxAttribLen is zero", activeAttrib); 1038 activeAttrib = 0; 1039 } 1040 } 1041 1042 if (activeAttrib>0) 1043 { 1044 pszName = (GLchar *) crAlloc((maxAttribLen+8)*sizeof(GLchar)); 1045 1046 if (!pszName) 1047 { 1048 crWarning("crRecDumpProgramAttrib: out of memory"); 1049 return; 1050 } 1051 } 1052 1053 for (i=0; i<activeAttrib; ++i) 1054 { 1055 pRec->pDispatch->GetActiveAttrib(hwid, i, maxAttribLen, NULL, &size, &type, pszName); 1056 attribCount += size; 1057 } 1058 Assert(attribCount>=activeAttrib); 1059 1060 if (activeAttrib>0) 1061 { 1062 GLfloat fdata[16]; 1063 GLint idata[16]; 1064 char *pIndexStr=NULL; 1065 1066 for (i=0; i<activeAttrib; ++i) 1067 { 1068 bool fPrintBraketsWithName = false; 1069 pRec->pDispatch->GetActiveAttrib(hwid, i, maxAttribLen, NULL, &size, &type, pszName); 1070 GLint arrayBufferBind = 0, arrayEnabled = 0, arraySize = 0, arrayStride = 0, arrayType = 0, arrayNormalized = 0, arrayInteger = 0/*, arrayDivisor = 0*/; 1071 1072 pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, &arrayBufferBind); 1073 pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &arrayEnabled); 1074 pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &arraySize); 1075 pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_STRIDE, &arrayStride); 1076 pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &arrayType); 1077 pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, &arrayNormalized); 1078 pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_INTEGER, &arrayInteger); 1079 // pRec->pDispatch->GetVertexAttribivARB(i, GL_VERTEX_ATTRIB_ARRAY_DIVISOR, &arrayDivisor); 1080 1081 if (size>1) 1082 { 1083 pIndexStr = crStrchr(pszName, '['); 1084 if (!pIndexStr) 1085 { 1086 pIndexStr = pszName+crStrlen(pszName); 1087 fPrintBraketsWithName = true; 1088 } 1089 } 1090 1091 if (fPrintBraketsWithName) 1092 { 1093 crDmpStrF(pRec->pDumper, "%s %s[%d];", crRecDumpVarTypeString(type, pRec->pDumper), pszName, size); 1094 Assert(size > 1); 1095 } 1096 else 1097 crDmpStrF(pRec->pDumper, "%s %s;", crRecDumpVarTypeString(type, pRec->pDumper), pszName); 1098 1099 crDmpStrF(pRec->pDumper, "Array buff(%d), enabled(%d) size(%d), stride(%d), type(%s), normalized(%d), integer(%d)", arrayBufferBind, arrayEnabled, arraySize, arrayStride, crRecDumpVarTypeString(arrayType, pRec->pDumper), arrayNormalized, arrayInteger); 1100 1101 GLint attribTypeSize = crStateGetUniformSize(type); 1102 Assert(attribTypeSize >= 1); 1103 1104 for (j=0; j<size; ++j) 1105 { 1106 if (size>1) 1107 { 1108 sprintf(pIndexStr, "[%i]", j); 1109 } 1110 location = pRec->pDispatch->GetAttribLocation(hwid, pszName); 1111 1112 if (crStateIsIntUniform(type)) 1113 { 1114 pRec->pDispatch->GetVertexAttribivARB(location, GL_CURRENT_VERTEX_ATTRIB, &idata[0]); 1115 switch (attribTypeSize) 1116 { 1117 case 1: 1118 crDmpStrF(pRec->pDumper, "%s = %d; //location %d", pszName, idata[0], location); 1119 break; 1120 case 2: 1121 crDmpStrF(pRec->pDumper, "%s = {%d, %d}; //location %d", pszName, idata[0], idata[1], location); 1122 break; 1123 case 3: 1124 crDmpStrF(pRec->pDumper, "%s = {%d, %d, %d}; //location %d", pszName, idata[0], idata[1], idata[2], location); 1125 break; 1126 case 4: 1127 crDmpStrF(pRec->pDumper, "%s = {%d, %d, %d, %d}; //location %d", pszName, idata[0], idata[1], idata[2], idata[3], location); 1128 break; 1129 default: 1130 for (GLint k = 0; k < attribTypeSize; ++k) 1131 { 1132 crDmpStrF(pRec->pDumper, "%s[%d] = %d; //location %d", pszName, k, idata[k], location); 1133 } 1134 break; 1135 } 1136 } 1137 else 1138 { 1139 pRec->pDispatch->GetVertexAttribfvARB(location, GL_CURRENT_VERTEX_ATTRIB, &fdata[0]); 1140 switch (attribTypeSize) 1141 { 1142 case 1: 1143 crDmpStrF(pRec->pDumper, "%s = %f; //location %d", pszName, fdata[0], location); 1144 break; 1145 case 2: 1146 crDmpStrF(pRec->pDumper, "%s = {%f, %f}; //location %d", pszName, fdata[0], fdata[1], location); 1147 break; 1148 case 3: 1149 crDmpStrF(pRec->pDumper, "%s = {%f, %f, %f}; //location %d", pszName, fdata[0], fdata[1], fdata[2], location); 1150 break; 1151 case 4: 1152 crDmpStrF(pRec->pDumper, "%s = {%f, %f, %f, %f}; //location %d", pszName, fdata[0], fdata[1], fdata[2], fdata[3], location); 1153 break; 1154 default: 1155 for (GLint k = 0; k < attribTypeSize; ++k) 1156 { 1157 crDmpStrF(pRec->pDumper, "%s[%d] = %f; //location %d", pszName, k, fdata[k], location); 855 1158 } 856 1159 break; … … 884 1187 } 885 1188 1189 VBOXDUMPDECL(void) crRecDumpCurrentProgramAttribs(CR_RECORDER *pRec, CRContext *ctx) 1190 { 1191 GLint curProgram = 0; 1192 pRec->pDispatch->GetIntegerv(GL_CURRENT_PROGRAM, &curProgram); 1193 if (curProgram) 1194 { 1195 Assert(ctx->glsl.activeProgram); 1196 if (!ctx->glsl.activeProgram) 1197 crWarning("no active program state with active hw program"); 1198 else 1199 Assert(ctx->glsl.activeProgram->hwid == curProgram); 1200 crRecDumpProgramAttribs(pRec, ctx, 0, curProgram); 1201 } 1202 else 1203 { 1204 Assert(!ctx->glsl.activeProgram); 1205 crDmpStrF(pRec->pDumper, "--no active program"); 1206 } 1207 } 1208 1209 VBOXDUMPDECL(void) crRecRecompileCurrentProgram(CR_RECORDER *pRec, CRContext *ctx) 1210 { 1211 GLint curProgram = 0; 1212 pRec->pDispatch->GetIntegerv(GL_CURRENT_PROGRAM, &curProgram); 1213 if (curProgram) 1214 { 1215 Assert(ctx->glsl.activeProgram); 1216 if (!ctx->glsl.activeProgram) 1217 crWarning("no active program state with active hw program"); 1218 else 1219 Assert(ctx->glsl.activeProgram->hwid == curProgram); 1220 crRecRecompileProgram(pRec, ctx, 0, curProgram); 1221 } 1222 else 1223 { 1224 Assert(!ctx->glsl.activeProgram); 1225 crDmpStrF(pRec->pDumper, "--no active program"); 1226 } 1227 } 1228 886 1229 void crRecDumpTextures(CR_RECORDER *pRec, CRContext *ctx, CR_BLITTER_CONTEXT *pCurCtx, CR_BLITTER_WINDOW *pCurWin) 887 1230 { … … 972 1315 Tex.hwid = hwTex; 973 1316 1317 crRecDumpTexParam(pRec, ctx, GL_TEXTURE_2D); 1318 crRecDumpTexEnv(pRec, ctx); 1319 crRecDumpTexGen(pRec, ctx); 1320 974 1321 rc = CrBltEnter(pRec->pBlitter, pCurCtx, pCurWin); 975 1322 if (RT_SUCCESS(rc)) … … 978 1325 if (RT_SUCCESS(rc)) 979 1326 { 980 crDmpImgF(pRec->pDumper, &Img, "ctx(%d), Unit %d: TEXTURE_2D id(%d) hwid(%d) ", ctx, i, pTobj->id, pTobj->hwid);1327 crDmpImgF(pRec->pDumper, &Img, "ctx(%d), Unit %d: TEXTURE_2D id(%d) hwid(%d), width(%d), height(%d)", ctx, i, pTobj->id, pTobj->hwid, width, height); 981 1328 CrBltImgFree(pRec->pBlitter, &Img); 982 1329 } -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/dump_gen.py
r46453 r46515 128 128 #endif 129 129 """ 130 131 from get_components import *; 132 133 texenv_mappings = { 134 'GL_TEXTURE_ENV' : [ 135 'GL_TEXTURE_ENV_MODE', 136 'GL_TEXTURE_ENV_COLOR', 137 'GL_COMBINE_RGB', 138 'GL_COMBINE_ALPHA', 139 'GL_RGB_SCALE', 140 'GL_ALPHA_SCALE', 141 'GL_SRC0_RGB', 142 'GL_SRC1_RGB', 143 'GL_SRC2_RGB', 144 'GL_SRC0_ALPHA', 145 'GL_SRC1_ALPHA', 146 'GL_SRC2_ALPHA' 147 ], 148 'GL_TEXTURE_FILTER_CONTROL' : [ 149 'GL_TEXTURE_LOD_BIAS' 150 ], 151 'GL_POINT_SPRITE' : [ 152 'GL_COORD_REPLACE' 153 ] 154 } 155 156 texgen_coords = [ 157 'GL_S', 158 'GL_T', 159 'GL_R', 160 'GL_Q' 161 ] 162 163 texgen_names = [ 164 'GL_TEXTURE_GEN_MODE', 165 'GL_OBJECT_PLANE', 166 'GL_EYE_PLANE' 167 ] 168 169 texparam_names = [ 170 'GL_TEXTURE_MAG_FILTER', 171 'GL_TEXTURE_MIN_FILTER', 172 'GL_TEXTURE_MIN_LOD', 173 'GL_TEXTURE_MAX_LOD', 174 'GL_TEXTURE_BASE_LEVEL', 175 'GL_TEXTURE_MAX_LEVEL', 176 'GL_TEXTURE_WRAP_S', 177 'GL_TEXTURE_WRAP_T', 178 'GL_TEXTURE_WRAP_R', 179 'GL_TEXTURE_BORDER_COLOR', 180 'GL_TEXTURE_PRIORITY', 181 'GL_TEXTURE_RESIDENT', 182 'GL_TEXTURE_COMPARE_MODE', 183 'GL_TEXTURE_COMPARE_FUNC', 184 'GL_DEPTH_TEXTURE_MODE', 185 'GL_GENERATE_MIPMAP' 186 ] 187 188 print """ 189 void crRecDumpTexParam(CR_RECORDER *pRec, CRContext *ctx, GLenum enmTarget) 190 { 191 GLfloat afBuf[4]; 192 char acBuf[1024]; 193 unsigned int cComponents; 194 crDmpStrF(pRec->pDumper, "==TEX_PARAM for target(0x%x)==", enmTarget); 195 """ 196 for pname in texparam_names: 197 print "\tcComponents = lookupComponents(%s);" % pname 198 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));" 199 print "\tmemset(afBuf, 0, sizeof (afBuf));" 200 print "\tpRec->pDispatch->GetTexParameterfv(enmTarget, %s, afBuf);" % pname 201 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);" 202 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname 203 print """ 204 crDmpStrF(pRec->pDumper, "==Done TEX_PARAM for target(0x%x)==", enmTarget); 205 } 206 """ 207 208 print """ 209 void crRecDumpTexEnv(CR_RECORDER *pRec, CRContext *ctx) 210 { 211 GLfloat afBuf[4]; 212 char acBuf[1024]; 213 unsigned int cComponents; 214 crDmpStrF(pRec->pDumper, "==TEX_ENV=="); 215 """ 216 217 keys = texenv_mappings.keys() 218 keys.sort(); 219 220 for target in keys: 221 print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % target 222 values = texenv_mappings[target] 223 for pname in values: 224 print "\tcComponents = lookupComponents(%s);" % pname 225 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));" 226 print "\tmemset(afBuf, 0, sizeof (afBuf));" 227 print "\tpRec->pDispatch->GetTexEnvfv(%s, %s, afBuf);" % (target, pname) 228 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);" 229 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname 230 print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % target 231 print """ 232 crDmpStrF(pRec->pDumper, "==Done TEX_ENV=="); 233 } 234 """ 235 236 237 print """ 238 void crRecDumpTexGen(CR_RECORDER *pRec, CRContext *ctx) 239 { 240 GLdouble afBuf[4]; 241 char acBuf[1024]; 242 unsigned int cComponents; 243 crDmpStrF(pRec->pDumper, "==TEX_GEN=="); 244 """ 245 246 for coord in texgen_coords: 247 print "\tcrDmpStrF(pRec->pDumper, \"===%s===\");" % coord 248 for pname in texgen_names: 249 print "\tcComponents = lookupComponents(%s);" % pname 250 print "\tAssert(cComponents <= RT_ELEMENTS(afBuf));" 251 print "\tmemset(afBuf, 0, sizeof (afBuf));" 252 print "\tpRec->pDispatch->GetTexGendv(%s, %s, afBuf);" % (coord, pname) 253 print "\tcrDmpFormatArray(acBuf, sizeof (acBuf), \"%f\", sizeof (afBuf[0]), afBuf, cComponents);" 254 print "\tcrDmpStrF(pRec->pDumper, \"%s = %%s;\", acBuf);" % pname 255 print "\tcrDmpStrF(pRec->pDumper, \"===Done %s===\");" % coord 256 print """ 257 crDmpStrF(pRec->pDumper, "==Done TEX_GEN=="); 258 } 259 """
Note:
See TracChangeset
for help on using the changeset viewer.