Put infrastructure in place so that other plugins may support dual-source blending.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6296 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Nolan Check
2010-10-21 05:22:18 +00:00
parent 0b7e90f0de
commit 95cfca08e2
14 changed files with 105 additions and 51 deletions

View File

@ -273,10 +273,10 @@ void PixelShaderCache::Shutdown()
unique_shaders.clear();
}
bool PixelShaderCache::SetShader(bool dstAlpha,u32 components)
bool PixelShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components)
{
PIXELSHADERUID uid;
GetPixelShaderId(&uid, dstAlpha ? 1 : 0);
GetPixelShaderId(&uid, dstAlphaMode);
// Check if the shader is already set
if (uid == last_pixel_shader_uid && PixelShaders[uid].frameCount == frameCount)
@ -308,7 +308,7 @@ bool PixelShaderCache::SetShader(bool dstAlpha,u32 components)
}
// Need to compile a new shader
const char *code = GeneratePixelShaderCode(dstAlpha, API_D3D9,components);
const char *code = GeneratePixelShaderCode(dstAlphaMode, API_D3D9, components);
u32 code_hash = HashAdler32((const u8 *)code, strlen(code));
unique_shaders.insert(code_hash);

View File

@ -60,7 +60,7 @@ private:
public:
static void Init();
static void Shutdown();
static bool SetShader(bool dstAlpha, u32 componets);
static bool SetShader(DSTALPHA_MODE dstAlphaMode, u32 componets);
static bool InsertByteCode(const PIXELSHADERUID &uid, const u8 *bytecode, int bytecodelen, bool activate);
static LPDIRECT3DPIXELSHADER9 GetColorMatrixProgram(int SSAAMode);
static LPDIRECT3DPIXELSHADER9 GetColorCopyProgram(int SSAAMode);

View File

@ -155,7 +155,7 @@ void VertexManager::vFlush()
VertexShaderManager::SetConstants();
PixelShaderManager::SetConstants();
if (!PixelShaderCache::SetShader(false,g_nativeVertexFmt->m_components))
if (!PixelShaderCache::SetShader(DSTALPHA_NONE,g_nativeVertexFmt->m_components))
{
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
goto shader_fail;
@ -175,7 +175,7 @@ void VertexManager::vFlush()
if (bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate)
{
DWORD write = 0;
if (!PixelShaderCache::SetShader(true, g_nativeVertexFmt->m_components))
if (!PixelShaderCache::SetShader(DSTALPHA_ALPHA_PASS, g_nativeVertexFmt->m_components))
{
DEBUGGER_PAUSE_LOG_AT(NEXT_ERROR,true,{printf("Fail to set pixel shader\n");});
goto shader_fail;