1
0
Fork 0
forked from suyu/suyu

gl_shader_util: Use vec3 constants for AppendColorCombiner.

This commit is contained in:
bunnei 2015-10-02 00:12:50 -04:00
parent 37b0aa5af7
commit b02a533d94

View file

@ -268,25 +268,25 @@ void AppendColorCombiner(std::string& shader, Pica::Regs::TevStageConfig::Operat
shader += variable_name + "[0] * " + variable_name + "[1]"; shader += variable_name + "[0] * " + variable_name + "[1]";
break; break;
case Operation::Add: case Operation::Add:
shader += "min(" + variable_name + "[0] + " + variable_name + "[1], 1.0)"; shader += "min(" + variable_name + "[0] + " + variable_name + "[1], vec3(1.0))";
break; break;
case Operation::AddSigned: case Operation::AddSigned:
shader += "clamp(" + variable_name + "[0] + " + variable_name + "[1] - vec3(0.5), 0.0, 1.0)"; shader += "clamp(" + variable_name + "[0] + " + variable_name + "[1] - vec3(0.5), vec3(0.0), vec3(1.0))";
break; break;
case Operation::Lerp: case Operation::Lerp:
shader += variable_name + "[0] * " + variable_name + "[2] + " + variable_name + "[1] * (vec3(1.0) - " + variable_name + "[2])"; shader += variable_name + "[0] * " + variable_name + "[2] + " + variable_name + "[1] * (vec3(1.0) - " + variable_name + "[2])";
break; break;
case Operation::Subtract: case Operation::Subtract:
shader += "max(" + variable_name + "[0] - " + variable_name + "[1], 0.0)"; shader += "max(" + variable_name + "[0] - " + variable_name + "[1], vec3(0.0))";
break; break;
case Operation::MultiplyThenAdd: case Operation::MultiplyThenAdd:
shader += "min(" + variable_name + "[0] * " + variable_name + "[1] + " + variable_name + "[2], 1.0)"; shader += "min(" + variable_name + "[0] * " + variable_name + "[1] + " + variable_name + "[2], vec3(1.0))";
break; break;
case Operation::AddThenMultiply: case Operation::AddThenMultiply:
shader += "min(" + variable_name + "[0] + " + variable_name + "[1], 1.0) * " + variable_name + "[2]"; shader += "min(" + variable_name + "[0] + " + variable_name + "[1], vec3(1.0)) * " + variable_name + "[2]";
break; break;
default: default:
shader += "0.0"; shader += "vec3(0.0)";
LOG_CRITICAL(Render_OpenGL, "Unknown color comb op %u", operation); LOG_CRITICAL(Render_OpenGL, "Unknown color comb op %u", operation);
break; break;
} }