| 78 | } |
| 79 | |
| 80 | std::unique_ptr<RuntimeProgram> CornerPinEffect::onCreateProgram(Context* context) const { |
| 81 | auto gl = GLFunctions::Get(context); |
| 82 | // Clear the previously generated GLError, causing the subsequent CheckGLError to return an |
| 83 | // incorrect result. |
| 84 | ClearGLError(gl); |
| 85 | const auto caps = GLCaps::Get(context); |
| 86 | const auto isDesktop = caps->standard == GLStandard::GL; |
| 87 | auto filterProgram = |
| 88 | FilterProgram::Make(context, GetFinalShaderCode(CORNER_PIN_VERTEX_SHADER, isDesktop), |
| 89 | GetFinalShaderCode(CORNER_PIN_FRAGMENT_SHADER, isDesktop)); |
| 90 | if (filterProgram == nullptr) { |
| 91 | return nullptr; |
| 92 | } |
| 93 | |
| 94 | auto program = filterProgram->program; |
| 95 | auto uniforms = std::make_unique<CornerPinUniforms>(); |
| 96 | uniforms->positionHandle = gl->getAttribLocation(program, "aPosition"); |
| 97 | uniforms->textureCoordHandle = gl->getAttribLocation(program, "aTextureCoord"); |
| 98 | filterProgram->uniforms = std::move(uniforms); |
| 99 | if (!CheckGLError(gl)) { |
| 100 | return nullptr; |
| 101 | } |
| 102 | return filterProgram; |
| 103 | } |
| 104 | |
| 105 | bool CornerPinEffect::onDraw(const RuntimeProgram* program, |
| 106 | const std::vector<BackendTexture>& inputTextures, |
no test coverage detected