Ejemplo n.º 1
0
void TgcDX11Effect::setTexture(string name, const TgcTexture* texture)
{
	ID3D11DeviceContext* deviceContext = ((TgcDX11Renderer*)GuiController::Instance->renderer)->deviceContext;

	TgcEffectValues::Sampler sampler = this->samplers[name];
	ID3D11SamplerState* dxSampler = this->dxSampleStates[name];
	TgcDX11Texture* dxTexture = (TgcDX11Texture*)texture;

	//Set the sampler and texture for pixel shader
	if(sampler.shaderType == TgcEffectValues::PS)
	{
		deviceContext->PSSetSamplers(sampler.slot, 1, &dxSampler);
		deviceContext->PSSetShaderResources(sampler.slot, 1, &(dxTexture->dxTexture));
	}
	//Set the sampler and texture for vertex shader
	else if(sampler.shaderType == TgcEffectValues::VS)
	{
		deviceContext->VSSetSamplers(sampler.slot, 1, &dxSampler);
		deviceContext->VSSetShaderResources(sampler.slot, 1, &(dxTexture->dxTexture));
	}
	else if(sampler.shaderType == TgcEffectValues::VS_AND_PS)
	{
		deviceContext->VSSetSamplers(sampler.slot, 1, &dxSampler);
		deviceContext->PSSetSamplers(sampler.slot, 1, &dxSampler);

		deviceContext->VSSetShaderResources(sampler.slot, 1, &(dxTexture->dxTexture));
		deviceContext->PSSetShaderResources(sampler.slot, 1, &(dxTexture->dxTexture));
	}
	
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
void CPUTRenderStateBlockDX11::SetRenderStates( CPUTRenderParameters &renderParams )
{
    ID3D11DeviceContext *pContext = ((CPUTRenderParametersDX*)&renderParams)->mpContext;

    pContext->OMSetBlendState( mpBlendState, mStateDesc.BlendFactor, mStateDesc.SampleMask );
    pContext->OMSetDepthStencilState( mpDepthStencilState, 0 ); // TODO: read stecil ref from config file
    pContext->RSSetState( mpRasterizerState );
    pContext->PSSetSamplers( 0, mNumSamplers, mpSamplerState );
    pContext->VSSetSamplers( 0, mNumSamplers, mpSamplerState );
    pContext->GSSetSamplers( 0, mNumSamplers, mpSamplerState );
} // CPUTRenderStateBlockDX11::SetRenderState()
Ejemplo n.º 3
0
		virtual	void	Apply(uint32 iStage, bool bVS, bool bGS, bool bTessellation)
		{
			ID3D11DeviceContext* pDC = g_pRenderSys->GetDeviceContext();
			pDC->PSSetSamplers(iStage, 1, &m_pSamp);

			if (bVS)
			{
				pDC->VSSetSamplers(iStage, 1, &m_pSamp);
			}
			if (bGS)
			{
				pDC->GSSetSamplers(iStage, 1, &m_pSamp);
			}
			if (bTessellation)
			{
				pDC->HSSetSamplers(iStage, 1, &m_pSamp);
				pDC->DSSetSamplers(iStage, 1, &m_pSamp);
			}
		}