mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-22 12:39:52 +00:00
vk: Improved attribute interpolation for NVIDIA
This commit is contained in:
parent
bf190fd3d8
commit
08e7a23121
@ -1246,30 +1246,14 @@ namespace glsl
|
|||||||
|
|
||||||
// Interpolate the input attributes manually.
|
// Interpolate the input attributes manually.
|
||||||
// Matches AMD behavior where gl_BaryCoordSmoothAMD only provides x and y with z being autogenerated.
|
// Matches AMD behavior where gl_BaryCoordSmoothAMD only provides x and y with z being autogenerated.
|
||||||
std::string interpolate_function_block;
|
std::string interpolate_function_block =
|
||||||
if (g_cfg.video.shader_precision == gpu_preset_level::ultra)
|
"\n"
|
||||||
{
|
"vec4 _interpolate_varying3(const in vec4[3] v)\n"
|
||||||
interpolate_function_block =
|
"{\n"
|
||||||
"\n"
|
" const vec4 p10 = v[1] - v[0];\n"
|
||||||
"vec4 _interpolate_varying3(const in vec4[3] v)\n"
|
" const vec4 p20 = v[2] - v[0];\n"
|
||||||
"{\n"
|
" return v[0] + p10 * $gl_BaryCoord.y + p20 * $gl_BaryCoord.z;\n"
|
||||||
" const double _gl_BaryCoord_x = double($gl_BaryCoord.x);\n"
|
"}\n\n";
|
||||||
" const double _gl_BaryCoord_y = double($gl_BaryCoord.y);\n"
|
|
||||||
" const double _gl_BaryCoord_z = double(1.0) - (_gl_BaryCoord_x + _gl_BaryCoord_y);\n"
|
|
||||||
" return vec4(_gl_BaryCoord_x * v[0] + _gl_BaryCoord_y * v[1] + _gl_BaryCoord_z * v[2]);\n"
|
|
||||||
"}\n\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
interpolate_function_block =
|
|
||||||
"\n"
|
|
||||||
"vec4 _interpolate_varying3(const in vec4[3] v)\n"
|
|
||||||
"{\n"
|
|
||||||
" vec3 _gl_BaryCoord = vec3($gl_BaryCoord.xy, 1.f);\n"
|
|
||||||
" _gl_BaryCoord.z = dot(_gl_BaryCoord, vec3(-1.f, -1.f, 1.f));\n"
|
|
||||||
" return vec4(_gl_BaryCoord.x * v[0] + _gl_BaryCoord.y * v[1] + _gl_BaryCoord.z * v[2]);\n"
|
|
||||||
"}\n\n";
|
|
||||||
}
|
|
||||||
OS << fmt::replace_all(interpolate_function_block, {{ "$gl_BaryCoord", "gl_BaryCoord"s + std::string(ext_flavour) }});
|
OS << fmt::replace_all(interpolate_function_block, {{ "$gl_BaryCoord", "gl_BaryCoord"s + std::string(ext_flavour) }});
|
||||||
|
|
||||||
for (const auto& reg : varying_list)
|
for (const auto& reg : varying_list)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user