summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
diff options
context:
space:
mode:
authorGravatar ameerj2021-06-25 13:09:45 -0400
committerGravatar ameerj2021-07-22 21:51:39 -0400
commit8289eb108fefa9bfbb445c9f6b3f423a5d0eb771 (patch)
treee1c72cddcaffd74a9acff03d223576e6d82fbcce /src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
parentvk_graphics_pipeline: Implement smooth lines (diff)
downloadyuzu-8289eb108fefa9bfbb445c9f6b3f423a5d0eb771.tar.gz
yuzu-8289eb108fefa9bfbb445c9f6b3f423a5d0eb771.tar.xz
yuzu-8289eb108fefa9bfbb445c9f6b3f423a5d0eb771.zip
opengl: Implement LOP.CC
Used by MH:Rise
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
index 2892074e1..38419f88f 100644
--- a/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
+++ b/src/shader_recompiler/backend/glsl/emit_glsl_integer.cpp
@@ -27,6 +27,14 @@ void SetSignFlag(EmitContext& ctx, IR::Inst& inst, std::string_view result) {
27 ctx.AddU1("{}=int({})<0;", *sign, result); 27 ctx.AddU1("{}=int({})<0;", *sign, result);
28 sign->Invalidate(); 28 sign->Invalidate();
29} 29}
30
31void BitwiseLogicalOp(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b,
32 char lop) {
33 const auto result{ctx.var_alloc.Define(inst, GlslVarType::U32)};
34 ctx.Add("{}={}{}{};", result, a, lop, b);
35 SetZeroFlag(ctx, inst, result);
36 SetSignFlag(ctx, inst, result);
37}
30} // Anonymous namespace 38} // Anonymous namespace
31 39
32void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { 40void EmitIAdd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
@@ -113,15 +121,15 @@ void EmitShiftRightArithmetic64(EmitContext& ctx, IR::Inst& inst, std::string_vi
113} 121}
114 122
115void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { 123void EmitBitwiseAnd32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
116 ctx.AddU32("{}={}&{};", inst, a, b); 124 BitwiseLogicalOp(ctx, inst, a, b, '&');
117} 125}
118 126
119void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { 127void EmitBitwiseOr32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
120 ctx.AddU32("{}={}|{};", inst, a, b); 128 BitwiseLogicalOp(ctx, inst, a, b, '|');
121} 129}
122 130
123void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) { 131void EmitBitwiseXor32(EmitContext& ctx, IR::Inst& inst, std::string_view a, std::string_view b) {
124 ctx.AddU32("{}={}^{};", inst, a, b); 132 BitwiseLogicalOp(ctx, inst, a, b, '^');
125} 133}
126 134
127void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base, 135void EmitBitFieldInsert(EmitContext& ctx, IR::Inst& inst, std::string_view base,