<commit_before>#include "okui/shaders/DistanceFieldShader.h"

namespace okui {
namespace shaders {

std::string DistanceFieldShader::FragmentShader() {
    bool useStandardDerivatives = !scraps::opengl::kIsOpenGLES || scraps::opengl::MajorVersion() >= 3;
    std::vector<std::string> extensions;
    if (!useStandardDerivatives && scraps::opengl::HasExtension("GL_OES_standard_derivatives")) {
        useStandardDerivatives = true;
        extensions.emplace_back("GL_OES_standard_derivatives");
    }
    return CommonOKUIFragmentShaderHeader(extensions) +
    R"(
        VARYING_IN vec4 color;
        VARYING_IN vec2 textureCoord;

        uniform sampler2D textureSampler;
        uniform float edge;
        uniform bool supersample;

        void main() {
            vec4 sample = SAMPLE(textureSampler, textureCoord);
            float aa = )" + (useStandardDerivatives ? "fwidth(sample.a) * 0.75;" : "0.03") + R"(
            float alpha = smoothstep(edge - aa, edge + aa, sample.a);
<commit_msg>fix shader on fire stick<commit_after>#include "okui/shaders/DistanceFieldShader.h"

namespace okui {
namespace shaders {

std::string DistanceFieldShader::FragmentShader() {
    bool useStandardDerivatives = !scraps::opengl::kIsOpenGLES || scraps::opengl::MajorVersion() >= 3;
    std::vector<std::string> extensions;
    if (!useStandardDerivatives && scraps::opengl::HasExtension("GL_OES_standard_derivatives")) {
        useStandardDerivatives = true;
        extensions.emplace_back("GL_OES_standard_derivatives");
    }
    return CommonOKUIFragmentShaderHeader(extensions) +
    R"(
        VARYING_IN vec4 color;
        VARYING_IN vec2 textureCoord;

        uniform sampler2D textureSampler;
        uniform float edge;
        uniform bool supersample;

        void main() {
            vec4 sample = SAMPLE(textureSampler, textureCoord);
            float aa = )" + (useStandardDerivatives ? "fwidth(sample.a) * 0.75" : "0.03") + R"(;
            float alpha = smoothstep(edge - aa, edge + aa, sample.a);

{'fraction_non_alphanumeric': 0.11259259259259259, 'fraction_numerical': 0.010864197530864197, 'mean_word_length': 3.5733634311512414, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1991574', 'n_tokens_mistral': 645, 'n_tokens_neox': 613, 'n_words': 122}