VideoCommon: Make dst_alpha state implicit.

This commit is contained in:
degasus
2016-12-28 01:37:41 +01:00
parent b7d8bd13a6
commit 41b0c74e30
33 changed files with 79 additions and 149 deletions

View File

@ -174,10 +174,10 @@ void ProgramShaderCache::UploadConstants()
}
}
SHADER* ProgramShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 primitive_type)
SHADER* ProgramShaderCache::SetShader(u32 primitive_type)
{
SHADERUID uid;
GetShaderId(&uid, dstAlphaMode, primitive_type);
GetShaderId(&uid, primitive_type);
// Check if the shader is already set
if (last_entry)
@ -388,9 +388,9 @@ GLuint ProgramShaderCache::CompileSingleShader(GLuint type, const std::string& c
return result;
}
void ProgramShaderCache::GetShaderId(SHADERUID* uid, DSTALPHA_MODE dstAlphaMode, u32 primitive_type)
void ProgramShaderCache::GetShaderId(SHADERUID* uid, u32 primitive_type)
{
uid->puid = GetPixelShaderUid(dstAlphaMode);
uid->puid = GetPixelShaderUid();
uid->vuid = GetVertexShaderUid();
uid->guid = GetGeometryShaderUid(primitive_type);
}

View File

@ -62,8 +62,8 @@ public:
};
static PCacheEntry GetShaderProgram();
static SHADER* SetShader(DSTALPHA_MODE dstAlphaMode, u32 primitive_type);
static void GetShaderId(SHADERUID* uid, DSTALPHA_MODE dstAlphaMode, u32 primitive_type);
static SHADER* SetShader(u32 primitive_type);
static void GetShaderId(SHADERUID* uid, u32 primitive_type);
static bool CompileShader(SHADER& shader, const std::string& vcode, const std::string& pcode,
const std::string& gcode = "");

View File

@ -136,7 +136,7 @@ void VertexManager::Draw(u32 stride)
static_cast<Renderer*>(g_renderer.get())->SetGenerationMode();
}
void VertexManager::vFlush(bool useDstAlpha)
void VertexManager::vFlush()
{
GLVertexFormat* nativeVertexFmt = (GLVertexFormat*)VertexLoaderManager::GetCurrentVertexFormat();
u32 stride = nativeVertexFmt->GetVertexStride();
@ -149,19 +149,7 @@ void VertexManager::vFlush(bool useDstAlpha)
PrepareDrawBuffers(stride);
// Makes sure we can actually do Dual source blending
bool dualSourcePossible = g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
// If host supports GL_ARB_blend_func_extended, we can do dst alpha in
// the same pass as regular rendering.
if (useDstAlpha && dualSourcePossible)
{
ProgramShaderCache::SetShader(DSTALPHA_DUAL_SOURCE_BLEND, m_current_primitive_type);
}
else
{
ProgramShaderCache::SetShader(DSTALPHA_NONE, m_current_primitive_type);
}
ProgramShaderCache::SetShader(m_current_primitive_type);
// upload global constants
ProgramShaderCache::UploadConstants();

View File

@ -41,7 +41,7 @@ protected:
private:
void Draw(u32 stride);
void vFlush(bool useDstAlpha) override;
void vFlush() override;
void PrepareDrawBuffers(u32 stride);
// Alternative buffers in CPU memory for primatives we are going to discard.