GeometryShader: Disable the geometry shader stage if it is a pass-through shader.
This commit is contained in:
parent
f2e52b46c3
commit
bd6d229733
|
@ -28,6 +28,7 @@ GeometryShaderCache::GSCache GeometryShaderCache::GeometryShaders;
|
||||||
const GeometryShaderCache::GSCacheEntry* GeometryShaderCache::last_entry;
|
const GeometryShaderCache::GSCacheEntry* GeometryShaderCache::last_entry;
|
||||||
GeometryShaderUid GeometryShaderCache::last_uid;
|
GeometryShaderUid GeometryShaderCache::last_uid;
|
||||||
UidChecker<GeometryShaderUid,ShaderCode> GeometryShaderCache::geometry_uid_checker;
|
UidChecker<GeometryShaderUid,ShaderCode> GeometryShaderCache::geometry_uid_checker;
|
||||||
|
const GeometryShaderCache::GSCacheEntry GeometryShaderCache::pass_entry;
|
||||||
|
|
||||||
ID3D11GeometryShader* ClearGeometryShader = nullptr;
|
ID3D11GeometryShader* ClearGeometryShader = nullptr;
|
||||||
ID3D11GeometryShader* CopyGeometryShader = nullptr;
|
ID3D11GeometryShader* CopyGeometryShader = nullptr;
|
||||||
|
@ -203,12 +204,20 @@ bool GeometryShaderCache::SetShader(u32 primitive_type)
|
||||||
if (uid == last_uid)
|
if (uid == last_uid)
|
||||||
{
|
{
|
||||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
|
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
|
||||||
return (last_entry->shader != nullptr);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_uid = uid;
|
last_uid = uid;
|
||||||
|
|
||||||
|
// Check if the shader is a pass-through shader
|
||||||
|
if (IsPassthroughGeometryShader(uid))
|
||||||
|
{
|
||||||
|
// Return the default pass-through shader
|
||||||
|
last_entry = &pass_entry;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the shader is already in the cache
|
// Check if the shader is already in the cache
|
||||||
GSCache::iterator iter;
|
GSCache::iterator iter;
|
||||||
iter = GeometryShaders.find(uid);
|
iter = GeometryShaders.find(uid);
|
||||||
|
|
|
@ -43,6 +43,7 @@ private:
|
||||||
static GSCache GeometryShaders;
|
static GSCache GeometryShaders;
|
||||||
static const GSCacheEntry* last_entry;
|
static const GSCacheEntry* last_entry;
|
||||||
static GeometryShaderUid last_uid;
|
static GeometryShaderUid last_uid;
|
||||||
|
static const GSCacheEntry pass_entry;
|
||||||
|
|
||||||
static UidChecker<GeometryShaderUid, ShaderCode> geometry_uid_checker;
|
static UidChecker<GeometryShaderUid, ShaderCode> geometry_uid_checker;
|
||||||
};
|
};
|
||||||
|
|
|
@ -211,7 +211,8 @@ SHADER* ProgramShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components
|
||||||
ShaderCode gcode;
|
ShaderCode gcode;
|
||||||
GenerateVertexShaderCode(vcode, components, API_OPENGL);
|
GenerateVertexShaderCode(vcode, components, API_OPENGL);
|
||||||
GeneratePixelShaderCode(pcode, dstAlphaMode, API_OPENGL, components);
|
GeneratePixelShaderCode(pcode, dstAlphaMode, API_OPENGL, components);
|
||||||
GenerateGeometryShaderCode(gcode, primitive_type, API_OPENGL);
|
if (!IsPassthroughGeometryShader(uid.guid))
|
||||||
|
GenerateGeometryShaderCode(gcode, primitive_type, API_OPENGL);
|
||||||
|
|
||||||
if (g_ActiveConfig.bEnableShaderDebugging)
|
if (g_ActiveConfig.bEnableShaderDebugging)
|
||||||
{
|
{
|
||||||
|
|
|
@ -281,3 +281,9 @@ void GenerateGeometryShaderCode(ShaderCode& object, u32 primitive_type, API_TYPE
|
||||||
{
|
{
|
||||||
GenerateGeometryShader<ShaderCode>(object, primitive_type, ApiType);
|
GenerateGeometryShader<ShaderCode>(object, primitive_type, ApiType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsPassthroughGeometryShader(GeometryShaderUid& object)
|
||||||
|
{
|
||||||
|
geometry_shader_uid_data* uid_data = object.GetUidData<geometry_shader_uid_data>();
|
||||||
|
return uid_data->primitive_type == PRIMITIVE_TRIANGLES && !uid_data->stereo;
|
||||||
|
}
|
||||||
|
|
|
@ -25,3 +25,4 @@ typedef ShaderUid<geometry_shader_uid_data> GeometryShaderUid;
|
||||||
|
|
||||||
void GenerateGeometryShaderCode(ShaderCode& object, u32 primitive_type, API_TYPE ApiType);
|
void GenerateGeometryShaderCode(ShaderCode& object, u32 primitive_type, API_TYPE ApiType);
|
||||||
void GetGeometryShaderUid(GeometryShaderUid& object, u32 primitive_type, API_TYPE ApiType);
|
void GetGeometryShaderUid(GeometryShaderUid& object, u32 primitive_type, API_TYPE ApiType);
|
||||||
|
bool IsPassthroughGeometryShader(GeometryShaderUid& object);
|
||||||
|
|
Loading…
Reference in New Issue