IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

DirectX Discussion :

Probleme de reset du device


Sujet :

DirectX

  1. #1
    Fry
    Fry est déconnecté
    Membre régulier Avatar de Fry
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    150
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 150
    Points : 119
    Points
    119
    Par défaut Probleme de reset du device
    j essaie de mettre en place une fonction de reset pour pouvoir changer la resolution en cours de jeu et Device->Reset me renvoie D3DERR_INVALIDCALL pourtant j ai verifier tout les parametres et la structure EngineConfig et les valeurs sont bonnes

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
     
    void D3DManager::Reset()
    {
    try	{
    	D3DPRESENT_PARAMETERS d3dpp; 
        ZeroMemory( &d3dpp, sizeof(d3dpp) ); 
    	d3dpp.BackBufferWidth					= this->EngineConfig.ScreenWidth;
    	d3dpp.BackBufferHeight					= this->EngineConfig.ScreenHeight;
    	d3dpp.EnableAutoDepthStencil			= false;
    	d3dpp.BackBufferFormat					= D3DFMT_X8R8G8B8;
    	d3dpp.SwapEffect						= D3DSWAPEFFECT_FLIP;
    	d3dpp.PresentationInterval				= D3DPRESENT_INTERVAL_ONE;
     
    	/*if (this->EngineConfig.PleinEcran == true)
    	{
    	d3dpp.Windowed							= FALSE;
    	d3dpp.FullScreen_RefreshRateInHz		= this->EngineConfig.FrequenceEcran; 
    	}
    	else
    	{*/
    	d3dpp.Windowed							= TRUE;
    	d3dpp.FullScreen_RefreshRateInHz		= 0;
    	//}
     
    	HRESULT ret = this->Device->Reset(&d3dpp);
    		if (ret != D3D_OK)
    		{
    			switch(ret)
    			{
    			case D3DERR_DEVICELOST:
    				throw EngineException("D3DERR_DEVICELOST");
    			case D3DERR_DRIVERINTERNALERROR:
    				throw EngineException("D3DERR_DRIVERINTERNALERROR");
    			case D3DERR_INVALIDCALL:
    				throw EngineException("D3DERR_INVALIDCALL");
    			case D3DERR_OUTOFVIDEOMEMORY:
    				throw EngineException("D3DERR_OUTOFVIDEOMEMORY");
    			case E_OUTOFMEMORY:
    				throw EngineException("E_OUTOFMEMORY");
    			};
    		}
     
    	this->SetDeviceStat();
    	this->InitialisationMatrice();
    	this->CreateVertexBuffer(); 
     
    	int iLeft = (GetDeviceCaps(GetDC(NULL), HORZRES) - this->EngineConfig.ScreenWidth)  / 2;
    	int iTop  = (GetDeviceCaps(GetDC(NULL), VERTRES) - this->EngineConfig.ScreenHeight) / 2;
    	SetWindowPos(this->hwnd,HWND_TOPMOST,iLeft,iTop,this->EngineConfig.ScreenWidth,this->EngineConfig.ScreenHeight,SWP_SHOWWINDOW);				
    	ShowWindow(this->hwnd, SW_NORMAL);
    }
    catch (EngineException& er)
    {
    	this->log	<< "Exception au reset: \n" 
    				<< er.What() << std::endl
    				<< this->EngineConfig.ScreenWidth << std::endl
    				<< this->EngineConfig.ScreenHeight << std::endl
    				<< this->EngineConfig.FrequenceEcran << std::endl
    				<< this->EngineConfig.PleinEcran << std::endl;
    }
    catch (...)
    {
    	this->log << "Eception inconnue est lance dans reset\n";
    }
    }

  2. #2
    Membre expérimenté

    Profil pro
    Programmeur
    Inscrit en
    Août 2002
    Messages
    1 091
    Détails du profil
    Informations personnelles :
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Programmeur

    Informations forums :
    Inscription : Août 2002
    Messages : 1 091
    Points : 1 679
    Points
    1 679
    Par défaut
    verifie avant que tu as bien releasé tous les objets du POOL DEFAULT.

    Ceci inclut bien evidemment les state blocks (si tu les utilises).
    ainsi que les objets alloués par des classes helpers, telles que la libraire D3DX.
    Generalement les objets de d3dx proposent une methode OnLostDevice ce qui leur permet de gerer cela en interne (mais il faut tout de meme l'appeler). Après le reset on recrée tous les objets que l'on a détruit et il faut aussi rappeler OnResetDevice sur les objets helpers.

  3. #3
    Fry
    Fry est déconnecté
    Membre régulier Avatar de Fry
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    150
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 150
    Points : 119
    Points
    119
    Par défaut
    j ai refait tout mon code sans creer aucune ressource (pas de vertex buffer, pas de texture, pas de font...) juste un state block releasé avant le reset
    et j ai toujours la meme erreur...
    voici le code de ma classe:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
     
    //ENTETE
    class CD3DManager
    {
    private:
    	CD3DManager();
    	~CD3DManager();
    	LPDIRECT3D9					D3D;          
    	LPDIRECT3DDEVICE9			Device;  
    	IDirect3DStateBlock9*		pStateBlock;
    	LPDIRECT3DVERTEXBUFFER9		VertexBuffer;
    	LPDIRECT3DSURFACE9			Screen;	
     
    public:
    	static		CD3DManager& GetInstance();
    	void Initialize(HINSTANCE hinst);
    	void CleanUp();
    	LRESULT     WindowProc (HWND pHwnd, unsigned int pMessage, WPARAM pWParam, LPARAM pLParam);
    	bool		BeginScene();
    	void		EndScene();
    	void		Reset();
    	bool		QUIT;
    private:
    	struct	{
    		std::string NomProg;
    		bool		PleinEcran;
    		int			ScreenWidth;
    		int			ScreenHeight;
    		int			FrequenceEcran;
    		D3DFORMAT	bpp;				//32bits par default ou compression en 16bits
    		HWND		hwnd;
    	} EngineConfig;
    	std::fstream log;
    	HWND		CreateWindows(HINSTANCE hinst);
    	bool		InitialisationD3D( HWND hwnd );
    	void		SetDeviceStat();
    	void		SetMatrice();
    };
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
     
    include "D3DManager.h"
     
    //=========================================
    //	Constructeur Destructeur Singleton
    //=========================================
    CD3DManager::CD3DManager()
    {
    	this->EngineConfig.ScreenWidth = 800;
    	this->EngineConfig.ScreenHeight = 600;
    	this->EngineConfig.PleinEcran = false;
    	this->EngineConfig.NomProg = "RETEST";
    	this->EngineConfig.FrequenceEcran = D3DPRESENT_RATE_DEFAULT;
    	this->EngineConfig.bpp = D3DFMT_X8R8G8B8;
     
    	this->QUIT = false;
     
    	this->pStateBlock = NULL;
    	this->Device = NULL;
    	this->D3D = NULL;
     
    	this->log.open("log.txt", std::ios::out);
    }
    CD3DManager::~CD3DManager()
    {
    	this->CleanUp();
    	this->log.close();
    }
    CD3DManager &CD3DManager::GetInstance()
    {
    	static CD3DManager Instance;
    	return Instance;
    }
    void CD3DManager::CleanUp()
    {
    	try
    	{
    		if ( this->pStateBlock != NULL )
    		{	
    			this->pStateBlock->Release();
    			this->pStateBlock = NULL;
    		}
    		if ( this->Device != NULL )
    		{
    			this->Device->Release();
    			this->Device = NULL;
    		}
    		if ( this->D3D != NULL)
    		{
    			this->D3D->Release();
    			this->D3D = NULL;
    		}
    	}
    	catch(...)
    	{
    		this->log << "Exception lors du Cleanup!" ;
    	}
    }
     
    void CD3DManager::Initialize(HINSTANCE hinst)
    {
    	try
    	{
    		if ( !this->InitialisationD3D( this->CreateWindows ( hinst ) ) )
    			throw EngineException("INITIALIZE: impossible d initialiser D3D!");
     
    		this->SetDeviceStat();
    		this->SetMatrice();
    	}
    	catch(EngineException& er)
    	{
    		this->log << er.What() << std::endl;
    	}
    }
    //=========================================
    // Creation de la fenetre Windows
    //=========================================
    HWND CD3DManager::CreateWindows(HINSTANCE hinst)
    {
    	// Calcul des coordonnées de la fenêtre de façon à ce qu'elle soit centrée
        int PosX = (GetDeviceCaps(GetDC(NULL), HORZRES) - this->EngineConfig.ScreenWidth)  / 2;
    	int PosY = (GetDeviceCaps(GetDC(NULL), VERTRES) - this->EngineConfig.ScreenHeight) / 2;
     
    	WNDCLASSEX WindowClass;
        WindowClass.cbSize        = sizeof(WNDCLASSEX);
        WindowClass.style         = 0;
        WindowClass.lpfnWndProc   = GlobalWindowProc;
        WindowClass.cbClsExtra    = 0;
        WindowClass.cbWndExtra    = 0;
        WindowClass.hInstance     = hinst;
        WindowClass.hIcon         = NULL; 
        WindowClass.hCursor       = 0;
        WindowClass.hbrBackground = 0;
        WindowClass.lpszMenuName  = NULL;
        WindowClass.lpszClassName = this->EngineConfig.NomProg.c_str();
        WindowClass.hIconSm       = NULL; 
        RegisterClassEx(&WindowClass);
     
        // Création de la fenêtre
    	HWND ret = CreateWindow(this->EngineConfig.NomProg.c_str(), this->EngineConfig.NomProg.c_str(), 
    		WS_SYSMENU, PosX, PosY, this->EngineConfig.ScreenWidth, this->EngineConfig.ScreenHeight, NULL, 
    		NULL, hinst, NULL);
     
    	if (ret == NULL) 
    	{
    		std::stringstream out;
    		out << "erreur: " << GetLastError();
    		MessageBox(ret,out.str().c_str(), "Creation Windows", MB_OK);
    	}
    	else	this->EngineConfig.hwnd = ret;
     
    	SetWindowPos(this->EngineConfig.hwnd,HWND_TOPMOST, PosX,PosY,this->EngineConfig.ScreenWidth,this->EngineConfig.ScreenHeight,SWP_SHOWWINDOW);				
    	ShowWindow(ret, SW_NORMAL);
    	return ret;
    }
    //=========================================
    //	Recuperation des messages windows
    //=========================================
    LRESULT CD3DManager::WindowProc (HWND pHwnd, unsigned int pMessage, WPARAM pWParam, LPARAM pLParam)
    {
      switch( pMessage )
        {
    		case WM_DESTROY: //a la destruction de la fenetre
    			this->QUIT = true;
    			PostQuitMessage( 0 );
    			break;
        }
        return DefWindowProc(pHwnd, pMessage, pWParam, pLParam);
    }
     
    //=========================================
    //	Creation du device D3D
    //=========================================
    bool CD3DManager::InitialisationD3D(HWND hwnd)
    {
    try
    {
    	if( ( this->D3D = Direct3DCreate9(D3D_SDK_VERSION) ) == NULL )
            throw EngineException("Impossible de creer Direct3D!");
     
        D3DPRESENT_PARAMETERS d3dpp; 
        ZeroMemory( &d3dpp, sizeof(d3dpp) ); 
    	d3dpp.BackBufferWidth					= this->EngineConfig.ScreenWidth;
    	d3dpp.BackBufferHeight					= this->EngineConfig.ScreenHeight;
    	d3dpp.BackBufferFormat					= this->EngineConfig.bpp;	
    	d3dpp.EnableAutoDepthStencil			= false;
    	d3dpp.SwapEffect						= D3DSWAPEFFECT_FLIP;
    	d3dpp.PresentationInterval				= D3DPRESENT_INTERVAL_ONE;
    	if (this->EngineConfig.PleinEcran == true)	{
    	d3dpp.Windowed							= FALSE;
    	d3dpp.FullScreen_RefreshRateInHz		= this->EngineConfig.FrequenceEcran; 
    	}
    	else	{
    	d3dpp.Windowed							= TRUE;
    	d3dpp.FullScreen_RefreshRateInHz		= 0;
    	}
     
    	//Creation du device en software ===> choix utilisateur
    	HRESULT ret = D3D->CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_REF,hwnd,D3DCREATE_HARDWARE_VERTEXPROCESSING,&d3dpp,&Device);
    	if (ret != D3D_OK)
    	{
    		switch(ret)
    		{
    		case(D3DERR_DEVICELOST):	
    			throw EngineException("Erreur device lost");
    		case(D3DERR_INVALIDCALL):	
    			throw EngineException("Erreur invalid call");
    		case(D3DERR_NOTAVAILABLE):		
    			throw EngineException("Erreur not available");
    		case(D3DERR_OUTOFVIDEOMEMORY):
    			throw EngineException("Erreur out of video memory");
    		};
    	}
     
     
    	//Creation du state Blok
    	D3DSTATEBLOCKTYPE sbType = D3DSBT_ALL;
    	this->Device->CreateStateBlock( sbType, &this->pStateBlock );
     
    	return true;
    }
    catch (EngineException& er)
    {
    	this->log << "Exception a l initialisation de direct3D: \n" 
    				<< er.What() << std::endl;
    	return false;
    }
    catch (...)
    {
    	this->log << "Eception inconnue est lance dans initialisationD3D\n";
    	return false;
    }
    }
    //=========================================
    // Parametrage de l etat du device
    //=========================================
    void CD3DManager::SetDeviceStat()
    {
    	this->Device->BeginStateBlock();
     
    	//parametre du device
        Device->SetRenderState(D3DRS_LIGHTING,         false);			//lumière off
    	Device->SetRenderState(D3DRS_CULLMODE,         D3DCULL_NONE);	//culling off
        Device->SetRenderState(D3DRS_DITHERENABLE,     true);
        Device->SetRenderState(D3DRS_ZENABLE,          false);
        Device->SetRenderState(D3DRS_FOGENABLE,        false);
        Device->SetRenderState(D3DRS_ALPHATESTENABLE,  false);
        Device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
        Device->SetRenderState(D3DRS_SRCBLEND,         D3DBLEND_SRCALPHA);
        Device->SetRenderState(D3DRS_DESTBLEND,        D3DBLEND_INVSRCALPHA);   
        Device->SetRenderState(D3DRS_TEXTUREFACTOR,    0xFFFFFFFF);
    	//pour l'utilisation de la clé de couleur et de la transparence
    	Device->SetRenderState(D3DRS_ALPHATESTENABLE, true);
    	Device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_NOTEQUAL);
    	Device->SetRenderState(D3DRS_ALPHAREF, 0x00);
    	Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
    	Device->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
    	Device->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
    	Device->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE);
    	Device->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);
    	Device->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_DIFFUSE);
    	// Initialisation du FVF
    //	Device->SetFVF(VertexFVF); 
     
    	this->Device->EndStateBlock( &this->pStateBlock );	
     
    	this->pStateBlock->Apply();
     
    	//on obtient un pointeur sur la surface du BackBuffer
    	Device->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &this->Screen);
    }
    //=========================================
    //	Definition des matrice de projection
    //=========================================
    void CD3DManager::SetMatrice()
    {
        D3DXMATRIXA16 mIdentity, mMatProj;
        D3DXMatrixIdentity(&mIdentity);
        D3DXMatrixOrthoOffCenterLH(&mMatProj, 0, static_cast<float>(this->EngineConfig.ScreenWidth), -this->EngineConfig.ScreenWidth * 1.0f, 0, 0.0f, 1.0f);  
    	Device->SetTransform(D3DTS_WORLD,      &mIdentity);
        Device->SetTransform(D3DTS_VIEW,       &mIdentity);
        Device->SetTransform(D3DTS_PROJECTION, &mMatProj);
    }
    //=========================================
    //	Prepare la scene et traite les messages
    //=========================================
    bool CD3DManager::BeginScene()
    {
    	//recuperation des messages windows
    	MSG Message;
        Message.message = WM_NULL ;
    	while (!this->QUIT)
        {
    		if (PeekMessage(&Message, NULL, 0, 0, PM_REMOVE))
    		{
    			TranslateMessage(&Message);
    			DispatchMessage(&Message);
    		}
    		else
    		{
    			break;
    		}
    	}
     
    	//verification de l etat du device
    //	if (this->CheckDevice()==false) return false;
     
    	Device->Clear(0, NULL, D3DCLEAR_TARGET, 0x00, 1.0f, 0x00);
    	Device->BeginScene();
    	return true;
    }
    //=================================================
    //	fini la scene et presente le rendu a l ecran
    //=================================================
    void CD3DManager::EndScene()
    {
    	Device->EndScene();
    	Device->Present(NULL,NULL,NULL,NULL);
     
    }
    //===========================================
    //	Reset du Device
    //===========================================
    void CD3DManager::Reset()
    {
    	this->pStateBlock->Release();
     
    try	{
    	D3DPRESENT_PARAMETERS d3dpp; 
        ZeroMemory( &d3dpp, sizeof(d3dpp) ); 
    	d3dpp.BackBufferWidth					= this->EngineConfig.ScreenWidth;
    	d3dpp.BackBufferHeight					= this->EngineConfig.ScreenHeight;
    	d3dpp.BackBufferFormat					= this->EngineConfig.bpp;
    	d3dpp.EnableAutoDepthStencil			= false;
    	d3dpp.SwapEffect						= D3DSWAPEFFECT_FLIP;
    	d3dpp.PresentationInterval				= D3DPRESENT_INTERVAL_ONE;
    	if (this->EngineConfig.PleinEcran == true)	{
    	d3dpp.Windowed							= FALSE;
    	d3dpp.FullScreen_RefreshRateInHz		= this->EngineConfig.FrequenceEcran; 
    	}
    	else
    	{
    	d3dpp.Windowed							= TRUE;
    	d3dpp.FullScreen_RefreshRateInHz		= 0;
    	}
     
    	HRESULT ret = this->Device->Reset(&d3dpp);
    		if (ret != D3D_OK)
    		{
    			switch(ret)
    			{
    			case D3DERR_DEVICELOST:
    				throw EngineException("D3DERR_DEVICELOST");
    			case D3DERR_DRIVERINTERNALERROR:
    				throw EngineException("D3DERR_DRIVERINTERNALERROR");
    			case D3DERR_INVALIDCALL:
    				throw EngineException("D3DERR_INVALIDCALL");
    			case D3DERR_OUTOFVIDEOMEMORY:
    				throw EngineException("D3DERR_OUTOFVIDEOMEMORY");
    			case E_OUTOFMEMORY:
    				throw EngineException("E_OUTOFMEMORY");
    			};
    		}
     
    	this->pStateBlock->Apply();
    	this->SetMatrice();
     
    	int iLeft = (GetDeviceCaps(GetDC(NULL), HORZRES) - this->EngineConfig.ScreenWidth)  / 2;
    	int iTop  = (GetDeviceCaps(GetDC(NULL), VERTRES) - this->EngineConfig.ScreenHeight) / 2;
    	SetWindowPos(this->EngineConfig.hwnd,HWND_TOPMOST,iLeft,iTop,this->EngineConfig.ScreenWidth,this->EngineConfig.ScreenHeight,SWP_SHOWWINDOW);				
    	ShowWindow(this->EngineConfig.hwnd, SW_NORMAL);
    }
    catch (EngineException& er)
    {
    	this->log	<< "Exception au reset: \n" 
    				<< er.What() << std::endl
    				<< this->EngineConfig.ScreenWidth << std::endl
    				<< this->EngineConfig.ScreenHeight << std::endl
    				<< this->EngineConfig.FrequenceEcran << std::endl
    				<< this->EngineConfig.PleinEcran << std::endl;
    }
    catch (...)
    {
    	this->log << "Eception inconnue est lance dans reset\n";
    }
    }
    et l erreur est lors du reset qui renvoir D3DERR_INVALIDCALL

  4. #4
    Membre expérimenté

    Profil pro
    Programmeur
    Inscrit en
    Août 2002
    Messages
    1 091
    Détails du profil
    Informations personnelles :
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Programmeur

    Informations forums :
    Inscription : Août 2002
    Messages : 1 091
    Points : 1 679
    Points
    1 679
    Par défaut
    Que dit le debug runtime ?

  5. #5
    Fry
    Fry est déconnecté
    Membre régulier Avatar de Fry
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    150
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 150
    Points : 119
    Points
    119
    Par défaut
    j suis pas sur que c est ca le debug runtime mais les exception lancer sont celle que j ai coder sinon y a pas d alerte
    puis y a aussi une exception a cause du release du device
    '2DEngine.exe': Loaded 'F:\Engine2D\NextED\2DEngine\Debug\2DEngine.exe', Symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\ntdll.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\kernel32.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\user32.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\gdi32.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\advapi32.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\d3d9.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\d3d8thk.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\version.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\winmm.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\uxtheme.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\MSCTF.dll', No symbols loaded.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\d3dref9.dll', No symbols loaded.
    First-chance exception at 0x77e53887 in 2DEngine.exe: Microsoft C++ exception: EngineException @ 0x0012fb4c.
    First-chance exception at 0x0043116d in 2DEngine.exe: 0xC0000005: Access violation reading location 0xfeeefef6.
    The program '[1120] 2DEngine.exe: Native' has exited with code 0 (0x0).

  6. #6
    Membre expérimenté

    Profil pro
    Programmeur
    Inscrit en
    Août 2002
    Messages
    1 091
    Détails du profil
    Informations personnelles :
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Programmeur

    Informations forums :
    Inscription : Août 2002
    Messages : 1 091
    Points : 1 679
    Points
    1 679
    Par défaut
    direct X control panel -> onglet Direct3D -> Use Debug version of Direct3D (si elle a été installée) + output debug level (more) + Maximum Validation

    Pour visualiser les messages deux solutions:
    - lancer depuis ton IDE, les messages sont affichés dans la fenetre output normalement
    - lancer dbmon. Utile, si tu n'as pas d'IDE sous la main ou pour tester une version release.

    Tu as aussi des outils de deboguage plus évolués genre deboguage à distance, dbgviewer etc mais bon dbmon ça devrait suffire pour commencer..

  7. #7
    Fry
    Fry est déconnecté
    Membre régulier Avatar de Fry
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    150
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 150
    Points : 119
    Points
    119
    Par défaut
    c est bien leur systeme de debugage a directx
    j ai trouver l erreur ca venait du backbuffer qui n etait pas release
    sinon y a un pb avec les stateblock je fais un release juste avant le reset et pourtant j ai cette erreur:
    Direct3D9: (ERROR) :All user created stateblocks must be freed before Reset can succeed. Reset Fails.
    Direct3D9: (ERROR) :Reset failed and Reset/TestCooperativeLevel/Release are the only legal APIs to be called subsequently
    First-chance exception at 0x77e53887 in 2DEngine.exe: Microsoft C++ exception: EngineException @ 0x0012fb4c.
    '2DEngine.exe': Loaded 'J:\WINDOWS\system32\SSSensor.dll', No symbols loaded.
    est ce que j ai fait une erreur dans leu utilisation?

  8. #8
    Membre expérimenté

    Profil pro
    Programmeur
    Inscrit en
    Août 2002
    Messages
    1 091
    Détails du profil
    Informations personnelles :
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : Programmeur

    Informations forums :
    Inscription : Août 2002
    Messages : 1 091
    Points : 1 679
    Points
    1 679
    Par défaut
    la raison pour laquelle tu dois faire un release du backbuffer c'est parce que tu as fait un Get dessus. J'espère que c'est clair pour toi sinon ça va te poser des problemes ensuite. (si le backbuffer est crée en meme temps que le device alors il est libéré en meme temps que le device sauf si quelqu'un possède encore un pointeur dessus comme dans ce cas).

    Pour ce qui est du stateblock, il y a au moins une erreur c'est que tu n'invalides pas le pointeur du stateblock après l'avoir releasé.
    Après l'appel du release tu n'es plus censé utiliser le stateblock parce qu'il n'existe plus.

    pour éviter les confusions: SAFE_RELEASE(pStateBlock)
    qui va faire if (pStateBlock) pStateBlock->release(); pStateBlock = 0;

    L'ideal ce serait d'avoir une methode "CleanOnReset" qui releaserait toutes les ressources du pool DEFAULT (y compris les stateblocks) et une fonction qui recréerait ces ressources à la volée une fois que le reset a réussi. (pour l'instant tu n'as que les stateblocks). à priori c'est le minimum à faire: pas besoin de reconvertir les textures du pool managed etc..

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 5
    Dernier message: 24/10/2006, 11h41
  2. [VB.NET] probleme RESET dans un formulaire
    Par hellosct1 dans le forum Windows Forms
    Réponses: 1
    Dernier message: 21/09/2006, 11h13
  3. Problème de reset après validation
    Par zev dans le forum Struts 1
    Réponses: 4
    Dernier message: 01/06/2006, 13h42
  4. probleme lors de la creation du device
    Par 180degrés dans le forum DirectX
    Réponses: 5
    Dernier message: 18/08/2005, 17h26
  5. Réponses: 2
    Dernier message: 18/03/2005, 08h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo