Beispiel #1
0
//--------------------------------------------------------------------------------------
// Name: SetPixelShader()
// Desc: Overloaded function to avoid redundant calls to D3D
//--------------------------------------------------------------------------------------
D3DVOID WINAPI D3DDevice::SetPixelShader( D3DPixelShader* pShader )
{
    static D3DPixelShader* g_pShader = NULL;
    // Synchronize with current D3D device state, to catch subsystems that do not go
    // through this codepath
    D3DPixelShader* pCurrentPS = NULL;
    D3DDevice_GetPixelShader( this, &pCurrentPS );
    g_pShader = pCurrentPS;
    if( pCurrentPS != NULL )
        pCurrentPS->Release();
    // Only update shader if it has changed
    if( g_pShader != pShader )
    {
        D3DDevice_SetPixelShader( this, pShader );
        g_pShader = pShader;
    }
    D3DVOIDRETURN;
}
Beispiel #2
0
Burger::Effect::~Effect()
{
	D3DPixelShader *pPixelShader = m_pPixelShader;
	if (pPixelShader != NULL) {
		IDirect3DDevice9 *pDevice;
		pPixelShader->GetDevice(&pDevice);
		if (pDevice) {
			pDevice->SetPixelShader(0);
		}

		pPixelShader->Release(); 
		m_pPixelShader = NULL;
	}
	D3DVertexShader *pVertexShader = m_pVertexShader;
	if (pVertexShader != NULL) {
		IDirect3DDevice9 *pDevice;
		pVertexShader->GetDevice(&pDevice);
		if (pDevice) {
			pDevice->SetVertexShader(0);
		}
		pVertexShader->Release(); 
		m_pVertexShader = NULL;
	}
}