blob: 90f3bd0bf48bd58a2c0742597007a7d6afea7a92 [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//
Jamie Madilla2ad4e82014-07-17 14:16:32 -04006// ShaderVars.cpp:
Jamie Madill6a729792014-07-18 10:33:14 -04007// Methods for GL variable types (varyings, uniforms, etc)
8//
9
Jamie Madille294bb82014-07-17 14:16:26 -040010#include <GLSLANG/ShaderLang.h>
Jamie Madill6a729792014-07-18 10:33:14 -040011
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),
Jamie Madill42bcf322014-08-25 16:20:46 -040038 staticUse(other.staticUse),
39 fields(other.fields),
40 structName(other.structName)
Jamie Madill6a729792014-07-18 10:33:14 -040041{}
42
43ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
44{
45 type = other.type;
46 precision = other.precision;
47 name = other.name;
48 mappedName = other.mappedName;
49 arraySize = other.arraySize;
50 staticUse = other.staticUse;
Jamie Madill42bcf322014-08-25 16:20:46 -040051 fields = other.fields;
52 structName = other.structName;
Jamie Madill6a729792014-07-18 10:33:14 -040053 return *this;
54}
55
56Uniform::Uniform()
57{}
58
59Uniform::~Uniform()
60{}
61
62Uniform::Uniform(const Uniform &other)
Jamie Madill42bcf322014-08-25 16:20:46 -040063 : ShaderVariable(other)
Jamie Madill6a729792014-07-18 10:33:14 -040064{}
65
66Uniform &Uniform::operator=(const Uniform &other)
67{
68 ShaderVariable::operator=(other);
Jamie Madill6a729792014-07-18 10:33:14 -040069 return *this;
70}
71
72Attribute::Attribute()
73 : location(-1)
74{}
75
76Attribute::~Attribute()
77{}
78
79Attribute::Attribute(const Attribute &other)
80 : ShaderVariable(other),
81 location(other.location)
82{}
83
84Attribute &Attribute::operator=(const Attribute &other)
85{
86 ShaderVariable::operator=(other);
87 location = other.location;
88 return *this;
89}
90
91InterfaceBlockField::InterfaceBlockField()
92 : isRowMajorMatrix(false)
93{}
94
95InterfaceBlockField::~InterfaceBlockField()
96{}
97
98InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other)
99 : ShaderVariable(other),
Jamie Madill42bcf322014-08-25 16:20:46 -0400100 isRowMajorMatrix(other.isRowMajorMatrix)
Jamie Madill6a729792014-07-18 10:33:14 -0400101{}
102
103InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other)
104{
105 ShaderVariable::operator=(other);
106 isRowMajorMatrix = other.isRowMajorMatrix;
Jamie Madill6a729792014-07-18 10:33:14 -0400107 return *this;
108}
109
110Varying::Varying()
Jamie Madill42bcf322014-08-25 16:20:46 -0400111 : interpolation(INTERPOLATION_SMOOTH),
112 isInvariant(false)
Jamie Madill6a729792014-07-18 10:33:14 -0400113{}
114
115Varying::~Varying()
116{}
117
118Varying::Varying(const Varying &other)
119 : ShaderVariable(other),
120 interpolation(other.interpolation),
Jamie Madill42bcf322014-08-25 16:20:46 -0400121 isInvariant(other.isInvariant)
Jamie Madill6a729792014-07-18 10:33:14 -0400122{}
123
124Varying &Varying::operator=(const Varying &other)
125{
126 ShaderVariable::operator=(other);
127 interpolation = other.interpolation;
Jamie Madill42bcf322014-08-25 16:20:46 -0400128 isInvariant = other.isInvariant;
Jamie Madill6a729792014-07-18 10:33:14 -0400129 return *this;
130}
131
132InterfaceBlock::InterfaceBlock()
133 : arraySize(0),
134 layout(BLOCKLAYOUT_PACKED),
135 isRowMajorLayout(false),
136 staticUse(false)
137{}
138
139InterfaceBlock::~InterfaceBlock()
140{}
141
142InterfaceBlock::InterfaceBlock(const InterfaceBlock &other)
143 : name(other.name),
144 mappedName(other.mappedName),
Jamie Madill42bcf322014-08-25 16:20:46 -0400145 instanceName(other.instanceName),
Jamie Madill6a729792014-07-18 10:33:14 -0400146 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;
Jamie Madill42bcf322014-08-25 16:20:46 -0400157 instanceName = other.instanceName;
Jamie Madill6a729792014-07-18 10:33:14 -0400158 arraySize = other.arraySize;
159 layout = other.layout;
160 isRowMajorLayout = other.isRowMajorLayout;
161 staticUse = other.staticUse;
162 fields = other.fields;
163 return *this;
164}
165
166}