summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/UberShaderPixel.cpp
diff options
context:
space:
mode:
authorTellowKrinkle <tellowkrinkle@gmail.com>2022-07-13 03:56:33 -0500
committerTellowKrinkle <tellowkrinkle@gmail.com>2023-01-30 14:04:37 -0600
commit600ad5f49832a69efe0ebd5ca7a19d3a82f7a319 (patch)
tree2f5568e49c52891274850bf28a37c815fb9f1fad /Source/Core/VideoCommon/UberShaderPixel.cpp
parentd380d43209ce046d30af398ca3ecfc6fdd5a47d1 (diff)
VideoCommon: Better logic op invert approximation
Diffstat (limited to 'Source/Core/VideoCommon/UberShaderPixel.cpp')
-rw-r--r--Source/Core/VideoCommon/UberShaderPixel.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/UberShaderPixel.cpp b/Source/Core/VideoCommon/UberShaderPixel.cpp
index d625ce9c42..21309bc8b3 100644
--- a/Source/Core/VideoCommon/UberShaderPixel.cpp
+++ b/Source/Core/VideoCommon/UberShaderPixel.cpp
@@ -1092,6 +1092,26 @@ ShaderCode GenPixelShader(APIType api_type, const ShaderHostConfig& host_config,
" TevResult &= 0xff;\n"
" }}\n");
}
+ else if (!host_config.backend_logic_op)
+ {
+ out.Write(" // Helpers for logic op blending approximations\n"
+ " if (logic_op_enable) {{\n"
+ " switch (logic_op_mode) {{\n");
+ out.Write(" case {}: // Clear\n", static_cast<u32>(LogicOp::Clear));
+ out.Write(" TevResult = int4(0, 0, 0, 0);\n"
+ " break;\n");
+ out.Write(" case {}: // Copy Inverted\n", static_cast<u32>(LogicOp::CopyInverted));
+ out.Write(" TevResult ^= 0xff;\n"
+ " break;\n");
+ out.Write(" case {}: // Set\n", static_cast<u32>(LogicOp::Set));
+ out.Write(" case {}: // Invert\n", static_cast<u32>(LogicOp::Invert));
+ out.Write(" TevResult = int4(255, 255, 255, 255);\n"
+ " break;\n");
+ out.Write(" default:\n"
+ " break;\n"
+ " }}\n"
+ " }}\n");
+ }
// Some backends require that the shader outputs be uint when writing to a uint render target for
// logic op.