<commit_before>#version 310 es
precision mediump float;

#if HAVE_UV
layout(location = 0) in highp vec2 vUV;
#endif

#if HAVE_NORMAL
layout(location = 1) in mediump vec3 vNormal;
#endif

#if HAVE_TANGENT
layout(location = 2) in mediump vec3 vTangent;
#endif

#if defined(HAVE_BASECOLORMAP) && HAVE_BASECOLORMAP
layout(set = 2, binding = 0) uniform sampler2D uBaseColormap;
#endif

#if defined(HAVE_NORMALMAP) && HAVE_NORMALMAP
layout(set = 2, binding = 1) uniform sampler2D uNormalmap;
#endif

#if defined(HAVE_METALLICROUGHNESSMAP) && HAVE_METALLICROUGHNESSMAP
layout(set = 2, binding = 2) uniform sampler2D uMetallicRoughnessmap;
#endif

layout(std430, push_constant) uniform Constants
{
    vec4 base_color;
    float emissive;
    float roughness;
    float metallic;
} registers;

layout(location = 0) out vec4 FragColor;

void main()
{
#if defined(HAVE_BASECOLORMAP) && HAVE_BASECOLORMAP
    vec4 base_color = texture(uBaseColormap, vUV);
    #if defined(ALPHA_TEST) && !defined(ALPHA_TEST_ALPHA_TO_COVERAGE)
        if (base_color.a < 0.5)
            discard;
    #endif
#else
    vec4 base_color = registers.base_color;
#endif

#if defined(HAVE_NORMAL) && HAVE_NORMAL
    vec3 normal = normalize(vNormal);
    #if defined(HAVE_NORMALMAP)
        vec3 tangent = normalize(vTangent);
        vec3 binormal = cross(normal, tangent);
        vec3 tangent_space = texture(uNormalmap, vUV).xyz * 2.0 - 1.0;
        normal = normalize(mat3(tangent, binormal, normal) * tangent_space);
    #endif
#endif

#if defined(HAVE_METALLICROUGHNESSMAP) && HAVE_METALLICROUGHNESSMAP<commit_msg>Shader fiddle.<commit_after>#version 310 es
precision mediump float;

#if HAVE_UV
layout(location = 0) in highp vec2 vUV;
#endif

#if HAVE_NORMAL
layout(location = 1) in mediump vec3 vNormal;
#endif

#if HAVE_TANGENT
layout(location = 2) in mediump vec3 vTangent;
#endif

#if defined(HAVE_BASECOLORMAP) && HAVE_BASECOLORMAP
layout(set = 2, binding = 0) uniform sampler2D uBaseColormap;
#endif

#if defined(HAVE_NORMALMAP) && HAVE_NORMALMAP
layout(set = 2, binding = 1) uniform sampler2D uNormalmap;
#endif

#if defined(HAVE_METALLICROUGHNESSMAP) && HAVE_METALLICROUGHNESSMAP
layout(set = 2, binding = 2) uniform sampler2D uMetallicRoughnessmap;
#endif

layout(std430, push_constant) uniform Constants
{
    vec4 base_color;
    float emissive;
    float roughness;
    float metallic;
} registers;

layout(location = 0) out vec4 FragColor;

void main()
{
#if defined(HAVE_BASECOLORMAP) && HAVE_BASECOLORMAP
    vec4 base_color = texture(uBaseColormap, vUV);
    #if defined(ALPHA_TEST) && !defined(ALPHA_TEST_ALPHA_TO_COVERAGE)
        if (base_color.a < 0.5)
            discard;
    #endif
#else
    vec4 base_color = registers.base_color;
#endif

#if defined(HAVE_NORMAL) && HAVE_NORMAL
    vec3 normal = normalize(vNormal);
    #if defined(HAVE_NORMALMAP) && HAVE_NORMALMAP
        vec3 tangent = normalize(vTangent);
        vec3 binormal = cross(normal, tangent);
        vec3 tangent_space = texture(uNormalmap, vUV).xyz * 2.0 - 1.0;
        normal = normalize(mat3(tangent, binormal, normal) * tangent_space);
    #endif
#endif

#if defined(HAVE_METALLICROUGHNESSMAP) && HAVE_METALLICROUGHNESSMAP
{'fraction_non_alphanumeric': 0.09689557855126998, 'fraction_numerical': 0.023204766384446535, 'mean_word_length': 4.62610229276896, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2738921', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1131, 'n_words': 275}