diff options
Diffstat (limited to 'src/gpu/glsl/GrGLSLVertexShaderBuilder.h')
-rw-r--r-- | src/gpu/glsl/GrGLSLVertexShaderBuilder.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/gpu/glsl/GrGLSLVertexShaderBuilder.h b/src/gpu/glsl/GrGLSLVertexShaderBuilder.h new file mode 100644 index 0000000000..92edd9ae81 --- /dev/null +++ b/src/gpu/glsl/GrGLSLVertexShaderBuilder.h @@ -0,0 +1,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 GrGLSLVertexShader_DEFINED +#define GrGLSLVertexShader_DEFINED + +#include "GrGLSLShaderBuilder.h" +#include "GrGeometryProcessor.h" + +class GrGLSLVarying; + +class GrGLSLVertexBuilder : public GrGLSLShaderBuilder { +public: + GrGLSLVertexBuilder(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 GrGLSLShaderBuilder INHERITED; +}; + +#endif |