- Timestamp:
- Dec 16, 2019 3:23:17 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 135467
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h
r82165 r82586 693 693 #endif 694 694 695 /** @def VMSVGA3DSURFACE_NEEDS_DATA 696 * Checks whether SurfaceDMA transfers must always update pSurfaceData, 697 * even if the surface has a host hardware resource. 698 * @returns true/false 699 * @param a_pSurface The VMSVGA3d surface. 700 */ 701 #ifdef VMSVGA3D_DIRECT3D 702 # define VMSVGA3DSURFACE_NEEDS_DATA(a_pSurface) \ 703 ( (a_pSurface)->enmD3DResType == VMSVGA3D_D3DRESTYPE_VERTEX_BUFFER \ 704 || (a_pSurface)->enmD3DResType == VMSVGA3D_D3DRESTYPE_INDEX_BUFFER) 705 #else 706 # define VMSVGA3DSURFACE_NEEDS_DATA(a_pSurface) \ 707 ((a_pSurface)->enmOGLResType == VMSVGA3D_OGLRESTYPE_BUFFER) 708 #endif 695 709 696 710 … … 1084 1098 PFNGLDELETESHADERPROC glDeleteShader; 1085 1099 PFNGLDELETEPROGRAMPROC glDeleteProgram; 1100 PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv; 1101 PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv; 1102 PFNGLVERTEXATTRIB4NUBVPROC glVertexAttrib4Nubv; 1103 PFNGLVERTEXATTRIB4SVPROC glVertexAttrib4sv; 1104 PFNGLVERTEXATTRIB4NSVPROC glVertexAttrib4Nsv; 1105 PFNGLVERTEXATTRIB4NUSVPROC glVertexAttrib4Nusv; 1086 1106 } ext; 1087 1107 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r82583 r82586 737 737 GLGETPROC_(PFNGLDELETESHADERPROC , glDeleteShader, ""); 738 738 GLGETPROC_(PFNGLDELETEPROGRAMPROC , glDeleteProgram, ""); 739 740 GLGETPROC_(PFNGLVERTEXATTRIB4FVPROC , glVertexAttrib4fv, ""); 741 GLGETPROC_(PFNGLVERTEXATTRIB4UBVPROC , glVertexAttrib4ubv, ""); 742 GLGETPROC_(PFNGLVERTEXATTRIB4NUBVPROC , glVertexAttrib4Nubv, ""); 743 GLGETPROC_(PFNGLVERTEXATTRIB4SVPROC , glVertexAttrib4sv, ""); 744 GLGETPROC_(PFNGLVERTEXATTRIB4NSVPROC , glVertexAttrib4Nsv, ""); 745 GLGETPROC_(PFNGLVERTEXATTRIB4NUSVPROC , glVertexAttrib4Nusv, ""); 739 746 740 747 /* OpenGL 3.0 core, GL_ARB_instanced_arrays. Same functions names in the ARB and core specs. */ … … 3102 3109 pBox->x, pBox->y, pBox->x + pBox->w, pBox->y + pBox->h)); 3103 3110 3111 /* The caller already copied the data to the pMipLevel->pSurfaceData buffer, see VMSVGA3DSURFACE_NEEDS_DATA. */ 3104 3112 uint32_t const offHst = pBox->x * pSurface->cbBlock; 3105 3113 uint32_t const cbWidth = pBox->w * pSurface->cbBlock; 3106 3114 3107 rc = vmsvgaR3GmrTransfer(pThis, 3108 pThisCC, 3109 transfer, 3110 pbData, 3111 pMipLevel->cbSurface, 3112 offHst, 3113 pMipLevel->cbSurfacePitch, 3114 GuestPtr, 3115 pBox->srcx * pSurface->cbBlock, 3116 cbGuestPitch, 3117 cbWidth, 3118 pBox->h); 3119 AssertRC(rc); 3115 memcpy(pbData + offHst, (uint8_t *)pMipLevel->pSurfaceData + offHst, cbWidth); 3120 3116 3121 3117 Log4(("Buffer updated at [0x%x;0x%x):\n%.*Rhxd\n", offHst, offHst + cbWidth, cbWidth, (uint8_t *)pbData + offHst)); … … 5899 5895 5900 5896 /* Convert VMWare vertex declaration to its OpenGL equivalent. */ 5901 int vmsvga3dVertexDecl2OGL(SVGA3dVertexArrayIdentity &identity, GLint &size, GLenum &type, GLboolean &normalized )5897 int vmsvga3dVertexDecl2OGL(SVGA3dVertexArrayIdentity &identity, GLint &size, GLenum &type, GLboolean &normalized, uint32_t &cbAttrib) 5902 5898 { 5903 5899 normalized = GL_FALSE; … … 5907 5903 size = 1; 5908 5904 type = GL_FLOAT; 5905 cbAttrib = sizeof(float); 5909 5906 break; 5910 5907 case SVGA3D_DECLTYPE_FLOAT2: 5911 5908 size = 2; 5912 5909 type = GL_FLOAT; 5910 cbAttrib = 2 * sizeof(float); 5913 5911 break; 5914 5912 case SVGA3D_DECLTYPE_FLOAT3: 5915 5913 size = 3; 5916 5914 type = GL_FLOAT; 5915 cbAttrib = 3 * sizeof(float); 5917 5916 break; 5918 5917 case SVGA3D_DECLTYPE_FLOAT4: 5919 5918 size = 4; 5920 5919 type = GL_FLOAT; 5920 cbAttrib = 4 * sizeof(float); 5921 5921 break; 5922 5922 … … 5925 5925 type = GL_UNSIGNED_BYTE; 5926 5926 normalized = GL_TRUE; /* glVertexAttribPointer fails otherwise */ 5927 cbAttrib = sizeof(uint32_t); 5927 5928 break; 5928 5929 … … 5933 5934 size = 4; 5934 5935 type = GL_UNSIGNED_BYTE; 5936 cbAttrib = sizeof(uint32_t); 5935 5937 break; 5936 5938 … … 5941 5943 size = 2; 5942 5944 type = GL_SHORT; 5945 cbAttrib = 2 * sizeof(uint16_t); 5943 5946 break; 5944 5947 … … 5949 5952 size = 4; 5950 5953 type = GL_SHORT; 5954 cbAttrib = 4 * sizeof(uint16_t); 5951 5955 break; 5952 5956 … … 5955 5959 size = 4; 5956 5960 type = GL_UNSIGNED_SHORT; 5961 cbAttrib = 4 * sizeof(uint16_t); 5957 5962 break; 5958 5963 … … 5961 5966 size = 2; 5962 5967 type = GL_UNSIGNED_SHORT; 5968 cbAttrib = 2 * sizeof(uint16_t); 5963 5969 break; 5964 5970 … … 5966 5972 size = 3; 5967 5973 type = GL_UNSIGNED_INT_2_10_10_10_REV; /** @todo correct? */ 5974 cbAttrib = sizeof(uint32_t); 5968 5975 break; 5969 5976 … … 5972 5979 size = 3; 5973 5980 type = GL_INT_2_10_10_10_REV; /** @todo correct? */ 5981 cbAttrib = sizeof(uint32_t); 5974 5982 break; 5975 5983 … … 5977 5985 size = 2; 5978 5986 type = GL_HALF_FLOAT; 5987 cbAttrib = 2 * sizeof(uint16_t); 5979 5988 break; 5980 5989 case SVGA3D_DECLTYPE_FLOAT16_4: 5981 5990 size = 4; 5982 5991 type = GL_HALF_FLOAT; 5992 cbAttrib = 4 * sizeof(uint16_t); 5983 5993 break; 5984 5994 default: … … 5988 5998 //pVertexElement->Method = identity.method; 5989 5999 //pVertexElement->Usage = identity.usage; 6000 6001 return VINF_SUCCESS; 6002 } 6003 6004 static float vmsvga3dFloat16To32(uint16_t f16) 6005 { 6006 /* From Wiki */ 6007 #ifndef INFINITY 6008 static uint32_t const sBitsINFINITY = UINT32_C(0x7f800000); 6009 #define INFINITY (*(float const *)&sBitsINFINITY) 6010 #endif 6011 #ifndef NAN 6012 static uint32_t const sBitsNAN = UINT32_C(0x7fc00000); 6013 #define NAN (*(float const *)&sBitsNAN) 6014 #endif 6015 6016 uint16_t const s = (f16 >> UINT16_C(15)) & UINT16_C(0x1); 6017 uint16_t const e = (f16 >> UINT16_C(10)) & UINT16_C(0x1f); 6018 uint16_t const m = (f16 ) & UINT16_C(0x3ff); 6019 6020 float result = s ? 1.0f : -1.0f; 6021 if (e == 0) 6022 { 6023 if (m == 0) 6024 result *= 0.0f; /* zero, -0 */ 6025 else 6026 result *= (float)m / 1024.0f / 16384.0f; /* subnormal numbers: sign * 2^-14 * 0.m */ 6027 } 6028 else if (e == 0x1f) 6029 { 6030 if (m == 0) 6031 result *= INFINITY; /* +-infinity */ 6032 else 6033 result = NAN; /* NAN */ 6034 } 6035 else 6036 { 6037 result *= powf(2.0f, (float)e - 15.0f) * (1.0f + (float)m / 1024.0f); /* sign * 2^(e-15) * 1.m */ 6038 } 6039 6040 return result; 6041 } 6042 6043 /* Set a vertex attribute according to VMSVGA vertex declaration. */ 6044 static int vmsvga3dSetVertexAttrib(PVMSVGA3DSTATE pState, GLuint index, SVGA3dVertexArrayIdentity const *pIdentity, GLvoid const *pv) 6045 { 6046 switch (pIdentity->type) 6047 { 6048 case SVGA3D_DECLTYPE_FLOAT1: 6049 { 6050 /* "One-component float expanded to (float, 0, 0, 1)." */ 6051 GLfloat const *p = (GLfloat *)pv; 6052 GLfloat const v[4] = { p[0], 0.0f, 0.0f, 1.0f }; 6053 pState->ext.glVertexAttrib4fv(index, v); 6054 break; 6055 } 6056 case SVGA3D_DECLTYPE_FLOAT2: 6057 { 6058 /* "Two-component float expanded to (float, float, 0, 1)." */ 6059 GLfloat const *p = (GLfloat *)pv; 6060 GLfloat const v[4] = { p[0], p[1], 0.0f, 1.0f }; 6061 pState->ext.glVertexAttrib4fv(index, v); 6062 break; 6063 } 6064 case SVGA3D_DECLTYPE_FLOAT3: 6065 { 6066 /* "Three-component float expanded to (float, float, float, 1)." */ 6067 GLfloat const *p = (GLfloat *)pv; 6068 GLfloat const v[4] = { p[0], p[1], p[2], 1.0f }; 6069 pState->ext.glVertexAttrib4fv(index, v); 6070 break; 6071 } 6072 case SVGA3D_DECLTYPE_FLOAT4: 6073 pState->ext.glVertexAttrib4fv(index, (GLfloat const *)pv); 6074 break; 6075 case SVGA3D_DECLTYPE_D3DCOLOR: 6076 /** @todo Need to swap bytes? */ 6077 pState->ext.glVertexAttrib4Nubv(index, (GLubyte const *)pv); 6078 break; 6079 case SVGA3D_DECLTYPE_UBYTE4: 6080 pState->ext.glVertexAttrib4ubv(index, (GLubyte const *)pv); 6081 break; 6082 case SVGA3D_DECLTYPE_SHORT2: 6083 { 6084 /* "Two-component, signed short expanded to (value, value, 0, 1)." */ 6085 GLshort const *p = (GLshort const *)pv; 6086 GLshort const v[4] = { p[0], p[1], 0, 1 }; 6087 pState->ext.glVertexAttrib4sv(index, v); 6088 break; 6089 } 6090 case SVGA3D_DECLTYPE_SHORT4: 6091 pState->ext.glVertexAttrib4sv(index, (GLshort const *)pv); 6092 break; 6093 case SVGA3D_DECLTYPE_UBYTE4N: 6094 pState->ext.glVertexAttrib4Nubv(index, (GLubyte const *)pv); 6095 break; 6096 case SVGA3D_DECLTYPE_SHORT2N: 6097 { 6098 /* "Normalized, two-component, signed short, expanded to (first short/32767.0, second short/32767.0, 0, 1)." */ 6099 GLshort const *p = (GLshort const *)pv; 6100 GLshort const v[4] = { p[0], p[1], 0, 1 }; 6101 pState->ext.glVertexAttrib4Nsv(index, v); 6102 break; 6103 } 6104 case SVGA3D_DECLTYPE_SHORT4N: 6105 pState->ext.glVertexAttrib4Nsv(index, (GLshort const *)pv); 6106 break; 6107 case SVGA3D_DECLTYPE_USHORT2N: 6108 { 6109 GLushort const *p = (GLushort const *)pv; 6110 GLushort const v[4] = { p[0], p[1], 0, 1 }; 6111 pState->ext.glVertexAttrib4Nusv(index, v); 6112 break; 6113 } 6114 case SVGA3D_DECLTYPE_USHORT4N: 6115 pState->ext.glVertexAttrib4Nusv(index, (GLushort const *)pv); 6116 break; 6117 case SVGA3D_DECLTYPE_UDEC3: 6118 { 6119 /** @todo Test */ 6120 /* "Three-component, unsigned, 10 10 10 format expanded to (value, value, value, 1)." */ 6121 uint32_t const u32 = *(uint32_t *)pv; 6122 GLfloat const v[4] = { (float)(u32 & 0x3ff), (float)((u32 >> 10) & 0x3ff), (float)((u32 >> 20) & 0x3ff), 1.0f }; 6123 pState->ext.glVertexAttrib4fv(index, v); 6124 break; 6125 } 6126 case SVGA3D_DECLTYPE_DEC3N: 6127 { 6128 /** @todo Test */ 6129 /* "Three-component, signed, 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1)." */ 6130 uint32_t const u32 = *(uint32_t *)pv; 6131 GLfloat const v[4] = { (u32 & 0x3ff) / 511.0f, ((u32 >> 10) & 0x3ff) / 511.0f, ((u32 >> 20) & 0x3ff) / 511.0f, 1.0f }; 6132 pState->ext.glVertexAttrib4fv(index, v); 6133 break; 6134 } 6135 case SVGA3D_DECLTYPE_FLOAT16_2: 6136 { 6137 /** @todo Test */ 6138 /* "Two-component, 16-bit, floating point expanded to (value, value, 0, 1)." */ 6139 uint16_t const *p = (uint16_t *)pv; 6140 GLfloat const v[4] = { vmsvga3dFloat16To32(p[0]), vmsvga3dFloat16To32(p[1]), 0.0f, 1.0f }; 6141 pState->ext.glVertexAttrib4fv(index, v); 6142 break; 6143 } 6144 case SVGA3D_DECLTYPE_FLOAT16_4: 6145 { 6146 /** @todo Test */ 6147 uint16_t const *p = (uint16_t *)pv; 6148 GLfloat const v[4] = { vmsvga3dFloat16To32(p[0]), vmsvga3dFloat16To32(p[1]), 6149 vmsvga3dFloat16To32(p[2]), vmsvga3dFloat16To32(p[3]) }; 6150 pState->ext.glVertexAttrib4fv(index, v); 6151 break; 6152 } 6153 default: 6154 AssertFailedReturn(VERR_INVALID_PARAMETER); 6155 } 5990 6156 5991 6157 return VINF_SUCCESS; … … 6073 6239 uint32_t iVertexDeclBase, uint32_t numVertexDecls, 6074 6240 SVGA3dVertexDecl *pVertexDecl, 6075 SVGA3dVertexDivisor const *paVertexDivisors , uint32_t cInstances)6241 SVGA3dVertexDivisor const *paVertexDivisors) 6076 6242 { 6077 6243 PVMSVGA3DSTATE pState = pThisCC->svga.p3dState; … … 6126 6292 GLenum type; 6127 6293 GLboolean normalized; 6294 uint32_t cbAttrib; 6128 6295 GLuint index = iVertexDeclBase + iVertex; 6129 6296 6130 6297 Log(("vmsvga3dDrawPrimitives: array index %d type=%s (%d) method=%s (%d) usage=%s (%d) usageIndex=%d stride=%d offset=%d\n", index, vmsvgaDeclType2String(pVertexDecl[iVertex].identity.type), pVertexDecl[iVertex].identity.type, vmsvgaDeclMethod2String(pVertexDecl[iVertex].identity.method), pVertexDecl[iVertex].identity.method, vmsvgaDeclUsage2String(pVertexDecl[iVertex].identity.usage), pVertexDecl[iVertex].identity.usage, pVertexDecl[iVertex].identity.usageIndex, pVertexDecl[iVertex].array.stride, pVertexDecl[iVertex].array.offset)); 6131 6298 6132 rc = vmsvga3dVertexDecl2OGL(pVertexDecl[iVertex].identity, size, type, normalized );6299 rc = vmsvga3dVertexDecl2OGL(pVertexDecl[iVertex].identity, size, type, normalized, cbAttrib); 6133 6300 AssertRCReturn(rc, rc); 6134 6301 6302 ASSERT_GUEST_RETURN( pVertexSurface->paMipmapLevels[0].cbSurface >= pVertexDecl[iVertex].array.offset 6303 && pVertexSurface->paMipmapLevels[0].cbSurface - pVertexDecl[iVertex].array.offset >= cbAttrib, 6304 VERR_INVALID_PARAMETER); 6305 RT_UNTRUSTED_VALIDATED_FENCE(); 6306 6135 6307 if (pContext->state.shidVertex != SVGA_ID_INVALID) 6136 6308 { 6137 /* Use numbered vertex arrays when shaders are active. */ 6138 pState->ext.glEnableVertexAttribArray(index); 6139 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 6140 pState->ext.glVertexAttribPointer(index, size, type, normalized, pVertexDecl[iVertex].array.stride, 6141 (const GLvoid *)(uintptr_t)pVertexDecl[iVertex].array.offset); 6142 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 6143 6144 GLuint divisor = paVertexDivisors && paVertexDivisors[index].s.instanceData ? 1 : 0; 6145 if (pVertexDecl[iVertex].array.stride == 0) 6309 /* Use numbered vertex arrays (or attributes) when shaders are active. */ 6310 if (pVertexDecl[iVertex].array.stride) 6146 6311 { 6147 /* Zero stride means that the attribute pointer must not be increased. 6148 * See comment about stride in vmsvga3dDrawPrimitives. 6312 pState->ext.glEnableVertexAttribArray(index); 6313 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 6314 pState->ext.glVertexAttribPointer(index, size, type, normalized, pVertexDecl[iVertex].array.stride, 6315 (const GLvoid *)(uintptr_t)pVertexDecl[iVertex].array.offset); 6316 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 6317 6318 GLuint divisor = paVertexDivisors && paVertexDivisors[index].s.instanceData ? 1 : 0; 6319 pState->ext.glVertexAttribDivisor(index, divisor); 6320 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 6321 6322 /** @todo case SVGA3D_DECLUSAGE_COLOR: color component order not identical!! test GL_BGRA!! */ 6323 } 6324 else 6325 { 6326 /* 6327 * D3D and OpenGL have a different meaning of value zero for the vertex array stride: 6328 * - D3D (VMSVGA): "use a zero stride to tell the runtime not to increment the vertex buffer offset." 6329 * - OpenGL: "If stride is 0, the generic vertex attributes are understood to be tightly packed in the array." 6330 * VMSVGA uses the D3D semantics. 6331 * 6332 * Use glVertexAttrib in order to tell OpenGL to reuse the zero stride attributes for each vertex. 6149 6333 */ 6150 if (!divisor) 6151 { 6152 LogRelMax(8, ("VMSVGA: zero stride array (instancing %s %d)\n", paVertexDivisors ? "on" : "off", cInstances)); 6153 AssertFailed(); 6154 } 6155 6156 divisor = cInstances; /* This attrib must never advance. */ 6334 pState->ext.glDisableVertexAttribArray(index); 6335 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 6336 6337 const GLvoid *v = (uint8_t *)pVertexSurface->paMipmapLevels[0].pSurfaceData + pVertexDecl[iVertex].array.offset; 6338 vmsvga3dSetVertexAttrib(pState, index, &pVertexDecl[iVertex].identity, v); 6339 VMSVGA3D_CHECK_LAST_ERROR_WARN(pState, pContext); 6157 6340 } 6158 pState->ext.glVertexAttribDivisor(index, divisor);6159 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext);6160 6161 /** @todo case SVGA3D_DECLUSAGE_COLOR: color component order not identical!! test GL_BGRA!! */6162 6341 } 6163 6342 else … … 6395 6574 } 6396 6575 6397 /*6398 * D3D and OpenGL have a different meaning of value zero for the vertex array stride:6399 * - D3D and VMSVGA: "use a zero stride to tell the runtime not to increment the vertex buffer offset."6400 * - OpenGL: "If stride is 0, the generic vertex attributes are understood to be tightly packed in the array."6401 * VMSVGA uses the D3D semantics.6402 *6403 * In order to tell OpenGL to reuse the zero stride attributes for each vertex6404 * such attributes could be declared as instance data, then OpenGL applies them once6405 * for all vertices of the one drawn instance.6406 *6407 * If instancing is already used (cVertexDivisor > 0), then the code does nothing and assumes that6408 * all instance data is already correctly marked as such.6409 *6410 * If instancing is not requisted (cVertexDivisor == 0), then the code creates a description for6411 * one instance where all arrays with zero stride are marked as instance data, and all arrays6412 * with non-zero stride as indexed data.6413 */6414 bool fZeroStrideArray = false;6415 if (cVertexDivisor == 0)6416 {6417 unsigned i;6418 for (i = 0; i < numVertexDecls; ++i)6419 {6420 if (pVertexDecl[i].array.stride == 0)6421 {6422 fZeroStrideArray = true;6423 break;6424 }6425 }6426 6427 if (fZeroStrideArray)6428 {6429 cVertexDivisor = numVertexDecls;6430 pVertexDivisor = (SVGA3dVertexDivisor *)RTMemTmpAlloc(sizeof(SVGA3dVertexDivisor) * cVertexDivisor);6431 AssertPtrReturn(pVertexDivisor, VERR_NO_MEMORY);6432 6433 for (i = 0; i < numVertexDecls; ++i)6434 {6435 pVertexDivisor[i].s.count = 1;6436 if (pVertexDecl[i].array.stride == 0)6437 {6438 pVertexDivisor[i].s.instanceData = 1;6439 }6440 else6441 {6442 pVertexDivisor[i].s.indexedData = 1;6443 }6444 }6445 }6446 }6447 6448 6576 /* Try to figure out if instancing is used. 6449 6577 * Support simple instancing case with one set of indexed data and one set per-instance data. … … 6482 6610 6483 6611 rc = vmsvga3dDrawPrimitivesProcessVertexDecls(pThisCC, pContext, iCurrentVertex, iVertex - iCurrentVertex, 6484 &pVertexDecl[iCurrentVertex], pVertexDivisor , cInstances);6612 &pVertexDecl[iCurrentVertex], pVertexDivisor); 6485 6613 AssertRCReturn(rc, rc); 6486 6614 … … 6647 6775 } 6648 6776 6649 if (fZeroStrideArray)6650 {6651 RTMemTmpFree(pVertexDivisor);6652 pVertexDivisor = NULL;6653 }6654 6655 6777 #ifdef DEBUG 6656 6778 /* Check whether 'activeTexture' on texture unit 'i' matches what we expect. */ -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r82583 r82586 2474 2474 Assert(pBox->y == 0 && pBox->h == 1 && pBox->z == 0 && pBox->d == 1); 2475 2475 2476 /* vmsvgaR3GmrTransfer verifies input parameters except for the host buffer addres and size.2477 * srcx has been verified in vmsvga3dSurfaceDMA to not cause 32 bit overflow when multiplied by cbBlock. 2478 */ 2476 /* The caller has already updated pMipLevel->pSurfaceData, see VMSVGA3DSURFACE_NEEDS_DATA. */ 2477 2478 #ifdef LOG_ENABLED 2479 2479 uint32_t const offHst = pBox->x * pSurface->cbBlock; 2480 2480 uint32_t const cbWidth = pBox->w * pSurface->cbBlock; 2481 2482 uint32_t const offGst = pBox->srcx * pSurface->cbBlock;2483 2484 /* Copy data between the guest and the host buffer. */2485 rc = vmsvgaR3GmrTransfer(pThis,2486 pThisCC,2487 transfer,2488 (uint8_t *)pMipLevel->pSurfaceData,2489 pMipLevel->cbSurface,2490 offHst,2491 pMipLevel->cbSurfacePitch,2492 GuestPtr,2493 offGst,2494 cbGuestPitch,2495 cbWidth,2496 1); /* Buffers are 1-dimensional */2497 AssertRC(rc);2498 2499 2481 Log4(("Buffer updated at [0x%x;0x%x):\n%.*Rhxd\n", offHst, offHst + cbWidth, cbWidth, (uint8_t *)pMipLevel->pSurfaceData + offHst)); 2482 #endif 2500 2483 2501 2484 /* Do not bother to copy the data to the D3D resource now. vmsvga3dDrawPrimitives will do that. -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r82583 r82586 616 616 RT_UNTRUSTED_VALIDATED_FENCE(); 617 617 618 if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)) 618 if ( !VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface) 619 || VMSVGA3DSURFACE_NEEDS_DATA(pSurface)) 619 620 { 620 621 uint64_t uGuestOffset = u32GuestBlockX * pSurface->cbBlock + … … 653 654 } 654 655 } 655 else 656 657 if (VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)) 656 658 { 657 659 SVGA3dCopyBox clipBox;
Note:
See TracChangeset
for help on using the changeset viewer.