Changeset 81080 in vbox
- Timestamp:
- Sep 30, 2019 12:52:30 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 133684
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r79668 r81080 2808 2808 2809 2809 uint32_t const offHst = pBox->x * pSurface->cbBlock; 2810 uint32_t const cbWidth = pBox->w * pSurface->cbBlock; 2810 2811 2811 2812 rc = vmsvgaGMRTransfer(pThis, … … 2818 2819 pBox->srcx * pSurface->cbBlock, 2819 2820 cbGuestPitch, 2820 pBox->w * pSurface->cbBlock,2821 cbWidth, 2821 2822 pBox->h); 2822 2823 AssertRC(rc); 2823 2824 2824 Log4((" first line:\n%.*Rhxd\n", cbGuestPitch, pbData + offHst));2825 Log4(("Buffer content (updated at [0x%x;0x%x):\n%.*Rhxd\n", offHst, offHst + cbWidth, pMipLevel->cbSurface, pbData)); 2825 2826 2826 2827 pState->ext.glUnmapBuffer(GL_ARRAY_BUFFER); … … 5799 5800 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 5800 5801 5801 GLuint const divisor = paVertexDivisors && paVertexDivisors[index].s.instanceData ? 1 : 0; 5802 GLuint divisor = paVertexDivisors && paVertexDivisors[index].s.instanceData ? 1 : 0; 5803 if (pVertexDecl[iVertex].array.stride == 0 && divisor == 0) 5804 { 5805 /* Zero stride means that the attribute pointer must not be increased. 5806 * See comment about stride in vmsvga3dDrawPrimitives. 5807 */ 5808 LogRelMax(8, ("VMSVGA: Warning: zero stride array (instancing %s)\n", paVertexDivisors ? "on" : "off")); 5809 AssertFailed(); 5810 divisor = 1; 5811 } 5802 5812 pState->ext.glVertexAttribDivisor(index, divisor); 5803 5813 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); … … 5807 5817 else 5808 5818 { 5819 if (pVertexDecl[iVertex].array.stride == 0) 5820 { 5821 /* Zero stride means that the attribute pointer must not be increased. 5822 * See comment about stride in vmsvga3dDrawPrimitives. 5823 */ 5824 LogRelMax(8, ("VMSVGA: Warning: zero stride array in fixed function pipeline\n")); 5825 AssertFailed(); 5826 } 5827 5809 5828 /* Use the predefined selection of vertex streams for the fixed pipeline. */ 5810 5829 switch (pVertexDecl[iVertex].identity.usage) … … 5908 5927 { 5909 5928 /* Use numbered vertex arrays when shaders are active. */ 5929 pState->ext.glVertexAttribDivisor(iVertexDeclBase + iVertex, 0); 5930 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); 5910 5931 pState->ext.glDisableVertexAttribArray(iVertexDeclBase + iVertex); 5911 5932 VMSVGA3D_CHECK_LAST_ERROR(pState, pContext); … … 6013 6034 break; 6014 6035 default: /* Shut up MSC. */ break; 6036 } 6037 } 6038 6039 /* 6040 * D3D and OpenGL have a different meaning of value zero for the vertex array stride: 6041 * - D3D and VMSVGA: "use a zero stride to tell the runtime not to increment the vertex buffer offset." 6042 * - OpenGL: "If stride is 0, the generic vertex attributes are understood to be tightly packed in the array." 6043 * VMSVGA uses the D3D semantics. 6044 * 6045 * In order to tell OpenGL to reuse the zero stride attributes for each vertex 6046 * such attributes could be declared as instance data, then OpenGL applies them once 6047 * for all vertices of the one drawn instance. 6048 * 6049 * If instancing is already used (cVertexDivisor > 0), then the code does nothing and assumes that 6050 * all instance data is already correctly marked as such. 6051 * 6052 * If instancing is not requisted (cVertexDivisor == 0), then the code creates a description for 6053 * one instance where all arrays with zero stride are marked as instance data, and all arrays 6054 * with non-zero stride as indexed data. 6055 */ 6056 bool fZeroStrideArray = false; 6057 if (cVertexDivisor == 0) 6058 { 6059 unsigned i; 6060 for (i = 0; i < numVertexDecls; ++i) 6061 { 6062 if (pVertexDecl[i].array.stride == 0) 6063 { 6064 fZeroStrideArray = true; 6065 break; 6066 } 6067 } 6068 6069 if (fZeroStrideArray) 6070 { 6071 cVertexDivisor = numVertexDecls; 6072 pVertexDivisor = (SVGA3dVertexDivisor *)RTMemTmpAlloc(sizeof(SVGA3dVertexDivisor) * cVertexDivisor); 6073 AssertPtrReturn(pVertexDivisor, VERR_NO_MEMORY); 6074 6075 for (i = 0; i < numVertexDecls; ++i) 6076 { 6077 pVertexDivisor[i].s.count = 1; 6078 if (pVertexDecl[i].array.stride == 0) 6079 { 6080 pVertexDivisor[i].s.instanceData = 1; 6081 } 6082 else 6083 { 6084 pVertexDivisor[i].s.indexedData = 1; 6085 } 6086 } 6015 6087 } 6016 6088 } … … 6232 6304 iCurrentVertex = iVertex; 6233 6305 } 6306 6307 if (fZeroStrideArray) 6308 { 6309 RTMemTmpFree(pVertexDivisor); 6310 pVertexDivisor = NULL; 6311 } 6312 6234 6313 #ifdef DEBUG 6235 6314 /* Check whether 'activeTexture' on texture unit 'i' matches what we expect. */ -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r81022 r81080 2481 2481 AssertRC(rc); 2482 2482 2483 Log4(("Buffer first line:\n%.*Rhxd\n", cbWidth, (uint8_t *)pMipLevel->pSurfaceData + offHst));2483 Log4(("Buffer content (updated at [0x%x;0x%x):\n%.*Rhxd\n", offHst, offHst + cbWidth, pMipLevel->cbSurface, pMipLevel->pSurfaceData)); 2484 2484 2485 2485 /* Do not bother to copy the data to the D3D resource now. vmsvga3dDrawPrimitives will do that.
Note:
See TracChangeset
for help on using the changeset viewer.