Example #1
0
void Shader::Draw(const Microsoft::WRL::ComPtr<ID3D11DeviceContext> &pDeviceContext)
{
    // VS
    pDeviceContext->VSSetShader(m_pVsh.Get(), NULL, 0);

    // PS
    pDeviceContext->PSSetShader(m_pPsh.Get(), NULL, 0);

	// 定数バッファ
	m_constant->UpdateCB(pDeviceContext);
	m_constant->SetCB(pDeviceContext);

	// Texture
	{
		auto v = m_constant->GetSRV("diffuseTexture");
		m_constant->SetSRV(pDeviceContext, v, m_texture->GetSRV());
	}
	{
		auto v = m_constant->GetSampler("diffuseTextureSampler");
		m_constant->SetSampler(pDeviceContext, v, m_texture->GetSampler());
	}

    // IA InputLayout
    pDeviceContext->IASetInputLayout(m_pInputLayout.Get());
    m_IASource->Draw(pDeviceContext);
}
Example #2
0
void glUseProgram(GLuint program)
{
    if( program > 1 )
        int bp = 1;
    int vsindex = g_D3DShaderProgramArray[program-1].m_VertexShaderIndex;
    int fsindex = g_D3DShaderProgramArray[program-1].m_FragmentShaderIndex;

    if( vsindex > 5 || vsindex < 0 )
        int bp = 1;

    if( fsindex > 5 || fsindex < 0 )
        int bp = 1;

    if( g_D3DShaderArray[vsindex].m_pVertexShader )
        g_pD3DContext->VSSetShader( g_D3DShaderArray[vsindex].m_pVertexShader.Get(), nullptr, 0 );
    if( g_D3DShaderArray[fsindex].m_pFragmentShader )
        g_pD3DContext->PSSetShader( g_D3DShaderArray[fsindex].m_pFragmentShader.Get(), nullptr, 0 );
}