6757527: D3D: serious rendering issues on Nvidia boards with driver version 178.13 on Vista
Reviewed-by: campbell
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp Tue Nov 18 17:16:27 2008 -0800
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DBlitLoops.cpp Tue Nov 18 18:32:31 2008 -0800
@@ -221,12 +221,17 @@
" srctype=%d rect={%-4d, %-4d, %-4d, %-4d}",
srctype, r.left, r.top, r.right, r.bottom);
- if (pDesc->Usage == D3DUSAGE_DYNAMIC &&
- dstx == 0 && dstx == 0 &&
- srcWidth == pDesc->Width && srcHeight == pDesc->Height)
- {
+ if (pDesc->Usage == D3DUSAGE_DYNAMIC) {
+ // it is safe to lock with discard because we don't care about the
+ // contents of dynamic textures, and some drivers are happier if
+ // dynamic textures are always locked with DISCARD
dwLockFlags |= D3DLOCK_DISCARD;
pR = NULL;
+ } else {
+ // in non-DYNAMIC case we lock the exact rect so there's no need to
+ // offset the destination pointer
+ dstx = 0;
+ dsty = 0;
}
res = pDstSurface->LockRect(&lockedRect, pR, dwLockFlags);
@@ -243,7 +248,9 @@
void *pSrcBase = PtrCoord(pSrcInfo->rasBase,
srcx, pSrcInfo->pixelStride,
srcy, pSrcInfo->scanStride);
- void *pDstBase = lockedRect.pBits;
+ void *pDstBase = PtrCoord(lockedRect.pBits,
+ dstx, dstInfo.pixelStride,
+ dsty, dstInfo.scanStride);
switch (srctype) {
case ST_INT_ARGB:
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DContext.cpp Tue Nov 18 17:16:27 2008 -0800
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DContext.cpp Tue Nov 18 18:32:31 2008 -0800
@@ -1174,11 +1174,10 @@
" rect={%-4d, %-4d, %-4d, %-4d}",
r.left, r.top, r.right, r.bottom);
- // REMIND: we should also check for dstx, dsty being 0 here,
- // but they're always 0 in dynamic texture case
- if (pDesc->Usage == D3DUSAGE_DYNAMIC &&
- srcWidth == pDesc->Width && srcHeight == pDesc->Height)
- {
+ if (pDesc->Usage == D3DUSAGE_DYNAMIC) {
+ // it is safe to lock with discard because we don't care about the
+ // contents of dynamic textures and dstx,dsty for this case is
+ // always 0,0 because we are uploading into a tile texture
dwLockFlags |= D3DLOCK_DISCARD;
pR = NULL;
}