mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
DX11 plugin: Do destination-alpha in a single pass. No more drawing the same geometry twice! SMG is faster now because it uses destination-alpha extensively. This uses dual-source color blending, a DirectX 10-level feature. The equivalent OpenGL function comes from the GL_ARB_blend_func_extended extension, which was made core in OpenGL 3.3.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6294 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -144,12 +144,9 @@ void VertexManager::LoadBuffers()
|
||||
m_indexBufferCursor += iCount;
|
||||
}
|
||||
|
||||
void VertexManager::Draw(UINT stride, bool alphapass)
|
||||
void VertexManager::Draw(UINT stride)
|
||||
{
|
||||
if (!alphapass)
|
||||
D3D::gfxstate->ApplyState();
|
||||
else
|
||||
D3D::gfxstate->AlphaPass();
|
||||
D3D::gfxstate->ApplyState();
|
||||
|
||||
D3D::context->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &m_vertexDrawOffset);
|
||||
D3D::context->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R16_UINT, 0);
|
||||
@ -221,7 +218,12 @@ void VertexManager::vFlush()
|
||||
VertexShaderManager::SetConstants();
|
||||
PixelShaderManager::SetConstants();
|
||||
|
||||
if (!PixelShaderCache::SetShader(false,g_nativeVertexFmt->m_components))
|
||||
bool useDstAlpha = bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate &&
|
||||
bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
|
||||
|
||||
D3D::gfxstate->SetDstAlpha(useDstAlpha);
|
||||
|
||||
if (!PixelShaderCache::SetShader(useDstAlpha,g_nativeVertexFmt->m_components))
|
||||
goto shader_fail;
|
||||
if (!VertexShaderCache::SetShader(g_nativeVertexFmt->m_components))
|
||||
goto shader_fail;
|
||||
@ -230,18 +232,8 @@ void VertexManager::vFlush()
|
||||
g_nativeVertexFmt->SetupVertexPointers();
|
||||
|
||||
LoadBuffers();
|
||||
Draw(stride);
|
||||
|
||||
Draw(stride, false);
|
||||
|
||||
if (bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
|
||||
{
|
||||
DWORD write = 0;
|
||||
if (!PixelShaderCache::SetShader(true,g_nativeVertexFmt->m_components))
|
||||
goto shader_fail;
|
||||
|
||||
// update alpha only
|
||||
Draw(stride, true);
|
||||
}
|
||||
D3D::gfxstate->Reset();
|
||||
|
||||
shader_fail:
|
||||
|
Reference in New Issue
Block a user