blob: 0e3168d92b370d14df2a34932f292c10333bcdf4 [file] [log] [blame]
Jamie Madill6a729792014-07-18 10:33:14 -04001//
2// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6// shadervars.cpp:
7// Methods for GL variable types (varyings, uniforms, etc)
8//
9
10#include "common/shadervars.h"
11
12namespace sh
13{
14
15ShaderVariable::ShaderVariable()
16 : type(0),
17 precision(0),
18 arraySize(0),
19 staticUse(false)
20{}
21
22ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn)
23 : type(typeIn),
24 precision(0),
25 arraySize(arraySizeIn),
26 staticUse(false)
27{}
28
29ShaderVariable::~ShaderVariable()
30{}
31
32ShaderVariable::ShaderVariable(const ShaderVariable &other)
33 : type(other.type),
34 precision(other.precision),
35 name(other.name),
36 mappedName(other.mappedName),
37 arraySize(other.arraySize),
38 staticUse(other.staticUse)
39{}
40
41ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
42{
43 type = other.type;
44 precision = other.precision;
45 name = other.name;
46 mappedName = other.mappedName;
47 arraySize = other.arraySize;
48 staticUse = other.staticUse;
49 return *this;
50}
51
52Uniform::Uniform()
53{}
54
55Uniform::~Uniform()
56{}
57
58Uniform::Uniform(const Uniform &other)
59 : ShaderVariable(other),
60 fields(other.fields)
61{}
62
63Uniform &Uniform::operator=(const Uniform &other)
64{
65 ShaderVariable::operator=(other);
66 fields = other.fields;
67 return *this;
68}
69
70Attribute::Attribute()
71 : location(-1)
72{}
73
74Attribute::~Attribute()
75{}
76
77Attribute::Attribute(const Attribute &other)
78 : ShaderVariable(other),
79 location(other.location)
80{}
81
82Attribute &Attribute::operator=(const Attribute &other)
83{
84 ShaderVariable::operator=(other);
85 location = other.location;
86 return *this;
87}
88
89InterfaceBlockField::InterfaceBlockField()
90 : isRowMajorMatrix(false)
91{}
92
93InterfaceBlockField::~InterfaceBlockField()
94{}
95
96InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other)
97 : ShaderVariable(other),
98 isRowMajorMatrix(other.isRowMajorMatrix),
99 fields(other.fields)
100{}
101
102InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other)
103{
104 ShaderVariable::operator=(other);
105 isRowMajorMatrix = other.isRowMajorMatrix;
106 fields = other.fields;
107 return *this;
108}
109
110Varying::Varying()
111 : interpolation(INTERPOLATION_SMOOTH)
112{}
113
114Varying::~Varying()
115{}
116
117Varying::Varying(const Varying &other)
118 : ShaderVariable(other),
119 interpolation(other.interpolation),
120 fields(other.fields),
121 structName(other.structName)
122{}
123
124Varying &Varying::operator=(const Varying &other)
125{
126 ShaderVariable::operator=(other);
127 interpolation = other.interpolation;
128 fields = other.fields;
129 structName = other.structName;
130 return *this;
131}
132
133InterfaceBlock::InterfaceBlock()
134 : arraySize(0),
135 layout(BLOCKLAYOUT_PACKED),
136 isRowMajorLayout(false),
137 staticUse(false)
138{}
139
140InterfaceBlock::~InterfaceBlock()
141{}
142
143InterfaceBlock::InterfaceBlock(const InterfaceBlock &other)
144 : name(other.name),
145 mappedName(other.mappedName),
146 arraySize(other.arraySize),
147 layout(other.layout),
148 isRowMajorLayout(other.isRowMajorLayout),
149 staticUse(other.staticUse),
150 fields(other.fields)
151{}
152
153InterfaceBlock &InterfaceBlock::operator=(const InterfaceBlock &other)
154{
155 name = other.name;
156 mappedName = other.mappedName;
157 arraySize = other.arraySize;
158 layout = other.layout;
159 isRowMajorLayout = other.isRowMajorLayout;
160 staticUse = other.staticUse;
161 fields = other.fields;
162 return *this;
163}
164
165}