mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 13:27:45 -07:00
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;
|
||||
GeometryShaderUid GeometryShaderCache::last_uid;
|
||||
UidChecker<GeometryShaderUid,ShaderCode> GeometryShaderCache::geometry_uid_checker;
|
||||
const GeometryShaderCache::GSCacheEntry GeometryShaderCache::pass_entry;
|
||||
|
||||
ID3D11GeometryShader* ClearGeometryShader = nullptr;
|
||||
ID3D11GeometryShader* CopyGeometryShader = nullptr;
|
||||
@ -203,12 +204,20 @@ bool GeometryShaderCache::SetShader(u32 primitive_type)
|
||||
if (uid == last_uid)
|
||||
{
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_PIXEL_SHADER_CHANGE,true);
|
||||
return (last_entry->shader != nullptr);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
GSCache::iterator iter;
|
||||
iter = GeometryShaders.find(uid);
|
||||
|
@ -43,6 +43,7 @@ private:
|
||||
static GSCache GeometryShaders;
|
||||
static const GSCacheEntry* last_entry;
|
||||
static GeometryShaderUid last_uid;
|
||||
static const GSCacheEntry pass_entry;
|
||||
|
||||
static UidChecker<GeometryShaderUid, ShaderCode> geometry_uid_checker;
|
||||
};
|
||||
|
@ -211,6 +211,7 @@ SHADER* ProgramShaderCache::SetShader(DSTALPHA_MODE dstAlphaMode, u32 components
|
||||
ShaderCode gcode;
|
||||
GenerateVertexShaderCode(vcode, components, API_OPENGL);
|
||||
GeneratePixelShaderCode(pcode, dstAlphaMode, API_OPENGL, components);
|
||||
if (!IsPassthroughGeometryShader(uid.guid))
|
||||
GenerateGeometryShaderCode(gcode, primitive_type, API_OPENGL);
|
||||
|
||||
if (g_ActiveConfig.bEnableShaderDebugging)
|
||||
|
@ -281,3 +281,9 @@ void GenerateGeometryShaderCode(ShaderCode& object, u32 primitive_type, API_TYPE
|
||||
{
|
||||
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 GetGeometryShaderUid(GeometryShaderUid& object, u32 primitive_type, API_TYPE ApiType);
|
||||
bool IsPassthroughGeometryShader(GeometryShaderUid& object);
|
||||
|
Loading…
Reference in New Issue
Block a user