예제 #1
0
static void
generate_110_vs_variables(exec_list *instructions,
                          struct _mesa_glsl_parse_state *state)
{
    for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
        add_builtin_variable(instructions, state->symbols,
                             & builtin_core_vs_variables[i]);
    }

    for (unsigned i = 0
                      ; i < Elements(builtin_110_deprecated_vs_variables)
            ; i++) {
        add_builtin_variable(instructions, state->symbols,
                             & builtin_110_deprecated_vs_variables[i]);
    }
    generate_110_uniforms(instructions, state);

    /* From page 54 (page 60 of the PDF) of the GLSL 1.20 spec:
     *
     *     "As with all arrays, indices used to subscript gl_TexCoord must
     *     either be an integral constant expressions, or this array must be
     *     re-declared by the shader with a size. The size can be at most
     *     gl_MaxTextureCoords. Using indexes close to 0 may aid the
     *     implementation in preserving varying resources."
     */
    const glsl_type *const vec4_array_type =
        glsl_type::get_array_instance(glsl_type::vec4_type, 0);

    add_variable(instructions, state->symbols,
                 "gl_TexCoord", vec4_array_type, ir_var_out, VERT_RESULT_TEX0);

    generate_ARB_draw_buffers_variables(instructions, state, false,
                                        vertex_shader);
}
예제 #2
0
/* This function should only be called for ES, not desktop GL. */
static void
generate_100ES_vs_variables(exec_list *instructions,
                            struct _mesa_glsl_parse_state *state)
{
    for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
        add_builtin_variable(instructions, state->symbols,
                             & builtin_core_vs_variables[i]);
    }

    generate_100ES_uniforms(instructions, state);

    generate_ARB_draw_buffers_variables(instructions, state, false,
                                        vertex_shader);
}
예제 #3
0
static void
generate_300ES_fs_variables(exec_list *instructions,
                            struct _mesa_glsl_parse_state *state)
{
    /* Note: we don't add builtin_core_fs_variables, because it contains
     * gl_FragColor, which is not in GLSL 3.00 ES.
     */

    for (unsigned i = 0; i < Elements(builtin_300ES_fs_variables); i++) {
        add_builtin_variable(instructions, state->symbols,
                             & builtin_300ES_fs_variables[i]);
    }

    generate_300ES_uniforms(instructions, state);

    generate_ARB_draw_buffers_variables(instructions, state, false,
                                        fragment_shader);
}