Changeset 25303 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- Dec 10, 2009 3:05:55 PM (15 years ago)
- Location:
- trunk/src/VBox/GuestHost/OpenGL
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/OpenGL/include/cr_glstate.h
r25155 r25303 81 81 #endif 82 82 CRPixelBits pixel; 83 CRPointBits point;83 CRPointBits point; 84 84 CRPolygonBits polygon; 85 85 CRProgramBits program; -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_bufferobject.c
r25216 r25303 791 791 792 792 /*@todo, move to state_client.c*/ 793 794 795 /*@todo, patch dirty bits after snapshot loading instead*/796 if (toCtx->client.array.v.enabled)797 {798 diff_api.EnableClientState(GL_VERTEX_ARRAY);799 }800 801 793 cp = &toCtx->client.array.v; 802 794 if (cp->buffer->name || locked) -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_client.c
r23123 r25303 17 17 #include "state/cr_statefuncs.h" 18 18 #include "state_internals.h" 19 20 #define GLCLIENT_BIT_ALLOC 102421 22 19 23 20 const CRPixelPackState crStateNativePixelPacking = { -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_internals.h
r15532 r25303 25 25 typedef void (SPU_APIENTRY *glAble)(GLenum); 26 26 27 #define GLCLIENT_BIT_ALLOC 1024 28 27 29 #endif -
trunk/src/VBox/GuestHost/OpenGL/state_tracker/state_snapshot.c
r25216 r25303 22 22 23 23 #include "state.h" 24 #include "state_internals.h" 24 25 #include "state/cr_statetypes.h" 25 26 #include "state/cr_texture.h" … … 207 208 #endif 208 209 crStateTextureInitTextureFormat(ptl, ptl->internalFormat); 209 210 //FILLDIRTY(ptl->dirty);211 210 } 212 211 } … … 897 896 } 898 897 898 static int32_t crStateSaveCurrentBits(CRStateBits *pBits, PSSMHANDLE pSSM) 899 { 900 int32_t rc, i; 901 902 rc = SSMR3PutMem(pSSM, pBits, sizeof(*pBits)); 903 AssertRCReturn(rc, rc); 904 905 rc = SSMR3PutMem(pSSM, pBits->client.v, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 906 AssertRCReturn(rc, rc); 907 rc = SSMR3PutMem(pSSM, pBits->client.n, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 908 AssertRCReturn(rc, rc); 909 rc = SSMR3PutMem(pSSM, pBits->client.c, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 910 AssertRCReturn(rc, rc); 911 rc = SSMR3PutMem(pSSM, pBits->client.s, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 912 AssertRCReturn(rc, rc); 913 rc = SSMR3PutMem(pSSM, pBits->client.i, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 914 AssertRCReturn(rc, rc); 915 for (i=0; i<CR_MAX_TEXTURE_UNITS; i++) 916 { 917 rc = SSMR3PutMem(pSSM, pBits->client.t[i], GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 918 AssertRCReturn(rc, rc); 919 } 920 rc = SSMR3PutMem(pSSM, pBits->client.e, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 921 AssertRCReturn(rc, rc); 922 rc = SSMR3PutMem(pSSM, pBits->client.f, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 923 AssertRCReturn(rc, rc); 924 #ifdef CR_NV_vertex_program 925 for (i=0; i<CR_MAX_VERTEX_ATTRIBS; i++) 926 { 927 rc = SSMR3PutMem(pSSM, pBits->client.a[i], GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 928 AssertRCReturn(rc, rc); 929 } 930 #endif 931 932 rc = SSMR3PutMem(pSSM, pBits->lighting.light, CR_MAX_LIGHTS*sizeof(pBits->lighting.light)); 933 AssertRCReturn(rc, rc); 934 935 return VINF_SUCCESS; 936 } 937 938 static int32_t crStateLoadCurrentBits(CRStateBits *pBits, PSSMHANDLE pSSM) 939 { 940 int32_t rc, i; 941 CRClientBits client; 942 CRLightingBits lighting; 943 944 CRASSERT(pBits); 945 946 client.v = pBits->client.v; 947 client.n = pBits->client.n; 948 client.c = pBits->client.c; 949 client.s = pBits->client.s; 950 client.i = pBits->client.i; 951 client.e = pBits->client.e; 952 client.f = pBits->client.f; 953 for (i=0; i<CR_MAX_TEXTURE_UNITS; i++) 954 { 955 client.t[i] = pBits->client.t[i]; 956 } 957 #ifdef CR_NV_vertex_program 958 for (i=0; i<CR_MAX_VERTEX_ATTRIBS; i++) 959 { 960 client.a[i] = pBits->client.a[i]; 961 } 962 #endif 963 lighting.light = pBits->lighting.light; 964 965 rc = SSMR3GetMem(pSSM, pBits, sizeof(*pBits)); 966 AssertRCReturn(rc, rc); 967 968 pBits->client.v = client.v; 969 rc = SSMR3GetMem(pSSM, pBits->client.v, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 970 AssertRCReturn(rc, rc); 971 pBits->client.n = client.n; 972 rc = SSMR3GetMem(pSSM, pBits->client.n, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 973 AssertRCReturn(rc, rc); 974 pBits->client.c = client.c; 975 rc = SSMR3GetMem(pSSM, pBits->client.c, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 976 AssertRCReturn(rc, rc); 977 pBits->client.s = client.s; 978 rc = SSMR3GetMem(pSSM, pBits->client.s, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 979 AssertRCReturn(rc, rc); 980 pBits->client.i = client.i; 981 rc = SSMR3GetMem(pSSM, pBits->client.i, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 982 AssertRCReturn(rc, rc); 983 pBits->client.e = client.e; 984 rc = SSMR3GetMem(pSSM, pBits->client.e, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 985 AssertRCReturn(rc, rc); 986 pBits->client.f = client.f; 987 rc = SSMR3GetMem(pSSM, pBits->client.f, GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 988 AssertRCReturn(rc, rc); 989 for (i=0; i<CR_MAX_TEXTURE_UNITS; i++) 990 { 991 pBits->client.t[i] = client.t[i]; 992 rc = SSMR3GetMem(pSSM, pBits->client.t[i], GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 993 AssertRCReturn(rc, rc); 994 } 995 #ifdef CR_NV_vertex_program 996 for (i=0; i<CR_MAX_VERTEX_ATTRIBS; i++) 997 { 998 pBits->client.a[i] = client.a[i]; 999 rc = SSMR3GetMem(pSSM, pBits->client.a[i], GLCLIENT_BIT_ALLOC*sizeof(CRbitvalue)); 1000 AssertRCReturn(rc, rc); 1001 } 1002 #endif 1003 1004 pBits->lighting.light = lighting.light; 1005 rc = SSMR3GetMem(pSSM, pBits->lighting.light, CR_MAX_LIGHTS*sizeof(pBits->lighting.light)); 1006 AssertRCReturn(rc, rc); 1007 1008 return VINF_SUCCESS; 1009 } 1010 899 1011 int32_t crStateSaveContext(CRContext *pContext, PSSMHANDLE pSSM) 900 1012 { … … 1417 1529 AssertRCReturn(rc, rc); 1418 1530 1419 //DIRTY(pTexture->dirty, pContext->neg_bitid);1420 //DIRTY(pTexture->imageBit, pContext->neg_bitid);1421 1422 1531 /*allocate actual memory*/ 1423 1532 for (i=0; i<6; ++i) { … … 1438 1547 AssertRCReturn(rc, rc); 1439 1548 } 1440 //FILLDIRTY(GetCurrentBits()->texture.dirty);1441 1549 1442 1550 /* Mark textures for resending to GPU */ … … 1535 1643 rc = SSMR3GetMem(pSSM, pBufferObj->data, pBufferObj->size); 1536 1644 AssertRCReturn(rc, rc); 1537 1538 //DIRTY(pBufferObj->dirty, pContext->neg_bitid);1539 //pBufferObj->dirtyStart = 0;1540 //pBufferObj->dirtyLength = pBufferObj->size;1541 1645 } 1542 1646 else if (pBufferObj->name!=0 && pBufferObj->size>0) … … 1557 1661 crHashtableAdd(pContext->bufferobject.buffers, key, pBufferObj); 1558 1662 } 1559 //FILLDIRTY(GetCurrentBits()->bufferobject.dirty);1560 1663 /* Load pointers */ 1561 1664 #define CRS_GET_BO(name) (((name)==0) ? (pContext->bufferobject.nullBuffer) : crHashtableSearch(pContext->bufferobject.buffers, name)) … … 1593 1696 rc = crStateLoadProgram(&pContext->program.defaultVertexProgram, pSSM); 1594 1697 AssertRCReturn(rc, rc); 1595 //FILLDIRTY(pContext->program.defaultVertexProgram->dirtyProgram);1596 1698 rc = crStateLoadProgram(&pContext->program.defaultFragmentProgram, pSSM); 1597 1699 AssertRCReturn(rc, rc); 1598 //FILLDIRTY(pContext->program.defaultFragmentProgram->dirtyProgram);1599 1700 /* Load all the rest */ 1600 1701 for (ui=0; ui<uiNumElems; ++ui) … … 1607 1708 1608 1709 } 1609 //FILLDIRTY(GetCurrentBits()->program.dirty);1610 1710 /* Load Pointers */ 1611 1711 rc = SSMR3GetU32(pSSM, &ui); … … 1794 1894 #endif 1795 1895 1896 1897 /*Restore front buffer image*/ 1796 1898 { 1797 1899 CRViewportState *pVP = &pContext->viewport; … … 1811 1913 } 1812 1914 1915 1916 /*Mark all as dirty to make sure we'd restore correct context state*/ 1917 { 1918 CRStateBits *pBits = GetCurrentBits(); 1919 1920 FILLDIRTY(pBits->attrib.dirty); 1921 1922 FILLDIRTY(pBits->buffer.dirty); 1923 FILLDIRTY(pBits->buffer.enable); 1924 FILLDIRTY(pBits->buffer.alphaFunc); 1925 FILLDIRTY(pBits->buffer.depthFunc); 1926 FILLDIRTY(pBits->buffer.blendFunc); 1927 FILLDIRTY(pBits->buffer.logicOp); 1928 FILLDIRTY(pBits->buffer.indexLogicOp); 1929 FILLDIRTY(pBits->buffer.drawBuffer); 1930 FILLDIRTY(pBits->buffer.readBuffer); 1931 FILLDIRTY(pBits->buffer.indexMask); 1932 FILLDIRTY(pBits->buffer.colorWriteMask); 1933 FILLDIRTY(pBits->buffer.clearColor); 1934 FILLDIRTY(pBits->buffer.clearIndex); 1935 FILLDIRTY(pBits->buffer.clearDepth); 1936 FILLDIRTY(pBits->buffer.clearAccum); 1937 FILLDIRTY(pBits->buffer.depthMask); 1938 #ifdef CR_EXT_blend_color 1939 FILLDIRTY(pBits->buffer.blendColor); 1940 #endif 1941 #if defined(CR_EXT_blend_minmax) || defined(CR_EXT_blend_subtract) || defined(CR_EXT_blend_logic_op) 1942 FILLDIRTY(pBits->buffer.blendEquation); 1943 #endif 1944 #if defined(CR_EXT_blend_func_separate) 1945 FILLDIRTY(pBits->buffer.blendFuncSeparate); 1946 #endif 1947 1948 #ifdef CR_ARB_vertex_buffer_object 1949 FILLDIRTY(pBits->bufferobject.dirty); 1950 FILLDIRTY(pBits->bufferobject.arrayBinding); 1951 FILLDIRTY(pBits->bufferobject.elementsBinding); 1952 #endif 1953 1954 FILLDIRTY(pBits->client.dirty); 1955 FILLDIRTY(pBits->client.pack); 1956 FILLDIRTY(pBits->client.unpack); 1957 FILLDIRTY(pBits->client.enableClientState); 1958 FILLDIRTY(pBits->client.clientPointer); 1959 FILLDIRTY(pBits->client.v); 1960 FILLDIRTY(pBits->client.n); 1961 FILLDIRTY(pBits->client.c); 1962 FILLDIRTY(pBits->client.i); 1963 FILLDIRTY(pBits->client.e); 1964 FILLDIRTY(pBits->client.s); 1965 FILLDIRTY(pBits->client.f); 1966 for (i=0; i<CR_MAX_TEXTURE_UNITS; i++) 1967 { 1968 FILLDIRTY(pBits->client.t[i]); 1969 } 1970 #ifdef CR_NV_vertex_program 1971 for (i=0; i<CR_MAX_VERTEX_ATTRIBS; i++) 1972 { 1973 FILLDIRTY(pBits->client.a[i]); 1974 } 1975 #endif 1976 1977 FILLDIRTY(pBits->current.dirty); 1978 for (i=0; i<CR_MAX_VERTEX_ATTRIBS; i++) 1979 { 1980 FILLDIRTY(pBits->current.vertexAttrib[i]); 1981 } 1982 FILLDIRTY(pBits->current.edgeFlag); 1983 FILLDIRTY(pBits->current.colorIndex); 1984 FILLDIRTY(pBits->current.rasterPos); 1985 1986 1987 FILLDIRTY(pBits->eval.dirty); 1988 for (i=0; i<GLEVAL_TOT; i++) 1989 { 1990 FILLDIRTY(pBits->eval.eval1D[i]); 1991 FILLDIRTY(pBits->eval.eval2D[i]); 1992 FILLDIRTY(pBits->eval.enable1D[i]); 1993 FILLDIRTY(pBits->eval.enable2D[i]); 1994 } 1995 FILLDIRTY(pBits->eval.enable); 1996 FILLDIRTY(pBits->eval.grid1D); 1997 FILLDIRTY(pBits->eval.grid2D); 1998 #ifdef CR_NV_vertex_program 1999 /*@todo Those seems to be unused? 2000 FILLDIRTY(pBits->eval.enableAttrib1D); 2001 FILLDIRTY(pBits->eval.enableAttrib2D); 2002 */ 2003 #endif 2004 2005 FILLDIRTY(pBits->feedback.dirty); 2006 FILLDIRTY(pBits->selection.dirty); 2007 2008 FILLDIRTY(pBits->fog.dirty); 2009 FILLDIRTY(pBits->fog.color); 2010 FILLDIRTY(pBits->fog.index); 2011 FILLDIRTY(pBits->fog.density); 2012 FILLDIRTY(pBits->fog.start); 2013 FILLDIRTY(pBits->fog.end); 2014 FILLDIRTY(pBits->fog.mode); 2015 FILLDIRTY(pBits->fog.enable); 2016 #ifdef CR_NV_fog_distance 2017 FILLDIRTY(pBits->fog.fogDistanceMode); 2018 #endif 2019 #ifdef CR_EXT_fog_coord 2020 FILLDIRTY(pBits->fog.fogCoordinateSource); 2021 #endif 2022 2023 FILLDIRTY(pBits->hint.dirty); 2024 FILLDIRTY(pBits->hint.perspectiveCorrection); 2025 FILLDIRTY(pBits->hint.pointSmooth); 2026 FILLDIRTY(pBits->hint.lineSmooth); 2027 FILLDIRTY(pBits->hint.polygonSmooth); 2028 FILLDIRTY(pBits->hint.fog); 2029 #ifdef CR_EXT_clip_volume_hint 2030 FILLDIRTY(pBits->hint.clipVolumeClipping); 2031 2032 #endif 2033 #ifdef CR_ARB_texture_compression 2034 FILLDIRTY(pBits->hint.textureCompression); 2035 #endif 2036 #ifdef CR_SGIS_generate_mipmap 2037 FILLDIRTY(pBits->hint.generateMipmap); 2038 #endif 2039 2040 FILLDIRTY(pBits->lighting.dirty); 2041 FILLDIRTY(pBits->lighting.shadeModel); 2042 FILLDIRTY(pBits->lighting.colorMaterial); 2043 FILLDIRTY(pBits->lighting.lightModel); 2044 FILLDIRTY(pBits->lighting.material); 2045 FILLDIRTY(pBits->lighting.enable); 2046 for (i=0; i<CR_MAX_LIGHTS; ++i) 2047 { 2048 FILLDIRTY(pBits->lighting.light[i].dirty); 2049 FILLDIRTY(pBits->lighting.light[i].enable); 2050 FILLDIRTY(pBits->lighting.light[i].ambient); 2051 FILLDIRTY(pBits->lighting.light[i].diffuse); 2052 FILLDIRTY(pBits->lighting.light[i].specular); 2053 FILLDIRTY(pBits->lighting.light[i].position); 2054 FILLDIRTY(pBits->lighting.light[i].attenuation); 2055 FILLDIRTY(pBits->lighting.light[i].spot); 2056 } 2057 2058 FILLDIRTY(pBits->line.dirty); 2059 FILLDIRTY(pBits->line.enable); 2060 FILLDIRTY(pBits->line.width); 2061 FILLDIRTY(pBits->line.stipple); 2062 2063 FILLDIRTY(pBits->lists.dirty); 2064 FILLDIRTY(pBits->lists.base); 2065 2066 FILLDIRTY(pBits->multisample.dirty); 2067 FILLDIRTY(pBits->multisample.enable); 2068 FILLDIRTY(pBits->multisample.sampleAlphaToCoverage); 2069 FILLDIRTY(pBits->multisample.sampleAlphaToOne); 2070 FILLDIRTY(pBits->multisample.sampleCoverage); 2071 FILLDIRTY(pBits->multisample.sampleCoverageValue); 2072 2073 #if CR_ARB_occlusion_query 2074 FILLDIRTY(pBits->occlusion.dirty); 2075 #endif 2076 2077 FILLDIRTY(pBits->pixel.dirty); 2078 FILLDIRTY(pBits->pixel.transfer); 2079 FILLDIRTY(pBits->pixel.zoom); 2080 FILLDIRTY(pBits->pixel.maps); 2081 2082 FILLDIRTY(pBits->point.dirty); 2083 FILLDIRTY(pBits->point.enableSmooth); 2084 FILLDIRTY(pBits->point.size); 2085 #ifdef CR_ARB_point_parameters 2086 FILLDIRTY(pBits->point.minSize); 2087 FILLDIRTY(pBits->point.maxSize); 2088 FILLDIRTY(pBits->point.fadeThresholdSize); 2089 FILLDIRTY(pBits->point.distanceAttenuation); 2090 #endif 2091 #ifdef CR_ARB_point_sprite 2092 FILLDIRTY(pBits->point.enableSprite); 2093 for (i=0; i<CR_MAX_TEXTURE_UNITS; ++i) 2094 { 2095 FILLDIRTY(pBits->point.coordReplacement[i]); 2096 } 2097 #endif 2098 2099 FILLDIRTY(pBits->polygon.dirty); 2100 FILLDIRTY(pBits->polygon.enable); 2101 FILLDIRTY(pBits->polygon.offset); 2102 FILLDIRTY(pBits->polygon.mode); 2103 FILLDIRTY(pBits->polygon.stipple); 2104 2105 FILLDIRTY(pBits->program.dirty); 2106 FILLDIRTY(pBits->program.vpEnable); 2107 FILLDIRTY(pBits->program.fpEnable); 2108 FILLDIRTY(pBits->program.vpBinding); 2109 FILLDIRTY(pBits->program.fpBinding); 2110 for (i=0; i<CR_MAX_VERTEX_ATTRIBS; ++i) 2111 { 2112 FILLDIRTY(pBits->program.vertexAttribArrayEnable[i]); 2113 FILLDIRTY(pBits->program.map1AttribArrayEnable[i]); 2114 FILLDIRTY(pBits->program.map2AttribArrayEnable[i]); 2115 } 2116 for (i=0; i<CR_MAX_VERTEX_PROGRAM_ENV_PARAMS; ++i) 2117 { 2118 FILLDIRTY(pBits->program.vertexEnvParameter[i]); 2119 } 2120 for (i=0; i<CR_MAX_FRAGMENT_PROGRAM_ENV_PARAMS; ++i) 2121 { 2122 FILLDIRTY(pBits->program.fragmentEnvParameter[i]); 2123 } 2124 FILLDIRTY(pBits->program.vertexEnvParameters); 2125 FILLDIRTY(pBits->program.fragmentEnvParameters); 2126 for (i=0; i<CR_MAX_VERTEX_PROGRAM_ENV_PARAMS/4; ++i) 2127 { 2128 FILLDIRTY(pBits->program.trackMatrix[i]); 2129 } 2130 2131 FILLDIRTY(pBits->regcombiner.dirty); 2132 FILLDIRTY(pBits->regcombiner.enable); 2133 FILLDIRTY(pBits->regcombiner.regCombinerVars); 2134 FILLDIRTY(pBits->regcombiner.regCombinerColor0); 2135 FILLDIRTY(pBits->regcombiner.regCombinerColor1); 2136 for (i=0; i<CR_MAX_GENERAL_COMBINERS; ++i) 2137 { 2138 FILLDIRTY(pBits->regcombiner.regCombinerStageColor0[i]); 2139 FILLDIRTY(pBits->regcombiner.regCombinerStageColor1[i]); 2140 FILLDIRTY(pBits->regcombiner.regCombinerInput[i]); 2141 FILLDIRTY(pBits->regcombiner.regCombinerOutput[i]); 2142 } 2143 FILLDIRTY(pBits->regcombiner.regCombinerFinalInput); 2144 2145 FILLDIRTY(pBits->stencil.dirty); 2146 FILLDIRTY(pBits->stencil.enable); 2147 FILLDIRTY(pBits->stencil.func); 2148 FILLDIRTY(pBits->stencil.op); 2149 FILLDIRTY(pBits->stencil.clearValue); 2150 FILLDIRTY(pBits->stencil.writeMask); 2151 2152 FILLDIRTY(pBits->texture.dirty); 2153 for (i=0; i<CR_MAX_TEXTURE_UNITS; ++i) 2154 { 2155 FILLDIRTY(pBits->texture.enable[i]); 2156 FILLDIRTY(pBits->texture.current[i]); 2157 FILLDIRTY(pBits->texture.objGen[i]); 2158 FILLDIRTY(pBits->texture.eyeGen[i]); 2159 FILLDIRTY(pBits->texture.genMode[i]); 2160 FILLDIRTY(pBits->texture.envBit[i]); 2161 } 2162 2163 FILLDIRTY(pBits->transform.dirty); 2164 FILLDIRTY(pBits->transform.matrixMode); 2165 FILLDIRTY(pBits->transform.modelviewMatrix); 2166 FILLDIRTY(pBits->transform.projectionMatrix); 2167 FILLDIRTY(pBits->transform.colorMatrix); 2168 FILLDIRTY(pBits->transform.textureMatrix); 2169 FILLDIRTY(pBits->transform.programMatrix); 2170 FILLDIRTY(pBits->transform.clipPlane); 2171 FILLDIRTY(pBits->transform.enable); 2172 FILLDIRTY(pBits->transform.base); 2173 2174 FILLDIRTY(pBits->viewport.dirty); 2175 FILLDIRTY(pBits->viewport.v_dims); 2176 FILLDIRTY(pBits->viewport.s_dims); 2177 FILLDIRTY(pBits->viewport.enable); 2178 FILLDIRTY(pBits->viewport.depth); 2179 } 2180 1813 2181 return VINF_SUCCESS; 1814 2182 }
Note:
See TracChangeset
for help on using the changeset viewer.