- Timestamp:
- Nov 21, 2019 10:29:30 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 6 edited
-
DevVGA-SVGA3d-info.cpp (modified) (1 diff)
-
DevVGA-SVGA3d-internal.h (modified) (3 diffs)
-
DevVGA-SVGA3d-ogl.cpp (modified) (31 diffs)
-
DevVGA-SVGA3d-savedstate.cpp (modified) (3 diffs)
-
DevVGA-SVGA3d-win.cpp (modified) (42 diffs)
-
DevVGA-SVGA3d.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp
r82089 r82090 345 345 /** @todo stricter checks for associated context */ 346 346 uint32_t cid = pSurface->idAssociatedContext; 347 if ( cid >= pState->cContexts 348 || pState->papContexts[cid]->id != cid) 349 { 350 Log(("vmsvga3dSurfaceUpdateHeapBuffers: invalid context id (%x - %x)!\n", cid, (cid >= pState->cContexts) ? -1 : pState->papContexts[cid]->id)); 351 AssertFailedReturn(VERR_INVALID_PARAMETER); 352 } 353 PVMSVGA3DCONTEXT pContext = pState->papContexts[cid]; 347 PVMSVGA3DCONTEXT pContext; 348 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 349 AssertRCReturn(rc, rc); 354 350 355 351 IDirect3DSurface9 *pDst = NULL; -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h
r82063 r82090 1225 1225 DECLINLINE(int) vmsvga3dContextFromCid(PVMSVGA3DSTATE pState, uint32_t cid, PVMSVGA3DCONTEXT *ppContext) 1226 1226 { 1227 /** @todo stricter checks for associated context */1228 1227 AssertReturn(cid < pState->cContexts, VERR_INVALID_PARAMETER); 1229 1228 PVMSVGA3DCONTEXT const pContext = pState->papContexts[cid]; … … 1233 1232 return VINF_SUCCESS; 1234 1233 } 1235 LogRelMax(64, ("VMSVGA: unknown cid=% d (%s cid=%d)\n", cid, pContext ? "expected" : "null", pContext ? pContext->id : -1));1234 LogRelMax(64, ("VMSVGA: unknown cid=%u (%s cid=%u)\n", cid, pContext ? "expected" : "null", pContext ? pContext->id : -1)); 1236 1235 return VERR_INVALID_PARAMETER; 1237 1236 } … … 1246 1245 return VINF_SUCCESS; 1247 1246 } 1248 LogRelMax(64, ("VMSVGA: unknown sid=% d (%s sid=%d)\n", sid, pSurface ? "expected" : "null", pSurface ? pSurface->id : -1));1247 LogRelMax(64, ("VMSVGA: unknown sid=%u (%s sid=%u)\n", sid, pSurface ? "expected" : "null", pSurface ? pSurface->id : -1)); 1249 1248 return VERR_INVALID_PARAMETER; 1250 1249 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r82089 r82090 2181 2181 RT_NOREF(idAssociatedContext); 2182 2182 2183 LogFunc(("sid=% x\n", pSurface->id));2183 LogFunc(("sid=%u\n", pSurface->id)); 2184 2184 2185 2185 uint32_t const numMipLevels = pSurface->faces[0].numMipLevels; … … 2967 2967 pSurface->autogenFilter = filter; 2968 2968 2969 LogFunc(("sid=% xfilter=%d\n", sid, filter));2969 LogFunc(("sid=%u filter=%d\n", sid, filter)); 2970 2970 2971 2971 cid = SVGA3D_INVALID_ID; … … 3443 3443 int vmsvga3dSetTransform(PVGASTATE pThis, uint32_t cid, SVGA3dTransformType type, float matrix[16]) 3444 3444 { 3445 PVMSVGA3DCONTEXT pContext;3446 3445 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3447 3446 AssertReturn(pState, VERR_NO_MEMORY); 3448 3447 bool fModelViewChanged = false; 3449 3448 3450 Log(("vmsvga3dSetTransform cid=%x %s\n", cid, vmsvgaTransformToString(type))); 3451 3452 if ( cid >= pState->cContexts 3453 || pState->papContexts[cid]->id != cid) 3454 { 3455 Log(("vmsvga3dSetTransform invalid context id!\n")); 3456 return VERR_INVALID_PARAMETER; 3457 } 3449 Log(("vmsvga3dSetTransform cid=%u %s\n", cid, vmsvgaTransformToString(type))); 3458 3450 3459 3451 ASSERT_GUEST_RETURN((unsigned)type < SVGA3D_TRANSFORM_MAX, VERR_INVALID_PARAMETER); 3460 3452 3461 pContext = pState->papContexts[cid]; 3453 PVMSVGA3DCONTEXT pContext; 3454 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 3455 AssertRCReturn(rc, rc); 3456 3462 3457 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 3463 3458 … … 3486 3481 case SVGA3D_TRANSFORM_PROJECTION: 3487 3482 { 3488 intrc = ShaderTransformProjection(pContext->state.RectViewPort.w, pContext->state.RectViewPort.h, matrix, false /* fPretransformed */);3483 rc = ShaderTransformProjection(pContext->state.RectViewPort.w, pContext->state.RectViewPort.h, matrix, false /* fPretransformed */); 3489 3484 AssertRCReturn(rc, rc); 3490 3485 break; … … 3554 3549 int vmsvga3dSetZRange(PVGASTATE pThis, uint32_t cid, SVGA3dZRange zRange) 3555 3550 { 3556 PVMSVGA3DCONTEXT pContext;3557 3551 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3558 3552 AssertReturn(pState, VERR_NO_MEMORY); 3559 3553 3560 Log(("vmsvga3dSetZRange cid=%x min=%d max=%d\n", cid, (uint32_t)(zRange.min * 100.0), (uint32_t)(zRange.max * 100.0))); 3561 3562 if ( cid >= pState->cContexts 3563 || pState->papContexts[cid]->id != cid) 3564 { 3565 Log(("vmsvga3dSetZRange invalid context id!\n")); 3566 return VERR_INVALID_PARAMETER; 3567 } 3568 pContext = pState->papContexts[cid]; 3554 Log(("vmsvga3dSetZRange cid=%u min=%d max=%d\n", cid, (uint32_t)(zRange.min * 100.0), (uint32_t)(zRange.max * 100.0))); 3555 3556 PVMSVGA3DCONTEXT pContext; 3557 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 3558 AssertRCReturn(rc, rc); 3559 3569 3560 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 3570 3561 … … 3697 3688 { 3698 3689 uint32_t val = UINT32_MAX; /* Shut up MSC. */ 3699 PVMSVGA3DCONTEXT pContext;3700 3690 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3701 3691 AssertReturn(pState, VERR_NO_MEMORY); 3702 3692 3703 Log(("vmsvga3dSetRenderState cid=%x cRenderStates=%d\n", cid, cRenderStates)); 3704 3705 if ( cid >= pState->cContexts 3706 || pState->papContexts[cid]->id != cid) 3707 { 3708 Log(("vmsvga3dSetRenderState invalid context id!\n")); 3709 return VERR_INVALID_PARAMETER; 3710 } 3711 3712 pContext = pState->papContexts[cid]; 3693 Log(("vmsvga3dSetRenderState cid=%u cRenderStates=%d\n", cid, cRenderStates)); 3694 3695 PVMSVGA3DCONTEXT pContext; 3696 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 3697 AssertRCReturn(rc, rc); 3698 3713 3699 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 3714 3700 … … 3716 3702 { 3717 3703 GLenum enableCap = ~(GLenum)0; 3718 Log(("vmsvga3dSetRenderState: cid=% xstate=%s (%d) val=%x\n", cid, vmsvga3dGetRenderStateName(pRenderState[i].state), pRenderState[i].state, pRenderState[i].uintValue));3704 Log(("vmsvga3dSetRenderState: cid=%u state=%s (%d) val=%x\n", cid, vmsvga3dGetRenderStateName(pRenderState[i].state), pRenderState[i].state, pRenderState[i].uintValue)); 3719 3705 /* Save the render state for vm state saving. */ 3720 3706 ASSERT_GUEST_RETURN((unsigned)pRenderState[i].state < SVGA3D_RS_MAX, VERR_INVALID_PARAMETER); … … 3998 3984 } 3999 3985 4000 intrc = vmsvga3dSetRenderState(pThis, cid, 2, renderstate);3986 rc = vmsvga3dSetRenderState(pThis, cid, 2, renderstate); 4001 3987 AssertRCReturn(rc, rc); 4002 3988 … … 4169 4155 } 4170 4156 4171 intrc = vmsvga3dSetRenderState(pThis, cid, RT_ELEMENTS(renderstate), renderstate);4157 rc = vmsvga3dSetRenderState(pThis, cid, RT_ELEMENTS(renderstate), renderstate); 4172 4158 AssertRCReturn(rc, rc); 4173 4159 … … 4571 4557 AssertReturn((unsigned)type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER); 4572 4558 4573 LogFunc(("cid=% x type=%x sid=%x\n", cid, type, target.sid));4559 LogFunc(("cid=%u type=%x sid=%u\n", cid, type, target.sid)); 4574 4560 4575 4561 PVMSVGA3DCONTEXT pContext; … … 4921 4907 #endif 4922 4908 4923 LogFunc(("cid=% xstage=%d type=%s (%x) val=%x\n",4909 LogFunc(("cid=%u stage=%d type=%s (%x) val=%x\n", 4924 4910 cid, pTextureState[i].stage, vmsvga3dTextureStateToString(pTextureState[i].name), pTextureState[i].name, pTextureState[i].value)); 4925 4911 … … 4996 4982 uint32_t const sid = pTextureState[i].value; 4997 4983 4998 Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture sid=% x replacing sid=%x\n",4984 Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture sid=%u replacing sid=%u\n", 4999 4985 currentStage, sid, pContext->aSidActiveTextures[currentStage])); 5000 4986 … … 5028 5014 AssertRCReturn(rc, rc); 5029 5015 5030 Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture sid=% x (%d,%d) replacing sid=%x\n",5016 Log(("SVGA3D_TS_BIND_TEXTURE: stage %d, texture sid=%u (%d,%d) replacing sid=%u\n", 5031 5017 currentStage, sid, pSurface->pMipmapLevels[0].mipmapSize.width, 5032 5018 pSurface->pMipmapLevels[0].mipmapSize.height, pContext->aSidActiveTextures[currentStage])); … … 5235 5221 AssertReturn(pState, VERR_NO_MEMORY); 5236 5222 5237 LogFunc(("cid=% xface %d\n", cid, face));5223 LogFunc(("cid=%u face %d\n", cid, face)); 5238 5224 5239 5225 PVMSVGA3DCONTEXT pContext; … … 5284 5270 AssertReturn(pState, VERR_NO_MEMORY); 5285 5271 5286 LogFunc(("vmsvga3dSetLightData cid=% xindex=%d type=%d\n", cid, index, pData->type));5272 LogFunc(("vmsvga3dSetLightData cid=%u index=%d type=%d\n", cid, index, pData->type)); 5287 5273 5288 5274 PVMSVGA3DCONTEXT pContext; … … 5461 5447 AssertReturn(pState, VERR_NO_MEMORY); 5462 5448 5463 LogFunc(("cid=% x%d -> %d\n", cid, index, enabled));5449 LogFunc(("cid=%u %d -> %d\n", cid, index, enabled)); 5464 5450 5465 5451 PVMSVGA3DCONTEXT pContext; … … 5494 5480 int vmsvga3dSetViewPort(PVGASTATE pThis, uint32_t cid, SVGA3dRect *pRect) 5495 5481 { 5496 PVMSVGA3DCONTEXT pContext;5497 5482 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5498 5483 AssertReturn(pState, VERR_NO_MEMORY); 5499 5484 5500 Log(("vmsvga3dSetViewPort cid=%x (%d,%d)(%d,%d)\n", cid, pRect->x, pRect->y, pRect->w, pRect->h)); 5501 5502 if ( cid >= pState->cContexts 5503 || pState->papContexts[cid]->id != cid) 5504 { 5505 Log(("vmsvga3dSetViewPort invalid context id!\n")); 5506 return VERR_INVALID_PARAMETER; 5507 } 5508 pContext = pState->papContexts[cid]; 5485 Log(("vmsvga3dSetViewPort cid=%u (%d,%d)(%d,%d)\n", cid, pRect->x, pRect->y, pRect->w, pRect->h)); 5486 5487 PVMSVGA3DCONTEXT pContext; 5488 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5489 AssertRCReturn(rc, rc); 5490 5509 5491 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 5510 5492 … … 5540 5522 int vmsvga3dSetClipPlane(PVGASTATE pThis, uint32_t cid, uint32_t index, float plane[4]) 5541 5523 { 5542 PVMSVGA3DCONTEXT pContext;5543 5524 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5544 5525 AssertReturn(pState, VERR_NO_MEMORY); 5545 5526 double oglPlane[4]; 5546 5527 5547 Log(("vmsvga3dSetClipPlane cid=% x%d (%d,%d)(%d,%d)\n", cid, index, (unsigned)(plane[0] * 100.0), (unsigned)(plane[1] * 100.0), (unsigned)(plane[2] * 100.0), (unsigned)(plane[3] * 100.0)));5528 Log(("vmsvga3dSetClipPlane cid=%u %d (%d,%d)(%d,%d)\n", cid, index, (unsigned)(plane[0] * 100.0), (unsigned)(plane[1] * 100.0), (unsigned)(plane[2] * 100.0), (unsigned)(plane[3] * 100.0))); 5548 5529 AssertReturn(index < SVGA3D_CLIPPLANE_MAX, VERR_INVALID_PARAMETER); 5549 5530 5550 if ( cid >= pState->cContexts 5551 || pState->papContexts[cid]->id != cid) 5552 { 5553 Log(("vmsvga3dSetClipPlane invalid context id!\n")); 5554 return VERR_INVALID_PARAMETER; 5555 } 5556 pContext = pState->papContexts[cid]; 5531 PVMSVGA3DCONTEXT pContext; 5532 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5533 AssertRCReturn(rc, rc); 5534 5557 5535 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 5558 5536 … … 5575 5553 int vmsvga3dSetScissorRect(PVGASTATE pThis, uint32_t cid, SVGA3dRect *pRect) 5576 5554 { 5577 PVMSVGA3DCONTEXT pContext;5578 5555 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5579 5556 AssertReturn(pState, VERR_NO_MEMORY); 5580 5557 5581 Log(("vmsvga3dSetScissorRect cid=%x (%d,%d)(%d,%d)\n", cid, pRect->x, pRect->y, pRect->w, pRect->h)); 5582 5583 if ( cid >= pState->cContexts 5584 || pState->papContexts[cid]->id != cid) 5585 { 5586 Log(("vmsvga3dSetScissorRect invalid context id!\n")); 5587 return VERR_INVALID_PARAMETER; 5588 } 5589 pContext = pState->papContexts[cid]; 5558 Log(("vmsvga3dSetScissorRect cid=%u (%d,%d)(%d,%d)\n", cid, pRect->x, pRect->y, pRect->w, pRect->h)); 5559 5560 PVMSVGA3DCONTEXT pContext; 5561 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5562 AssertRCReturn(rc, rc); 5563 5590 5564 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 5591 5565 … … 5613 5587 { 5614 5588 GLbitfield mask = 0; 5615 PVMSVGA3DCONTEXT pContext;5616 5589 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5617 5590 AssertReturn(pState, VERR_NO_MEMORY); 5618 5591 GLboolean fDepthWriteEnabled = GL_FALSE; 5619 5592 5620 Log(("vmsvga3dCommandClear cid=%x clearFlag=%x color=%x depth=%d stencil=%x cRects=%d\n", cid, clearFlag, color, (uint32_t)(depth * 100.0), stencil, cRects)); 5621 5622 if ( cid >= pState->cContexts 5623 || pState->papContexts[cid]->id != cid) 5624 { 5625 Log(("vmsvga3dCommandClear invalid context id!\n")); 5626 return VERR_INVALID_PARAMETER; 5627 } 5628 pContext = pState->papContexts[cid]; 5593 Log(("vmsvga3dCommandClear cid=%u clearFlag=%x color=%x depth=%d stencil=%x cRects=%d\n", cid, clearFlag, color, (uint32_t)(depth * 100.0), stencil, cRects)); 5594 5595 PVMSVGA3DCONTEXT pContext; 5596 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5597 AssertRCReturn(rc, rc); 5598 5629 5599 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 5630 5600 … … 5866 5836 { 5867 5837 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5868 unsigned sidVertex = pVertexDecl[0].array.surfaceId; 5838 unsigned const sidVertex = pVertexDecl[0].array.surfaceId; 5839 5869 5840 PVMSVGA3DSURFACE pVertexSurface; 5870 5871 AssertReturn(sidVertex < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER); 5872 AssertReturn(sidVertex < pState->cSurfaces && pState->papSurfaces[sidVertex]->id == sidVertex, VERR_INVALID_PARAMETER); 5873 5874 pVertexSurface = pState->papSurfaces[sidVertex]; 5875 Log(("vmsvga3dDrawPrimitives: vertex surface %x\n", sidVertex)); 5841 int rc = vmsvga3dSurfaceFromSid(pState, sidVertex, &pVertexSurface); 5842 AssertRCReturn(rc, rc); 5843 5844 Log(("vmsvga3dDrawPrimitives: vertex surface sid=%u\n", sidVertex)); 5876 5845 5877 5846 /* Create and/or bind the vertex buffer. */ … … 5921 5890 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)); 5922 5891 5923 intrc = vmsvga3dVertexDecl2OGL(pVertexDecl[iVertex].identity, size, type, normalized);5892 rc = vmsvga3dVertexDecl2OGL(pVertexDecl[iVertex].identity, size, type, normalized); 5924 5893 AssertRCReturn(rc, rc); 5925 5894 … … 6131 6100 SVGA3dVertexDivisor *pVertexDivisor) 6132 6101 { 6133 RT_NOREF(pVertexDivisor);6134 6102 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6135 6103 AssertReturn(pState, VERR_INTERNAL_ERROR); 6136 PVMSVGA3DCONTEXT pContext;6137 int rc = VERR_NOT_IMPLEMENTED;6138 6104 uint32_t iCurrentVertex; 6139 6105 6140 Log(("vmsvga3dDrawPrimitives cid=% xnumVertexDecls=%d numRanges=%d, cVertexDivisor=%d\n", cid, numVertexDecls, numRanges, cVertexDivisor));6106 Log(("vmsvga3dDrawPrimitives cid=%u numVertexDecls=%d numRanges=%d, cVertexDivisor=%d\n", cid, numVertexDecls, numRanges, cVertexDivisor)); 6141 6107 6142 6108 /* Caller already check these, but it cannot hurt to check again... */ … … 6148 6114 pVertexDivisor = NULL; /* Be sure. */ 6149 6115 6150 if ( cid >= pState->cContexts 6151 || pState->papContexts[cid]->id != cid) 6152 { 6153 Log(("vmsvga3dDrawPrimitives invalid context id!\n")); 6154 return VERR_INVALID_PARAMETER; 6155 } 6156 pContext = pState->papContexts[cid]; 6116 PVMSVGA3DCONTEXT pContext; 6117 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 6118 AssertRCReturn(rc, rc); 6119 6157 6120 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 6158 6121 … … 6285 6248 { 6286 6249 GLenum modeDraw; 6287 unsigned sidIndex = pRange[iPrimitive].indexArray.surfaceId;6250 unsigned const sidIndex = pRange[iPrimitive].indexArray.surfaceId; 6288 6251 PVMSVGA3DSURFACE pIndexSurface = NULL; 6289 6252 unsigned cVertices; … … 6301 6264 AssertMsg(pRange[iPrimitive].indexWidth == sizeof(uint32_t) || pRange[iPrimitive].indexWidth == sizeof(uint16_t), ("Unsupported primitive width %d\n", pRange[iPrimitive].indexWidth)); 6302 6265 6303 if ( sidIndex >= SVGA3D_MAX_SURFACE_IDS 6304 || sidIndex >= pState->cSurfaces 6305 || pState->papSurfaces[sidIndex]->id != sidIndex) 6266 rc = vmsvga3dSurfaceFromSid(pState, sidIndex, &pIndexSurface); 6267 if (RT_FAILURE(rc)) 6306 6268 { 6307 Assert(sidIndex < SVGA3D_MAX_SURFACE_IDS); 6308 Assert(sidIndex < pState->cSurfaces && pState->papSurfaces[sidIndex]->id == sidIndex); 6309 rc = VERR_INVALID_PARAMETER; 6269 AssertRC(rc); 6310 6270 goto internal_error; 6311 6271 } 6312 pIndexSurface = pState->papSurfaces[sidIndex]; 6313 Log(("vmsvga3dDrawPrimitives: index surface %x\n", sidIndex));6272 6273 Log(("vmsvga3dDrawPrimitives: index surface sid=%u\n", sidIndex)); 6314 6274 6315 6275 if (pIndexSurface->oglId.buffer == OPENGL_INVALID_ID) … … 6473 6433 6474 6434 AssertMsg(pTexture->oglId.texture == (GLuint)activeTexture, 6475 ("% x vs %x unit %d (active unit %d) sid=%x\n", pTexture->oglId.texture, activeTexture, i,6435 ("%d vs %d unit %d (active unit %d) sid=%u\n", pTexture->oglId.texture, activeTexture, i, 6476 6436 activeTextureUnit - GL_TEXTURE0, pContext->aSidActiveTextures[i])); 6477 6437 } … … 6507 6467 int vmsvga3dShaderDefine(PVGASTATE pThis, uint32_t cid, uint32_t shid, SVGA3dShaderType type, uint32_t cbData, uint32_t *pShaderData) 6508 6468 { 6509 PVMSVGA3DCONTEXT pContext;6510 6469 PVMSVGA3DSHADER pShader; 6511 6470 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6512 6471 AssertReturn(pState, VERR_NO_MEMORY); 6513 int rc; 6514 6515 Log(("vmsvga3dShaderDefine cid=%x shid=%d type=%s cbData=0x%x\n", cid, shid, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL", cbData)); 6472 6473 Log(("vmsvga3dShaderDefine cid=%u shid=%d type=%s cbData=0x%x\n", cid, shid, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL", cbData)); 6516 6474 Log3(("shader code:\n%.*Rhxd\n", cbData, pShaderData)); 6517 6475 6518 if ( cid >= pState->cContexts 6519 || pState->papContexts[cid]->id != cid) 6520 { 6521 Log(("vmsvga3dShaderDefine invalid context id!\n")); 6522 return VERR_INVALID_PARAMETER; 6523 } 6524 pContext = pState->papContexts[cid]; 6476 PVMSVGA3DCONTEXT pContext; 6477 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 6478 AssertRCReturn(rc, rc); 6479 6525 6480 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 6526 6481 … … 6610 6565 int vmsvga3dShaderDestroy(PVGASTATE pThis, uint32_t cid, uint32_t shid, SVGA3dShaderType type) 6611 6566 { 6612 PVMSVGA3DCONTEXT pContext;6613 6567 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6614 6568 AssertReturn(pState, VERR_NO_MEMORY); 6615 6569 PVMSVGA3DSHADER pShader = NULL; 6616 int rc; 6617 6618 Log(("vmsvga3dShaderDestroy cid=%x shid=%d type=%s\n", cid, shid, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL")); 6619 6620 if ( cid >= pState->cContexts 6621 || pState->papContexts[cid]->id != cid) 6622 { 6623 Log(("vmsvga3dShaderDestroy invalid context id!\n")); 6624 return VERR_INVALID_PARAMETER; 6625 } 6626 pContext = pState->papContexts[cid]; 6570 6571 Log(("vmsvga3dShaderDestroy cid=%u shid=%d type=%s\n", cid, shid, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL")); 6572 6573 PVMSVGA3DCONTEXT pContext; 6574 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 6575 AssertRCReturn(rc, rc); 6576 6627 6577 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 6628 6578 … … 6668 6618 int rc; 6669 6619 6670 Log(("vmsvga3dShaderSet cid=%x type=%s shid=%d\n", cid, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL", shid)); 6671 6672 if ( !pContext 6673 && cid < pState->cContexts 6674 && pState->papContexts[cid]->id == cid) 6675 pContext = pState->papContexts[cid]; 6676 else if (!pContext) 6677 { 6678 AssertMsgFailed(("cid=%#x cContexts=%#x\n", cid, pState->cContexts)); 6679 Log(("vmsvga3dShaderSet invalid context id!\n")); 6680 return VERR_INVALID_PARAMETER; 6681 } 6620 Log(("vmsvga3dShaderSet cid=%u type=%s shid=%d\n", cid, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL", shid)); 6621 6622 if (!pContext) 6623 { 6624 rc = vmsvga3dContextFromCid(pState, cid, &pContext); 6625 AssertRCReturn(rc, rc); 6626 } 6627 6682 6628 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 6683 6629 … … 6739 6685 int vmsvga3dShaderSetConst(PVGASTATE pThis, uint32_t cid, uint32_t reg, SVGA3dShaderType type, SVGA3dShaderConstType ctype, uint32_t cRegisters, uint32_t *pValues) 6740 6686 { 6741 PVMSVGA3DCONTEXT pContext;6742 6687 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 6743 6688 AssertReturn(pState, VERR_NO_MEMORY); 6744 int rc; 6745 6746 Log(("vmsvga3dShaderSetConst cid=%x reg=%x type=%s cregs=%d ctype=%x\n", cid, reg, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL", cRegisters, ctype)); 6747 6748 if ( cid >= pState->cContexts 6749 || pState->papContexts[cid]->id != cid) 6750 { 6751 Log(("vmsvga3dShaderSetConst invalid context id!\n")); 6752 return VERR_INVALID_PARAMETER; 6753 } 6754 pContext = pState->papContexts[cid]; 6689 6690 Log(("vmsvga3dShaderSetConst cid=%u reg=%x type=%s cregs=%d ctype=%x\n", cid, reg, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL", cRegisters, ctype)); 6691 6692 PVMSVGA3DCONTEXT pContext; 6693 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 6694 AssertRCReturn(rc, rc); 6695 6755 6696 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 6756 6697 -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-savedstate.cpp
r82048 r82090 458 458 AssertRCReturn(rc, rc); 459 459 460 Log(("Surface sid=% x: load mipmap level %d with %x bytes data (present=%d).\n", sid, j, pMipmapLevel->cbSurface, fDataPresent));460 Log(("Surface sid=%u: load mipmap level %d with %x bytes data (present=%d).\n", sid, j, pMipmapLevel->cbSurface, fDataPresent)); 461 461 462 462 if (fDataPresent) … … 701 701 PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->pMipmapLevels[idx]; 702 702 703 Log(("Surface sid=% d: save mipmap level %d with %x bytes data.\n", sid, i, pMipmapLevel->cbSurface));703 Log(("Surface sid=%u: save mipmap level %d with %x bytes data.\n", sid, i, pMipmapLevel->cbSurface)); 704 704 705 705 if (!VMSVGA3DSURFACE_HAS_HW_SURFACE(pSurface)) … … 769 769 /** @todo stricter checks for associated context */ 770 770 uint32_t cid = pSurface->idAssociatedContext; 771 if ( cid >= pState->cContexts 772 || pState->papContexts[cid]->id != cid) 773 { 774 Log(("vmsvga3dSaveExec invalid context id (%x - %x)!\n", cid, (cid >= pState->cContexts) ? -1 : pState->papContexts[cid]->id)); 775 AssertFailedReturn(VERR_INVALID_PARAMETER); 776 } 777 PVMSVGA3DCONTEXT pContext = pState->papContexts[cid]; 771 772 PVMSVGA3DCONTEXT pContext; 773 rc = vmsvga3dContextFromCid(pState, cid, &pContext); 774 AssertRCReturn(rc, rc); 778 775 779 776 hr = pSurface->bounce.pTexture->GetSurfaceLevel(i, &pDest); -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r82089 r82090 1315 1315 return VINF_SUCCESS; 1316 1316 1317 LogFunc(("track usage of sid=% x (cid=%d) for cid=%d, pQuery %p\n", pSurface->id, pSurface->idAssociatedContext, pContext->id, pSurface->pQuery));1317 LogFunc(("track usage of sid=%u (cid=%u) for cid=%u, pQuery %p\n", pSurface->id, pSurface->idAssociatedContext, pContext->id, pSurface->pQuery)); 1318 1318 1319 1319 if (pSurface->idQueryContext == pContext->id) … … 1357 1357 static int vmsvga3dSurfaceTrackUsageById(PVMSVGA3DSTATE pState, PVMSVGA3DCONTEXT pContext, uint32_t sid) 1358 1358 { 1359 Assert(sid < SVGA3D_MAX_SURFACE_IDS); 1360 AssertReturn(sid < pState->cSurfaces, VERR_INVALID_PARAMETER); 1361 PVMSVGA3DSURFACE pSurface = pState->papSurfaces[sid]; 1362 AssertReturn(pSurface && pSurface->id == sid, VERR_INVALID_PARAMETER); 1359 PVMSVGA3DSURFACE pSurface; 1360 int rc = vmsvga3dSurfaceFromSid(pState, sid, &pSurface); 1361 AssertRCReturn(rc, rc); 1363 1362 1364 1363 return vmsvga3dSurfaceTrackUsage(pState, pContext, pSurface); … … 1379 1378 Assert(pSurface->pSharedObjectTree); 1380 1379 1381 Log(("vmsvga3dSurfaceFlush: wait for draw to finish (sid=% x)\n", pSurface->id));1380 Log(("vmsvga3dSurfaceFlush: wait for draw to finish (sid=%u)\n", pSurface->id)); 1382 1381 while (true) 1383 1382 { … … 1425 1424 || pSurface->enmD3DResType == VMSVGA3D_D3DRESTYPE_CUBE_TEXTURE) 1426 1425 { 1427 LogFunc(("using texture sid=% xcreated for another context (%d vs %d)\n",1426 LogFunc(("using texture sid=%u created for another context (%d vs %d)\n", 1428 1427 pSurface->id, pSurface->idAssociatedContext, pContext->id)); 1429 1428 … … 1435 1434 else 1436 1435 { 1437 AssertMsgFailed(("surface sid=% xcreated for another context (%d vs %d)\n",1436 AssertMsgFailed(("surface sid=%u created for another context (%d vs %d)\n", 1438 1437 pSurface->id, pSurface->idAssociatedContext, pContext->id)); 1439 1438 } … … 1512 1511 AssertRCReturn(rc, rc); 1513 1512 1514 LogFunc(("sid=% xtype=%x format=%d -> create dest texture\n", sidDest, pSurfaceDest->surfaceFlags, pSurfaceDest->format));1513 LogFunc(("sid=%u type=%x format=%d -> create dest texture\n", sidDest, pSurfaceDest->surfaceFlags, pSurfaceDest->format)); 1515 1514 rc = vmsvga3dBackCreateTexture(pState, pContextSrc, cidSrc, pSurfaceDest); 1516 1515 AssertRCReturn(rc, rc); … … 1569 1568 RectDest.bottom = clipBox.y + clipBox.h; /* exclusive */ 1570 1569 1571 LogFunc(("StretchRect copy src sid=% x face=%d mipmap=%d (%d,%d)(%d,%d) to dest sid=%xface=%d mipmap=%d (%d,%d)\n", sidSrc, src.face, src.mipmap, RectSrc.left, RectSrc.top, RectSrc.right, RectSrc.bottom, sidDest, dest.face, dest.mipmap, pBox[i].x, pBox[i].y));1570 LogFunc(("StretchRect copy src sid=%u face=%d mipmap=%d (%d,%d)(%d,%d) to dest sid=%u face=%d mipmap=%d (%d,%d)\n", sidSrc, src.face, src.mipmap, RectSrc.left, RectSrc.top, RectSrc.right, RectSrc.bottom, sidDest, dest.face, dest.mipmap, pBox[i].x, pBox[i].y)); 1572 1571 1573 1572 if ( sidSrc == sidDest … … 1724 1723 RectDest.bottom = clipBox.y + clipBox.h; /* exclusive */ 1725 1724 1726 LogFunc(("(manual) copy sid=% x face=%d mipmap=%d (%d,%d)(%d,%d) to sid=%xface=%d mipmap=%d (%d,%d)\n",1725 LogFunc(("(manual) copy sid=%u face=%d mipmap=%d (%d,%d)(%d,%d) to sid=%u face=%d mipmap=%d (%d,%d)\n", 1727 1726 sidSrc, src.face, src.mipmap, RectSrc.left, RectSrc.top, RectSrc.right, RectSrc.bottom, 1728 1727 sidDest, dest.face, dest.mipmap, pBox[i].x, pBox[i].y)); … … 1835 1834 HRESULT hr; 1836 1835 1837 LogFunc(("sid=% x\n", pSurface->id));1836 LogFunc(("sid=%u\n", pSurface->id)); 1838 1837 1839 1838 Assert(pSurface->hSharedObject == NULL); … … 2401 2400 AssertMsgReturn(hr == D3D_OK, ("LockRect failed with %x\n", hr), VERR_INTERNAL_ERROR); 2402 2401 2403 LogFunc(("Lock sid=% x%s(bounce=%d) memory for rectangle (%d,%d)(%d,%d)\n",2402 LogFunc(("Lock sid=%u %s(bounce=%d) memory for rectangle (%d,%d)(%d,%d)\n", 2404 2403 pSurface->id, fTexture ? "TEXTURE " : "", RT_BOOL(pSurface->bounce.pTexture), 2405 2404 Rect.left, Rect.top, Rect.right, Rect.bottom)); … … 2515 2514 { 2516 2515 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 2517 PVMSVGA3DSURFACE pSurface;2518 int rc = VINF_SUCCESS;2519 2516 HRESULT hr; 2520 2517 2521 AssertReturn(pState, VERR_NO_MEMORY); 2522 AssertReturn(sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER); 2523 AssertReturn(sid < pState->cSurfaces && pState->papSurfaces[sid]->id == sid, VERR_INVALID_PARAMETER); 2524 2525 pSurface = pState->papSurfaces[sid]; 2518 PVMSVGA3DSURFACE pSurface; 2519 int rc = vmsvga3dSurfaceFromSid(pState, sid, &pSurface); 2520 AssertRCReturn(rc, rc); 2526 2521 AssertReturn(pSurface->idAssociatedContext != SVGA3D_INVALID_ID, VERR_INTERNAL_ERROR); 2527 2522 … … 2530 2525 pSurface->autogenFilter = filter; 2531 2526 2532 Log(("vmsvga3dGenerateMipmaps: sid=% xfilter=%d\n", sid, filter));2527 Log(("vmsvga3dGenerateMipmaps: sid=%u filter=%d\n", sid, filter)); 2533 2528 2534 2529 if (!pSurface->u.pSurface) 2535 2530 { 2536 PVMSVGA3DCONTEXT pContext;2537 uint32_t cid;2538 2539 2531 /** @todo stricter checks for associated context */ 2540 cid = pSurface->idAssociatedContext; 2541 2542 if ( cid >= pState->cContexts 2543 || pState->papContexts[cid]->id != cid) 2544 { 2545 Log(("vmsvga3dGenerateMipmaps invalid context id!\n")); 2546 return VERR_INVALID_PARAMETER; 2547 } 2548 pContext = pState->papContexts[cid]; 2532 uint32_t const cid = pSurface->idAssociatedContext; 2533 2534 PVMSVGA3DCONTEXT pContext; 2535 rc = vmsvga3dContextFromCid(pState, cid, &pContext); 2536 AssertRCReturn(rc, rc); 2549 2537 2550 2538 /* Unknown surface type; turn it into a texture. */ 2551 LogFunc(("unknown src surface sid=% xtype=%d format=%d -> create texture\n", sid, pSurface->surfaceFlags, pSurface->format));2539 LogFunc(("unknown src surface sid=%u type=%d format=%d -> create texture\n", sid, pSurface->surfaceFlags, pSurface->format)); 2552 2540 rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pSurface); 2553 2541 AssertRCReturn(rc, rc); … … 2697 2685 int rc; 2698 2686 2699 LogFunc(("Remove all dependencies for surface sid=% x\n", sid));2687 LogFunc(("Remove all dependencies for surface sid=%u\n", sid)); 2700 2688 2701 2689 uint32_t surfaceFlags = pSurface->surfaceFlags; … … 2740 2728 if (pSharedSurface) 2741 2729 { 2742 LogFunc(("Remove shared dependency for surface sid=% x\n", sid));2730 LogFunc(("Remove shared dependency for surface sid=%u\n", sid)); 2743 2731 2744 2732 switch (pSurface->enmD3DResType) … … 2856 2844 && pSurface->u.pSurface) 2857 2845 { 2858 Log(("vmsvga3dChangeMode: sync back data of surface sid=% x(fDirty=%d)\n", sid, pSurface->fDirty));2846 Log(("vmsvga3dChangeMode: sync back data of surface sid=%u (fDirty=%d)\n", sid, pSurface->fDirty)); 2859 2847 2860 2848 /* Reallocate our surface memory buffers. */ … … 3077 3065 D3DTRANSFORMSTATETYPE d3dState; 3078 3066 HRESULT hr; 3079 PVMSVGA3DCONTEXT pContext;3080 3067 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3081 3068 AssertReturn(pState, VERR_NO_MEMORY); … … 3085 3072 ASSERT_GUEST_RETURN((unsigned)type < SVGA3D_TRANSFORM_MAX, VERR_INVALID_PARAMETER); 3086 3073 3087 if ( cid >= pState->cContexts 3088 || pState->papContexts[cid]->id != cid) 3089 { 3090 Log(("vmsvga3dSetTransform invalid context id!\n")); 3091 return VERR_INVALID_PARAMETER; 3092 } 3093 pContext = pState->papContexts[cid]; 3074 PVMSVGA3DCONTEXT pContext; 3075 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 3076 AssertRCReturn(rc, rc); 3094 3077 3095 3078 switch (type) … … 3161 3144 D3DVIEWPORT9 viewport; 3162 3145 HRESULT hr; 3163 PVMSVGA3DCONTEXT pContext;3164 3146 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3165 3147 AssertReturn(pState, VERR_NO_MEMORY); … … 3167 3149 Log(("vmsvga3dSetZRange %x min=%d max=%d\n", cid, (uint32_t)(zRange.min * 100.0), (uint32_t)(zRange.max * 100.0))); 3168 3150 3169 if ( cid >= pState->cContexts 3170 || pState->papContexts[cid]->id != cid) 3171 { 3172 Log(("vmsvga3dSetZRange invalid context id!\n")); 3173 return VERR_INVALID_PARAMETER; 3174 } 3175 pContext = pState->papContexts[cid]; 3151 PVMSVGA3DCONTEXT pContext; 3152 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 3153 AssertRCReturn(rc, rc); 3154 3176 3155 pContext->state.zRange = zRange; 3177 3156 pContext->state.u32UpdateFlags |= VMSVGA3D_UPDATE_ZRANGE; … … 3237 3216 DWORD val = 0; /* Shut up MSC */ 3238 3217 HRESULT hr; 3239 PVMSVGA3DCONTEXT pContext;3240 3218 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3241 3219 AssertReturn(pState, VERR_NO_MEMORY); 3242 3220 3243 Log(("vmsvga3dSetRenderState cid=%x cRenderStates=%d\n", cid, cRenderStates)); 3244 3245 if ( cid >= pState->cContexts 3246 || pState->papContexts[cid]->id != cid) 3247 { 3248 Log(("vmsvga3dSetRenderState invalid context id!\n")); 3249 return VERR_INVALID_PARAMETER; 3250 } 3251 pContext = pState->papContexts[cid]; 3221 Log(("vmsvga3dSetRenderState cid=%u cRenderStates=%d\n", cid, cRenderStates)); 3222 3223 PVMSVGA3DCONTEXT pContext; 3224 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 3225 AssertRCReturn(rc, rc); 3252 3226 3253 3227 for (unsigned i = 0; i < cRenderStates; i++) … … 3917 3891 AssertReturn((unsigned)type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER); 3918 3892 3919 LogFunc(("cid=% x type=%x sid=%xface=%u mipmap=%u\n", cid, type, target.sid, target.face, target.mipmap));3893 LogFunc(("cid=%u type=%x sid=%u face=%u mipmap=%u\n", cid, type, target.sid, target.face, target.mipmap)); 3920 3894 3921 3895 PVMSVGA3DCONTEXT pContext; … … 4127 4101 if (!pRenderTarget->u.pTexture) 4128 4102 { 4129 LogFunc(("Create texture to be used as render target; sid=% xtype=%d format=%d -> create texture\n", target.sid, pRenderTarget->surfaceFlags, pRenderTarget->format));4103 LogFunc(("Create texture to be used as render target; sid=%u type=%d format=%d -> create texture\n", target.sid, pRenderTarget->surfaceFlags, pRenderTarget->format)); 4130 4104 int rc = vmsvga3dBackCreateTexture(pState, pContext, cid, pRenderTarget); 4131 4105 AssertRCReturn(rc, rc); … … 4345 4319 for (unsigned i = 0; i < cTextureStates; i++) 4346 4320 { 4347 LogFunc(("cid=% xstage=%d type=%s (%x) val=%x\n", cid, pTextureState[i].stage, vmsvga3dTextureStateToString(pTextureState[i].name), pTextureState[i].name, pTextureState[i].value));4321 LogFunc(("cid=%u stage=%d type=%s (%x) val=%x\n", cid, pTextureState[i].stage, vmsvga3dTextureStateToString(pTextureState[i].name), pTextureState[i].name, pTextureState[i].value)); 4348 4322 4349 4323 if (pTextureState[i].name == SVGA3D_TS_BIND_TEXTURE) … … 4355 4329 if (RT_UNLIKELY(idxSampler >= SVGA3D_MAX_SAMPLERS)) 4356 4330 { 4357 AssertMsgFailed(("pTextureState[%d]: SVGA3D_TS_BIND_TEXTURE idxSampler=%d, sid=% x\n", i, idxSampler, sid));4331 AssertMsgFailed(("pTextureState[%d]: SVGA3D_TS_BIND_TEXTURE idxSampler=%d, sid=%u\n", i, idxSampler, sid)); 4358 4332 continue; 4359 4333 } … … 4376 4350 AssertRCReturn(rc, rc); 4377 4351 4378 LogFunc(("SVGA3D_TS_BIND_TEXTURE: bind idxSampler=%d, texture sid=% x(%d,%d)\n", idxSampler, sid, pSurface->pMipmapLevels[0].mipmapSize.width, pSurface->pMipmapLevels[0].mipmapSize.height));4352 LogFunc(("SVGA3D_TS_BIND_TEXTURE: bind idxSampler=%d, texture sid=%u (%d,%d)\n", idxSampler, sid, pSurface->pMipmapLevels[0].mipmapSize.width, pSurface->pMipmapLevels[0].mipmapSize.height)); 4379 4353 4380 4354 if (!pSurface->u.pTexture) … … 4397 4371 if (pSurface->idAssociatedContext != cid) 4398 4372 { 4399 LogFunc(("Using texture sid=% xcreated for another context (%d vs %d)\n", sid, pSurface->idAssociatedContext, cid));4373 LogFunc(("Using texture sid=%u created for another context (%d vs %d)\n", sid, pSurface->idAssociatedContext, cid)); 4400 4374 4401 4375 PVMSVGA3DSHAREDSURFACE pSharedSurface = vmsvga3dSurfaceGetSharedCopy(pState, pContext, pSurface); … … 4624 4598 AssertReturn(pState, VERR_NO_MEMORY); 4625 4599 4626 LogFunc(("cid=% xface %d\n", cid, face));4600 LogFunc(("cid=%u face %d\n", cid, face)); 4627 4601 4628 4602 PVMSVGA3DCONTEXT pContext; … … 4930 4904 pVertexSurface->enmD3DResType = VMSVGA3D_D3DRESTYPE_NONE; 4931 4905 4932 LogFunc(("index -> vertex buffer sid=% x\n", pVertexSurface->id));4906 LogFunc(("index -> vertex buffer sid=%u\n", pVertexSurface->id)); 4933 4907 } 4934 4908 … … 4936 4910 if (!pVertexSurface->u.pVertexBuffer) 4937 4911 { 4938 LogFunc(("Create vertex buffer sid=% xfDirty=%d\n", pVertexSurface->id, pVertexSurface->fDirty));4912 LogFunc(("Create vertex buffer sid=%u fDirty=%d\n", pVertexSurface->id, pVertexSurface->fDirty)); 4939 4913 4940 4914 const DWORD Usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY; /* possible severe performance penalty otherwise (according to d3d debug output */ … … 4985 4959 pIndexSurface->enmD3DResType = VMSVGA3D_D3DRESTYPE_NONE; 4986 4960 4987 LogFunc(("vertex -> index buffer sid=% x\n", pIndexSurface->id));4961 LogFunc(("vertex -> index buffer sid=%u\n", pIndexSurface->id)); 4988 4962 } 4989 4963 … … 5093 5067 RT_ZERO(aIndexSurfaces); 5094 5068 5095 LogFunc(("cid=% xnumVertexDecls=%d numRanges=%d, cVertexDivisor=%d\n", cid, numVertexDecls, numRanges, cVertexDivisor));5069 LogFunc(("cid=%u numVertexDecls=%d numRanges=%d, cVertexDivisor=%d\n", cid, numVertexDecls, numRanges, cVertexDivisor)); 5096 5070 5097 5071 AssertReturn(numVertexDecls && numVertexDecls <= SVGA3D_MAX_VERTEX_ARRAYS, VERR_INVALID_PARAMETER); … … 5152 5126 AssertRCBreak(rc); 5153 5127 5154 LogFunc(("SetStreamSource vertex sid=% xstream %d min offset=%d stride=%d\n",5128 LogFunc(("SetStreamSource vertex sid=%u stream %d min offset=%d stride=%d\n", 5155 5129 pVertexSurface->id, iCurrentStreamId, uVertexMinOffset, strideVertex)); 5156 5130 … … 5242 5216 aIndexSurfaces[iPrimitive] = pIndexSurface; 5243 5217 5244 Log(("vmsvga3dDrawPrimitives: index sid=% x\n", sidIndex));5218 Log(("vmsvga3dDrawPrimitives: index sid=%u\n", sidIndex)); 5245 5219 5246 5220 rc = vmsvga3dDrawPrimitivesSyncIndexBuffer(pContext, pIndexSurface, pRange[iPrimitive].indexWidth); … … 5384 5358 HRESULT hr; 5385 5359 RECT rect; 5386 PVMSVGA3DCONTEXT pContext;5387 5360 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5388 5361 AssertReturn(pState, VERR_NO_MEMORY); … … 5390 5363 Log(("vmsvga3dSetScissorRect %x (%d,%d)(%d,%d)\n", cid, pRect->x, pRect->y, pRect->w, pRect->h)); 5391 5364 5392 if ( cid >= pState->cContexts 5393 || pState->papContexts[cid]->id != cid) 5394 { 5395 Log(("vmsvga3dSetScissorRect invalid context id!\n")); 5396 return VERR_INVALID_PARAMETER; 5397 } 5398 pContext = pState->papContexts[cid]; 5365 PVMSVGA3DCONTEXT pContext; 5366 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5367 AssertRCReturn(rc, rc); 5399 5368 5400 5369 /* Store for vm state save/restore. */ … … 5417 5386 { 5418 5387 HRESULT hr; 5419 PVMSVGA3DCONTEXT pContext;5420 5388 PVMSVGA3DSHADER pShader; 5421 5389 PVMSVGA3DSTATE pState = pThis->svga.p3dState; … … 5443 5411 #endif 5444 5412 5445 if ( cid >= pState->cContexts 5446 || pState->papContexts[cid]->id != cid) 5447 { 5448 Log(("vmsvga3dShaderDefine invalid context id!\n")); 5449 return VERR_INVALID_PARAMETER; 5450 } 5451 pContext = pState->papContexts[cid]; 5413 PVMSVGA3DCONTEXT pContext; 5414 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5415 AssertRCReturn(rc, rc); 5452 5416 5453 5417 AssertReturn(shid < SVGA3D_MAX_SHADER_IDS, VERR_INVALID_PARAMETER); … … 5560 5524 int vmsvga3dShaderDestroy(PVGASTATE pThis, uint32_t cid, uint32_t shid, SVGA3dShaderType type) 5561 5525 { 5562 PVMSVGA3DCONTEXT pContext;5563 5526 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5564 5527 AssertReturn(pState, VERR_NO_MEMORY); … … 5567 5530 Log(("vmsvga3dShaderDestroy %x shid=%x type=%s\n", cid, shid, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL")); 5568 5531 5569 if ( cid >= pState->cContexts 5570 || pState->papContexts[cid]->id != cid) 5571 { 5572 Log(("vmsvga3dShaderDestroy invalid context id!\n")); 5573 return VERR_INVALID_PARAMETER; 5574 } 5575 pContext = pState->papContexts[cid]; 5532 PVMSVGA3DCONTEXT pContext; 5533 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5534 AssertRCReturn(rc, rc); 5576 5535 5577 5536 if (type == SVGA3D_SHADERTYPE_VS) … … 5618 5577 5619 5578 NOREF(pContext); 5620 if ( cid >= pState->cContexts 5621 || pState->papContexts[cid]->id != cid) 5622 { 5623 Log(("vmsvga3dShaderSet invalid context id!\n")); 5624 return VERR_INVALID_PARAMETER; 5625 } 5626 pContext = pState->papContexts[cid]; 5579 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5580 AssertRCReturn(rc, rc); 5627 5581 5628 5582 if (type == SVGA3D_SHADERTYPE_VS) … … 5684 5638 { 5685 5639 HRESULT hr; 5686 PVMSVGA3DCONTEXT pContext;5687 5640 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5688 5641 AssertReturn(pState, VERR_NO_MEMORY); … … 5690 5643 Log(("vmsvga3dShaderSetConst %x reg=%x type=%s ctype=%x\n", cid, reg, (type == SVGA3D_SHADERTYPE_VS) ? "VERTEX" : "PIXEL", ctype)); 5691 5644 5692 if ( cid >= pState->cContexts 5693 || pState->papContexts[cid]->id != cid) 5694 { 5695 Log(("vmsvga3dShaderSetConst invalid context id!\n")); 5696 return VERR_INVALID_PARAMETER; 5697 } 5698 pContext = pState->papContexts[cid]; 5645 PVMSVGA3DCONTEXT pContext; 5646 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5647 AssertRCReturn(rc, rc); 5699 5648 5700 5649 for (uint32_t i = 0; i < cRegisters; i++) -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp
r82089 r82090 64 64 AssertReturn(pState, VERR_NO_MEMORY); 65 65 66 Log(("vmsvga3dSurfaceDefine: sid=% xsurfaceFlags=%x format=%s (%x) multiSampleCount=%d autogenFilter=%d, cMipLevels=%d size=(%d,%d,%d)\n",66 Log(("vmsvga3dSurfaceDefine: sid=%u surfaceFlags=%x format=%s (%x) multiSampleCount=%d autogenFilter=%d, cMipLevels=%d size=(%d,%d,%d)\n", 67 67 sid, surfaceFlags, vmsvgaLookupEnum((int)format, &g_SVGA3dSurfaceFormat2String), format, multisampleCount, autogenFilter, 68 68 cMipLevels, paMipLevelSizes->width, paMipLevelSizes->height, paMipLevelSizes->depth)); … … 342 342 AssertRCReturn(rc, rc); 343 343 344 LogFunc(("sid=% x\n", sid));344 LogFunc(("sid=%u\n", sid)); 345 345 346 346 /* Check all contexts if this surface is used as a render target or active texture. */ … … 412 412 PVMSVGA3DCONTEXT pContext; 413 413 #ifdef VMSVGA3D_OPENGL 414 LogFunc(("src sid=% x (%d,%d)(%d,%d) dest sid=%x(%d,%d)(%d,%d) mode=%x\n",414 LogFunc(("src sid=%u (%d,%d)(%d,%d) dest sid=%u (%d,%d)(%d,%d) mode=%x\n", 415 415 sidSrc, pSrcBox->x, pSrcBox->y, pSrcBox->x + pSrcBox->w, pSrcBox->y + pSrcBox->h, 416 416 sidDst, pDstBox->x, pDstBox->y, pDstBox->x + pDstBox->w, pDstBox->y + pDstBox->h, enmMode)); … … 418 418 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 419 419 #else 420 LogFunc(("src sid=% x cid=%x (%d,%d)(%d,%d) dest sid=%x cid=%x(%d,%d)(%d,%d) mode=%x\n",420 LogFunc(("src sid=%u cid=%u (%d,%d)(%d,%d) dest sid=%u cid=%u (%d,%d)(%d,%d) mode=%x\n", 421 421 sidSrc, pSrcSurface->idAssociatedContext, pSrcBox->x, pSrcBox->y, pSrcBox->x + pSrcBox->w, pSrcBox->y + pSrcBox->h, 422 422 sidDst, pDstSurface->idAssociatedContext, pDstBox->x, pDstBox->y, pDstBox->x + pDstBox->w, pDstBox->y + pDstBox->h, enmMode)); … … 436 436 { 437 437 /* Unknown surface type; turn it into a texture, which can be used for other purposes too. */ 438 LogFunc(("unknown src sid=% xtype=%d format=%d -> create texture\n", sidSrc, pSrcSurface->surfaceFlags, pSrcSurface->format));438 LogFunc(("unknown src sid=%u type=%d format=%d -> create texture\n", sidSrc, pSrcSurface->surfaceFlags, pSrcSurface->format)); 439 439 rc = vmsvga3dBackCreateTexture(pState, pContext, pContext->id, pSrcSurface); 440 440 AssertRCReturn(rc, rc); … … 444 444 { 445 445 /* Unknown surface type; turn it into a texture, which can be used for other purposes too. */ 446 LogFunc(("unknown dest sid=% xtype=%d format=%d -> create texture\n", sidDst, pDstSurface->surfaceFlags, pDstSurface->format));446 LogFunc(("unknown dest sid=%u type=%d format=%d -> create texture\n", sidDst, pDstSurface->surfaceFlags, pDstSurface->format)); 447 447 rc = vmsvga3dBackCreateTexture(pState, pContext, pContext->id, pDstSurface); 448 448 AssertRCReturn(rc, rc); … … 489 489 AssertRCReturn(rc, rc); 490 490 491 LogFunc(("%sguestptr gmr=%x offset=%x pitch=%x host sid=% xface=%d mipmap=%d transfer=%s cCopyBoxes=%d\n",491 LogFunc(("%sguestptr gmr=%x offset=%x pitch=%x host sid=%u face=%d mipmap=%d transfer=%s cCopyBoxes=%d\n", 492 492 (pSurface->surfaceFlags & SVGA3D_SURFACE_HINT_TEXTURE) ? "TEXTURE " : "", 493 493 guest.ptr.gmrId, guest.ptr.offset, guest.pitch, … … 696 696 AssertReturn(pState, VERR_NO_MEMORY); 697 697 698 LogFunc(("cid=% xtype=%d\n", cid, type));698 LogFunc(("cid=%u type=%d\n", cid, type)); 699 699 700 700 PVMSVGA3DCONTEXT pContext; … … 731 731 AssertReturn(pState, VERR_NO_MEMORY); 732 732 733 LogFunc(("cid=% xtype=%d guestResult %d:0x%x\n", cid, type, guestResult.gmrId, guestResult.offset));733 LogFunc(("cid=%u type=%d guestResult %d:0x%x\n", cid, type, guestResult.gmrId, guestResult.offset)); 734 734 735 735 PVMSVGA3DCONTEXT pContext; … … 761 761 AssertReturn(pState, VERR_NO_MEMORY); 762 762 763 LogFunc(("cid=% xtype=%d guestResult GMR%d:0x%x\n", cid, type, guestResult.gmrId, guestResult.offset));763 LogFunc(("cid=%u type=%d guestResult GMR%d:0x%x\n", cid, type, guestResult.gmrId, guestResult.offset)); 764 764 765 765 PVMSVGA3DCONTEXT pContext; … … 812 812 { 813 813 /* Requires SVGA_FIFO_CAP_SCREEN_OBJECT support */ 814 LogFunc(("dest=%d (%d,%d)(%d,%d) sid=% x(face=%d, mipmap=%d) (%d,%d)(%d,%d) cRects=%d\n",814 LogFunc(("dest=%d (%d,%d)(%d,%d) sid=%u (face=%d, mipmap=%d) (%d,%d)(%d,%d) cRects=%d\n", 815 815 idDstScreen, destRect.left, destRect.top, destRect.right, destRect.bottom, src.sid, src.face, src.mipmap, 816 816 srcRect.left, srcRect.top, srcRect.right, srcRect.bottom, cRects));
Note:
See TracChangeset
for help on using the changeset viewer.

