aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders/GrGLVertexShaderBuilder.h
blob: 4662c403e5d80ab815219b9c803cce9078429ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrGLVertexShader_DEFINED
#define GrGLVertexShader_DEFINED

#include "GrGLShaderBuilder.h"
#include "GrGeometryProcessor.h"

class GrGLSLVarying;

class GrGLVertexBuilder : public GrGLShaderBuilder {
public:
    GrGLVertexBuilder(GrGLSLProgramBuilder* program);

    void transformToNormalizedDeviceSpace(const GrShaderVar& posVar);
    void emitAttributes(const GrGeometryProcessor& gp);

    void addAttribute(const GrGeometryProcessor::Attribute* attr) {
        this->addAttribute(GrShaderVar(attr->fName,
                                       GrVertexAttribTypeToSLType(attr->fType),
                                       GrShaderVar::kAttribute_TypeModifier,
                                       GrShaderVar::kNonArray,
                                       attr->fPrecision));
    }

private:
    /*
     * Internal call for GrGLProgramBuilder.addVarying
     */
    void addVarying(const char* name, GrSLPrecision, GrGLSLVarying*);

    // an internal call which checks for uniquness of a var before adding it to the list of inputs
    bool addAttribute(const GrShaderVar& var);

    void onFinalize() override {}
    
    const char* fRtAdjustName;

    friend class GrGLProgramBuilder;

    typedef GrGLShaderBuilder INHERITED;
};

#endif