Changeset 78589 in vbox for trunk/src/VBox
- Timestamp:
- May 20, 2019 9:55:47 AM (6 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-ogl.cpp
r77114 r78589 4448 4448 int vmsvga3dSetRenderTarget(PVGASTATE pThis, uint32_t cid, SVGA3dRenderTargetType type, SVGA3dSurfaceImageId target) 4449 4449 { 4450 PVMSVGA3DCONTEXT pContext; 4451 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4452 PVMSVGA3DSURFACE pRenderTarget; 4450 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4453 4451 4454 4452 AssertReturn(pState, VERR_NO_MEMORY); 4455 AssertReturn(type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER); 4456 4457 Log(("vmsvga3dSetRenderTarget cid=%x type=%x surface id=%x\n", cid, type, target.sid)); 4458 4459 if ( cid >= pState->cContexts 4460 || pState->papContexts[cid]->id != cid) 4461 { 4462 Log(("vmsvga3dSetRenderTarget invalid context id!\n")); 4463 return VERR_INVALID_PARAMETER; 4464 } 4465 pContext = pState->papContexts[cid]; 4453 AssertReturn((unsigned)type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER); 4454 4455 LogFunc(("cid=%x type=%x sid=%x\n", cid, type, target.sid)); 4456 4457 PVMSVGA3DCONTEXT pContext; 4458 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 4459 AssertRCReturn(rc, rc); 4460 4466 4461 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 4467 4462 … … 4498 4493 } 4499 4494 4500 AssertReturn(target.sid < SVGA3D_MAX_SURFACE_IDS, VERR_INVALID_PARAMETER);4501 AssertReturn(target.sid < pState->cSurfaces && pState->papSurfaces[target.sid]->id == target.sid, VERR_INVALID_PARAMETER);4502 pRenderTarget = pState->papSurfaces[target.sid];4495 PVMSVGA3DSURFACE pRenderTarget; 4496 rc = vmsvga3dSurfaceFromSid(pState, target.sid, &pRenderTarget); 4497 AssertRCReturn(rc, rc); 4503 4498 4504 4499 switch (type) … … 4788 4783 GLenum val = ~(GLenum)0; /* Shut up MSC. */ 4789 4784 GLenum currentStage = ~(GLenum)0; 4790 PVMSVGA3DCONTEXT pContext;4791 4785 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4792 4786 AssertReturn(pState, VERR_NO_MEMORY); … … 4794 4788 Log(("vmsvga3dSetTextureState %x cTextureState=%d\n", cid, cTextureStates)); 4795 4789 4796 if ( cid >= pState->cContexts 4797 || pState->papContexts[cid]->id != cid) 4798 { 4799 Log(("vmsvga3dSetTextureState invalid context id!\n")); 4800 return VERR_INVALID_PARAMETER; 4801 } 4802 pContext = pState->papContexts[cid]; 4790 PVMSVGA3DCONTEXT pContext; 4791 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 4792 AssertRCReturn(rc, rc); 4793 4803 4794 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 4804 4795 … … 5103 5094 int vmsvga3dSetMaterial(PVGASTATE pThis, uint32_t cid, SVGA3dFace face, SVGA3dMaterial *pMaterial) 5104 5095 { 5105 PVMSVGA3DCONTEXT pContext; 5106 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5096 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5107 5097 AssertReturn(pState, VERR_NO_MEMORY); 5108 GLenum oglFace; 5109 5110 Log(("vmsvga3dSetMaterial cid=%x face %d\n", cid, face)); 5111 5112 if ( cid >= pState->cContexts 5113 || pState->papContexts[cid]->id != cid) 5114 { 5115 Log(("vmsvga3dSetMaterial invalid context id!\n")); 5116 return VERR_INVALID_PARAMETER; 5117 } 5118 pContext = pState->papContexts[cid]; 5098 5099 LogFunc(("cid=%x face %d\n", cid, face)); 5100 5101 PVMSVGA3DCONTEXT pContext; 5102 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5103 AssertRCReturn(rc, rc); 5104 5119 5105 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 5120 5106 5107 GLenum oglFace; 5121 5108 switch (face) 5122 5109 { … … 5156 5143 int vmsvga3dSetLightData(PVGASTATE pThis, uint32_t cid, uint32_t index, SVGA3dLightData *pData) 5157 5144 { 5158 PVMSVGA3DCONTEXT pContext; 5159 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5145 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5160 5146 AssertReturn(pState, VERR_NO_MEMORY); 5161 float QuadAttenuation; 5162 5163 Log(("vmsvga3dSetLightData cid=%x index=%d type=%d\n", cid, index, pData->type)); 5164 5165 if ( cid >= pState->cContexts 5166 || pState->papContexts[cid]->id != cid) 5167 { 5168 Log(("vmsvga3dSetLightData invalid context id!\n")); 5169 return VERR_INVALID_PARAMETER; 5170 } 5171 pContext = pState->papContexts[cid]; 5147 5148 LogFunc(("vmsvga3dSetLightData cid=%x index=%d type=%d\n", cid, index, pData->type)); 5149 5150 PVMSVGA3DCONTEXT pContext; 5151 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5152 AssertRCReturn(rc, rc); 5153 5172 5154 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 5173 5155 … … 5198 5180 glLightfv(GL_LIGHT0 + index, GL_AMBIENT, pData->ambient); 5199 5181 5182 float QuadAttenuation; 5200 5183 if (pData->range * pData->range >= FLT_MIN) 5201 5184 QuadAttenuation = 1.4f / (pData->range * pData->range); … … 5325 5308 default: 5326 5309 Log(("Unsupported light type!!\n")); 5327 return VERR_INVALID_PARAMETER; 5310 rc = VERR_INVALID_PARAMETER; 5311 break; 5328 5312 } 5329 5313 … … 5331 5315 glPopMatrix(); 5332 5316 5333 return VINF_SUCCESS;5317 return rc; 5334 5318 } 5335 5319 5336 5320 int vmsvga3dSetLightEnabled(PVGASTATE pThis, uint32_t cid, uint32_t index, uint32_t enabled) 5337 5321 { 5338 PVMSVGA3DCONTEXT pContext; 5339 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5322 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 5340 5323 AssertReturn(pState, VERR_NO_MEMORY); 5341 5324 5342 Log(("vmsvga3dSetLightEnabled cid=%x %d -> %d\n", cid, index, enabled)); 5343 5344 if ( cid >= pState->cContexts 5345 || pState->papContexts[cid]->id != cid) 5346 { 5347 Log(("vmsvga3dSetLightEnabled invalid context id!\n")); 5348 return VERR_INVALID_PARAMETER; 5349 } 5350 pContext = pState->papContexts[cid]; 5325 LogFunc(("cid=%x %d -> %d\n", cid, index, enabled)); 5326 5327 PVMSVGA3DCONTEXT pContext; 5328 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 5329 AssertRCReturn(rc, rc); 5330 5351 5331 VMSVGA3D_SET_CURRENT_CONTEXT(pState, pContext); 5352 5332 … … 5359 5339 if (enabled) 5360 5340 { 5361 /* Load the default settings if none have been set yet. */ 5362 if (!pContext->state.aLightData[index].fValidData) 5363 vmsvga3dSetLightData(pThis, cid, index, (SVGA3dLightData *)&vmsvga3d_default_light); 5341 if (index < SVGA3D_MAX_LIGHTS) 5342 { 5343 /* Load the default settings if none have been set yet. */ 5344 if (!pContext->state.aLightData[index].fValidData) 5345 vmsvga3dSetLightData(pThis, cid, index, (SVGA3dLightData *)&vmsvga3d_default_light); 5346 } 5364 5347 glEnable(GL_LIGHT0 + index); 5365 5348 } -
trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-win.cpp
r76553 r78589 3880 3880 int vmsvga3dSetRenderTarget(PVGASTATE pThis, uint32_t cid, SVGA3dRenderTargetType type, SVGA3dSurfaceImageId target) 3881 3881 { 3882 HRESULT hr; 3883 PVMSVGA3DCONTEXT pContext; 3884 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3885 PVMSVGA3DSURFACE pRenderTarget; 3882 HRESULT hr; 3883 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 3886 3884 3887 3885 AssertReturn(pState, VERR_NO_MEMORY); 3888 AssertReturn( type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER);3886 AssertReturn((unsigned)type < SVGA3D_RT_MAX, VERR_INVALID_PARAMETER); 3889 3887 3890 3888 LogFunc(("cid=%x type=%x sid=%x\n", cid, type, target.sid)); 3891 3889 3890 PVMSVGA3DCONTEXT pContext; 3892 3891 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 3893 3892 AssertRCReturn(rc, rc); … … 3950 3949 } 3951 3950 3951 PVMSVGA3DSURFACE pRenderTarget; 3952 3952 rc = vmsvga3dSurfaceFromSid(pState, target.sid, &pRenderTarget); 3953 3953 AssertRCReturn(rc, rc); … … 4261 4261 default: 4262 4262 AssertFailed(); 4263 return 0;4263 return D3DTA_DIFFUSE; 4264 4264 } 4265 4265 } … … 4286 4286 default: 4287 4287 AssertFailed(); 4288 return 0;4288 return D3DTTFF_DISABLE; 4289 4289 } 4290 4290 } … … 4549 4549 /* Record the texture state for vm state saving. */ 4550 4550 if ( currentStage < RT_ELEMENTS(pContext->state.aTextureStates) 4551 && pTextureState[i].name < RT_ELEMENTS(pContext->state.aTextureStates[0]))4551 && (unsigned)pTextureState[i].name < RT_ELEMENTS(pContext->state.aTextureStates[0])) 4552 4552 { 4553 4553 pContext->state.aTextureStates[currentStage][pTextureState[i].name] = pTextureState[i]; … … 4588 4588 { 4589 4589 HRESULT hr; 4590 D3DMATERIAL9 material;4591 PVMSVGA3DCONTEXT pContext;4592 4590 PVMSVGA3DSTATE pState = pThis->svga.p3dState; 4593 4591 AssertReturn(pState, VERR_NO_MEMORY); … … 4595 4593 LogFunc(("cid=%x face %d\n", cid, face)); 4596 4594 4595 PVMSVGA3DCONTEXT pContext; 4597 4596 int rc = vmsvga3dContextFromCid(pState, cid, &pContext); 4598 4597 AssertRCReturn(rc, rc); 4599 4598 4600 AssertReturn( face < SVGA3D_FACE_MAX, VERR_INVALID_PARAMETER);4599 AssertReturn((unsigned)face < SVGA3D_FACE_MAX, VERR_INVALID_PARAMETER); 4601 4600 4602 4601 /* Save for vm state save/restore. */ … … 4611 4610 Log(("Unsupported face %d!!\n", face)); 4612 4611 4612 D3DMATERIAL9 material; 4613 4613 material.Diffuse.r = pMaterial->diffuse[0]; 4614 4614 material.Diffuse.g = pMaterial->diffuse[1];
Note:
See TracChangeset
for help on using the changeset viewer.