summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GeometryShaderGen.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-10-23 01:49:26 -0400
committerGitHub <noreply@github.com>2022-10-23 01:49:26 -0400
commitcdcbe51b2a0c4dd78ab8d1d3ad38d8ab2947405b (patch)
tree5d29d92713f591f003b7d83da63b427b3c847ea1 /Source/Core/VideoCommon/GeometryShaderGen.cpp
parent06bd0a908692f61702a483c51c93fadb2ed7eefc (diff)
parent1e9b6f88e4c13722a2a47aeb0d54df95c3a07c69 (diff)
Merge pull request #10890 from tellowkrinkle/VertexLineExpand
VideoCommon: Add vertex shader point/line expansion
Diffstat (limited to 'Source/Core/VideoCommon/GeometryShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/GeometryShaderGen.cpp23
1 files changed, 3 insertions, 20 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp
index 818a22bfa4..2db201c636 100644
--- a/Source/Core/VideoCommon/GeometryShaderGen.cpp
+++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp
@@ -97,10 +97,8 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
else
out.Write("cbuffer GSBlock {{\n");
- out.Write("\tfloat4 " I_STEREOPARAMS ";\n"
- "\tfloat4 " I_LINEPTPARAMS ";\n"
- "\tint4 " I_TEXOFFSET ";\n"
- "}};\n");
+ out.Write("{}", s_geometry_shader_uniforms);
+ out.Write("}};\n");
out.Write("struct VS_OUTPUT {{\n");
GenerateVSOutputMembers(out, api_type, uid_data->numTexGens, host_config, "",
@@ -171,22 +169,7 @@ ShaderCode GenerateGeometryShaderCode(APIType api_type, const ShaderHostConfig&
"\tVS_OUTPUT end = o[1];\n");
}
- // GameCube/Wii's line drawing algorithm is a little quirky. It does not
- // use the correct line caps. Instead, the line caps are vertical or
- // horizontal depending the slope of the line.
- out.Write("\tfloat2 offset;\n"
- "\tfloat2 to = abs(end.pos.xy / end.pos.w - start.pos.xy / start.pos.w);\n"
- // FIXME: What does real hardware do when line is at a 45-degree angle?
- // FIXME: Lines aren't drawn at the correct width. See Twilight Princess map.
- "\tif (" I_LINEPTPARAMS ".y * to.y > " I_LINEPTPARAMS ".x * to.x) {{\n"
- // Line is more tall. Extend geometry left and right.
- // Lerp LineWidth/2 from [0..VpWidth] to [-1..1]
- "\t\toffset = float2(" I_LINEPTPARAMS ".z / " I_LINEPTPARAMS ".x, 0);\n"
- "\t}} else {{\n"
- // Line is more wide. Extend geometry up and down.
- // Lerp LineWidth/2 from [0..VpHeight] to [1..-1]
- "\t\toffset = float2(0, -" I_LINEPTPARAMS ".z / " I_LINEPTPARAMS ".y);\n"
- "\t}}\n");
+ GenerateLineOffset(out, "\t", "\t\t", "end.pos", "start.pos", "");
}
else if (primitive_type == PrimitiveType::Points)
{