VirtualBox

Changeset 82586 in vbox for trunk/src


Ignore:
Timestamp:
Dec 16, 2019 3:23:17 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
135467
Message:

Devices/Graphics: use glVertexAttrib to set a constant value of a generic vertex attribute

Location:
trunk/src/VBox/Devices/Graphics
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h

    r82165 r82586  
    693693#endif
    694694
     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
    695709
    696710
     
    10841098        PFNGLDELETESHADERPROC                           glDeleteShader;
    10851099        PFNGLDELETEPROGRAMPROC                          glDeleteProgram;
     1100        PFNGLVERTEXATTRIB4FVPROC                        glVertexAttrib4fv;
     1101        PFNGLVERTEXATTRIB4UBVPROC                       glVertexAttrib4ubv;
     1102        PFNGLVERTEXATTRIB4NUBVPROC                      glVertexAttrib4Nubv;
     1103        PFNGLVERTEXATTRIB4SVPROC                        glVertexAttrib4sv;
     1104        PFNGLVERTEXATTRIB4NSVPROC                       glVertexAttrib4Nsv;
     1105        PFNGLVERTEXATTRIB4NUSVPROC                      glVertexAttrib4Nusv;
    10861106    } ext;
    10871107
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp

    r82583 r82586  
    737737    GLGETPROC_(PFNGLDELETESHADERPROC                     , glDeleteShader, "");
    738738    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, "");
    739746
    740747    /* OpenGL 3.0 core, GL_ARB_instanced_arrays. Same functions names in the ARB and core specs. */
     
    31023109                     pBox->x, pBox->y, pBox->x + pBox->w, pBox->y + pBox->h));
    31033110
     3111                /* The caller already copied the data to the pMipLevel->pSurfaceData buffer, see VMSVGA3DSURFACE_NEEDS_DATA. */
    31043112                uint32_t const offHst = pBox->x * pSurface->cbBlock;
    31053113                uint32_t const cbWidth = pBox->w * pSurface->cbBlock;
    31063114
    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);
    31203116
    31213117                Log4(("Buffer updated at [0x%x;0x%x):\n%.*Rhxd\n", offHst, offHst + cbWidth, cbWidth, (uint8_t *)pbData + offHst));
     
    58995895
    59005896/* Convert VMWare vertex declaration to its OpenGL equivalent. */
    5901 int vmsvga3dVertexDecl2OGL(SVGA3dVertexArrayIdentity &identity, GLint &size, GLenum &type, GLboolean &normalized)
     5897int vmsvga3dVertexDecl2OGL(SVGA3dVertexArrayIdentity &identity, GLint &size, GLenum &type, GLboolean &normalized, uint32_t &cbAttrib)
    59025898{
    59035899    normalized = GL_FALSE;
     
    59075903        size = 1;
    59085904        type = GL_FLOAT;
     5905        cbAttrib = sizeof(float);
    59095906        break;
    59105907    case SVGA3D_DECLTYPE_FLOAT2:
    59115908        size = 2;
    59125909        type = GL_FLOAT;
     5910        cbAttrib = 2 * sizeof(float);
    59135911        break;
    59145912    case SVGA3D_DECLTYPE_FLOAT3:
    59155913        size = 3;
    59165914        type = GL_FLOAT;
     5915        cbAttrib = 3 * sizeof(float);
    59175916        break;
    59185917    case SVGA3D_DECLTYPE_FLOAT4:
    59195918        size = 4;
    59205919        type = GL_FLOAT;
     5920        cbAttrib = 4 * sizeof(float);
    59215921        break;
    59225922
     
    59255925        type = GL_UNSIGNED_BYTE;
    59265926        normalized = GL_TRUE;   /* glVertexAttribPointer fails otherwise */
     5927        cbAttrib = sizeof(uint32_t);
    59275928        break;
    59285929
     
    59335934        size = 4;
    59345935        type = GL_UNSIGNED_BYTE;
     5936        cbAttrib = sizeof(uint32_t);
    59355937        break;
    59365938
     
    59415943        size = 2;
    59425944        type = GL_SHORT;
     5945        cbAttrib = 2 * sizeof(uint16_t);
    59435946        break;
    59445947
     
    59495952        size = 4;
    59505953        type = GL_SHORT;
     5954        cbAttrib = 4 * sizeof(uint16_t);
    59515955        break;
    59525956
     
    59555959        size = 4;
    59565960        type = GL_UNSIGNED_SHORT;
     5961        cbAttrib = 4 * sizeof(uint16_t);
    59575962        break;
    59585963
     
    59615966        size = 2;
    59625967        type = GL_UNSIGNED_SHORT;
     5968        cbAttrib = 2 * sizeof(uint16_t);
    59635969        break;
    59645970
     
    59665972        size = 3;
    59675973        type = GL_UNSIGNED_INT_2_10_10_10_REV;    /** @todo correct? */
     5974        cbAttrib = sizeof(uint32_t);
    59685975        break;
    59695976
     
    59725979        size = 3;
    59735980        type = GL_INT_2_10_10_10_REV;    /** @todo correct? */
     5981        cbAttrib = sizeof(uint32_t);
    59745982        break;
    59755983
     
    59775985        size = 2;
    59785986        type = GL_HALF_FLOAT;
     5987        cbAttrib = 2 * sizeof(uint16_t);
    59795988        break;
    59805989    case SVGA3D_DECLTYPE_FLOAT16_4:
    59815990        size = 4;
    59825991        type = GL_HALF_FLOAT;
     5992        cbAttrib = 4 * sizeof(uint16_t);
    59835993        break;
    59845994    default:
     
    59885998    //pVertexElement->Method      = identity.method;
    59895999    //pVertexElement->Usage       = identity.usage;
     6000
     6001    return VINF_SUCCESS;
     6002}
     6003
     6004static 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. */
     6044static 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    }
    59906156
    59916157    return VINF_SUCCESS;
     
    60736239                                                    uint32_t iVertexDeclBase, uint32_t numVertexDecls,
    60746240                                                    SVGA3dVertexDecl *pVertexDecl,
    6075                                                     SVGA3dVertexDivisor const *paVertexDivisors, uint32_t cInstances)
     6241                                                    SVGA3dVertexDivisor const *paVertexDivisors)
    60766242{
    60776243    PVMSVGA3DSTATE      pState = pThisCC->svga.p3dState;
     
    61266292        GLenum type;
    61276293        GLboolean normalized;
     6294        uint32_t cbAttrib;
    61286295        GLuint index = iVertexDeclBase + iVertex;
    61296296
    61306297        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));
    61316298
    6132         rc = vmsvga3dVertexDecl2OGL(pVertexDecl[iVertex].identity, size, type, normalized);
     6299        rc = vmsvga3dVertexDecl2OGL(pVertexDecl[iVertex].identity, size, type, normalized, cbAttrib);
    61336300        AssertRCReturn(rc, rc);
    61346301
     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
    61356307        if (pContext->state.shidVertex != SVGA_ID_INVALID)
    61366308        {
    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)
    61466311            {
    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.
    61496333                 */
    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);
    61576340            }
    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!!  */
    61626341        }
    61636342        else
     
    63956574    }
    63966575
    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 vertex
    6404      * such attributes could be declared as instance data, then OpenGL applies them once
    6405      * for all vertices of the one drawn instance.
    6406      *
    6407      * If instancing is already used (cVertexDivisor > 0), then the code does nothing and assumes that
    6408      * all instance data is already correctly marked as such.
    6409      *
    6410      * If instancing is not requisted (cVertexDivisor == 0), then the code creates a description for
    6411      * one instance where all arrays with zero stride are marked as instance data, and all arrays
    6412      * 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                 else
    6441                 {
    6442                     pVertexDivisor[i].s.indexedData = 1;
    6443                 }
    6444             }
    6445         }
    6446     }
    6447 
    64486576    /* Try to figure out if instancing is used.
    64496577     * Support simple instancing case with one set of indexed data and one set per-instance data.
     
    64826610
    64836611        rc = vmsvga3dDrawPrimitivesProcessVertexDecls(pThisCC, pContext, iCurrentVertex, iVertex - iCurrentVertex,
    6484                                                       &pVertexDecl[iCurrentVertex], pVertexDivisor, cInstances);
     6612                                                      &pVertexDecl[iCurrentVertex], pVertexDivisor);
    64856613        AssertRCReturn(rc, rc);
    64866614
     
    66476775    }
    66486776
    6649     if (fZeroStrideArray)
    6650     {
    6651         RTMemTmpFree(pVertexDivisor);
    6652         pVertexDivisor = NULL;
    6653     }
    6654 
    66556777#ifdef DEBUG
    66566778    /* Check whether 'activeTexture' on texture unit 'i' matches what we expect. */
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp

    r82583 r82586  
    24742474        Assert(pBox->y == 0 && pBox->h == 1 && pBox->z == 0 && pBox->d == 1);
    24752475
    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
    24792479        uint32_t const offHst = pBox->x * pSurface->cbBlock;
    24802480        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 
    24992481        Log4(("Buffer updated at [0x%x;0x%x):\n%.*Rhxd\n", offHst, offHst + cbWidth, cbWidth, (uint8_t *)pMipLevel->pSurfaceData + offHst));
     2482#endif
    25002483
    25012484        /* 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  
    616616        RT_UNTRUSTED_VALIDATED_FENCE();
    617617
    618         if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface))
     618        if (   !VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)
     619            || VMSVGA3DSURFACE_NEEDS_DATA(pSurface))
    619620        {
    620621            uint64_t uGuestOffset = u32GuestBlockX * pSurface->cbBlock +
     
    653654            }
    654655        }
    655         else
     656
     657        if (VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface))
    656658        {
    657659            SVGA3dCopyBox clipBox;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette