示例#1
0
static void
generate_130_vs_variables(exec_list *instructions,
                          struct _mesa_glsl_parse_state *state,
                          bool add_deprecated)
{
    generate_120_vs_variables(instructions, state, add_deprecated);

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

    generate_130_uniforms(instructions, state);

    /* From the GLSL 1.30 spec, section 7.1 (Vertex Shader Special
     * Variables):
     *
     *   The gl_ClipDistance array is predeclared as unsized and must
     *   be sized by the shader either redeclaring it with a size or
     *   indexing it only with integral constant expressions.
     *
     * We represent this in Mesa by initially declaring the array as
     * size 0.
     */
    const glsl_type *const clip_distance_array_type =
        glsl_type::get_array_instance(glsl_type::float_type, 0);

    add_variable(instructions, state->symbols,
                 "gl_ClipDistance", clip_distance_array_type, ir_var_shader_out,
                 VERT_RESULT_CLIP_DIST0);

}
示例#2
0
static void
generate_130_vs_variables(exec_list *instructions,
                          struct _mesa_glsl_parse_state *state)
{
    generate_120_vs_variables(instructions, state);

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

    const glsl_type *const clip_distance_array_type =
        glsl_type::get_array_instance(glsl_type::float_type,
                                      state->Const.MaxClipPlanes);

    /* FINISHME: gl_ClipDistance needs a real location assigned. */
    add_variable(instructions, state->symbols,
                 "gl_ClipDistance", clip_distance_array_type, ir_var_out, -1);

}
示例#3
0
static void
initialize_vs_variables(exec_list *instructions,
                        struct _mesa_glsl_parse_state *state)
{
    if (state->es_shader) {
        switch (state->language_version) {
        case 100:
            generate_100ES_vs_variables(instructions, state);
            break;
        case 300:
            generate_300ES_vs_variables(instructions, state);
            break;
        default:
            assert(!"Unexpected language version");
            break;
        }
    } else {
        switch (state->language_version) {
        case 110:
            generate_110_vs_variables(instructions, state, true);
            break;
        case 120:
            generate_120_vs_variables(instructions, state, true);
            break;
        case 130:
            generate_130_vs_variables(instructions, state, true);
            break;
        case 140:
            generate_130_vs_variables(instructions, state, false);
            break;
        default:
            assert(!"Unexpected language version");
            break;
        }
    }

    generate_ARB_draw_instanced_variables(instructions, state, false,
                                          vertex_shader);
}
示例#4
0
static void
initialize_vs_variables(exec_list *instructions,
                        struct _mesa_glsl_parse_state *state)
{

    switch (state->language_version) {
    case 100:
        generate_100ES_vs_variables(instructions, state);
        break;
    case 110:
        generate_110_vs_variables(instructions, state);
        break;
    case 120:
        generate_120_vs_variables(instructions, state);
        break;
    case 130:
        generate_130_vs_variables(instructions, state);
        break;
    }

    if (state->ARB_draw_instanced_enable)
        generate_ARB_draw_instanced_variables(instructions, state, false,
                                              vertex_shader);
}