Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-swiftshader: Commit

external/swiftshader


Commit MetaInfo

Revisione6f65d9265e764034c1c078bd67db893cd565cac (tree)
Time2020-04-10 02:52:05
AuthorNicolas Capens <capn@goog...>
CommiterNicolas Capens

Log Message

Rename GenericValue to Operand

Bug: b/129000021
Change-Id: I0000fc5e65bde87e9037400002db37cb6d50960d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43688
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>

Change Summary

Incremental Difference

--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -2009,7 +2009,7 @@ SpirvShader::EmitResult SpirvShader::EmitCompositeConstruct(InsnIterator insn, E
20092009 Object::ID srcObjectId = insn.word(3u + i);
20102010 auto &srcObject = getObject(srcObjectId);
20112011 auto &srcObjectTy = getType(srcObject.type);
2012- GenericValue srcObjectAccess(this, state, srcObjectId);
2012+ Operand srcObjectAccess(this, state, srcObjectId);
20132013
20142014 for(auto j = 0u; j < srcObjectTy.sizeInComponents; j++)
20152015 {
@@ -2029,8 +2029,8 @@ SpirvShader::EmitResult SpirvShader::EmitCompositeInsert(InsnIterator insn, Emit
20292029 auto &newPartObjectTy = getType(newPartObject.type);
20302030 auto firstNewComponent = WalkLiteralAccessChain(resultTypeId, insn.wordCount() - 5, insn.wordPointer(5));
20312031
2032- GenericValue srcObjectAccess(this, state, insn.word(4));
2033- GenericValue newPartObjectAccess(this, state, insn.word(3));
2032+ Operand srcObjectAccess(this, state, insn.word(4));
2033+ Operand newPartObjectAccess(this, state, insn.word(3));
20342034
20352035 // old components before
20362036 for(auto i = 0u; i < firstNewComponent; i++)
@@ -2059,7 +2059,7 @@ SpirvShader::EmitResult SpirvShader::EmitCompositeExtract(InsnIterator insn, Emi
20592059 Type::ID compositeTypeId = compositeObject.definition.word(1);
20602060 auto firstComponent = WalkLiteralAccessChain(compositeTypeId, insn.wordCount() - 4, insn.wordPointer(4));
20612061
2062- GenericValue compositeObjectAccess(this, state, insn.word(3));
2062+ Operand compositeObjectAccess(this, state, insn.word(3));
20632063 for(auto i = 0u; i < type.sizeInComponents; i++)
20642064 {
20652065 dst.move(i, compositeObjectAccess.Float(firstComponent + i));
@@ -2077,8 +2077,8 @@ SpirvShader::EmitResult SpirvShader::EmitVectorShuffle(InsnIterator insn, EmitSt
20772077 // half type are all independent.
20782078 auto &firstHalfType = getType(getObject(insn.word(3)).type);
20792079
2080- GenericValue firstHalfAccess(this, state, insn.word(3));
2081- GenericValue secondHalfAccess(this, state, insn.word(4));
2080+ Operand firstHalfAccess(this, state, insn.word(3));
2081+ Operand secondHalfAccess(this, state, insn.word(4));
20822082
20832083 for(auto i = 0u; i < type.sizeInComponents; i++)
20842084 {
@@ -2108,8 +2108,8 @@ SpirvShader::EmitResult SpirvShader::EmitVectorExtractDynamic(InsnIterator insn,
21082108 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
21092109 auto &srcType = getType(getObject(insn.word(3)).type);
21102110
2111- GenericValue src(this, state, insn.word(3));
2112- GenericValue index(this, state, insn.word(4));
2111+ Operand src(this, state, insn.word(3));
2112+ Operand index(this, state, insn.word(4));
21132113
21142114 SIMD::UInt v = SIMD::UInt(0);
21152115
@@ -2127,9 +2127,9 @@ SpirvShader::EmitResult SpirvShader::EmitVectorInsertDynamic(InsnIterator insn,
21272127 auto &type = getType(insn.word(1));
21282128 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
21292129
2130- GenericValue src(this, state, insn.word(3));
2131- GenericValue component(this, state, insn.word(4));
2132- GenericValue index(this, state, insn.word(5));
2130+ Operand src(this, state, insn.word(3));
2131+ Operand component(this, state, insn.word(4));
2132+ Operand index(this, state, insn.word(5));
21332133
21342134 for(auto i = 0u; i < type.sizeInComponents; i++)
21352135 {
@@ -2143,10 +2143,10 @@ SpirvShader::EmitResult SpirvShader::EmitSelect(InsnIterator insn, EmitState *st
21432143 {
21442144 auto &type = getType(insn.word(1));
21452145 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
2146- auto cond = GenericValue(this, state, insn.word(3));
2146+ auto cond = Operand(this, state, insn.word(3));
21472147 auto condIsScalar = (getType(cond.type).sizeInComponents == 1);
2148- auto lhs = GenericValue(this, state, insn.word(4));
2149- auto rhs = GenericValue(this, state, insn.word(5));
2148+ auto lhs = Operand(this, state, insn.word(4));
2149+ auto rhs = Operand(this, state, insn.word(5));
21502150
21512151 for(auto i = 0u; i < type.sizeInComponents; i++)
21522152 {
@@ -2163,7 +2163,7 @@ SpirvShader::EmitResult SpirvShader::EmitAny(InsnIterator insn, EmitState *state
21632163 ASSERT(type.sizeInComponents == 1);
21642164 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
21652165 auto &srcType = getType(getObject(insn.word(3)).type);
2166- auto src = GenericValue(this, state, insn.word(3));
2166+ auto src = Operand(this, state, insn.word(3));
21672167
21682168 SIMD::UInt result = src.UInt(0);
21692169
@@ -2182,7 +2182,7 @@ SpirvShader::EmitResult SpirvShader::EmitAll(InsnIterator insn, EmitState *state
21822182 ASSERT(type.sizeInComponents == 1);
21832183 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
21842184 auto &srcType = getType(getObject(insn.word(3)).type);
2185- auto src = GenericValue(this, state, insn.word(3));
2185+ auto src = Operand(this, state, insn.word(3));
21862186
21872187 SIMD::UInt result = src.UInt(0);
21882188
@@ -2203,7 +2203,7 @@ SpirvShader::EmitResult SpirvShader::EmitAtomicOp(InsnIterator insn, EmitState *
22032203 auto memorySemantics = static_cast<spv::MemorySemanticsMask>(getObject(semanticsId).constantValue[0]);
22042204 auto memoryOrder = MemoryOrder(memorySemantics);
22052205 // Where no value is provided (increment/decrement) use an implicit value of 1.
2206- auto value = (insn.wordCount() == 7) ? GenericValue(this, state, insn.word(6)).UInt(0) : RValue<SIMD::UInt>(1);
2206+ auto value = (insn.wordCount() == 7) ? Operand(this, state, insn.word(6)).UInt(0) : RValue<SIMD::UInt>(1);
22072207 auto &dst = state->createIntermediate(resultId, resultType.sizeInComponents);
22082208 auto ptr = state->getPointer(insn.word(3));
22092209 auto ptrOffsets = ptr.offsets();
@@ -2274,8 +2274,8 @@ SpirvShader::EmitResult SpirvShader::EmitAtomicCompareExchange(InsnIterator insn
22742274 auto memorySemanticsUnequal = static_cast<spv::MemorySemanticsMask>(getObject(insn.word(6)).constantValue[0]);
22752275 auto memoryOrderUnequal = MemoryOrder(memorySemanticsUnequal);
22762276
2277- auto value = GenericValue(this, state, insn.word(7));
2278- auto comparator = GenericValue(this, state, insn.word(8));
2277+ auto value = Operand(this, state, insn.word(7));
2278+ auto comparator = Operand(this, state, insn.word(8));
22792279 auto &dst = state->createIntermediate(resultId, resultType.sizeInComponents);
22802280 auto ptr = state->getPointer(insn.word(3));
22812281 auto ptrOffsets = ptr.offsets();
@@ -2302,7 +2302,7 @@ SpirvShader::EmitResult SpirvShader::EmitCopyObject(InsnIterator insn, EmitState
23022302 {
23032303 auto ty = getType(insn.word(1));
23042304 auto &dst = state->createIntermediate(insn.word(2), ty.sizeInComponents);
2305- auto src = GenericValue(this, state, insn.word(3));
2305+ auto src = Operand(this, state, insn.word(3));
23062306 for(uint32_t i = 0; i < ty.sizeInComponents; i++)
23072307 {
23082308 dst.move(i, src.Int(i));
@@ -2428,7 +2428,7 @@ VkShaderStageFlagBits SpirvShader::executionModelToStage(spv::ExecutionModel mod
24282428 }
24292429 }
24302430
2431-SpirvShader::GenericValue::GenericValue(SpirvShader const *shader, EmitState const *state, SpirvShader::Object::ID objId)
2431+SpirvShader::Operand::Operand(SpirvShader const *shader, EmitState const *state, SpirvShader::Object::ID objId)
24322432 : obj(shader->getObject(objId))
24332433 , intermediate(obj.kind == SpirvShader::Object::Kind::Intermediate ? &state->getIntermediate(objId) : nullptr)
24342434 , type(obj.type)
--- a/src/Pipeline/SpirvShader.hpp
+++ b/src/Pipeline/SpirvShader.hpp
@@ -961,13 +961,13 @@ private:
961961 // Constants are transparently widened to per-lane values in operator[].
962962 // This is appropriate in most cases -- if we're not going to do something
963963 // significantly different based on whether the value is uniform across lanes.
964- class GenericValue
964+ class Operand
965965 {
966966 SpirvShader::Object const &obj;
967967 Intermediate const *intermediate;
968968
969969 public:
970- GenericValue(SpirvShader const *shader, EmitState const *state, SpirvShader::Object::ID objId);
970+ Operand(SpirvShader const *shader, EmitState const *state, SpirvShader::Object::ID objId);
971971
972972 RValue<SIMD::Float> Float(uint32_t i) const
973973 {
@@ -1136,7 +1136,7 @@ private:
11361136 EmitResult EmitArrayLength(InsnIterator insn, EmitState *state) const;
11371137
11381138 void GetImageDimensions(EmitState const *state, Type const &resultTy, Object::ID imageId, Object::ID lodId, Intermediate &dst) const;
1139- SIMD::Pointer GetTexelAddress(EmitState const *state, SIMD::Pointer base, GenericValue const &coordinate, Type const &imageType, Pointer<Byte> descriptor, int texelSize, Object::ID sampleId, bool useStencilAspect) const;
1139+ SIMD::Pointer GetTexelAddress(EmitState const *state, SIMD::Pointer base, Operand const &coordinate, Type const &imageType, Pointer<Byte> descriptor, int texelSize, Object::ID sampleId, bool useStencilAspect) const;
11401140 uint32_t GetConstScalarInt(Object::ID id) const;
11411141 void EvalSpecConstantOp(InsnIterator insn);
11421142 void EvalSpecConstantUnaryOp(InsnIterator insn);
@@ -1168,7 +1168,7 @@ private:
11681168 static bool IsStatement(spv::Op op);
11691169
11701170 // Helper as we often need to take dot products as part of doing other things.
1171- SIMD::Float Dot(unsigned numComponents, GenericValue const &x, GenericValue const &y) const;
1171+ SIMD::Float Dot(unsigned numComponents, Operand const &x, Operand const &y) const;
11721172
11731173 // Splits x into a floating-point significand in the range [0.5, 1.0)
11741174 // and an integral exponent of two, such that:
--- a/src/Pipeline/SpirvShaderArithmetic.cpp
+++ b/src/Pipeline/SpirvShaderArithmetic.cpp
@@ -24,8 +24,8 @@ SpirvShader::EmitResult SpirvShader::EmitVectorTimesScalar(InsnIterator insn, Em
2424 {
2525 auto &type = getType(insn.word(1));
2626 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
27- auto lhs = GenericValue(this, state, insn.word(3));
28- auto rhs = GenericValue(this, state, insn.word(4));
27+ auto lhs = Operand(this, state, insn.word(3));
28+ auto rhs = Operand(this, state, insn.word(4));
2929
3030 for(auto i = 0u; i < type.sizeInComponents; i++)
3131 {
@@ -39,8 +39,8 @@ SpirvShader::EmitResult SpirvShader::EmitMatrixTimesVector(InsnIterator insn, Em
3939 {
4040 auto &type = getType(insn.word(1));
4141 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
42- auto lhs = GenericValue(this, state, insn.word(3));
43- auto rhs = GenericValue(this, state, insn.word(4));
42+ auto lhs = Operand(this, state, insn.word(3));
43+ auto rhs = Operand(this, state, insn.word(4));
4444 auto rhsType = getType(rhs.type);
4545
4646 for(auto i = 0u; i < type.sizeInComponents; i++)
@@ -60,8 +60,8 @@ SpirvShader::EmitResult SpirvShader::EmitVectorTimesMatrix(InsnIterator insn, Em
6060 {
6161 auto &type = getType(insn.word(1));
6262 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
63- auto lhs = GenericValue(this, state, insn.word(3));
64- auto rhs = GenericValue(this, state, insn.word(4));
63+ auto lhs = Operand(this, state, insn.word(3));
64+ auto rhs = Operand(this, state, insn.word(4));
6565 auto lhsType = getType(lhs.type);
6666
6767 for(auto i = 0u; i < type.sizeInComponents; i++)
@@ -81,8 +81,8 @@ SpirvShader::EmitResult SpirvShader::EmitMatrixTimesMatrix(InsnIterator insn, Em
8181 {
8282 auto &type = getType(insn.word(1));
8383 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
84- auto lhs = GenericValue(this, state, insn.word(3));
85- auto rhs = GenericValue(this, state, insn.word(4));
84+ auto lhs = Operand(this, state, insn.word(3));
85+ auto rhs = Operand(this, state, insn.word(4));
8686
8787 auto numColumns = type.definition.word(3);
8888 auto numRows = getType(type.definition.word(2)).definition.word(3);
@@ -108,8 +108,8 @@ SpirvShader::EmitResult SpirvShader::EmitOuterProduct(InsnIterator insn, EmitSta
108108 {
109109 auto &type = getType(insn.word(1));
110110 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
111- auto lhs = GenericValue(this, state, insn.word(3));
112- auto rhs = GenericValue(this, state, insn.word(4));
111+ auto lhs = Operand(this, state, insn.word(3));
112+ auto rhs = Operand(this, state, insn.word(4));
113113 auto &lhsType = getType(lhs.type);
114114 auto &rhsType = getType(rhs.type);
115115
@@ -137,7 +137,7 @@ SpirvShader::EmitResult SpirvShader::EmitTranspose(InsnIterator insn, EmitState
137137 {
138138 auto &type = getType(insn.word(1));
139139 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
140- auto mat = GenericValue(this, state, insn.word(3));
140+ auto mat = Operand(this, state, insn.word(3));
141141
142142 auto numCols = type.definition.word(3);
143143 auto numRows = getType(type.definition.word(2)).sizeInComponents;
@@ -157,7 +157,7 @@ SpirvShader::EmitResult SpirvShader::EmitUnaryOp(InsnIterator insn, EmitState *s
157157 {
158158 auto &type = getType(insn.word(1));
159159 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
160- auto src = GenericValue(this, state, insn.word(3));
160+ auto src = Operand(this, state, insn.word(3));
161161
162162 for(auto i = 0u; i < type.sizeInComponents; i++)
163163 {
@@ -169,9 +169,9 @@ SpirvShader::EmitResult SpirvShader::EmitUnaryOp(InsnIterator insn, EmitState *s
169169 break;
170170 case spv::OpBitFieldInsert:
171171 {
172- auto insert = GenericValue(this, state, insn.word(4)).UInt(i);
173- auto offset = GenericValue(this, state, insn.word(5)).UInt(0);
174- auto count = GenericValue(this, state, insn.word(6)).UInt(0);
172+ auto insert = Operand(this, state, insn.word(4)).UInt(i);
173+ auto offset = Operand(this, state, insn.word(5)).UInt(0);
174+ auto count = Operand(this, state, insn.word(6)).UInt(0);
175175 auto one = SIMD::UInt(1);
176176 auto v = src.UInt(i);
177177 auto mask = Bitmask32(offset + count) ^ Bitmask32(offset);
@@ -181,8 +181,8 @@ SpirvShader::EmitResult SpirvShader::EmitUnaryOp(InsnIterator insn, EmitState *s
181181 case spv::OpBitFieldSExtract:
182182 case spv::OpBitFieldUExtract:
183183 {
184- auto offset = GenericValue(this, state, insn.word(4)).UInt(0);
185- auto count = GenericValue(this, state, insn.word(5)).UInt(0);
184+ auto offset = Operand(this, state, insn.word(4)).UInt(0);
185+ auto count = Operand(this, state, insn.word(5)).UInt(0);
186186 auto one = SIMD::UInt(1);
187187 auto v = src.UInt(i);
188188 SIMD::UInt out = (v >> offset) & Bitmask32(count);
@@ -320,8 +320,8 @@ SpirvShader::EmitResult SpirvShader::EmitBinaryOp(InsnIterator insn, EmitState *
320320 auto &type = getType(insn.word(1));
321321 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
322322 auto &lhsType = getType(getObject(insn.word(3)).type);
323- auto lhs = GenericValue(this, state, insn.word(3));
324- auto rhs = GenericValue(this, state, insn.word(4));
323+ auto lhs = Operand(this, state, insn.word(3));
324+ auto rhs = Operand(this, state, insn.word(4));
325325
326326 for(auto i = 0u; i < lhsType.sizeInComponents; i++)
327327 {
@@ -524,14 +524,14 @@ SpirvShader::EmitResult SpirvShader::EmitDot(InsnIterator insn, EmitState *state
524524 ASSERT(type.sizeInComponents == 1);
525525 auto &dst = state->createIntermediate(insn.word(2), type.sizeInComponents);
526526 auto &lhsType = getType(getObject(insn.word(3)).type);
527- auto lhs = GenericValue(this, state, insn.word(3));
528- auto rhs = GenericValue(this, state, insn.word(4));
527+ auto lhs = Operand(this, state, insn.word(3));
528+ auto rhs = Operand(this, state, insn.word(4));
529529
530530 dst.move(0, Dot(lhsType.sizeInComponents, lhs, rhs));
531531 return EmitResult::Continue;
532532 }
533533
534-SIMD::Float SpirvShader::Dot(unsigned numComponents, GenericValue const &x, GenericValue const &y) const
534+SIMD::Float SpirvShader::Dot(unsigned numComponents, Operand const &x, Operand const &y) const
535535 {
536536 SIMD::Float d = x.Float(0) * y.Float(0);
537537
--- a/src/Pipeline/SpirvShaderControlFlow.cpp
+++ b/src/Pipeline/SpirvShaderControlFlow.cpp
@@ -495,7 +495,7 @@ SpirvShader::EmitResult SpirvShader::EmitBranchConditional(InsnIterator insn, Em
495495 auto trueBlockId = Block::ID(block.branchInstruction.word(2));
496496 auto falseBlockId = Block::ID(block.branchInstruction.word(3));
497497
498- auto cond = GenericValue(this, state, condId);
498+ auto cond = Operand(this, state, condId);
499499 ASSERT_MSG(getType(cond.type).sizeInComponents == 1, "Condition must be a Boolean type scalar");
500500
501501 // TODO: Optimize for case where all lanes take same path.
@@ -514,7 +514,7 @@ SpirvShader::EmitResult SpirvShader::EmitSwitch(InsnIterator insn, EmitState *st
514514
515515 auto selId = Object::ID(block.branchInstruction.word(1));
516516
517- auto sel = GenericValue(this, state, selId);
517+ auto sel = Operand(this, state, selId);
518518 ASSERT_MSG(getType(sel.type).sizeInComponents == 1, "Selector must be a scalar");
519519
520520 auto numCases = (block.branchInstruction.wordCount() - 3) / 2;
@@ -678,7 +678,7 @@ void SpirvShader::StorePhi(Block::ID currentBlock, InsnIterator insn, EmitState
678678 }
679679
680680 auto mask = GetActiveLaneMaskEdge(state, blockId, currentBlock);
681- auto in = GenericValue(this, state, varId);
681+ auto in = Operand(this, state, varId);
682682
683683 for(uint32_t i = 0; i < type.sizeInComponents; i++)
684684 {
--- a/src/Pipeline/SpirvShaderDebugger.cpp
+++ b/src/Pipeline/SpirvShaderDebugger.cpp
@@ -1203,7 +1203,7 @@ void SpirvShader::Impl::Debugger::exposeVariable(
12031203 case Object::Kind::Constant:
12041204 case Object::Kind::Intermediate:
12051205 {
1206- auto val = GenericValue(shader, state, id).Int(wordOffset);
1206+ auto val = Operand(shader, state, id).Int(wordOffset);
12071207
12081208 switch(ty->encoding)
12091209 {
@@ -1287,7 +1287,7 @@ void SpirvShader::Impl::Debugger::exposeVariable(
12871287 }
12881288
12891289 // No debug type information. Derive from SPIR-V.
1290- GenericValue val(shader, state, id);
1290+ Operand val(shader, state, id);
12911291 switch(shader->getType(val.type).opcode())
12921292 {
12931293 case spv::OpTypeInt:
--- a/src/Pipeline/SpirvShaderGLSLstd450.cpp
+++ b/src/Pipeline/SpirvShaderGLSLstd450.cpp
@@ -35,7 +35,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
3535 {
3636 case GLSLstd450FAbs:
3737 {
38- auto src = GenericValue(this, state, insn.word(5));
38+ auto src = Operand(this, state, insn.word(5));
3939 for(auto i = 0u; i < type.sizeInComponents; i++)
4040 {
4141 dst.move(i, Abs(src.Float(i)));
@@ -44,7 +44,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
4444 }
4545 case GLSLstd450SAbs:
4646 {
47- auto src = GenericValue(this, state, insn.word(5));
47+ auto src = Operand(this, state, insn.word(5));
4848 for(auto i = 0u; i < type.sizeInComponents; i++)
4949 {
5050 dst.move(i, Abs(src.Int(i)));
@@ -53,8 +53,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
5353 }
5454 case GLSLstd450Cross:
5555 {
56- auto lhs = GenericValue(this, state, insn.word(5));
57- auto rhs = GenericValue(this, state, insn.word(6));
56+ auto lhs = Operand(this, state, insn.word(5));
57+ auto rhs = Operand(this, state, insn.word(6));
5858 dst.move(0, lhs.Float(1) * rhs.Float(2) - rhs.Float(1) * lhs.Float(2));
5959 dst.move(1, lhs.Float(2) * rhs.Float(0) - rhs.Float(2) * lhs.Float(0));
6060 dst.move(2, lhs.Float(0) * rhs.Float(1) - rhs.Float(0) * lhs.Float(1));
@@ -62,7 +62,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
6262 }
6363 case GLSLstd450Floor:
6464 {
65- auto src = GenericValue(this, state, insn.word(5));
65+ auto src = Operand(this, state, insn.word(5));
6666 for(auto i = 0u; i < type.sizeInComponents; i++)
6767 {
6868 dst.move(i, Floor(src.Float(i)));
@@ -71,7 +71,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
7171 }
7272 case GLSLstd450Trunc:
7373 {
74- auto src = GenericValue(this, state, insn.word(5));
74+ auto src = Operand(this, state, insn.word(5));
7575 for(auto i = 0u; i < type.sizeInComponents; i++)
7676 {
7777 dst.move(i, Trunc(src.Float(i)));
@@ -80,7 +80,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
8080 }
8181 case GLSLstd450Ceil:
8282 {
83- auto src = GenericValue(this, state, insn.word(5));
83+ auto src = Operand(this, state, insn.word(5));
8484 for(auto i = 0u; i < type.sizeInComponents; i++)
8585 {
8686 dst.move(i, Ceil(src.Float(i)));
@@ -89,7 +89,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
8989 }
9090 case GLSLstd450Fract:
9191 {
92- auto src = GenericValue(this, state, insn.word(5));
92+ auto src = Operand(this, state, insn.word(5));
9393 for(auto i = 0u; i < type.sizeInComponents; i++)
9494 {
9595 dst.move(i, Frac(src.Float(i)));
@@ -98,7 +98,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
9898 }
9999 case GLSLstd450Round:
100100 {
101- auto src = GenericValue(this, state, insn.word(5));
101+ auto src = Operand(this, state, insn.word(5));
102102 for(auto i = 0u; i < type.sizeInComponents; i++)
103103 {
104104 dst.move(i, Round(src.Float(i)));
@@ -107,7 +107,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
107107 }
108108 case GLSLstd450RoundEven:
109109 {
110- auto src = GenericValue(this, state, insn.word(5));
110+ auto src = Operand(this, state, insn.word(5));
111111 for(auto i = 0u; i < type.sizeInComponents; i++)
112112 {
113113 auto x = Round(src.Float(i));
@@ -119,8 +119,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
119119 }
120120 case GLSLstd450FMin:
121121 {
122- auto lhs = GenericValue(this, state, insn.word(5));
123- auto rhs = GenericValue(this, state, insn.word(6));
122+ auto lhs = Operand(this, state, insn.word(5));
123+ auto rhs = Operand(this, state, insn.word(6));
124124 for(auto i = 0u; i < type.sizeInComponents; i++)
125125 {
126126 dst.move(i, Min(lhs.Float(i), rhs.Float(i)));
@@ -129,8 +129,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
129129 }
130130 case GLSLstd450FMax:
131131 {
132- auto lhs = GenericValue(this, state, insn.word(5));
133- auto rhs = GenericValue(this, state, insn.word(6));
132+ auto lhs = Operand(this, state, insn.word(5));
133+ auto rhs = Operand(this, state, insn.word(6));
134134 for(auto i = 0u; i < type.sizeInComponents; i++)
135135 {
136136 dst.move(i, Max(lhs.Float(i), rhs.Float(i)));
@@ -139,8 +139,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
139139 }
140140 case GLSLstd450SMin:
141141 {
142- auto lhs = GenericValue(this, state, insn.word(5));
143- auto rhs = GenericValue(this, state, insn.word(6));
142+ auto lhs = Operand(this, state, insn.word(5));
143+ auto rhs = Operand(this, state, insn.word(6));
144144 for(auto i = 0u; i < type.sizeInComponents; i++)
145145 {
146146 dst.move(i, Min(lhs.Int(i), rhs.Int(i)));
@@ -149,8 +149,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
149149 }
150150 case GLSLstd450SMax:
151151 {
152- auto lhs = GenericValue(this, state, insn.word(5));
153- auto rhs = GenericValue(this, state, insn.word(6));
152+ auto lhs = Operand(this, state, insn.word(5));
153+ auto rhs = Operand(this, state, insn.word(6));
154154 for(auto i = 0u; i < type.sizeInComponents; i++)
155155 {
156156 dst.move(i, Max(lhs.Int(i), rhs.Int(i)));
@@ -159,8 +159,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
159159 }
160160 case GLSLstd450UMin:
161161 {
162- auto lhs = GenericValue(this, state, insn.word(5));
163- auto rhs = GenericValue(this, state, insn.word(6));
162+ auto lhs = Operand(this, state, insn.word(5));
163+ auto rhs = Operand(this, state, insn.word(6));
164164 for(auto i = 0u; i < type.sizeInComponents; i++)
165165 {
166166 dst.move(i, Min(lhs.UInt(i), rhs.UInt(i)));
@@ -169,8 +169,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
169169 }
170170 case GLSLstd450UMax:
171171 {
172- auto lhs = GenericValue(this, state, insn.word(5));
173- auto rhs = GenericValue(this, state, insn.word(6));
172+ auto lhs = Operand(this, state, insn.word(5));
173+ auto rhs = Operand(this, state, insn.word(6));
174174 for(auto i = 0u; i < type.sizeInComponents; i++)
175175 {
176176 dst.move(i, Max(lhs.UInt(i), rhs.UInt(i)));
@@ -179,8 +179,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
179179 }
180180 case GLSLstd450Step:
181181 {
182- auto edge = GenericValue(this, state, insn.word(5));
183- auto x = GenericValue(this, state, insn.word(6));
182+ auto edge = Operand(this, state, insn.word(5));
183+ auto x = Operand(this, state, insn.word(6));
184184 for(auto i = 0u; i < type.sizeInComponents; i++)
185185 {
186186 dst.move(i, CmpNLT(x.Float(i), edge.Float(i)) & As<SIMD::Int>(SIMD::Float(1.0f)));
@@ -189,9 +189,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
189189 }
190190 case GLSLstd450SmoothStep:
191191 {
192- auto edge0 = GenericValue(this, state, insn.word(5));
193- auto edge1 = GenericValue(this, state, insn.word(6));
194- auto x = GenericValue(this, state, insn.word(7));
192+ auto edge0 = Operand(this, state, insn.word(5));
193+ auto edge1 = Operand(this, state, insn.word(6));
194+ auto x = Operand(this, state, insn.word(7));
195195 for(auto i = 0u; i < type.sizeInComponents; i++)
196196 {
197197 auto tx = Min(Max((x.Float(i) - edge0.Float(i)) /
@@ -204,9 +204,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
204204 }
205205 case GLSLstd450FMix:
206206 {
207- auto x = GenericValue(this, state, insn.word(5));
208- auto y = GenericValue(this, state, insn.word(6));
209- auto a = GenericValue(this, state, insn.word(7));
207+ auto x = Operand(this, state, insn.word(5));
208+ auto y = Operand(this, state, insn.word(6));
209+ auto a = Operand(this, state, insn.word(7));
210210 for(auto i = 0u; i < type.sizeInComponents; i++)
211211 {
212212 dst.move(i, a.Float(i) * (y.Float(i) - x.Float(i)) + x.Float(i));
@@ -215,9 +215,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
215215 }
216216 case GLSLstd450FClamp:
217217 {
218- auto x = GenericValue(this, state, insn.word(5));
219- auto minVal = GenericValue(this, state, insn.word(6));
220- auto maxVal = GenericValue(this, state, insn.word(7));
218+ auto x = Operand(this, state, insn.word(5));
219+ auto minVal = Operand(this, state, insn.word(6));
220+ auto maxVal = Operand(this, state, insn.word(7));
221221 for(auto i = 0u; i < type.sizeInComponents; i++)
222222 {
223223 dst.move(i, Min(Max(x.Float(i), minVal.Float(i)), maxVal.Float(i)));
@@ -226,9 +226,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
226226 }
227227 case GLSLstd450SClamp:
228228 {
229- auto x = GenericValue(this, state, insn.word(5));
230- auto minVal = GenericValue(this, state, insn.word(6));
231- auto maxVal = GenericValue(this, state, insn.word(7));
229+ auto x = Operand(this, state, insn.word(5));
230+ auto minVal = Operand(this, state, insn.word(6));
231+ auto maxVal = Operand(this, state, insn.word(7));
232232 for(auto i = 0u; i < type.sizeInComponents; i++)
233233 {
234234 dst.move(i, Min(Max(x.Int(i), minVal.Int(i)), maxVal.Int(i)));
@@ -237,9 +237,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
237237 }
238238 case GLSLstd450UClamp:
239239 {
240- auto x = GenericValue(this, state, insn.word(5));
241- auto minVal = GenericValue(this, state, insn.word(6));
242- auto maxVal = GenericValue(this, state, insn.word(7));
240+ auto x = Operand(this, state, insn.word(5));
241+ auto minVal = Operand(this, state, insn.word(6));
242+ auto maxVal = Operand(this, state, insn.word(7));
243243 for(auto i = 0u; i < type.sizeInComponents; i++)
244244 {
245245 dst.move(i, Min(Max(x.UInt(i), minVal.UInt(i)), maxVal.UInt(i)));
@@ -248,7 +248,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
248248 }
249249 case GLSLstd450FSign:
250250 {
251- auto src = GenericValue(this, state, insn.word(5));
251+ auto src = Operand(this, state, insn.word(5));
252252 for(auto i = 0u; i < type.sizeInComponents; i++)
253253 {
254254 auto neg = As<SIMD::Int>(CmpLT(src.Float(i), SIMD::Float(-0.0f))) & As<SIMD::Int>(SIMD::Float(-1.0f));
@@ -259,7 +259,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
259259 }
260260 case GLSLstd450SSign:
261261 {
262- auto src = GenericValue(this, state, insn.word(5));
262+ auto src = Operand(this, state, insn.word(5));
263263 for(auto i = 0u; i < type.sizeInComponents; i++)
264264 {
265265 auto neg = CmpLT(src.Int(i), SIMD::Int(0)) & SIMD::Int(-1);
@@ -270,8 +270,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
270270 }
271271 case GLSLstd450Reflect:
272272 {
273- auto I = GenericValue(this, state, insn.word(5));
274- auto N = GenericValue(this, state, insn.word(6));
273+ auto I = Operand(this, state, insn.word(5));
274+ auto N = Operand(this, state, insn.word(6));
275275
276276 SIMD::Float d = Dot(type.sizeInComponents, I, N);
277277
@@ -283,9 +283,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
283283 }
284284 case GLSLstd450Refract:
285285 {
286- auto I = GenericValue(this, state, insn.word(5));
287- auto N = GenericValue(this, state, insn.word(6));
288- auto eta = GenericValue(this, state, insn.word(7));
286+ auto I = Operand(this, state, insn.word(5));
287+ auto N = Operand(this, state, insn.word(6));
288+ auto eta = Operand(this, state, insn.word(7));
289289
290290 SIMD::Float d = Dot(type.sizeInComponents, I, N);
291291 SIMD::Float k = SIMD::Float(1.0f) - eta.Float(0) * eta.Float(0) * (SIMD::Float(1.0f) - d * d);
@@ -300,9 +300,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
300300 }
301301 case GLSLstd450FaceForward:
302302 {
303- auto N = GenericValue(this, state, insn.word(5));
304- auto I = GenericValue(this, state, insn.word(6));
305- auto Nref = GenericValue(this, state, insn.word(7));
303+ auto N = Operand(this, state, insn.word(5));
304+ auto I = Operand(this, state, insn.word(6));
305+ auto Nref = Operand(this, state, insn.word(7));
306306
307307 SIMD::Float d = Dot(type.sizeInComponents, I, Nref);
308308 SIMD::Int neg = CmpLT(d, SIMD::Float(0.0f));
@@ -316,7 +316,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
316316 }
317317 case GLSLstd450Length:
318318 {
319- auto x = GenericValue(this, state, insn.word(5));
319+ auto x = Operand(this, state, insn.word(5));
320320 SIMD::Float d = Dot(getType(getObject(insn.word(5)).type).sizeInComponents, x, x);
321321
322322 dst.move(0, Sqrt(d));
@@ -324,7 +324,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
324324 }
325325 case GLSLstd450Normalize:
326326 {
327- auto x = GenericValue(this, state, insn.word(5));
327+ auto x = Operand(this, state, insn.word(5));
328328 SIMD::Float d = Dot(getType(getObject(insn.word(5)).type).sizeInComponents, x, x);
329329 SIMD::Float invLength = SIMD::Float(1.0f) / Sqrt(d);
330330
@@ -336,8 +336,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
336336 }
337337 case GLSLstd450Distance:
338338 {
339- auto p0 = GenericValue(this, state, insn.word(5));
340- auto p1 = GenericValue(this, state, insn.word(6));
339+ auto p0 = Operand(this, state, insn.word(5));
340+ auto p1 = Operand(this, state, insn.word(6));
341341 auto p0Type = getType(p0.type);
342342
343343 // sqrt(dot(p0-p1, p0-p1))
@@ -353,7 +353,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
353353 }
354354 case GLSLstd450Modf:
355355 {
356- auto val = GenericValue(this, state, insn.word(5));
356+ auto val = Operand(this, state, insn.word(5));
357357 auto ptrId = Object::ID(insn.word(6));
358358 auto ptrTy = getType(getObject(ptrId).type);
359359 auto ptr = GetPointerToData(ptrId, 0, state);
@@ -377,7 +377,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
377377 }
378378 case GLSLstd450ModfStruct:
379379 {
380- auto val = GenericValue(this, state, insn.word(5));
380+ auto val = Operand(this, state, insn.word(5));
381381 auto valTy = getType(val.type);
382382
383383 for(auto i = 0u; i < valTy.sizeInComponents; i++)
@@ -391,7 +391,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
391391 }
392392 case GLSLstd450PackSnorm4x8:
393393 {
394- auto val = GenericValue(this, state, insn.word(5));
394+ auto val = Operand(this, state, insn.word(5));
395395 dst.move(0, (SIMD::Int(Round(Min(Max(val.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
396396 SIMD::Int(0xFF)) |
397397 ((SIMD::Int(Round(Min(Max(val.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(127.0f))) &
@@ -407,7 +407,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
407407 }
408408 case GLSLstd450PackUnorm4x8:
409409 {
410- auto val = GenericValue(this, state, insn.word(5));
410+ auto val = Operand(this, state, insn.word(5));
411411 dst.move(0, (SIMD::UInt(Round(Min(Max(val.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) |
412412 ((SIMD::UInt(Round(Min(Max(val.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 8) |
413413 ((SIMD::UInt(Round(Min(Max(val.Float(2), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(255.0f)))) << 16) |
@@ -416,7 +416,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
416416 }
417417 case GLSLstd450PackSnorm2x16:
418418 {
419- auto val = GenericValue(this, state, insn.word(5));
419+ auto val = Operand(this, state, insn.word(5));
420420 dst.move(0, (SIMD::Int(Round(Min(Max(val.Float(0), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(32767.0f))) &
421421 SIMD::Int(0xFFFF)) |
422422 ((SIMD::Int(Round(Min(Max(val.Float(1), SIMD::Float(-1.0f)), SIMD::Float(1.0f)) * SIMD::Float(32767.0f))) &
@@ -426,7 +426,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
426426 }
427427 case GLSLstd450PackUnorm2x16:
428428 {
429- auto val = GenericValue(this, state, insn.word(5));
429+ auto val = Operand(this, state, insn.word(5));
430430 dst.move(0, (SIMD::UInt(Round(Min(Max(val.Float(0), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(65535.0f))) &
431431 SIMD::UInt(0xFFFF)) |
432432 ((SIMD::UInt(Round(Min(Max(val.Float(1), SIMD::Float(0.0f)), SIMD::Float(1.0f)) * SIMD::Float(65535.0f))) &
@@ -436,13 +436,13 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
436436 }
437437 case GLSLstd450PackHalf2x16:
438438 {
439- auto val = GenericValue(this, state, insn.word(5));
439+ auto val = Operand(this, state, insn.word(5));
440440 dst.move(0, floatToHalfBits(val.UInt(0), false) | floatToHalfBits(val.UInt(1), true));
441441 break;
442442 }
443443 case GLSLstd450UnpackSnorm4x8:
444444 {
445- auto val = GenericValue(this, state, insn.word(5));
445+ auto val = Operand(this, state, insn.word(5));
446446 dst.move(0, Min(Max(SIMD::Float(((val.Int(0) << 24) & SIMD::Int(0xFF000000))) * SIMD::Float(1.0f / float(0x7f000000)), SIMD::Float(-1.0f)), SIMD::Float(1.0f)));
447447 dst.move(1, Min(Max(SIMD::Float(((val.Int(0) << 16) & SIMD::Int(0xFF000000))) * SIMD::Float(1.0f / float(0x7f000000)), SIMD::Float(-1.0f)), SIMD::Float(1.0f)));
448448 dst.move(2, Min(Max(SIMD::Float(((val.Int(0) << 8) & SIMD::Int(0xFF000000))) * SIMD::Float(1.0f / float(0x7f000000)), SIMD::Float(-1.0f)), SIMD::Float(1.0f)));
@@ -451,7 +451,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
451451 }
452452 case GLSLstd450UnpackUnorm4x8:
453453 {
454- auto val = GenericValue(this, state, insn.word(5));
454+ auto val = Operand(this, state, insn.word(5));
455455 dst.move(0, SIMD::Float((val.UInt(0) & SIMD::UInt(0xFF))) * SIMD::Float(1.0f / 255.f));
456456 dst.move(1, SIMD::Float(((val.UInt(0) >> 8) & SIMD::UInt(0xFF))) * SIMD::Float(1.0f / 255.f));
457457 dst.move(2, SIMD::Float(((val.UInt(0) >> 16) & SIMD::UInt(0xFF))) * SIMD::Float(1.0f / 255.f));
@@ -460,7 +460,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
460460 }
461461 case GLSLstd450UnpackSnorm2x16:
462462 {
463- auto val = GenericValue(this, state, insn.word(5));
463+ auto val = Operand(this, state, insn.word(5));
464464 // clamp(f / 32767.0, -1.0, 1.0)
465465 dst.move(0, Min(Max(SIMD::Float(As<SIMD::Int>((val.UInt(0) & SIMD::UInt(0x0000FFFF)) << 16)) *
466466 SIMD::Float(1.0f / float(0x7FFF0000)),
@@ -473,7 +473,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
473473 }
474474 case GLSLstd450UnpackUnorm2x16:
475475 {
476- auto val = GenericValue(this, state, insn.word(5));
476+ auto val = Operand(this, state, insn.word(5));
477477 // f / 65535.0
478478 dst.move(0, SIMD::Float((val.UInt(0) & SIMD::UInt(0x0000FFFF)) << 16) * SIMD::Float(1.0f / float(0xFFFF0000)));
479479 dst.move(1, SIMD::Float(val.UInt(0) & SIMD::UInt(0xFFFF0000)) * SIMD::Float(1.0f / float(0xFFFF0000)));
@@ -481,16 +481,16 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
481481 }
482482 case GLSLstd450UnpackHalf2x16:
483483 {
484- auto val = GenericValue(this, state, insn.word(5));
484+ auto val = Operand(this, state, insn.word(5));
485485 dst.move(0, halfToFloatBits(val.UInt(0) & SIMD::UInt(0x0000FFFF)));
486486 dst.move(1, halfToFloatBits((val.UInt(0) & SIMD::UInt(0xFFFF0000)) >> 16));
487487 break;
488488 }
489489 case GLSLstd450Fma:
490490 {
491- auto a = GenericValue(this, state, insn.word(5));
492- auto b = GenericValue(this, state, insn.word(6));
493- auto c = GenericValue(this, state, insn.word(7));
491+ auto a = Operand(this, state, insn.word(5));
492+ auto b = Operand(this, state, insn.word(6));
493+ auto c = Operand(this, state, insn.word(7));
494494 for(auto i = 0u; i < type.sizeInComponents; i++)
495495 {
496496 dst.move(i, FMA(a.Float(i), b.Float(i), c.Float(i)));
@@ -499,7 +499,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
499499 }
500500 case GLSLstd450Frexp:
501501 {
502- auto val = GenericValue(this, state, insn.word(5));
502+ auto val = Operand(this, state, insn.word(5));
503503 auto ptrId = Object::ID(insn.word(6));
504504 auto ptrTy = getType(getObject(ptrId).type);
505505 auto ptr = GetPointerToData(ptrId, 0, state);
@@ -526,7 +526,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
526526 }
527527 case GLSLstd450FrexpStruct:
528528 {
529- auto val = GenericValue(this, state, insn.word(5));
529+ auto val = Operand(this, state, insn.word(5));
530530 auto numComponents = getType(val.type).sizeInComponents;
531531 for(auto i = 0u; i < numComponents; i++)
532532 {
@@ -538,8 +538,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
538538 }
539539 case GLSLstd450Ldexp:
540540 {
541- auto significand = GenericValue(this, state, insn.word(5));
542- auto exponent = GenericValue(this, state, insn.word(6));
541+ auto significand = Operand(this, state, insn.word(5));
542+ auto exponent = Operand(this, state, insn.word(6));
543543 for(auto i = 0u; i < type.sizeInComponents; i++)
544544 {
545545 // Assumes IEEE 754
@@ -572,7 +572,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
572572 }
573573 case GLSLstd450Radians:
574574 {
575- auto degrees = GenericValue(this, state, insn.word(5));
575+ auto degrees = Operand(this, state, insn.word(5));
576576 for(auto i = 0u; i < type.sizeInComponents; i++)
577577 {
578578 dst.move(i, degrees.Float(i) * SIMD::Float(PI / 180.0f));
@@ -581,7 +581,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
581581 }
582582 case GLSLstd450Degrees:
583583 {
584- auto radians = GenericValue(this, state, insn.word(5));
584+ auto radians = Operand(this, state, insn.word(5));
585585 for(auto i = 0u; i < type.sizeInComponents; i++)
586586 {
587587 dst.move(i, radians.Float(i) * SIMD::Float(180.0f / PI));
@@ -590,7 +590,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
590590 }
591591 case GLSLstd450Sin:
592592 {
593- auto radians = GenericValue(this, state, insn.word(5));
593+ auto radians = Operand(this, state, insn.word(5));
594594 for(auto i = 0u; i < type.sizeInComponents; i++)
595595 {
596596 dst.move(i, Sin(radians.Float(i)));
@@ -599,7 +599,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
599599 }
600600 case GLSLstd450Cos:
601601 {
602- auto radians = GenericValue(this, state, insn.word(5));
602+ auto radians = Operand(this, state, insn.word(5));
603603 for(auto i = 0u; i < type.sizeInComponents; i++)
604604 {
605605 dst.move(i, Cos(radians.Float(i)));
@@ -608,7 +608,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
608608 }
609609 case GLSLstd450Tan:
610610 {
611- auto radians = GenericValue(this, state, insn.word(5));
611+ auto radians = Operand(this, state, insn.word(5));
612612 for(auto i = 0u; i < type.sizeInComponents; i++)
613613 {
614614 dst.move(i, Tan(radians.Float(i)));
@@ -617,7 +617,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
617617 }
618618 case GLSLstd450Asin:
619619 {
620- auto val = GenericValue(this, state, insn.word(5));
620+ auto val = Operand(this, state, insn.word(5));
621621 for(auto i = 0u; i < type.sizeInComponents; i++)
622622 {
623623 dst.move(i, Asin(val.Float(i)));
@@ -626,7 +626,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
626626 }
627627 case GLSLstd450Acos:
628628 {
629- auto val = GenericValue(this, state, insn.word(5));
629+ auto val = Operand(this, state, insn.word(5));
630630 for(auto i = 0u; i < type.sizeInComponents; i++)
631631 {
632632 dst.move(i, Acos(val.Float(i)));
@@ -635,7 +635,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
635635 }
636636 case GLSLstd450Atan:
637637 {
638- auto val = GenericValue(this, state, insn.word(5));
638+ auto val = Operand(this, state, insn.word(5));
639639 for(auto i = 0u; i < type.sizeInComponents; i++)
640640 {
641641 dst.move(i, Atan(val.Float(i)));
@@ -644,7 +644,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
644644 }
645645 case GLSLstd450Sinh:
646646 {
647- auto val = GenericValue(this, state, insn.word(5));
647+ auto val = Operand(this, state, insn.word(5));
648648 for(auto i = 0u; i < type.sizeInComponents; i++)
649649 {
650650 dst.move(i, Sinh(val.Float(i)));
@@ -653,7 +653,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
653653 }
654654 case GLSLstd450Cosh:
655655 {
656- auto val = GenericValue(this, state, insn.word(5));
656+ auto val = Operand(this, state, insn.word(5));
657657 for(auto i = 0u; i < type.sizeInComponents; i++)
658658 {
659659 dst.move(i, Cosh(val.Float(i)));
@@ -662,7 +662,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
662662 }
663663 case GLSLstd450Tanh:
664664 {
665- auto val = GenericValue(this, state, insn.word(5));
665+ auto val = Operand(this, state, insn.word(5));
666666 for(auto i = 0u; i < type.sizeInComponents; i++)
667667 {
668668 dst.move(i, Tanh(val.Float(i)));
@@ -671,7 +671,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
671671 }
672672 case GLSLstd450Asinh:
673673 {
674- auto val = GenericValue(this, state, insn.word(5));
674+ auto val = Operand(this, state, insn.word(5));
675675 for(auto i = 0u; i < type.sizeInComponents; i++)
676676 {
677677 dst.move(i, Asinh(val.Float(i)));
@@ -680,7 +680,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
680680 }
681681 case GLSLstd450Acosh:
682682 {
683- auto val = GenericValue(this, state, insn.word(5));
683+ auto val = Operand(this, state, insn.word(5));
684684 for(auto i = 0u; i < type.sizeInComponents; i++)
685685 {
686686 dst.move(i, Acosh(val.Float(i)));
@@ -689,7 +689,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
689689 }
690690 case GLSLstd450Atanh:
691691 {
692- auto val = GenericValue(this, state, insn.word(5));
692+ auto val = Operand(this, state, insn.word(5));
693693 for(auto i = 0u; i < type.sizeInComponents; i++)
694694 {
695695 dst.move(i, Atanh(val.Float(i)));
@@ -698,8 +698,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
698698 }
699699 case GLSLstd450Atan2:
700700 {
701- auto x = GenericValue(this, state, insn.word(5));
702- auto y = GenericValue(this, state, insn.word(6));
701+ auto x = Operand(this, state, insn.word(5));
702+ auto y = Operand(this, state, insn.word(6));
703703 for(auto i = 0u; i < type.sizeInComponents; i++)
704704 {
705705 dst.move(i, Atan2(x.Float(i), y.Float(i)));
@@ -708,8 +708,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
708708 }
709709 case GLSLstd450Pow:
710710 {
711- auto x = GenericValue(this, state, insn.word(5));
712- auto y = GenericValue(this, state, insn.word(6));
711+ auto x = Operand(this, state, insn.word(5));
712+ auto y = Operand(this, state, insn.word(6));
713713 for(auto i = 0u; i < type.sizeInComponents; i++)
714714 {
715715 dst.move(i, Pow(x.Float(i), y.Float(i)));
@@ -718,7 +718,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
718718 }
719719 case GLSLstd450Exp:
720720 {
721- auto val = GenericValue(this, state, insn.word(5));
721+ auto val = Operand(this, state, insn.word(5));
722722 for(auto i = 0u; i < type.sizeInComponents; i++)
723723 {
724724 dst.move(i, Exp(val.Float(i)));
@@ -727,7 +727,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
727727 }
728728 case GLSLstd450Log:
729729 {
730- auto val = GenericValue(this, state, insn.word(5));
730+ auto val = Operand(this, state, insn.word(5));
731731 for(auto i = 0u; i < type.sizeInComponents; i++)
732732 {
733733 dst.move(i, Log(val.Float(i)));
@@ -736,7 +736,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
736736 }
737737 case GLSLstd450Exp2:
738738 {
739- auto val = GenericValue(this, state, insn.word(5));
739+ auto val = Operand(this, state, insn.word(5));
740740 for(auto i = 0u; i < type.sizeInComponents; i++)
741741 {
742742 dst.move(i, Exp2(val.Float(i)));
@@ -745,7 +745,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
745745 }
746746 case GLSLstd450Log2:
747747 {
748- auto val = GenericValue(this, state, insn.word(5));
748+ auto val = Operand(this, state, insn.word(5));
749749 for(auto i = 0u; i < type.sizeInComponents; i++)
750750 {
751751 dst.move(i, Log2(val.Float(i)));
@@ -754,7 +754,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
754754 }
755755 case GLSLstd450Sqrt:
756756 {
757- auto val = GenericValue(this, state, insn.word(5));
757+ auto val = Operand(this, state, insn.word(5));
758758 for(auto i = 0u; i < type.sizeInComponents; i++)
759759 {
760760 dst.move(i, Sqrt(val.Float(i)));
@@ -763,7 +763,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
763763 }
764764 case GLSLstd450InverseSqrt:
765765 {
766- auto val = GenericValue(this, state, insn.word(5));
766+ auto val = Operand(this, state, insn.word(5));
767767 Decorations d;
768768 ApplyDecorationsForId(&d, insn.word(5));
769769 if(d.RelaxedPrecision)
@@ -784,7 +784,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
784784 }
785785 case GLSLstd450Determinant:
786786 {
787- auto mat = GenericValue(this, state, insn.word(5));
787+ auto mat = Operand(this, state, insn.word(5));
788788 auto numComponents = getType(mat.type).sizeInComponents;
789789 switch(numComponents)
790790 {
@@ -813,7 +813,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
813813 }
814814 case GLSLstd450MatrixInverse:
815815 {
816- auto mat = GenericValue(this, state, insn.word(5));
816+ auto mat = Operand(this, state, insn.word(5));
817817 auto numComponents = getType(mat.type).sizeInComponents;
818818 switch(numComponents)
819819 {
@@ -875,7 +875,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
875875 }
876876 case GLSLstd450FindILsb:
877877 {
878- auto val = GenericValue(this, state, insn.word(5));
878+ auto val = Operand(this, state, insn.word(5));
879879 for(auto i = 0u; i < type.sizeInComponents; i++)
880880 {
881881 auto v = val.UInt(i);
@@ -885,7 +885,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
885885 }
886886 case GLSLstd450FindSMsb:
887887 {
888- auto val = GenericValue(this, state, insn.word(5));
888+ auto val = Operand(this, state, insn.word(5));
889889 for(auto i = 0u; i < type.sizeInComponents; i++)
890890 {
891891 auto v = val.UInt(i) ^ As<SIMD::UInt>(CmpLT(val.Int(i), SIMD::Int(0)));
@@ -895,7 +895,7 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
895895 }
896896 case GLSLstd450FindUMsb:
897897 {
898- auto val = GenericValue(this, state, insn.word(5));
898+ auto val = Operand(this, state, insn.word(5));
899899 for(auto i = 0u; i < type.sizeInComponents; i++)
900900 {
901901 dst.move(i, SIMD::UInt(31) - Ctlz(val.UInt(i), false));
@@ -919,8 +919,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
919919 }
920920 case GLSLstd450NMin:
921921 {
922- auto x = GenericValue(this, state, insn.word(5));
923- auto y = GenericValue(this, state, insn.word(6));
922+ auto x = Operand(this, state, insn.word(5));
923+ auto y = Operand(this, state, insn.word(6));
924924 for(auto i = 0u; i < type.sizeInComponents; i++)
925925 {
926926 dst.move(i, NMin(x.Float(i), y.Float(i)));
@@ -929,8 +929,8 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
929929 }
930930 case GLSLstd450NMax:
931931 {
932- auto x = GenericValue(this, state, insn.word(5));
933- auto y = GenericValue(this, state, insn.word(6));
932+ auto x = Operand(this, state, insn.word(5));
933+ auto y = Operand(this, state, insn.word(6));
934934 for(auto i = 0u; i < type.sizeInComponents; i++)
935935 {
936936 dst.move(i, NMax(x.Float(i), y.Float(i)));
@@ -939,9 +939,9 @@ SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitSt
939939 }
940940 case GLSLstd450NClamp:
941941 {
942- auto x = GenericValue(this, state, insn.word(5));
943- auto minVal = GenericValue(this, state, insn.word(6));
944- auto maxVal = GenericValue(this, state, insn.word(7));
942+ auto x = Operand(this, state, insn.word(5));
943+ auto minVal = Operand(this, state, insn.word(6));
944+ auto maxVal = Operand(this, state, insn.word(7));
945945 for(auto i = 0u; i < type.sizeInComponents; i++)
946946 {
947947 auto clamp = NMin(NMax(x.Float(i), minVal.Float(i)), maxVal.Float(i));
--- a/src/Pipeline/SpirvShaderGroup.cpp
+++ b/src/Pipeline/SpirvShaderGroup.cpp
@@ -34,7 +34,7 @@ struct SpirvShader::Impl::Group
3434 const I identityValue,
3535 APPLY &&apply)
3636 {
37- SpirvShader::GenericValue value(shader, state, insn.word(5));
37+ SpirvShader::Operand value(shader, state, insn.word(5));
3838 auto &type = shader->getType(SpirvShader::Type::ID(insn.word(1)));
3939 for(auto i = 0u; i < type.sizeInComponents; i++)
4040 {
@@ -104,21 +104,21 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
104104
105105 case spv::OpGroupNonUniformAll:
106106 {
107- GenericValue predicate(this, state, insn.word(4));
107+ Operand predicate(this, state, insn.word(4));
108108 dst.move(0, AndAll(predicate.UInt(0) | ~As<SIMD::UInt>(state->activeLaneMask())));
109109 break;
110110 }
111111
112112 case spv::OpGroupNonUniformAny:
113113 {
114- GenericValue predicate(this, state, insn.word(4));
114+ Operand predicate(this, state, insn.word(4));
115115 dst.move(0, OrAll(predicate.UInt(0) & As<SIMD::UInt>(state->activeLaneMask())));
116116 break;
117117 }
118118
119119 case spv::OpGroupNonUniformAllEqual:
120120 {
121- GenericValue value(this, state, insn.word(4));
121+ Operand value(this, state, insn.word(4));
122122 auto res = SIMD::UInt(0xffffffff);
123123 SIMD::UInt active = As<SIMD::UInt>(state->activeLaneMask());
124124 SIMD::UInt inactive = ~active;
@@ -140,7 +140,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
140140 {
141141 auto valueId = Object::ID(insn.word(4));
142142 auto id = SIMD::Int(GetConstScalarInt(insn.word(5)));
143- GenericValue value(this, state, valueId);
143+ Operand value(this, state, valueId);
144144 auto mask = CmpEQ(id, SIMD::Int(0, 1, 2, 3));
145145 for(auto i = 0u; i < type.sizeInComponents; i++)
146146 {
@@ -152,7 +152,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
152152 case spv::OpGroupNonUniformBroadcastFirst:
153153 {
154154 auto valueId = Object::ID(insn.word(4));
155- GenericValue value(this, state, valueId);
155+ Operand value(this, state, valueId);
156156 // Result is true only in the active invocation with the lowest id
157157 // in the group, otherwise result is false.
158158 SIMD::Int active = state->activeLaneMask();
@@ -170,7 +170,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
170170 case spv::OpGroupNonUniformBallot:
171171 {
172172 ASSERT(type.sizeInComponents == 4);
173- GenericValue predicate(this, state, insn.word(4));
173+ Operand predicate(this, state, insn.word(4));
174174 dst.move(0, SIMD::Int(SignMask(state->activeLaneMask() & predicate.Int(0))));
175175 dst.move(1, SIMD::Int(0));
176176 dst.move(2, SIMD::Int(0));
@@ -183,7 +183,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
183183 auto valueId = Object::ID(insn.word(4));
184184 ASSERT(type.sizeInComponents == 1);
185185 ASSERT(getType(getObject(valueId).type).sizeInComponents == 4);
186- GenericValue value(this, state, valueId);
186+ Operand value(this, state, valueId);
187187 auto bit = (value.Int(0) >> SIMD::Int(0, 1, 2, 3)) & SIMD::Int(1);
188188 dst.move(0, -bit);
189189 break;
@@ -196,8 +196,8 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
196196 ASSERT(type.sizeInComponents == 1);
197197 ASSERT(getType(getObject(valueId).type).sizeInComponents == 4);
198198 ASSERT(getType(getObject(indexId).type).sizeInComponents == 1);
199- GenericValue value(this, state, valueId);
200- GenericValue index(this, state, indexId);
199+ Operand value(this, state, valueId);
200+ Operand index(this, state, indexId);
201201 auto vecIdx = index.Int(0) / SIMD::Int(32);
202202 auto bitIdx = index.Int(0) & SIMD::Int(31);
203203 auto bits = (value.Int(0) & CmpEQ(vecIdx, SIMD::Int(0))) |
@@ -214,7 +214,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
214214 auto valueId = Object::ID(insn.word(5));
215215 ASSERT(type.sizeInComponents == 1);
216216 ASSERT(getType(getObject(valueId).type).sizeInComponents == 4);
217- GenericValue value(this, state, valueId);
217+ Operand value(this, state, valueId);
218218 switch(operation)
219219 {
220220 case spv::GroupOperationReduce:
@@ -237,7 +237,7 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
237237 auto valueId = Object::ID(insn.word(4));
238238 ASSERT(type.sizeInComponents == 1);
239239 ASSERT(getType(getObject(valueId).type).sizeInComponents == 4);
240- GenericValue value(this, state, valueId);
240+ Operand value(this, state, valueId);
241241 dst.move(0, Cttz(value.UInt(0) & SIMD::UInt(15), true));
242242 break;
243243 }
@@ -247,15 +247,15 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
247247 auto valueId = Object::ID(insn.word(4));
248248 ASSERT(type.sizeInComponents == 1);
249249 ASSERT(getType(getObject(valueId).type).sizeInComponents == 4);
250- GenericValue value(this, state, valueId);
250+ Operand value(this, state, valueId);
251251 dst.move(0, SIMD::UInt(31) - Ctlz(value.UInt(0) & SIMD::UInt(15), false));
252252 break;
253253 }
254254
255255 case spv::OpGroupNonUniformShuffle:
256256 {
257- GenericValue value(this, state, insn.word(4));
258- GenericValue id(this, state, insn.word(5));
257+ Operand value(this, state, insn.word(4));
258+ Operand id(this, state, insn.word(5));
259259 auto x = CmpEQ(SIMD::Int(0), id.Int(0));
260260 auto y = CmpEQ(SIMD::Int(1), id.Int(0));
261261 auto z = CmpEQ(SIMD::Int(2), id.Int(0));
@@ -270,8 +270,8 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
270270
271271 case spv::OpGroupNonUniformShuffleXor:
272272 {
273- GenericValue value(this, state, insn.word(4));
274- GenericValue mask(this, state, insn.word(5));
273+ Operand value(this, state, insn.word(4));
274+ Operand mask(this, state, insn.word(5));
275275 auto x = CmpEQ(SIMD::Int(0), SIMD::Int(0, 1, 2, 3) ^ mask.Int(0));
276276 auto y = CmpEQ(SIMD::Int(1), SIMD::Int(0, 1, 2, 3) ^ mask.Int(0));
277277 auto z = CmpEQ(SIMD::Int(2), SIMD::Int(0, 1, 2, 3) ^ mask.Int(0));
@@ -286,8 +286,8 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
286286
287287 case spv::OpGroupNonUniformShuffleUp:
288288 {
289- GenericValue value(this, state, insn.word(4));
290- GenericValue delta(this, state, insn.word(5));
289+ Operand value(this, state, insn.word(4));
290+ Operand delta(this, state, insn.word(5));
291291 auto d0 = CmpEQ(SIMD::Int(0), delta.Int(0));
292292 auto d1 = CmpEQ(SIMD::Int(1), delta.Int(0));
293293 auto d2 = CmpEQ(SIMD::Int(2), delta.Int(0));
@@ -302,8 +302,8 @@ SpirvShader::EmitResult SpirvShader::EmitGroupNonUniform(InsnIterator insn, Emit
302302
303303 case spv::OpGroupNonUniformShuffleDown:
304304 {
305- GenericValue value(this, state, insn.word(4));
306- GenericValue delta(this, state, insn.word(5));
305+ Operand value(this, state, insn.word(4));
306+ Operand delta(this, state, insn.word(5));
307307 auto d0 = CmpEQ(SIMD::Int(0), delta.Int(0));
308308 auto d1 = CmpEQ(SIMD::Int(1), delta.Int(0));
309309 auto d2 = CmpEQ(SIMD::Int(2), delta.Int(0));
--- a/src/Pipeline/SpirvShaderImage.cpp
+++ b/src/Pipeline/SpirvShaderImage.cpp
@@ -120,7 +120,7 @@ SpirvShader::EmitResult SpirvShader::EmitImageSample(ImageInstruction instructio
120120 auto &sampledImage = getObject(sampledImageId);
121121 auto samplerDescriptor = (sampledImage.opcode() == spv::OpSampledImage) ? state->getPointer(sampledImage.definition.word(4)).base : imageDescriptor;
122122
123- auto coordinate = GenericValue(this, state, coordinateId);
123+ auto coordinate = Operand(this, state, coordinateId);
124124 auto &coordinateType = getType(coordinate.type);
125125
126126 Pointer<Byte> sampler = samplerDescriptor + OFFSET(vk::SampledImageDescriptor, sampler); // vk::Sampler*
@@ -224,7 +224,7 @@ SpirvShader::EmitResult SpirvShader::EmitImageSample(ImageInstruction instructio
224224
225225 if(instruction.isDref())
226226 {
227- auto drefValue = GenericValue(this, state, insn.word(5));
227+ auto drefValue = Operand(this, state, insn.word(5));
228228
229229 if(instruction.isProj())
230230 {
@@ -240,14 +240,14 @@ SpirvShader::EmitResult SpirvShader::EmitImageSample(ImageInstruction instructio
240240
241241 if(lodOrBias)
242242 {
243- auto lodValue = GenericValue(this, state, lodOrBiasId);
243+ auto lodValue = Operand(this, state, lodOrBiasId);
244244 in[i] = lodValue.Float(0);
245245 i++;
246246 }
247247 else if(grad)
248248 {
249- auto dxValue = GenericValue(this, state, gradDxId);
250- auto dyValue = GenericValue(this, state, gradDyId);
249+ auto dxValue = Operand(this, state, gradDxId);
250+ auto dyValue = Operand(this, state, gradDyId);
251251 auto &dxyType = getType(dxValue.type);
252252 ASSERT(dxyType.sizeInComponents == getType(dyValue.type).sizeInComponents);
253253
@@ -274,7 +274,7 @@ SpirvShader::EmitResult SpirvShader::EmitImageSample(ImageInstruction instructio
274274
275275 if(constOffset)
276276 {
277- auto offsetValue = GenericValue(this, state, offsetId);
277+ auto offsetValue = Operand(this, state, offsetId);
278278 auto &offsetType = getType(offsetValue.type);
279279
280280 instruction.offset = offsetType.sizeInComponents;
@@ -287,7 +287,7 @@ SpirvShader::EmitResult SpirvShader::EmitImageSample(ImageInstruction instructio
287287
288288 if(sample)
289289 {
290- auto sampleValue = GenericValue(this, state, sampleId);
290+ auto sampleValue = Operand(this, state, sampleId);
291291 in[i] = As<SIMD::Float>(sampleValue.Int(0));
292292 }
293293
@@ -386,7 +386,7 @@ void SpirvShader::GetImageDimensions(EmitState const *state, Type const &resultT
386386 std::vector<Int> out;
387387 if(lodId != 0)
388388 {
389- auto lodVal = GenericValue(this, state, lodId);
389+ auto lodVal = Operand(this, state, lodId);
390390 ASSERT(getType(lodVal.type).sizeInComponents == 1);
391391 auto lod = lodVal.Int(0);
392392 auto one = SIMD::Int(1);
@@ -477,7 +477,7 @@ SpirvShader::EmitResult SpirvShader::EmitImageQuerySamples(InsnIterator insn, Em
477477 return EmitResult::Continue;
478478 }
479479
480-SIMD::Pointer SpirvShader::GetTexelAddress(EmitState const *state, SIMD::Pointer ptr, GenericValue const &coordinate, Type const &imageType, Pointer<Byte> descriptor, int texelSize, Object::ID sampleId, bool useStencilAspect) const
480+SIMD::Pointer SpirvShader::GetTexelAddress(EmitState const *state, SIMD::Pointer ptr, Operand const &coordinate, Type const &imageType, Pointer<Byte> descriptor, int texelSize, Object::ID sampleId, bool useStencilAspect) const
481481 {
482482 auto routine = state->routine;
483483 bool isArrayed = imageType.definition.word(5) != 0;
@@ -532,7 +532,7 @@ SIMD::Pointer SpirvShader::GetTexelAddress(EmitState const *state, SIMD::Pointer
532532
533533 if(sampleId.value())
534534 {
535- GenericValue sample(this, state, sampleId);
535+ Operand sample(this, state, sampleId);
536536 ptr += sample.Int(0) * samplePitch;
537537 }
538538
@@ -566,7 +566,7 @@ SpirvShader::EmitResult SpirvShader::EmitImageRead(InsnIterator insn, EmitState
566566 ASSERT(imageType.definition.opcode() == spv::OpTypeImage);
567567 auto dim = static_cast<spv::Dim>(imageType.definition.word(3));
568568
569- auto coordinate = GenericValue(this, state, insn.word(4));
569+ auto coordinate = Operand(this, state, insn.word(4));
570570 const DescriptorDecorations &d = descriptorDecorations.at(imageId);
571571
572572 // For subpass data, format in the instruction is spv::ImageFormatUnknown. Get it from
@@ -855,8 +855,8 @@ SpirvShader::EmitResult SpirvShader::EmitImageWrite(InsnIterator insn, EmitState
855855 // TODO(b/131171141): Not handling any image operands yet.
856856 ASSERT(insn.wordCount() == 4);
857857
858- auto coordinate = GenericValue(this, state, insn.word(2));
859- auto texel = GenericValue(this, state, insn.word(3));
858+ auto coordinate = Operand(this, state, insn.word(2));
859+ auto texel = Operand(this, state, insn.word(3));
860860
861861 Pointer<Byte> binding = state->getPointer(imageId).base;
862862 Pointer<Byte> imageBase = *Pointer<Pointer<Byte>>(binding + OFFSET(vk::StorageImageDescriptor, ptr));
@@ -1007,7 +1007,7 @@ SpirvShader::EmitResult SpirvShader::EmitImageTexelPointer(InsnIterator insn, Em
10071007 ASSERT(resultType.storageClass == spv::StorageClassImage);
10081008 ASSERT(getType(resultType.element).opcode() == spv::OpTypeInt);
10091009
1010- auto coordinate = GenericValue(this, state, insn.word(4));
1010+ auto coordinate = Operand(this, state, insn.word(4));
10111011
10121012 Pointer<Byte> binding = state->getPointer(imageId).base;
10131013 Pointer<Byte> imageBase = *Pointer<Pointer<Byte>>(binding + OFFSET(vk::StorageImageDescriptor, ptr));
--- a/src/Pipeline/SpirvShaderMemory.cpp
+++ b/src/Pipeline/SpirvShaderMemory.cpp
@@ -236,7 +236,7 @@ SpirvShader::EmitResult SpirvShader::EmitVariable(InsnIterator insn, EmitState *
236236 {
237237 bool interleavedByLane = IsStorageInterleavedByLane(objectTy.storageClass);
238238 auto ptr = GetPointerToData(resultId, 0, state);
239- GenericValue initialValue(this, state, initializerId);
239+ Operand initialValue(this, state, initializerId);
240240 VisitMemoryObject(resultId, [&](const MemoryElement &el) {
241241 auto p = ptr + el.offset;
242242 if(interleavedByLane) { p = InterleaveByLane(p); }
Show on old repository browser