Re: Inclusion to CVS

Peter Hunnisett <[email protected]>
Newsgroups gmane.comp.emulators.winex.devel
Message-ID <[email protected]>
Hi Jarmo

Jarmo wrote:

>QUESTIONs:
>
>When I compile source code debuging messages won't appear anymore.
>
When you configure and compile all debug messages should be possible to 
enable. The only time where you can't get debugmsg output is if you 
configure with --disable-debug or --disable-trace. See ./configure 
--help if you want any more information.

>I have read from documentation about debuging channels but that won't help.
>I can turn-on and disable channels with --debugmsg and I tried make_debug 
>script without success.
>
>DXT decompression code is removed from source distribution, is that correct ?
>
Correct. It's covered under patents.


Just a couple of minor points.
1) If you could attempt to not use C++ style comments that would be 
appreciated.
2) If you could provide this in a diff -u format it would make 
application easier.

>
>
>New functions to be added in CVS ddraw/d3ddevice/main.c
>-------------------------------------------------------
>
>/*
>  This code can be distributed under X11 License
>  (c) 2003 Jarmo Nikkanen
>
>  ComputeSphereVisibility
>  calculates the visibility of an array of spheres within the viewport.
>  sphere can be fully, non or partially visible.
>
>  Parameters:
>  lpCenters, Array of D3DVECTOR structures containing center point for each 			 
>sphere, in world-space coordinates
>  lpRadius, Array of D3DVALUE variables representing the radius for each 
>sphere.
>  dwNumSpheres, Number of spheres.
>  dwFlags, Unknown.
>  lpdwReturnValues, Array of DWORD values the visibility of each sphere within 
>the viewport
>*/
>
>
>HRESULT WINAPI
>Main_Direct3DDevice_ComputeSphereVisibility(LPDIRECT3DDEVICE7 iface, 
>LPD3DVECTOR lpCenters,
>              LPD3DVALUE  lpRadius, DWORD dwSpheres, DWORD dwFlags,LPDWORD 
>lpdwReturnValues)
>{
>    // This is quick implementation. All spheres are fully visible.
>    // Should be computed more accurately to improve performance
>
>    FIXME("Not fully implemented");
>
>    while(dwSpheres) {
>      dwSpheres--;
>      lpdwReturnValues[dwSpheres] = D3DVIS_INSIDE_FRUSTUM;
>    }
>
>    return D3D_OK;
>}
>
>
>
>static HRESULT WINAPI
>Main_Direct3DDevice3_ComputeSphereVisibility(LPDIRECT3DDEVICE3 iface, 
>LPD3DVECTOR lpCenters,
>              LPD3DVALUE  lpRadius, DWORD dwSpheres, DWORD dwFlags,LPDWORD 
>lpdwReturnValues)
>{
>     return 
>IDirect3DDevice7_ComputeSphereVisibility(CONVERT7(iface),lpCenters,
>     lpRadius,dwSpheres,dwFlags,lpdwReturnValues);
>}
>
I think that you're missing adding these functions to 
Main_IDirect3DDevice7_VTable and Main_IDirect3DDevice3_VTable.


>
>
>
>
>-------------------------------------------------------------------------------------
>
>
>
>
>I have fixed one bug in this code and I am tracking an other one. Some 
>graphics appears incorrectly most likely in a cases where dwWidth*bpp and 
>lPitch are not equal. It seems that some code is using dwWidth*bpp instead of 
>lPitch. I tried to use dwWidth*bpp in DIB_DirectDrawSurface_BltFast after 
>that all graphics appears correctly but dwWidth*bpp is wrong.
>There is also new clipping function that prevents atleast one crash in a 
>software I am running.
>
If you could provide this in a diff -u format, it would be much easier 
to see what you've changed.

>
>I haven't tested this with any other software.
>
Which program are you testing with?

>
>
>/* BltBatch: generic, unimplemented */
>
>HRESULT WINAPI
>DIB_DirectDrawSurface_BltFast(LPDIRECTDRAWSURFACE7 iface, DWORD dstx,
>			      DWORD dsty, LPDIRECTDRAWSURFACE7 src,
>			      LPRECT rsrc, DWORD trans)
>{
>    ICOM_THIS(IDirectDrawSurfaceImpl,iface);
>    int			bpp, w, h, x=0, y=0;
>    DDSURFACEDESC2	ddesc,sdesc;
>    HRESULT		ret = DD_OK;
>    LPBYTE		sbuf, dbuf;
>    RECT		rsrc2;
>
>
>    if (TRACE_ON(ddraw)) {
>	FIXME("(%p)->(%ld,%ld,%p,%p,%08lx)\n",
>		This,dstx,dsty,src,rsrc,trans
>	);
>	FIXME("	trans:");
>	if (FIXME_ON(ddraw))
>	  DDRAW_dump_DDBLTFAST(trans);
>	if (rsrc)
>	  FIXME("\tsrcrect: 
>%dx%d-%dx%d\n",rsrc->left,rsrc->top,rsrc->right,rsrc->bottom);
>	else
>	  FIXME(" srcrect: NULL\n");
>    }
>
>
>    /* We need to lock the surfaces, or we won't get refreshes when done. */
>    sdesc.dwSize = sizeof(sdesc);
>    IDirectDrawSurface7_Lock(src, NULL,&sdesc,DDLOCK_READONLY, 0);
>
>    ddesc.dwSize = sizeof(ddesc);
>    IDirectDrawSurface7_Lock(iface,NULL,&ddesc,DDLOCK_WRITEONLY,0);
>
>
>    
>    // PROCESS COMPRESSED SURFACES
>    if (sdesc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC)
>    {
>       if (ddesc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) {
>           if (sdesc.u4.ddpfPixelFormat.dwFourCC == 
>ddesc.u4.ddpfPixelFormat.dwFourCC &&
>               sdesc.u1.dwLinearSize == ddesc.u1.dwLinearSize) {
>               TRACE("compressed-surface copy (%ld bytes)\n", 
>ddesc.u1.dwLinearSize);
>               memcpy(ddesc.lpSurface, sdesc.lpSurface, 
>ddesc.u1.dwLinearSize);
>           } else {
>               FIXME("trying to decompress %4.4s surface to %4.4s surface\n", 
>(char*)&sdesc.u4.ddpfPixelFormat.dwFourCC,
>                                                                              
>(char*)&ddesc.u4.ddpfPixelFormat.dwFourCC);
>           }
>       } else {
>           FIXME("software-decompression of %4.4s surface not 
>supported\n",(char*)&sdesc.u4.ddpfPixelFormat.dwFourCC);
>           /* most compression algorithms are patented, which limits source 
>distribution...
>            * patented software decompressors will only be available in the 
>WineX binaries */
>           /* here, we'll just clear the destination surface */
>           memset(ddesc.lpSurface, 0, ddesc.u1.lPitch * ddesc.dwHeight);
>       }
>       goto release;
>   }
>
>
>    //Setup source rect if not defined
>    if (!rsrc) {
>	   WARN("rsrc is NULL!\n");
>	   rsrc = &rsrc2;
>	   rsrc->left = rsrc->top = 0;
>	   rsrc->right = sdesc.dwWidth;
>	   rsrc->bottom = sdesc.dwHeight;
>    }
>
>
>    //CLIPING CODE for source and destination. Everyting is cliped
>    //rsrc, dsty, dstx values can be anything.
>     
>    int ix,iy,srcx,srcy;
>    h=rsrc->bottom-rsrc->top;
>    w=rsrc->right-rsrc->left;
>    srcx=rsrc->left;
>    srcy=rsrc->top;
>  
>    ix=dstx+w;
>    iy=dsty+h;
>
>    if (ix<=0 || iy<=0 || dstx>=ddesc.dwWidth || dsty>=ddesc.dwHeight) goto 
>release;
>
>    if (x<0) srcx-=dstx,dstx=0;
>    if (y<0) srcy-=dsty,dsty=0;
>    if (ix>ddesc.dwWidth) ix=ddesc.dwWidth;
>    if (iy>ddesc.dwHeight) iy=ddesc.dwHeight;
>
>    ix=srcx+(ix-dstx);
>    iy=srcy+(iy-dsty);
>
>    if (ix<=0 || iy<=0 || srcx>=sdesc.dwWidth || srcy>=sdesc.dwHeight) goto 
>release;
>
>    if (srcx<0) dstx-=srcx,srcx=0;
>    if (srcy<0) dsty-=srcy,srcy=0;
>    if (ix>sdesc.dwWidth) ix=sdesc.dwWidth;
>    if (iy>sdesc.dwHeight) iy=sdesc.dwHeight;
>    
>    w=ix-srcx;
>    h=iy-srcy;
>
>    // new values initialized in w, h, dstx ,dsty, srcx, srcy. rsrc is not 
>modified.
>    // Cliping code ends
>    
>
>                                            
>    bpp = GET_BPP(This->surface_desc);
>    sbuf = (BYTE *)sdesc.lpSurface+(srcy*sdesc.u1.lPitch)+(srcx*bpp);
>    dbuf = (BYTE *)ddesc.lpSurface+(dsty*ddesc.u1.lPitch)+(dstx*bpp);
>
>
> // Setup ColorKeys
> if (trans & (DDBLTFAST_SRCCOLORKEY | DDBLTFAST_DESTCOLORKEY)) {
> 	DWORD keylow, keyhigh;
> 	if (trans & DDBLTFAST_SRCCOLORKEY) {
> 	    keylow  = sdesc.ddckCKSrcBlt.dwColorSpaceLowValue;
> 	    keyhigh = sdesc.ddckCKSrcBlt.dwColorSpaceHighValue;
> 	} else {
> 	    /* I'm not sure if this is correct */
> 	    FIXME("DDBLTFAST_DESTCOLORKEY not fully supported yet.\n");
> 	    keylow  = ddesc.ddckCKDestBlt.dwColorSpaceLowValue;
> 	    keyhigh = ddesc.ddckCKDestBlt.dwColorSpaceHighValue;
> }
>  
>
>#define COPYBOX_COLORKEY(type) { \
>    type *d = (type *)dbuf, *s = (type *)sbuf, tmp; \
>    for (y = 0; y < h; y++) { \
>	  for (x = 0; x < w; x++) { \
>	    tmp = s[x]; \
>	    if (tmp < keylow || tmp > keyhigh) d[x] = tmp; \
>	  } \
>	  (BYTE *)s += sdesc.u1.lPitch; \
>	  (BYTE *)d += ddesc.u1.lPitch; \
>    } \
>    break; \
>}
>
>
>  	switch (bpp) {
>  	case 1: COPYBOX_COLORKEY(BYTE)
>  	case 2: COPYBOX_COLORKEY(WORD)
>  	case 4: COPYBOX_COLORKEY(DWORD)
>  	default:
>  	    FIXME("Source color key blitting not supported for bpp %d\n",bpp*8);
>  	    ret = DDERR_UNSUPPORTED;
>  	    goto error;
>  	}
>     
>
>#undef COPYBOX_COLORKEY
>
>  }
>  else {  // CopyOP Without ColorKey
>
>	int width = w * bpp;
>
>	LONG spitch = sdesc.u1.lPitch;
>	LONG dpitch = ddesc.u1.lPitch; 
>
>  	//LONG spitch = sdesc.dwWidth*bpp; // This works fine but it is wrong.
>	//LONG dpitch = ddesc.dwWidth*bpp; // It seems that something else is using 
>dwWidth instead of lPitch
>
>
>	/* Detect self-copies and ensure that we copy rows in the
>	 * right order to avoid overwriting a that is still needed.
>	 * (memmove is used to ensure that the pixels in a row are
>	 * copied in the right order.) */
>
>	if (src == iface && srcy < dsty)
>	{
>	    LPBYTE surf = (BYTE*)sdesc.lpSurface;
>	    sbuf = surf + ((srcy+h)-1)*spitch + srcx*bpp;
>	    dbuf = surf + ((dsty+h)-1)*dpitch + dstx*bpp;
>
>	    spitch = -spitch;
>	    dpitch = -dpitch;
>	}
>    
>	for (y = 0; y < h; y++) {
>	    memmove(dbuf, sbuf, width);
>	    sbuf += spitch;
>	    dbuf += dpitch;
>	}
>
>  }
>
>error:
>release:
>  
>
>    IDirectDrawSurface7_Unlock(iface, NULL);
>    IDirectDrawSurface7_Unlock(src, NULL);
>    return ret;
>}
>
>
>------------------------------------------------------------
>
>Regards,
>Jarmo
>
>
>
>-------------------------------------------------------
>This SF.NET email is sponsored by: eBay
>Great deals on office technology -- on eBay now! Click here:
>http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
>_______________________________________________
>WineX-devel mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/winex-devel
>
>  
>
Ciao,
Peter

>  
>



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.