mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Remove global refrences from common code.
Bug Fix: Previously vertex shaders and geometery shaders didn't track antialaising state in their UIDs, which could cause AA bugs on directx.
This commit is contained in:
@ -245,40 +245,41 @@ inline void DefineOutputMember(T& object, API_TYPE api_type, const char* qualifi
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void GenerateVSOutputMembers(T& object, API_TYPE api_type, const char* qualifier)
|
||||
inline void GenerateVSOutputMembers(T& object, API_TYPE api_type, u32 texgens,
|
||||
bool per_pixel_lighting, const char* qualifier)
|
||||
{
|
||||
DefineOutputMember(object, api_type, qualifier, "float4", "pos", -1, "POSITION");
|
||||
DefineOutputMember(object, api_type, qualifier, "float4", "colors_", 0, "COLOR", 0);
|
||||
DefineOutputMember(object, api_type, qualifier, "float4", "colors_", 1, "COLOR", 1);
|
||||
|
||||
for (unsigned int i = 0; i < xfmem.numTexGen.numTexGens; ++i)
|
||||
for (unsigned int i = 0; i < texgens; ++i)
|
||||
DefineOutputMember(object, api_type, qualifier, "float3", "tex", i, "TEXCOORD", i);
|
||||
|
||||
DefineOutputMember(object, api_type, qualifier, "float4", "clipPos", -1, "TEXCOORD",
|
||||
xfmem.numTexGen.numTexGens);
|
||||
DefineOutputMember(object, api_type, qualifier, "float4", "clipPos", -1, "TEXCOORD", texgens);
|
||||
|
||||
if (g_ActiveConfig.bEnablePixelLighting)
|
||||
if (per_pixel_lighting)
|
||||
{
|
||||
DefineOutputMember(object, api_type, qualifier, "float3", "Normal", -1, "TEXCOORD",
|
||||
xfmem.numTexGen.numTexGens + 1);
|
||||
texgens + 1);
|
||||
DefineOutputMember(object, api_type, qualifier, "float3", "WorldPos", -1, "TEXCOORD",
|
||||
xfmem.numTexGen.numTexGens + 2);
|
||||
texgens + 2);
|
||||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void AssignVSOutputMembers(T& object, const char* a, const char* b)
|
||||
inline void AssignVSOutputMembers(T& object, const char* a, const char* b, u32 texgens,
|
||||
bool per_pixel_lighting)
|
||||
{
|
||||
object.Write("\t%s.pos = %s.pos;\n", a, b);
|
||||
object.Write("\t%s.colors_0 = %s.colors_0;\n", a, b);
|
||||
object.Write("\t%s.colors_1 = %s.colors_1;\n", a, b);
|
||||
|
||||
for (unsigned int i = 0; i < xfmem.numTexGen.numTexGens; ++i)
|
||||
for (unsigned int i = 0; i < texgens; ++i)
|
||||
object.Write("\t%s.tex%d = %s.tex%d;\n", a, i, b, i);
|
||||
|
||||
object.Write("\t%s.clipPos = %s.clipPos;\n", a, b);
|
||||
|
||||
if (g_ActiveConfig.bEnablePixelLighting)
|
||||
if (per_pixel_lighting)
|
||||
{
|
||||
object.Write("\t%s.Normal = %s.Normal;\n", a, b);
|
||||
object.Write("\t%s.WorldPos = %s.WorldPos;\n", a, b);
|
||||
@ -293,23 +294,24 @@ inline void AssignVSOutputMembers(T& object, const char* a, const char* b)
|
||||
// As a workaround, we interpolate at the centroid of the coveraged pixel, which
|
||||
// is always inside the primitive.
|
||||
// Without MSAA, this flag is defined to have no effect.
|
||||
inline const char* GetInterpolationQualifier(bool in_glsl_interface_block = false, bool in = false)
|
||||
inline const char* GetInterpolationQualifier(bool msaa, bool ssaa,
|
||||
bool in_glsl_interface_block = false, bool in = false)
|
||||
{
|
||||
if (g_ActiveConfig.iMultisamples <= 1)
|
||||
if (!msaa)
|
||||
return "";
|
||||
|
||||
// Without GL_ARB_shading_language_420pack support, the interpolation qualifier must be
|
||||
// "centroid in" and not "centroid", even within an interface block.
|
||||
if (in_glsl_interface_block && !g_ActiveConfig.backend_info.bSupportsBindingLayout)
|
||||
{
|
||||
if (!g_ActiveConfig.bSSAA)
|
||||
if (!ssaa)
|
||||
return in ? "centroid in" : "centroid out";
|
||||
else
|
||||
return in ? "sample in" : "sample out";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_ActiveConfig.bSSAA)
|
||||
if (!ssaa)
|
||||
return "centroid";
|
||||
else
|
||||
return "sample";
|
||||
|
Reference in New Issue
Block a user