move shared parts from VertexManager::vFlush into VideoCommon

This commit is contained in:
degasus 2014-02-03 16:56:17 +01:00
parent 48798d8d34
commit e5318d2624
6 changed files with 12 additions and 16 deletions

View File

@ -197,11 +197,8 @@ void VertexManager::Draw(UINT stride)
}
}
void VertexManager::vFlush()
void VertexManager::vFlush(bool useDstAlpha)
{
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate &&
bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
if (!PixelShaderCache::SetShader(
useDstAlpha ? DSTALPHA_DUAL_SOURCE_BLEND : DSTALPHA_NONE,
g_nativeVertexFmt->m_components))
@ -223,8 +220,6 @@ void VertexManager::vFlush()
Draw(stride);
g_perf_query->DisableQuery(bpmem.zcontrol.early_ztest ? PQG_ZCOMP_ZCOMPLOC : PQG_ZCOMP);
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
g_renderer->RestoreState();
}

View File

@ -30,7 +30,7 @@ private:
void PrepareDrawBuffers();
void Draw(u32 stride);
// temp
void vFlush();
void vFlush(bool useDstAlpha);
u32 m_vertex_buffer_cursor;
u32 m_vertex_draw_offset;

View File

@ -25,7 +25,6 @@
#include "VertexManager.h"
#include "IndexGenerator.h"
#include "FileUtil.h"
#include "Debugger.h"
#include "StreamBuffer.h"
#include "PerfQueryBase.h"
#include "Render.h"
@ -131,7 +130,7 @@ void VertexManager::Draw(u32 stride)
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
void VertexManager::vFlush()
void VertexManager::vFlush(bool useDstAlpha)
{
GLVertexFormat *nativeVertexFmt = (GLVertexFormat*)g_nativeVertexFmt;
u32 stride = nativeVertexFmt->GetVertexStride();
@ -144,9 +143,6 @@ void VertexManager::vFlush()
PrepareDrawBuffers(stride);
GL_REPORT_ERRORD();
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate
&& bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
// Makes sure we can actually do Dual source blending
bool dualSourcePossible = g_ActiveConfig.backend_info.bSupportsDualSourceBlend;
@ -200,7 +196,6 @@ void VertexManager::vFlush()
if (bpmem.blendmode.blendenable || bpmem.blendmode.subtract)
glEnable(GL_BLEND);
}
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
#if defined(_DEBUG) || defined(DEBUGFAST)
if (g_ActiveConfig.iLog & CONF_SAVESHADERS)

View File

@ -43,7 +43,7 @@ protected:
virtual void ResetBuffer(u32 stride);
private:
void Draw(u32 stride);
void vFlush() override;
void vFlush(bool useDstAlpha) override;
void PrepareDrawBuffers(u32 stride);
NativeVertexFormat *m_CurrentVertexFmt;
};

View File

@ -11,6 +11,7 @@
#include "RenderBase.h"
#include "BPStructs.h"
#include "XFMemory.h"
#include "Debugger.h"
#include "VertexManagerBase.h"
#include "MainBase.h"
@ -216,8 +217,13 @@ void VertexManager::Flush()
VertexShaderManager::SetConstants();
PixelShaderManager::SetConstants();
bool useDstAlpha = !g_ActiveConfig.bDstAlphaPass && bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate
&& bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
// TODO: need to merge more stuff into VideoCommon
g_vertex_manager->vFlush();
g_vertex_manager->vFlush(useDstAlpha);
GFX_DEBUGGER_PAUSE_AT(NEXT_FLUSH, true);
IsFlushed = true;
}

View File

@ -58,7 +58,7 @@ private:
//virtual void Draw(u32 stride, bool alphapass) = 0;
// temp
virtual void vFlush() = 0;
virtual void vFlush(bool useDstAlpha) = 0;
};
extern VertexManager *g_vertex_manager;