//----------------------------------------------------------------------------
void PdrPixelShader::Enable (Renderer* renderer, const PixelShader* pshader,
                             const ShaderParameters* parameters)
{
    IDirect3DDevice9* device = renderer->mData->mDevice;

    // Enable the buffer by setting the state.
    HRESULT hr = device->SetPixelShader(mShader);
    assertion(hr == D3D_OK, "Failed to enable pixel shader: %s\n",
              DXGetErrorString(hr));

    // Set the shader constants.
    int profile = PixelShader::GetProfile();
    const int numConstants = pshader->GetNumConstants();
    int i;
    for (i = 0; i < numConstants; ++i)
    {
        hr = device->SetPixelShaderConstantF(
                 pshader->GetBaseRegister(profile, i),
                 parameters->GetConstant(i)->GetData(),
                 pshader->GetNumRegistersUsed(i));
        assertion(hr == D3D_OK, "Failed to set shader constant: %s\n",
                  DXGetErrorString(hr));
    }

    SetSamplerState(renderer, pshader, profile, parameters,
                    renderer->mData->mMaxPShaderImages, 0,
                    renderer->mData->mCurrentPSState);
}
//----------------------------------------------------------------------------
void PdrPixelShader::Disable (Renderer* renderer, const PixelShader* pshader,
                              const ShaderParameters* parameters)
{
    IDirect3DDevice9* device = renderer->mData->mDevice;
    HRESULT hr;
    WM5_UNUSED(hr);

#ifdef WM5_PDR_DEBUG
    // Verify that the active shader is the one making the disable request.
    IDirect3DPixelShader9* activePShader = 0;
    hr = device->GetPixelShader(&activePShader);
    assertion(hr == D3D_OK, "Failed to get pixel shader: %s\n",
              DXGetErrorString(hr));
    assertion(activePShader == mShader, "Mismatched pixel shaders\n");
    activePShader->Release();
#endif

    int profile = PixelShader::GetProfile();
    DisableTextures(renderer, pshader, profile, parameters,
                    renderer->mData->mMaxPShaderImages, 0);

    // Disable the shader by clearing the state.
    hr = device->SetPixelShader(0);
    assertion(hr == D3D_OK, "Failed to set pixel shader: %s\n",
              DXGetErrorString(hr));
}
    void CFullscreenTriangleDrawer::DrawDX9( IDirect3DTexture9* texture )
    {
        float width = ( float )gEnv->pRenderer->GetWidth();
        float height = ( float )gEnv->pRenderer->GetHeight();

        IDirect3DDevice9* pDevice = static_cast<IDirect3DDevice9*>( gD3DDevice );

        m_pStateBlock->Capture();

        pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
        pDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE );
        pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );

        pDevice->SetVertexDeclaration( m_pVertexDeclaration );
        pDevice->SetStreamSource( 0, m_pVertexBuffer, 0, 5 * sizeof( float ) );

        pDevice->SetVertexShader( m_pVertexShader9 );
        pDevice->SetVertexShaderConstantF( 0, &width, 1 );
        pDevice->SetVertexShaderConstantF( 1, &height, 1 );

        pDevice->SetPixelShader( m_pPixelShader9 );
        pDevice->SetTexture( 0, texture );

        pDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 3 );

        m_pStateBlock->Apply();
    }
//----------------------------------------------------------------------------
void PdrPixelShader::Disable (Renderer* renderer, const PixelShader* pshader,
							  const ShaderParameters* parameters)
{
	IDirect3DDevice9* device = renderer->mData->mDevice;
	HRESULT hr;
	PX2_UNUSED(hr);

#ifdef PX2_PDR_DEBUG
	// 检测需要被取消激活的数据,是否匹配。
	IDirect3DPixelShader9* activePShader = 0;
	hr = device->GetPixelShader(&activePShader);
	assertion(hr == D3D_OK, "Failed to get pixel shader: %s\n",
		DXGetErrorString(hr));
	assertion(activePShader == mShader, "Mismatched pixel shaders\n");
	activePShader->Release();
#endif

	int profile = PixelShader::GetProfile();
	DisableTextures(renderer, pshader, profile, parameters,
		renderer->mData->mMaxPShaderImages, 0);

	// 取消激活着色器
	hr = device->SetPixelShader(0);
	assertion(hr == D3D_OK, "Failed to set pixel shader: %s\n",
		DXGetErrorString(hr));
}
Beispiel #5
0
void DevState::createCleanState() {
	if (dwMyThread != 0) {
		ods("D3D9: CreateCleanState from other thread.");
	}
	Stash<DWORD> stashThread(&dwMyThread, GetCurrentThreadId());

	if (pSB)
		pSB->Release();
	pSB = NULL;

	IDirect3DStateBlock9* pStateBlock = NULL;
	dev->CreateStateBlock(D3DSBT_ALL, &pStateBlock);
	if (! pStateBlock)
		return;

	pStateBlock->Capture();

	dev->CreateStateBlock(D3DSBT_ALL, &pSB);
	if (! pSB) {
		pStateBlock->Release();
		return;
	}

	D3DVIEWPORT9 vp;
	dev->GetViewport(&vp);

	dev->SetVertexShader(NULL);
	dev->SetPixelShader(NULL);
	dev->SetFVF(D3DFVF_TLVERTEX);

	dev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
	dev->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
	dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // 0x16
	dev->SetRenderState(D3DRS_WRAP0, FALSE); // 0x80

	dev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	dev->SetRenderState(D3DRS_SRCBLEND,  D3DBLEND_ONE);
	dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

	dev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
	dev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);

	dev->SetRenderState(D3DRS_ZENABLE, FALSE);
	dev->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
	dev->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS);
	dev->SetRenderState(D3DRS_COLORVERTEX, FALSE);

	dev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
	dev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
	dev->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE);

	dev->SetRenderState(D3DRS_LIGHTING, FALSE);

	pSB->Capture();

	pStateBlock->Apply();
	pStateBlock->Release();
}
Beispiel #6
0
void CState::Restore()
{
	// viewport
	m_D3DDev->SetViewport(&m_Vp);

	// render states
	m_D3DDev->SetRenderState(D3DRS_ZENABLE, m_Z);
	m_D3DDev->SetRenderState(D3DRS_CULLMODE, m_CullMode);
	m_D3DDev->SetRenderState(D3DRS_ALPHATESTENABLE, m_AlphaTest);
	m_D3DDev->SetRenderState(D3DRS_ALPHABLENDENABLE, m_AlphaBlend);
	m_D3DDev->SetRenderState(D3DRS_BLENDOP, m_BlendOp);
	m_D3DDev->SetRenderState(D3DRS_SRCBLEND, m_SrcBlend);
	m_D3DDev->SetRenderState(D3DRS_DESTBLEND, m_DstBlend);
	m_D3DDev->SetRenderState(D3DRS_CLIPPLANEENABLE, m_ClipPlane);
	m_D3DDev->SetRenderState(D3DRS_FILLMODE, m_FillMode);
	m_D3DDev->SetRenderState(D3DRS_LASTPIXEL, m_LastPixel);
	m_D3DDev->SetRenderState(D3DRS_FOGENABLE, m_Fog);
	m_D3DDev->SetRenderState(D3DRS_STENCILENABLE, m_Stencil);
	m_D3DDev->SetRenderState(D3DRS_COLORWRITEENABLE, m_ColorWrite);
	m_D3DDev->SetRenderState(D3DRS_SCISSORTESTENABLE, m_Scissor);
	if( m_Caps.PrimitiveMiscCaps & D3DPMISCCAPS_SEPARATEALPHABLEND )
		m_D3DDev->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, m_SeparateAlphaBlend);
	//if( m_Caps.LineCaps & D3DLINECAPS_ANTIALIAS )
		m_D3DDev->SetRenderState(D3DRS_ANTIALIASEDLINEENABLE, m_AntiAliasedLine);

	// primitive
	m_D3DDev->SetFVF(m_FVF);
	m_D3DDev->SetStreamSource(0, m_StreamData, m_StreamOffset, m_StreamStride);
	if( m_StreamData )
		m_StreamData->Release();
	m_D3DDev->SetVertexShader(m_VertexShader);
	if( m_VertexShader )
		m_VertexShader->Release();

	// texture
	m_D3DDev->SetTexture(0, m_Tex);
	if( m_Tex )
		m_Tex->Release();
	m_D3DDev->SetPixelShader(m_PixelShader);
	if( m_PixelShader )
		m_PixelShader->Release();

	// texture stage states
	m_D3DDev->SetTextureStageState(0, D3DTSS_COLOROP, m_ColorOp);
	m_D3DDev->SetTextureStageState(0, D3DTSS_COLORARG1, m_ColorArg1);
	m_D3DDev->SetTextureStageState(0, D3DTSS_COLORARG2, m_ColorArg2);
	m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAOP, m_AlphaOp);
	m_D3DDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, m_AlphaArg1);
	m_D3DDev->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, m_TexCoordIndex);
	m_D3DDev->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, m_TexTransfFlags);
	m_D3DDev->SetSamplerState(0, D3DSAMP_ADDRESSU, m_AddressU);
	m_D3DDev->SetSamplerState(0, D3DSAMP_ADDRESSV, m_AddressV);
	m_D3DDev->SetSamplerState(0, D3DSAMP_MAGFILTER, m_MagFilter);
	m_D3DDev->SetSamplerState(0, D3DSAMP_MINFILTER, m_MinFilter);
	m_D3DDev->SetSamplerState(0, D3DSAMP_MIPFILTER, m_MipFilter);
}
Beispiel #7
0
void Blit::saveState()
{
    IDirect3DDevice9 *device = getDevice();

    HRESULT hr;

    device->GetDepthStencilSurface(&mSavedDepthStencil);
    device->GetRenderTarget(0, &mSavedRenderTarget);

    if (mSavedStateBlock == NULL)
    {
        hr = device->BeginStateBlock();
        ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);

        setCommonBlitState();

        static const float dummyConst[4] = { 0, 0, 0, 0 };

        device->SetVertexShader(NULL);
        device->SetVertexShaderConstantF(0, dummyConst, 1);
        device->SetPixelShader(NULL);
        device->SetPixelShaderConstantF(0, dummyConst, 1);

        D3DVIEWPORT9 dummyVp;
        dummyVp.X = 0;
        dummyVp.Y = 0;
        dummyVp.Width = 1;
        dummyVp.Height = 1;
        dummyVp.MinZ = 0;
        dummyVp.MaxZ = 1;

        device->SetViewport(&dummyVp);

        device->SetTexture(0, NULL);

        device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);

        device->SetVertexDeclaration(mQuadVertexDeclaration);

        hr = device->EndStateBlock(&mSavedStateBlock);
        ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
    }

    ASSERT(mSavedStateBlock != NULL);

    if (mSavedStateBlock != NULL)
    {
        hr = mSavedStateBlock->Capture();
        ASSERT(SUCCEEDED(hr));
    }
}
Beispiel #8
0
    void CubeMesh::DrawRay(const D3DXVECTOR2& screenPos,
        const D3DXMATRIX& matWorld, const D3DXMATRIX& matView, const D3DXMATRIX& matProj)
    {
        HRESULT hr = S_FALSE;
        GraphicsDevice* pGDevice = GraphicsDevice::getInstance();
        IDirect3DDevice9* pDevice = pGDevice->m_pD3DDevice;
        Ray ray = CalcPickingRay((int)screenPos.x, (int)screenPos.y,
            pGDevice->mCubeViewport, matView, matProj );
        PCVertex rayLine[] = {
            {D3DXVECTOR3(0.0f,0.0f,0.0f), D3DCOLOR_ARGB(255,255,0,0)},
            {ray.Origin + 1000*ray.Direction, D3DCOLOR_ARGB(255,255,0,0)},
        };

        PCVertex intersectPoint[] = {
            {p, D3DCOLOR_ARGB(255,0,0,255)},
            {p+D3DXVECTOR3(0.5f,0.0f,0.0f),  D3DCOLOR_ARGB(255,0,0,255)},
            {p+D3DXVECTOR3(0.0f,0.5f,0.0f),  D3DCOLOR_ARGB(255,0,0,255)},
            {p+D3DXVECTOR3(0.0f,0.0f,0.5f),  D3DCOLOR_ARGB(255,0,0,255)},
            {p+D3DXVECTOR3(-0.5f,0.0f,0.0f), D3DCOLOR_ARGB(255,0,0,255)},
            {p+D3DXVECTOR3(0.0f,-0.5f,0.0f), D3DCOLOR_ARGB(255,0,0,255)},
            {p+D3DXVECTOR3(0.0f,0.0f,-0.5f), D3DCOLOR_ARGB(255,0,0,255)},
        };

        pGDevice->SetViewport(pGDevice->mCubeViewport);
        pDevice->SetVertexShader(NULL);
        pDevice->SetPixelShader(NULL);
        V(pDevice->SetTransform(D3DTS_WORLD, &matWorld));
        V(pDevice->SetTransform(D3DTS_VIEW, &matView));
        V(pDevice->SetTransform(D3DTS_PROJECTION, &matProj));
        V(pDevice->SetRenderState(D3DRS_LIGHTING, FALSE));
        V(pDevice->SetRenderState(D3DRS_ZENABLE, FALSE));
        V(pDevice->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE));
        V(pDevice->DrawPrimitiveUP(D3DPT_LINELIST, 1, rayLine, sizeof(PCVertex)));
        V(pDevice->DrawPrimitiveUP(D3DPT_POINTLIST, 7, intersectPoint, sizeof(PCVertex)));
        V(pDevice->SetFVF(NULL));
        V(pDevice->SetRenderState(D3DRS_ZENABLE, TRUE));
        V(pDevice->SetRenderState(D3DRS_LIGHTING, TRUE));
        pGDevice->ResetViewport();
    }
Beispiel #9
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;
	}
}
Beispiel #10
0
// parameters should be validated/clamped by caller
EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
{
    if (!mSwapChain)
    {
        return EGL_SUCCESS;
    }

    IDirect3DDevice9 *device = mRenderer->getDevice();

    // Disable all pipeline operations
    device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
    device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
    device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
    device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
    device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
    device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
    device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
    device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
    device->SetPixelShader(NULL);
    device->SetVertexShader(NULL);

    device->SetRenderTarget(0, mBackBuffer);
    device->SetDepthStencilSurface(NULL);

    device->SetTexture(0, mOffscreenTexture);
    device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
    device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
    device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
    device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
    device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
    device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
    device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
    device->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);

    for (UINT streamIndex = 0; streamIndex < gl::MAX_VERTEX_ATTRIBS; streamIndex++)
    {
        device->SetStreamSourceFreq(streamIndex, 1);
    }

    D3DVIEWPORT9 viewport = {0, 0, mWidth, mHeight, 0.0f, 1.0f};
    device->SetViewport(&viewport);

    float x1 = x - 0.5f;
    float y1 = (mHeight - y - height) - 0.5f;
    float x2 = (x + width) - 0.5f;
    float y2 = (mHeight - y) - 0.5f;

    float u1 = x / float(mWidth);
    float v1 = y / float(mHeight);
    float u2 = (x + width) / float(mWidth);
    float v2 = (y + height) / float(mHeight);

    float quad[4][6] = {{x1, y1, 0.0f, 1.0f, u1, v2},
                        {x2, y1, 0.0f, 1.0f, u2, v2},
                        {x2, y2, 0.0f, 1.0f, u2, v1},
                        {x1, y2, 0.0f, 1.0f, u1, v1}};   // x, y, z, rhw, u, v

    mRenderer->startScene();
    device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, 6 * sizeof(float));
    mRenderer->endScene();

    device->SetTexture(0, NULL);

    RECT rect =
    {
        x, mHeight - y - height,
        x + width, mHeight - y
    };

    HRESULT result = mSwapChain->Present(&rect, &rect, NULL, NULL, 0);

    mRenderer->markAllStateDirty();

    if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
    {
        return EGL_BAD_ALLOC;
    }

    // On Windows 8 systems, IDirect3DSwapChain9::Present sometimes returns 0x88760873 when the windows is
    // in the process of entering/exiting fullscreen. This code doesn't seem to have any documentation.  The
    // device appears to be ok after emitting this error so simply return a failure to swap.
    if (result == 0x88760873)
    {
        return EGL_BAD_NATIVE_WINDOW;
    }

    // http://crbug.com/313210
    // If our swap failed, trigger a device lost event. Resetting will work around an AMD-specific
    // device removed bug with lost contexts when reinstalling drivers.
    if (FAILED(result))
    {
        mRenderer->notifyDeviceLost();
        return EGL_CONTEXT_LOST;
    }

    return EGL_SUCCESS;
}
Beispiel #11
0
// parameters should be validated/clamped by caller
EGLint SwapChain9::swapRect(EGLint x, EGLint y, EGLint width, EGLint height)
{
    if (!mSwapChain)
    {
        return EGL_SUCCESS;
    }

    IDirect3DDevice9 *device = mRenderer->getDevice();

    // Disable all pipeline operations
    device->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
    device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
    device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
    device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    device->SetRenderState(D3DRS_STENCILENABLE, FALSE);
    device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
    device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
    device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
    device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
    device->SetPixelShader(NULL);
    device->SetVertexShader(NULL);

    device->SetRenderTarget(0, mBackBuffer);
    device->SetDepthStencilSurface(NULL);

    device->SetTexture(0, mOffscreenTexture);
    device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
    device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
    device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
    device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
    device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
    device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
    device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
    device->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1);

    D3DVIEWPORT9 viewport = {0, 0, mWidth, mHeight, 0.0f, 1.0f};
    device->SetViewport(&viewport);

    float x1 = x - 0.5f;
    float y1 = (mHeight - y - height) - 0.5f;
    float x2 = (x + width) - 0.5f;
    float y2 = (mHeight - y) - 0.5f;

    float u1 = x / float(mWidth);
    float v1 = y / float(mHeight);
    float u2 = (x + width) / float(mWidth);
    float v2 = (y + height) / float(mHeight);

    float quad[4][6] = {{x1, y1, 0.0f, 1.0f, u1, v2},
                        {x2, y1, 0.0f, 1.0f, u2, v2},
                        {x2, y2, 0.0f, 1.0f, u2, v1},
                        {x1, y2, 0.0f, 1.0f, u1, v1}};   // x, y, z, rhw, u, v

    mRenderer->startScene();
    device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, quad, 6 * sizeof(float));
    mRenderer->endScene();

    device->SetTexture(0, NULL);

    RECT rect =
    {
        x, mHeight - y - height,
        x + width, mHeight - y
    };

    HRESULT result = mSwapChain->Present(&rect, &rect, NULL, NULL, 0);

    mRenderer->markAllStateDirty();

    if (d3d9::isDeviceLostError(result))
    {
        return EGL_CONTEXT_LOST;
    }

    if (result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY || result == D3DERR_DRIVERINTERNALERROR)
    {
        return EGL_BAD_ALLOC;
    }

    ASSERT(SUCCEEDED(result));

    return EGL_SUCCESS;
}
Beispiel #12
0
void BURGER_API Burger::EffectDX9::SetEffect(void)
{
	IDirect3DDevice9 *pDevice = m_pDevice;
	pDevice->SetPixelShader(m_pPixelShader);
	pDevice->SetVertexShader(m_pVertexShader);
}
Beispiel #13
0
 void GPUContextDX9::bindPixelShader( PixelShaderHandle inPixelShader )
 {
   HRESULT result = _device->SetPixelShader( (IDirect3DPixelShader9*)inPixelShader );
   GPUAssert( !FAILED(result), "SetPixelShader failed" );
 }