WineD3D refcounting fun part II :)
Stefan Dösinger
stefandoesinger at gmx.at
Fri Feb 24 13:59:00 CST 2006
Hi,
From the multitexture demo:
> void loadTexture( void )
> {
> D3DXCreateTextureFromFile( g_pd3dDevice, "test.bmp", &g_pTexture_0 );
> D3DXCreateTextureFromFile( g_pd3dDevice, "checker.bmp", &g_pTexture_1 );
>
> g_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
> g_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
> }
Two textures are created
> //-----------------------------------------------------------------------------
> // Name: shutDown()
> // Desc:
> //-----------------------------------------------------------------------------
> void shutDown( void )
> {
> if( g_pTexture_0 != NULL )
> g_pTexture_0->Release();
>
> if( g_pVertexBuffer != NULL )
> g_pVertexBuffer->Release();
>
> if( g_pd3dDevice != NULL )
> g_pd3dDevice->Release();
>
> if( g_pD3D != NULL )
> g_pD3D->Release();
> }
One texture is released
> void render( void )
> {
> <snip>
> g_pd3dDevice->SetTexture( 0, g_pTexture_0 );
> g_pd3dDevice->SetTexture( 1, g_pTexture_1 );
The texture stage is set -> Texure AddRef. The texture isn't unset.
The missing release of the 2nd texture is definitly an application bug. What
remains open is if not unsetting the texture stages is a bug too. Can someone
check on Windows if (a) creating a surface or texture addrefs the
Direct3DDevice, and if (b) assigning a texture to a texture stage addrefs the
Texture? If (a) isn't true, we should unset all texture stages when the
WineD3DDevice is released, if (b) is false we shouldn't do that too. If (a)
and (b) are true, the application is buggy too. I'm sorry that I can't test,
because I've no D3D9-Equipped windows machine available ATM.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20060224/448b549f/attachment.pgp
More information about the wine-devel
mailing list