gsdx ogl: only use geometry shader to convert big enough draw call (#1554)

gsdx ogl: only use geometry shader to convert big enough draw call

The purpose of geometry shader is to reduce bandwidth (72 bytes by sprite)
and CPU load.

Unfortunately it increases CPU load due to extra shader validations.

So geometry shader will only be enabled for draw call with more than
16 sprites (arbitrarily, smallest number before shadow hearts plummet)

v2: don't disable geometry shader in replayer.
It is easier to spot sprite rendering and to manually read vertex info.
This commit is contained in:
Gregory Hainaut 2016-09-18 16:58:02 +02:00 committed by GitHub
parent 2a60264e40
commit 310f13a2f7
1 changed files with 16 additions and 1 deletions

View File

@ -159,7 +159,22 @@ void GSRendererOGL::SetupIA(const float& sx, const float& sy)
break; break;
case GS_SPRITE_CLASS: case GS_SPRITE_CLASS:
if (GLLoader::found_geometry_shader) { // Heuristics: trade-off
// CPU conversion => ofc, more CPU ;) more bandwidth (72 bytes / sprite)
// GPU conversion => ofc, more GPU. And also more CPU due to extra shader validation stage.
//
// Note: severals openGL operation does draw call under the wood like texture upload. So even if
// you do 10 consecutive draw with the geometry shader, you will still pay extra validation if new
// texture are uploaded. (game Shadow Hearts)
//
// Note2: Due to MultiThreaded driver, Nvidia suffers less of the previous issue. Still it isn't free
// Shadow Heart is 90 fps (gs) vs 113 fps (no gs)
// If the draw calls contains few primitives. Geometry Shader gain with be rather small versus
// the extra validation cost of the extra stage.
//
// Note: keep Geometry Shader in the replayer to ease debug.
if (GLLoader::found_geometry_shader && (m_vertex.next > 32 || GLLoader::in_replayer)) { // <=> 16 sprites (based on Shadow Hearts)
m_gs_sel.sprite = 1; m_gs_sel.sprite = 1;
t = GL_LINES; t = GL_LINES;