blob: 19ec6e17a3cdac47cfe9ac9a21abdf20f1cc2c46 (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrGLShaderBuilder_DEFINED
#define GrGLShaderBuilder_DEFINED
#include "GrAllocator.h"
#include "gl/GrGLShaderVar.h"
#include "gl/GrGLSL.h"
typedef GrTAllocator<GrGLShaderVar> VarArray;
/**
Containts all the incremental state of a shader as it is being built,
as well as helpers to manipulate that state.
TODO: migrate CompileShaders() here?
*/
class GrGLShaderBuilder {
public:
GrGLShaderBuilder();
void appendVarying(GrSLType type,
const char* name,
const char** vsOutName = NULL,
const char** fsInName = NULL);
void appendVarying(GrSLType type,
const char* name,
int stageNum,
const char** vsOutName = NULL,
const char** fsInName = NULL);
GrStringBuilder fHeader; // VS+FS, GLSL version, etc
VarArray fVSUnis;
VarArray fVSAttrs;
VarArray fVSOutputs;
VarArray fGSInputs;
VarArray fGSOutputs;
VarArray fFSInputs;
GrStringBuilder fGSHeader; // layout qualifiers specific to GS
VarArray fFSUnis;
VarArray fFSOutputs;
GrStringBuilder fFSFunctions;
GrStringBuilder fVSCode;
GrStringBuilder fGSCode;
GrStringBuilder fFSCode;
int fVaryingDims;
static const int fCoordDims = 2;
bool fUsesGS;
};
#endif
|