Commit 63c1093f authored by Raphael Junqueira's avatar Raphael Junqueira Committed by Alexandre Julliard

- stupid typos fixes on software vertex shader operands

- CopyRects fix (problem in error paths) based on Carlos Lozano patch
parent b330df56
......@@ -990,8 +990,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface,
dst->myDesc.Format = src->myDesc.Format;
/* Convert container as well */
IDirect3DSurface8Impl_GetContainer((LPDIRECT3DSURFACE8) dst, &IID_IDirect3DBaseTexture8, (void**) &texture); /* FIXME: Which refid? */
if (texture != NULL) {
rc = IDirect3DSurface8Impl_GetContainer((LPDIRECT3DSURFACE8) dst, &IID_IDirect3DBaseTexture8, (void**) &texture); /* FIXME: Which refid? */
if (SUCCEEDED(rc) && NULL != texture) {
((IDirect3DBaseTexture8Impl*) texture)->format = src->myDesc.Format;
/** Releasing texture after GetContainer */
IDirect3DBaseTexture8_Release(texture);
......@@ -1000,38 +1000,39 @@ HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface,
}
/* Quick if complete copy ... */
if (rc == D3D_OK && cRects == 0 && pSourceRectsArray == NULL && pDestPointsArray == NULL) {
if (src->myDesc.Width == dst->myDesc.Width && src->myDesc.Height == dst->myDesc.Height) {
D3DLOCKED_RECT lrSrc;
D3DLOCKED_RECT lrDst;
IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) src, &lrSrc, NULL, D3DLOCK_READONLY);
IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) dst, &lrDst, NULL, 0L);
TRACE("Locked src and dst, Direct copy as surfaces are equal, w=%d, h=%d\n", dst->myDesc.Width, dst->myDesc.Height);
memcpy(lrDst.pBits, lrSrc.pBits, src->myDesc.Size);
IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) src);
rc = IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) dst);
TRACE("Unlocked src and dst\n");
if (SUCCEEDED(rc)) {
if (cRects == 0 && pSourceRectsArray == NULL && pDestPointsArray == NULL) {
if (src->myDesc.Width == dst->myDesc.Width && src->myDesc.Height == dst->myDesc.Height) {
D3DLOCKED_RECT lrSrc;
D3DLOCKED_RECT lrDst;
IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) src, &lrSrc, NULL, D3DLOCK_READONLY);
IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) dst, &lrDst, NULL, 0L);
TRACE("Locked src and dst, Direct copy as surfaces are equal, w=%d, h=%d\n", dst->myDesc.Width, dst->myDesc.Height);
memcpy(lrDst.pBits, lrSrc.pBits, src->myDesc.Size);
IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) src);
rc = IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) dst);
TRACE("Unlocked src and dst\n");
} else {
FIXME("Wanted to copy all surfaces but size not compatible\n");
rc = D3DERR_INVALIDCALL;
}
} else {
if (NULL != pSourceRectsArray && NULL != pDestPointsArray) {
FIXME("Wanted to copy all surfaces but size not compatible\n");
rc = D3DERR_INVALIDCALL;
}
} else {
if (NULL != pSourceRectsArray && NULL != pDestPointsArray) {
int bytesPerPixel = ((IDirect3DSurface8Impl*) pSourceSurface)->bytesPerPixel;
int i;
int bytesPerPixel = ((IDirect3DSurface8Impl*) pSourceSurface)->bytesPerPixel;
int i;
/* Copy rect by rect */
for (i = 0; i < cRects; i++) {
/* Copy rect by rect */
for (i = 0; i < cRects; i++) {
CONST RECT* r = &pSourceRectsArray[i];
CONST POINT* p = &pDestPointsArray[i];
int copyperline;
......@@ -1040,10 +1041,9 @@ HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface,
D3DLOCKED_RECT lrDst;
RECT dest_rect;
TRACE("Copying rect %d (%ld,%ld),(%ld,%ld) -> (%ld,%ld)\n", i, r->left, r->top, r->right, r->bottom, p->x, p->y);
if (src->myDesc.Format == D3DFMT_DXT1) {
copyperline = ((r->right - r->left) * bytesPerPixel)/2; /* DXT1 is half byte per pixel */
copyperline = ((r->right - r->left) * bytesPerPixel)/2; /* DXT1 is half byte per pixel */
} else {
copyperline = ((r->right - r->left) * bytesPerPixel);
}
......@@ -1057,19 +1057,16 @@ HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface,
/* Find where to start */
for (j = 0; j < (r->bottom - r->top - 1); j++) {
memcpy((char*) lrDst.pBits + (j * lrDst.Pitch), (char*) lrSrc.pBits + (j * lrSrc.Pitch), copyperline);
memcpy((char*) lrDst.pBits + (j * lrDst.Pitch), (char*) lrSrc.pBits + (j * lrSrc.Pitch), copyperline);
}
IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) src);
rc = IDirect3DSurface8Impl_UnlockRect((LPDIRECT3DSURFACE8) dst);
TRACE("Unlocked src and dst\n");
}
} else {
FIXME("Wanted to copy partial surfaces not implemented\n");
rc = D3DERR_INVALIDCALL;
}
} else {
FIXME("Wanted to copy partial surfaces not implemented\n");
rc = D3DERR_INVALIDCALL;
}
}
}
......
......@@ -306,7 +306,7 @@ void vshader_m4x3(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DMATRIX43 mat) {
void vshader_m3x4(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DMATRIX34 mat) {
d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[0][2] * s0->z;
d->y = mat[2][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
d->z = mat[2][0] * s0->x + mat[2][1] * s0->y + mat[2][2] * s0->z;
d->w = mat[3][0] * s0->x + mat[3][1] * s0->y + mat[3][2] * s0->z;
VSTRACE(("executing m3x4(1): mat=(%f, %f, %f) s0=(%f) d=(%f) \n", mat[0][0], mat[0][1], mat[0][2], s0->x, d->x));
......@@ -316,8 +316,8 @@ void vshader_m3x4(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DMATRIX34 mat) {
}
void vshader_m3x3(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DMATRIX33 mat) {
d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[2][2] * s0->z;
d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[2][2] * s0->z;
d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[0][2] * s0->z;
d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
d->z = mat[2][0] * s0->x + mat[2][1] * s0->y + mat[2][2] * s0->z;
d->w = 1.0f;
VSTRACE(("executing m3x3(1): mat=(%f, %f, %f) s0=(%f) d=(%f) \n", mat[0][0], mat[0][1], mat[0][2], s0->x, d->x));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment