d3d: GetStreamSource on a stream with NULL data isn't an error.

This commit is contained in:
Chris Robinson 2006-12-24 01:00:05 -08:00 committed by Alexandre Julliard
parent c5b8df481f
commit b7b9d4e3c7
5 changed files with 31 additions and 9 deletions

View File

@ -1498,7 +1498,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 ifa
IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
IWineD3DVertexBuffer_Release(retStream);
}else{
FIXME("Call to GetStreamSource failed %p\n", pStride);
if (rc != D3D_OK){
FIXME("Call to GetStreamSource failed %p\n", pStride);
}
*pStream = NULL;
}

View File

@ -407,13 +407,22 @@ static void test_refcount(void)
CHECK_CALL( hr, "CreateVertexBuffer", pDevice, ++refcount );
if(pVertexBuffer)
{
IDirect3DVertexBuffer8 *pVBuf = (void*)~0;
UINT stride = ~0;
tmp = get_refcount( (IUnknown *)pVertexBuffer );
hr = IDirect3DDevice8_SetStreamSource(pDevice, 0, pVertexBuffer, 3 * sizeof(float));
CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp);
hr = IDirect3DDevice8_SetStreamSource(pDevice, 0, NULL, 0);
CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp);
hr = IDirect3DDevice8_GetStreamSource(pDevice, 0, &pVBuf, &stride);
ok(SUCCEEDED(hr), "GetStreamSource did not succeed with NULL stream!\n");
ok(pVBuf==NULL, "pVBuf not NULL (%p)!\n", pVBuf);
ok(stride==3*sizeof(float), "stride not %u (got %u)!\n", 3*sizeof(float), stride);
}
/* Shaders */
hr = IDirect3DDevice8_CreateVertexShader( pDevice, decl, simple_vs, &dVertexShader, 0 );
CHECK_CALL( hr, "CreateVertexShader", pDevice, refcount );

View File

@ -800,7 +800,9 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface, U
IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
IWineD3DVertexBuffer_Release(retStream);
}else{
FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride);
if (rc != D3D_OK){
FIXME("Call to GetStreamSource failed %p %p\n", OffsetInBytes, pStride);
}
*pStream = NULL;
}
return rc;

View File

@ -455,12 +455,22 @@ static void test_refcount(void)
CHECK_CALL( hr, "CreateVertexBuffer", pDevice, ++refcount );
if(pVertexBuffer)
{
IDirect3DVertexBuffer9 *pVBuf = (void*)~0;
UINT offset = ~0;
UINT stride = ~0;
tmp = get_refcount( (IUnknown *)pVertexBuffer );
hr = IDirect3DDevice9_SetStreamSource(pDevice, 0, pVertexBuffer, 0, 3 * sizeof(float));
CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp);
hr = IDirect3DDevice9_SetStreamSource(pDevice, 0, NULL, 0, 0);
CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp);
hr = IDirect3DDevice9_GetStreamSource(pDevice, 0, &pVBuf, &offset, &stride);
ok(SUCCEEDED(hr), "GetStreamSource did not succeed with NULL stream!\n");
ok(pVBuf==NULL, "pVBuf not NULL (%p)!\n", pVBuf);
ok(stride==3*sizeof(float), "stride not %u (got %u)!\n", 3*sizeof(float), stride);
ok(offset==0, "offset not 0 (got %u)!\n", offset);
}
/* Shaders */
hr = IDirect3DDevice9_CreateVertexDeclaration( pDevice, decl, &pVertexDeclaration );

View File

@ -2421,9 +2421,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
This->updateStateBlock->changed.streamSource[StreamNumber] = TRUE;
This->updateStateBlock->set.streamSource[StreamNumber] = TRUE;
This->updateStateBlock->streamStride[StreamNumber] = Stride;
This->updateStateBlock->streamSource[StreamNumber] = pStreamData;
This->updateStateBlock->streamOffset[StreamNumber] = OffsetInBytes;
if (pStreamData) {
This->updateStateBlock->streamStride[StreamNumber] = Stride;
This->updateStateBlock->streamOffset[StreamNumber] = OffsetInBytes;
}
This->updateStateBlock->streamFlags[StreamNumber] = streamFlags;
/* Handle recording of state blocks */
@ -2487,12 +2489,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface,
*pOffset = This->stateBlock->streamOffset[StreamNumber];
}
if (*pStream == NULL) {
FIXME("Attempting to get an empty stream %d, returning WINED3DERR_INVALIDCALL\n", StreamNumber);
return WINED3DERR_INVALIDCALL;
if (*pStream != NULL) {
IWineD3DVertexBuffer_AddRef(*pStream); /* We have created a new reference to the VB */
}
IWineD3DVertexBuffer_AddRef(*pStream); /* We have created a new reference to the VB */
return WINED3D_OK;
}