Jamie Madill | 6a72979 | 2014-07-18 10:33:14 -0400 | [diff] [blame^] | 1 | // |
| 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 | |
| 12 | namespace sh |
| 13 | { |
| 14 | |
| 15 | ShaderVariable::ShaderVariable() |
| 16 | : type(0), |
| 17 | precision(0), |
| 18 | arraySize(0), |
| 19 | staticUse(false) |
| 20 | {} |
| 21 | |
| 22 | ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn) |
| 23 | : type(typeIn), |
| 24 | precision(0), |
| 25 | arraySize(arraySizeIn), |
| 26 | staticUse(false) |
| 27 | {} |
| 28 | |
| 29 | ShaderVariable::~ShaderVariable() |
| 30 | {} |
| 31 | |
| 32 | ShaderVariable::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 | |
| 41 | ShaderVariable &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 | |
| 52 | Uniform::Uniform() |
| 53 | {} |
| 54 | |
| 55 | Uniform::~Uniform() |
| 56 | {} |
| 57 | |
| 58 | Uniform::Uniform(const Uniform &other) |
| 59 | : ShaderVariable(other), |
| 60 | fields(other.fields) |
| 61 | {} |
| 62 | |
| 63 | Uniform &Uniform::operator=(const Uniform &other) |
| 64 | { |
| 65 | ShaderVariable::operator=(other); |
| 66 | fields = other.fields; |
| 67 | return *this; |
| 68 | } |
| 69 | |
| 70 | Attribute::Attribute() |
| 71 | : location(-1) |
| 72 | {} |
| 73 | |
| 74 | Attribute::~Attribute() |
| 75 | {} |
| 76 | |
| 77 | Attribute::Attribute(const Attribute &other) |
| 78 | : ShaderVariable(other), |
| 79 | location(other.location) |
| 80 | {} |
| 81 | |
| 82 | Attribute &Attribute::operator=(const Attribute &other) |
| 83 | { |
| 84 | ShaderVariable::operator=(other); |
| 85 | location = other.location; |
| 86 | return *this; |
| 87 | } |
| 88 | |
| 89 | InterfaceBlockField::InterfaceBlockField() |
| 90 | : isRowMajorMatrix(false) |
| 91 | {} |
| 92 | |
| 93 | InterfaceBlockField::~InterfaceBlockField() |
| 94 | {} |
| 95 | |
| 96 | InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other) |
| 97 | : ShaderVariable(other), |
| 98 | isRowMajorMatrix(other.isRowMajorMatrix), |
| 99 | fields(other.fields) |
| 100 | {} |
| 101 | |
| 102 | InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other) |
| 103 | { |
| 104 | ShaderVariable::operator=(other); |
| 105 | isRowMajorMatrix = other.isRowMajorMatrix; |
| 106 | fields = other.fields; |
| 107 | return *this; |
| 108 | } |
| 109 | |
| 110 | Varying::Varying() |
| 111 | : interpolation(INTERPOLATION_SMOOTH) |
| 112 | {} |
| 113 | |
| 114 | Varying::~Varying() |
| 115 | {} |
| 116 | |
| 117 | Varying::Varying(const Varying &other) |
| 118 | : ShaderVariable(other), |
| 119 | interpolation(other.interpolation), |
| 120 | fields(other.fields), |
| 121 | structName(other.structName) |
| 122 | {} |
| 123 | |
| 124 | Varying &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 | |
| 133 | InterfaceBlock::InterfaceBlock() |
| 134 | : arraySize(0), |
| 135 | layout(BLOCKLAYOUT_PACKED), |
| 136 | isRowMajorLayout(false), |
| 137 | staticUse(false) |
| 138 | {} |
| 139 | |
| 140 | InterfaceBlock::~InterfaceBlock() |
| 141 | {} |
| 142 | |
| 143 | InterfaceBlock::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 | |
| 153 | InterfaceBlock &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 | } |