Rename size/sizeInComponents to componentCount
Bug: b/129000021
Change-Id: I36401de649eb53474ca74acb069351ce37f7529f
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43828
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/Pipeline/SpirvShader.cpp b/src/Pipeline/SpirvShader.cpp
index c33fe4c..159bc73 100644
--- a/src/Pipeline/SpirvShader.cpp
+++ b/src/Pipeline/SpirvShader.cpp
@@ -264,7 +264,7 @@
case spv::StorageClassWorkgroup:
{
auto &elTy = getType(getType(typeId).element);
- auto sizeInBytes = elTy.sizeInComponents * static_cast<uint32_t>(sizeof(float));
+ auto sizeInBytes = elTy.componentCount * static_cast<uint32_t>(sizeof(float));
workgroupMemory.allocate(resultId, sizeInBytes);
object.kind = Object::Kind::Pointer;
break;
@@ -308,7 +308,7 @@
// OpConstantNull forms a constant of arbitrary type, all zeros.
auto &object = CreateConstant(insn);
auto &objectTy = getType(object);
- for(auto i = 0u; i < objectTy.sizeInComponents; i++)
+ for(auto i = 0u; i < objectTy.componentCount; i++)
{
object.constantValue[i] = 0;
}
@@ -323,7 +323,7 @@
{
auto &constituent = getObject(insn.word(i + 3));
auto &constituentTy = getType(constituent);
- for(auto j = 0u; j < constituentTy.sizeInComponents; j++)
+ for(auto j = 0u; j < constituentTy.componentCount; j++)
{
object.constantValue[offset++] = constituent.constantValue[j];
}
@@ -342,7 +342,7 @@
// any execution mode set for LocalSize.
// The object decorated with WorkgroupSize must be declared
// as a three-component vector of 32-bit integers.
- ASSERT(getType(object).sizeInComponents == 3);
+ ASSERT(getType(object).componentCount == 3);
modes.WorkgroupSizeX = object.constantValue[0];
modes.WorkgroupSizeY = object.constantValue[1];
modes.WorkgroupSizeZ = object.constantValue[2];
@@ -743,7 +743,7 @@
auto &type = types[resultId];
type.definition = insn;
- type.sizeInComponents = ComputeTypeSize(insn);
+ type.componentCount = ComputeTypeSize(insn);
// A structure is a builtin block if it has a builtin
// member. All members of such a structure are builtins.
@@ -795,7 +795,7 @@
auto &objectTy = getType(typeId);
object.kind = Object::Kind::Constant;
object.definition = insn;
- object.constantValue = std::unique_ptr<uint32_t[]>(new uint32_t[objectTy.sizeInComponents]);
+ object.constantValue = std::unique_ptr<uint32_t[]>(new uint32_t[objectTy.componentCount]);
return object;
}
@@ -829,10 +829,10 @@
if(member.HasBuiltIn)
{
- builtinInterface[member.BuiltIn] = { resultId, offset, memberType.sizeInComponents };
+ builtinInterface[member.BuiltIn] = { resultId, offset, memberType.componentCount };
}
- offset += memberType.sizeInComponents;
+ offset += memberType.componentCount;
++memberIndex;
}
@@ -842,7 +842,7 @@
auto d = decorations.find(resultId);
if(d != decorations.end() && d->second.HasBuiltIn)
{
- builtinInterface[d->second.BuiltIn] = { resultId, 0, pointeeTy.sizeInComponents };
+ builtinInterface[d->second.BuiltIn] = { resultId, 0, pointeeTy.componentCount };
}
else
{
@@ -924,13 +924,13 @@
case spv::OpTypeVector:
case spv::OpTypeMatrix:
// Vectors and matrices both consume element count * element size.
- return getType(insn.word(2)).sizeInComponents * insn.word(3);
+ return getType(insn.word(2)).componentCount * insn.word(3);
case spv::OpTypeArray:
{
// Element count * element size. Array sizes come from constant ids.
auto arraySize = GetConstScalarInt(insn.word(3));
- return getType(insn.word(2)).sizeInComponents * arraySize;
+ return getType(insn.word(2)).componentCount * arraySize;
}
case spv::OpTypeStruct:
@@ -938,7 +938,7 @@
uint32_t size = 0;
for(uint32_t i = 2u; i < insn.wordCount(); i++)
{
- size += getType(insn.word(i)).sizeInComponents;
+ size += getType(insn.word(i)).componentCount;
}
return size;
}
@@ -1202,7 +1202,7 @@
for(auto j = 0; j < memberIndex; j++)
{
auto memberType = type.definition.word(2u + j);
- offsetIntoStruct += getType(memberType).sizeInComponents * sizeof(float);
+ offsetIntoStruct += getType(memberType).componentCount * sizeof(float);
}
constantOffset += offsetIntoStruct;
typeId = type.definition.word(2u + memberIndex);
@@ -1233,7 +1233,7 @@
}
else
{
- auto stride = getType(type.element).sizeInComponents * static_cast<uint32_t>(sizeof(float));
+ auto stride = getType(type.element).componentCount * static_cast<uint32_t>(sizeof(float));
auto &obj = getObject(indexIds[i]);
if(obj.kind == Object::Kind::Constant)
{
@@ -1276,7 +1276,7 @@
for(auto j = 0; j < memberIndex; j++)
{
auto memberType = type.definition.word(2u + j);
- offsetIntoStruct += getType(memberType).sizeInComponents;
+ offsetIntoStruct += getType(memberType).componentCount;
}
componentOffset += offsetIntoStruct;
typeId = type.definition.word(2u + memberIndex);
@@ -1288,7 +1288,7 @@
case spv::OpTypeArray:
{
auto elementType = type.definition.word(2);
- auto stride = getType(elementType).sizeInComponents;
+ auto stride = getType(elementType).componentCount;
componentOffset += stride * indexes[i];
typeId = elementType;
break;
@@ -1515,16 +1515,16 @@
auto resultPointerType = getType(insn.resultTypeId());
auto pointeeType = getType(resultPointerType.element);
- if(pointeeType.sizeInComponents > 0) // TODO: what to do about zero-slot objects?
+ if(pointeeType.componentCount > 0) // TODO: what to do about zero-slot objects?
{
- routine->createVariable(insn.resultId(), pointeeType.sizeInComponents);
+ routine->createVariable(insn.resultId(), pointeeType.componentCount);
}
break;
}
case spv::OpPhi:
{
auto type = getType(insn.resultTypeId());
- routine->phis.emplace(insn.resultId(), SpirvRoutine::Variable(type.sizeInComponents));
+ routine->phis.emplace(insn.resultId(), SpirvRoutine::Variable(type.componentCount));
break;
}
@@ -1973,7 +1973,7 @@
uint32_t numIndexes = insn.wordCount() - 4;
const uint32_t *indexes = insn.wordPointer(4);
auto &type = getType(typeId);
- ASSERT(type.sizeInComponents == 1);
+ ASSERT(type.componentCount == 1);
ASSERT(getObject(resultId).kind == Object::Kind::Pointer);
if(type.storageClass == spv::StorageClassPushConstant ||
@@ -1995,7 +1995,7 @@
SpirvShader::EmitResult SpirvShader::EmitCompositeConstruct(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto offset = 0u;
for(auto i = 0u; i < insn.wordCount() - 3; i++)
@@ -2005,7 +2005,7 @@
auto &srcObjectTy = getType(srcObject);
Operand srcObjectAccess(this, state, srcObjectId);
- for(auto j = 0u; j < srcObjectTy.sizeInComponents; j++)
+ for(auto j = 0u; j < srcObjectTy.componentCount; j++)
{
dst.move(offset++, srcObjectAccess.Float(j));
}
@@ -2018,7 +2018,7 @@
{
Type::ID resultTypeId = insn.word(1);
auto &type = getType(resultTypeId);
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto &newPartObject = getObject(insn.word(3));
auto &newPartObjectTy = getType(newPartObject);
auto firstNewComponent = WalkLiteralAccessChain(resultTypeId, insn.wordCount() - 5, insn.wordPointer(5));
@@ -2032,12 +2032,12 @@
dst.move(i, srcObjectAccess.Float(i));
}
// new part
- for(auto i = 0u; i < newPartObjectTy.sizeInComponents; i++)
+ for(auto i = 0u; i < newPartObjectTy.componentCount; i++)
{
dst.move(firstNewComponent + i, newPartObjectAccess.Float(i));
}
// old components after
- for(auto i = firstNewComponent + newPartObjectTy.sizeInComponents; i < type.sizeInComponents; i++)
+ for(auto i = firstNewComponent + newPartObjectTy.componentCount; i < type.componentCount; i++)
{
dst.move(i, srcObjectAccess.Float(i));
}
@@ -2048,13 +2048,13 @@
SpirvShader::EmitResult SpirvShader::EmitCompositeExtract(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto &compositeObject = getObject(insn.word(3));
Type::ID compositeTypeId = compositeObject.definition.word(1);
auto firstComponent = WalkLiteralAccessChain(compositeTypeId, insn.wordCount() - 4, insn.wordPointer(4));
Operand compositeObjectAccess(this, state, insn.word(3));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, compositeObjectAccess.Float(firstComponent + i));
}
@@ -2065,7 +2065,7 @@
SpirvShader::EmitResult SpirvShader::EmitVectorShuffle(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
// Note: number of components in result type, first half type, and second
// half type are all independent.
@@ -2074,7 +2074,7 @@
Operand firstHalfAccess(this, state, insn.word(3));
Operand secondHalfAccess(this, state, insn.word(4));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto selector = insn.word(5 + i);
if(selector == static_cast<uint32_t>(-1))
@@ -2083,13 +2083,13 @@
// a value as any
dst.move(i, RValue<SIMD::Float>(0.0f));
}
- else if(selector < firstHalfType.sizeInComponents)
+ else if(selector < firstHalfType.componentCount)
{
dst.move(i, firstHalfAccess.Float(selector));
}
else
{
- dst.move(i, secondHalfAccess.Float(selector - firstHalfType.sizeInComponents));
+ dst.move(i, secondHalfAccess.Float(selector - firstHalfType.componentCount));
}
}
@@ -2099,7 +2099,7 @@
SpirvShader::EmitResult SpirvShader::EmitVectorExtractDynamic(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto &srcType = getType(getObject(insn.word(3)));
Operand src(this, state, insn.word(3));
@@ -2107,7 +2107,7 @@
SIMD::UInt v = SIMD::UInt(0);
- for(auto i = 0u; i < srcType.sizeInComponents; i++)
+ for(auto i = 0u; i < srcType.componentCount; i++)
{
v |= CmpEQ(index.UInt(0), SIMD::UInt(i)) & src.UInt(i);
}
@@ -2119,13 +2119,13 @@
SpirvShader::EmitResult SpirvShader::EmitVectorInsertDynamic(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
Operand src(this, state, insn.word(3));
Operand component(this, state, insn.word(4));
Operand index(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::UInt mask = CmpEQ(SIMD::UInt(i), index.UInt(0));
dst.move(i, (src.UInt(i) & ~mask) | (component.UInt(0) & mask));
@@ -2136,13 +2136,13 @@
SpirvShader::EmitResult SpirvShader::EmitSelect(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto cond = Operand(this, state, insn.word(3));
- auto condIsScalar = (getType(cond).sizeInComponents == 1);
+ auto condIsScalar = (getType(cond).componentCount == 1);
auto lhs = Operand(this, state, insn.word(4));
auto rhs = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto sel = cond.Int(condIsScalar ? 0 : i);
dst.move(i, (sel & lhs.Int(i)) | (~sel & rhs.Int(i))); // TODO: IfThenElse()
@@ -2154,14 +2154,14 @@
SpirvShader::EmitResult SpirvShader::EmitAny(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- ASSERT(type.sizeInComponents == 1);
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ ASSERT(type.componentCount == 1);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto &srcType = getType(getObject(insn.word(3)));
auto src = Operand(this, state, insn.word(3));
SIMD::UInt result = src.UInt(0);
- for(auto i = 1u; i < srcType.sizeInComponents; i++)
+ for(auto i = 1u; i < srcType.componentCount; i++)
{
result |= src.UInt(i);
}
@@ -2173,14 +2173,14 @@
SpirvShader::EmitResult SpirvShader::EmitAll(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- ASSERT(type.sizeInComponents == 1);
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ ASSERT(type.componentCount == 1);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto &srcType = getType(getObject(insn.word(3)));
auto src = Operand(this, state, insn.word(3));
SIMD::UInt result = src.UInt(0);
- for(auto i = 1u; i < srcType.sizeInComponents; i++)
+ for(auto i = 1u; i < srcType.componentCount; i++)
{
result &= src.UInt(i);
}
@@ -2198,7 +2198,7 @@
auto memoryOrder = MemoryOrder(memorySemantics);
// Where no value is provided (increment/decrement) use an implicit value of 1.
auto value = (insn.wordCount() == 7) ? Operand(this, state, insn.word(6)).UInt(0) : RValue<SIMD::UInt>(1);
- auto &dst = state->createIntermediate(resultId, resultType.sizeInComponents);
+ auto &dst = state->createIntermediate(resultId, resultType.componentCount);
auto ptr = state->getPointer(insn.word(3));
auto ptrOffsets = ptr.offsets();
@@ -2270,7 +2270,7 @@
auto value = Operand(this, state, insn.word(7));
auto comparator = Operand(this, state, insn.word(8));
- auto &dst = state->createIntermediate(resultId, resultType.sizeInComponents);
+ auto &dst = state->createIntermediate(resultId, resultType.componentCount);
auto ptr = state->getPointer(insn.word(3));
auto ptrOffsets = ptr.offsets();
@@ -2295,9 +2295,9 @@
SpirvShader::EmitResult SpirvShader::EmitCopyObject(InsnIterator insn, EmitState *state) const
{
auto type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto src = Operand(this, state, insn.word(3));
- for(uint32_t i = 0; i < type.sizeInComponents; i++)
+ for(uint32_t i = 0; i < type.componentCount; i++)
{
dst.move(i, src.Int(i));
}
@@ -2310,7 +2310,7 @@
auto arrayFieldIdx = insn.word(4);
auto &resultType = getType(insn.resultTypeId());
- ASSERT(resultType.sizeInComponents == 1);
+ ASSERT(resultType.componentCount == 1);
ASSERT(resultType.definition.opcode() == spv::OpTypeInt);
auto &structPtrTy = getType(getObject(structPtrId));
@@ -2356,7 +2356,7 @@
{
auto &scopeObj = getObject(id);
ASSERT(scopeObj.kind == Object::Kind::Constant);
- ASSERT(getType(scopeObj).sizeInComponents == 1);
+ ASSERT(getType(scopeObj).componentCount == 1);
return scopeObj.constantValue[0];
}
diff --git a/src/Pipeline/SpirvShader.hpp b/src/Pipeline/SpirvShader.hpp
index 1410ef1..38f866e 100644
--- a/src/Pipeline/SpirvShader.hpp
+++ b/src/Pipeline/SpirvShader.hpp
@@ -65,17 +65,17 @@
// Incrementally constructed complex bundle of rvalues
// Effectively a restricted vector, supporting only:
-// - allocation to a (runtime-known) fixed size
+// - allocation to a (runtime-known) fixed component count
// - in-place construction of elements
// - const operator[]
class Intermediate
{
public:
- Intermediate(uint32_t size)
- : scalar(new rr::Value *[size])
- , size(size)
+ Intermediate(uint32_t componentCount)
+ : scalar(new rr::Value *[componentCount])
+ , componentCount(componentCount)
{
- memset(scalar, 0, sizeof(rr::Value *) * size);
+ memset(scalar, 0, sizeof(rr::Value *) * componentCount);
}
~Intermediate()
@@ -94,21 +94,21 @@
// Value retrieval functions.
RValue<SIMD::Float> Float(uint32_t i) const
{
- ASSERT(i < size);
+ ASSERT(i < componentCount);
ASSERT(scalar[i] != nullptr);
return As<SIMD::Float>(scalar[i]); // TODO(b/128539387): RValue<SIMD::Float>(scalar)
}
RValue<SIMD::Int> Int(uint32_t i) const
{
- ASSERT(i < size);
+ ASSERT(i < componentCount);
ASSERT(scalar[i] != nullptr);
return As<SIMD::Int>(scalar[i]); // TODO(b/128539387): RValue<SIMD::Int>(scalar)
}
RValue<SIMD::UInt> UInt(uint32_t i) const
{
- ASSERT(i < size);
+ ASSERT(i < componentCount);
ASSERT(scalar[i] != nullptr);
return As<SIMD::UInt>(scalar[i]); // TODO(b/128539387): RValue<SIMD::UInt>(scalar)
}
@@ -122,13 +122,13 @@
private:
void emplace(uint32_t i, rr::Value *value)
{
- ASSERT(i < size);
+ ASSERT(i < componentCount);
ASSERT(scalar[i] == nullptr);
scalar[i] = value;
}
rr::Value **const scalar;
- uint32_t size;
+ uint32_t componentCount;
};
class SpirvShader
@@ -259,7 +259,7 @@
InsnIterator definition;
spv::StorageClass storageClass = static_cast<spv::StorageClass>(-1);
- uint32_t sizeInComponents = 0;
+ uint32_t componentCount = 0;
bool isBuiltInBlock = false;
// Inner element type for pointers, arrays, vectors and matrices.
@@ -939,11 +939,11 @@
OutOfBoundsBehavior getOutOfBoundsBehavior(spv::StorageClass storageClass) const;
- Intermediate &createIntermediate(Object::ID id, uint32_t size)
+ Intermediate &createIntermediate(Object::ID id, uint32_t componentCount)
{
auto it = intermediates.emplace(std::piecewise_construct,
std::forward_as_tuple(id),
- std::forward_as_tuple(size));
+ std::forward_as_tuple(componentCount));
ASSERT_MSG(it.second, "Intermediate %d created twice", id.value());
return it.first->second;
}
@@ -1336,9 +1336,9 @@
Pointer<Byte> dbgState; // Pointer to a debugger state.
- void createVariable(SpirvShader::Object::ID id, uint32_t size)
+ void createVariable(SpirvShader::Object::ID id, uint32_t componentCount)
{
- bool added = variables.emplace(id, Variable(size)).second;
+ bool added = variables.emplace(id, Variable(componentCount)).second;
ASSERT_MSG(added, "Variable %d created twice", id.value());
}
diff --git a/src/Pipeline/SpirvShaderArithmetic.cpp b/src/Pipeline/SpirvShaderArithmetic.cpp
index f895290..6ea7611 100644
--- a/src/Pipeline/SpirvShaderArithmetic.cpp
+++ b/src/Pipeline/SpirvShaderArithmetic.cpp
@@ -23,11 +23,11 @@
SpirvShader::EmitResult SpirvShader::EmitVectorTimesScalar(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto lhs = Operand(this, state, insn.word(3));
auto rhs = Operand(this, state, insn.word(4));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, lhs.Float(i) * rhs.Float(0));
}
@@ -38,17 +38,17 @@
SpirvShader::EmitResult SpirvShader::EmitMatrixTimesVector(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto lhs = Operand(this, state, insn.word(3));
auto rhs = Operand(this, state, insn.word(4));
auto rhsType = getType(rhs);
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::Float v = lhs.Float(i) * rhs.Float(0);
- for(auto j = 1u; j < rhsType.sizeInComponents; j++)
+ for(auto j = 1u; j < rhsType.componentCount; j++)
{
- v += lhs.Float(i + type.sizeInComponents * j) * rhs.Float(j);
+ v += lhs.Float(i + type.componentCount * j) * rhs.Float(j);
}
dst.move(i, v);
}
@@ -59,17 +59,17 @@
SpirvShader::EmitResult SpirvShader::EmitVectorTimesMatrix(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto lhs = Operand(this, state, insn.word(3));
auto rhs = Operand(this, state, insn.word(4));
auto lhsType = getType(lhs);
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
- SIMD::Float v = lhs.Float(0) * rhs.Float(i * lhsType.sizeInComponents);
- for(auto j = 1u; j < lhsType.sizeInComponents; j++)
+ SIMD::Float v = lhs.Float(0) * rhs.Float(i * lhsType.componentCount);
+ for(auto j = 1u; j < lhsType.componentCount; j++)
{
- v += lhs.Float(j) * rhs.Float(i * lhsType.sizeInComponents + j);
+ v += lhs.Float(j) * rhs.Float(i * lhsType.componentCount + j);
}
dst.move(i, v);
}
@@ -80,7 +80,7 @@
SpirvShader::EmitResult SpirvShader::EmitMatrixTimesMatrix(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto lhs = Operand(this, state, insn.word(3));
auto rhs = Operand(this, state, insn.word(4));
@@ -107,7 +107,7 @@
SpirvShader::EmitResult SpirvShader::EmitOuterProduct(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto lhs = Operand(this, state, insn.word(3));
auto rhs = Operand(this, state, insn.word(4));
auto &lhsType = getType(lhs);
@@ -136,11 +136,11 @@
SpirvShader::EmitResult SpirvShader::EmitTranspose(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto mat = Operand(this, state, insn.word(3));
auto numCols = type.definition.word(3);
- auto numRows = getType(type.definition.word(2)).sizeInComponents;
+ auto numRows = getType(type.definition.word(2)).componentCount;
for(auto col = 0u; col < numCols; col++)
{
@@ -156,10 +156,10 @@
SpirvShader::EmitResult SpirvShader::EmitUnaryOp(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto src = Operand(this, state, insn.word(3));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
switch(insn.opcode())
{
@@ -318,12 +318,12 @@
SpirvShader::EmitResult SpirvShader::EmitBinaryOp(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto &lhsType = getType(getObject(insn.word(3)));
auto lhs = Operand(this, state, insn.word(3));
auto rhs = Operand(this, state, insn.word(4));
- for(auto i = 0u; i < lhsType.sizeInComponents; i++)
+ for(auto i = 0u; i < lhsType.componentCount; i++)
{
switch(insn.opcode())
{
@@ -496,19 +496,19 @@
// In our flat view then, component i is the i'th component of the first member;
// component i + N is the i'th component of the second member.
dst.move(i, lhs.Int(i) * rhs.Int(i));
- dst.move(i + lhsType.sizeInComponents, MulHigh(lhs.Int(i), rhs.Int(i)));
+ dst.move(i + lhsType.componentCount, MulHigh(lhs.Int(i), rhs.Int(i)));
break;
case spv::OpUMulExtended:
dst.move(i, lhs.UInt(i) * rhs.UInt(i));
- dst.move(i + lhsType.sizeInComponents, MulHigh(lhs.UInt(i), rhs.UInt(i)));
+ dst.move(i + lhsType.componentCount, MulHigh(lhs.UInt(i), rhs.UInt(i)));
break;
case spv::OpIAddCarry:
dst.move(i, lhs.UInt(i) + rhs.UInt(i));
- dst.move(i + lhsType.sizeInComponents, CmpLT(dst.UInt(i), lhs.UInt(i)) >> 31);
+ dst.move(i + lhsType.componentCount, CmpLT(dst.UInt(i), lhs.UInt(i)) >> 31);
break;
case spv::OpISubBorrow:
dst.move(i, lhs.UInt(i) - rhs.UInt(i));
- dst.move(i + lhsType.sizeInComponents, CmpLT(lhs.UInt(i), rhs.UInt(i)) >> 31);
+ dst.move(i + lhsType.componentCount, CmpLT(lhs.UInt(i), rhs.UInt(i)) >> 31);
break;
default:
UNREACHABLE("%s", OpcodeName(insn.opcode()).c_str());
@@ -521,13 +521,13 @@
SpirvShader::EmitResult SpirvShader::EmitDot(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- ASSERT(type.sizeInComponents == 1);
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ ASSERT(type.componentCount == 1);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto &lhsType = getType(getObject(insn.word(3)));
auto lhs = Operand(this, state, insn.word(3));
auto rhs = Operand(this, state, insn.word(4));
- dst.move(0, Dot(lhsType.sizeInComponents, lhs, rhs));
+ dst.move(0, Dot(lhsType.componentCount, lhs, rhs));
return EmitResult::Continue;
}
diff --git a/src/Pipeline/SpirvShaderControlFlow.cpp b/src/Pipeline/SpirvShaderControlFlow.cpp
index bcfed7f..dc140fe 100644
--- a/src/Pipeline/SpirvShaderControlFlow.cpp
+++ b/src/Pipeline/SpirvShaderControlFlow.cpp
@@ -496,7 +496,7 @@
auto falseBlockId = Block::ID(block.branchInstruction.word(3));
auto cond = Operand(this, state, condId);
- ASSERT_MSG(getType(cond).sizeInComponents == 1, "Condition must be a Boolean type scalar");
+ ASSERT_MSG(getType(cond).componentCount == 1, "Condition must be a Boolean type scalar");
// TODO: Optimize for case where all lanes take same path.
@@ -515,7 +515,7 @@
auto selId = Object::ID(block.branchInstruction.word(1));
auto sel = Operand(this, state, selId);
- ASSERT_MSG(getType(sel).sizeInComponents == 1, "Selector must be a scalar");
+ ASSERT_MSG(getType(sel).componentCount == 1, "Selector must be a scalar");
auto numCases = (block.branchInstruction.wordCount() - 3) / 2;
@@ -650,8 +650,8 @@
ASSERT(storageIt != state->routine->phis.end());
auto &storage = storageIt->second;
- auto &dst = state->createIntermediate(objectId, type.sizeInComponents);
- for(uint32_t i = 0; i < type.sizeInComponents; i++)
+ auto &dst = state->createIntermediate(objectId, type.componentCount);
+ for(uint32_t i = 0; i < type.componentCount; i++)
{
dst.move(i, storage[i]);
}
@@ -680,7 +680,7 @@
auto mask = GetActiveLaneMaskEdge(state, blockId, currentBlock);
auto in = Operand(this, state, varId);
- for(uint32_t i = 0; i < type.sizeInComponents; i++)
+ for(uint32_t i = 0; i < type.componentCount; i++)
{
storage[i] = As<SIMD::Float>((As<SIMD::Int>(storage[i]) & ~mask) | (in.Int(i) & mask));
}
diff --git a/src/Pipeline/SpirvShaderGLSLstd450.cpp b/src/Pipeline/SpirvShaderGLSLstd450.cpp
index acc739d..554cbe4 100644
--- a/src/Pipeline/SpirvShaderGLSLstd450.cpp
+++ b/src/Pipeline/SpirvShaderGLSLstd450.cpp
@@ -28,7 +28,7 @@
SpirvShader::EmitResult SpirvShader::EmitExtGLSLstd450(InsnIterator insn, EmitState *state) const
{
auto &type = getType(insn.resultTypeId());
- auto &dst = state->createIntermediate(insn.resultId(), type.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), type.componentCount);
auto extInstIndex = static_cast<GLSLstd450>(insn.word(4));
switch(extInstIndex)
@@ -36,7 +36,7 @@
case GLSLstd450FAbs:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Abs(src.Float(i)));
}
@@ -45,7 +45,7 @@
case GLSLstd450SAbs:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Abs(src.Int(i)));
}
@@ -63,7 +63,7 @@
case GLSLstd450Floor:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Floor(src.Float(i)));
}
@@ -72,7 +72,7 @@
case GLSLstd450Trunc:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Trunc(src.Float(i)));
}
@@ -81,7 +81,7 @@
case GLSLstd450Ceil:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Ceil(src.Float(i)));
}
@@ -90,7 +90,7 @@
case GLSLstd450Fract:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Frac(src.Float(i)));
}
@@ -99,7 +99,7 @@
case GLSLstd450Round:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Round(src.Float(i)));
}
@@ -108,7 +108,7 @@
case GLSLstd450RoundEven:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto x = Round(src.Float(i));
// dst = round(src) + ((round(src) < src) * 2 - 1) * (fract(src) == 0.5) * isOdd(round(src));
@@ -121,7 +121,7 @@
{
auto lhs = Operand(this, state, insn.word(5));
auto rhs = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Min(lhs.Float(i), rhs.Float(i)));
}
@@ -131,7 +131,7 @@
{
auto lhs = Operand(this, state, insn.word(5));
auto rhs = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Max(lhs.Float(i), rhs.Float(i)));
}
@@ -141,7 +141,7 @@
{
auto lhs = Operand(this, state, insn.word(5));
auto rhs = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Min(lhs.Int(i), rhs.Int(i)));
}
@@ -151,7 +151,7 @@
{
auto lhs = Operand(this, state, insn.word(5));
auto rhs = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Max(lhs.Int(i), rhs.Int(i)));
}
@@ -161,7 +161,7 @@
{
auto lhs = Operand(this, state, insn.word(5));
auto rhs = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Min(lhs.UInt(i), rhs.UInt(i)));
}
@@ -171,7 +171,7 @@
{
auto lhs = Operand(this, state, insn.word(5));
auto rhs = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Max(lhs.UInt(i), rhs.UInt(i)));
}
@@ -181,7 +181,7 @@
{
auto edge = Operand(this, state, insn.word(5));
auto x = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, CmpNLT(x.Float(i), edge.Float(i)) & As<SIMD::Int>(SIMD::Float(1.0f)));
}
@@ -192,7 +192,7 @@
auto edge0 = Operand(this, state, insn.word(5));
auto edge1 = Operand(this, state, insn.word(6));
auto x = Operand(this, state, insn.word(7));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto tx = Min(Max((x.Float(i) - edge0.Float(i)) /
(edge1.Float(i) - edge0.Float(i)),
@@ -207,7 +207,7 @@
auto x = Operand(this, state, insn.word(5));
auto y = Operand(this, state, insn.word(6));
auto a = Operand(this, state, insn.word(7));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, a.Float(i) * (y.Float(i) - x.Float(i)) + x.Float(i));
}
@@ -218,7 +218,7 @@
auto x = Operand(this, state, insn.word(5));
auto minVal = Operand(this, state, insn.word(6));
auto maxVal = Operand(this, state, insn.word(7));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Min(Max(x.Float(i), minVal.Float(i)), maxVal.Float(i)));
}
@@ -229,7 +229,7 @@
auto x = Operand(this, state, insn.word(5));
auto minVal = Operand(this, state, insn.word(6));
auto maxVal = Operand(this, state, insn.word(7));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Min(Max(x.Int(i), minVal.Int(i)), maxVal.Int(i)));
}
@@ -240,7 +240,7 @@
auto x = Operand(this, state, insn.word(5));
auto minVal = Operand(this, state, insn.word(6));
auto maxVal = Operand(this, state, insn.word(7));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Min(Max(x.UInt(i), minVal.UInt(i)), maxVal.UInt(i)));
}
@@ -249,7 +249,7 @@
case GLSLstd450FSign:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto neg = As<SIMD::Int>(CmpLT(src.Float(i), SIMD::Float(-0.0f))) & As<SIMD::Int>(SIMD::Float(-1.0f));
auto pos = As<SIMD::Int>(CmpNLE(src.Float(i), SIMD::Float(+0.0f))) & As<SIMD::Int>(SIMD::Float(1.0f));
@@ -260,7 +260,7 @@
case GLSLstd450SSign:
{
auto src = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto neg = CmpLT(src.Int(i), SIMD::Int(0)) & SIMD::Int(-1);
auto pos = CmpNLE(src.Int(i), SIMD::Int(0)) & SIMD::Int(1);
@@ -273,9 +273,9 @@
auto I = Operand(this, state, insn.word(5));
auto N = Operand(this, state, insn.word(6));
- SIMD::Float d = Dot(type.sizeInComponents, I, N);
+ SIMD::Float d = Dot(type.componentCount, I, N);
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, I.Float(i) - SIMD::Float(2.0f) * d * N.Float(i));
}
@@ -287,12 +287,12 @@
auto N = Operand(this, state, insn.word(6));
auto eta = Operand(this, state, insn.word(7));
- SIMD::Float d = Dot(type.sizeInComponents, I, N);
+ SIMD::Float d = Dot(type.componentCount, I, N);
SIMD::Float k = SIMD::Float(1.0f) - eta.Float(0) * eta.Float(0) * (SIMD::Float(1.0f) - d * d);
SIMD::Int pos = CmpNLT(k, SIMD::Float(0.0f));
SIMD::Float t = (eta.Float(0) * d + Sqrt(k));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, pos & As<SIMD::Int>(eta.Float(0) * I.Float(i) - t * N.Float(i)));
}
@@ -304,10 +304,10 @@
auto I = Operand(this, state, insn.word(6));
auto Nref = Operand(this, state, insn.word(7));
- SIMD::Float d = Dot(type.sizeInComponents, I, Nref);
+ SIMD::Float d = Dot(type.componentCount, I, Nref);
SIMD::Int neg = CmpLT(d, SIMD::Float(0.0f));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto n = N.Float(i);
dst.move(i, (neg & As<SIMD::Int>(n)) | (~neg & As<SIMD::Int>(-n)));
@@ -317,7 +317,7 @@
case GLSLstd450Length:
{
auto x = Operand(this, state, insn.word(5));
- SIMD::Float d = Dot(getType(getObject(insn.word(5))).sizeInComponents, x, x);
+ SIMD::Float d = Dot(getType(getObject(insn.word(5))).componentCount, x, x);
dst.move(0, Sqrt(d));
break;
@@ -325,10 +325,10 @@
case GLSLstd450Normalize:
{
auto x = Operand(this, state, insn.word(5));
- SIMD::Float d = Dot(getType(getObject(insn.word(5))).sizeInComponents, x, x);
+ SIMD::Float d = Dot(getType(getObject(insn.word(5))).componentCount, x, x);
SIMD::Float invLength = SIMD::Float(1.0f) / Sqrt(d);
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, invLength * x.Float(i));
}
@@ -343,7 +343,7 @@
// sqrt(dot(p0-p1, p0-p1))
SIMD::Float d = (p0.Float(0) - p1.Float(0)) * (p0.Float(0) - p1.Float(0));
- for(auto i = 1u; i < p0Type.sizeInComponents; i++)
+ for(auto i = 1u; i < p0Type.componentCount; i++)
{
d += (p0.Float(i) - p1.Float(i)) * (p0.Float(i) - p1.Float(i));
}
@@ -364,7 +364,7 @@
// - Eliminate lane masking and assume interleaving.
auto robustness = OutOfBoundsBehavior::UndefinedBehavior;
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::Float whole, frac;
std::tie(whole, frac) = Modf(val.Float(i));
@@ -380,12 +380,12 @@
auto val = Operand(this, state, insn.word(5));
auto valTy = getType(val);
- for(auto i = 0u; i < valTy.sizeInComponents; i++)
+ for(auto i = 0u; i < valTy.componentCount; i++)
{
SIMD::Float whole, frac;
std::tie(whole, frac) = Modf(val.Float(i));
dst.move(i, frac);
- dst.move(i + valTy.sizeInComponents, whole);
+ dst.move(i + valTy.componentCount, whole);
}
break;
}
@@ -491,7 +491,7 @@
auto a = Operand(this, state, insn.word(5));
auto b = Operand(this, state, insn.word(6));
auto c = Operand(this, state, insn.word(7));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, FMA(a.Float(i), b.Float(i), c.Float(i)));
}
@@ -510,7 +510,7 @@
// - Eliminate lane masking and assume interleaving.
auto robustness = OutOfBoundsBehavior::UndefinedBehavior;
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::Float significand;
SIMD::Int exponent;
@@ -527,7 +527,7 @@
case GLSLstd450FrexpStruct:
{
auto val = Operand(this, state, insn.word(5));
- auto numComponents = getType(val).sizeInComponents;
+ auto numComponents = getType(val).componentCount;
for(auto i = 0u; i < numComponents; i++)
{
auto significandAndExponent = Frexp(val.Float(i));
@@ -540,7 +540,7 @@
{
auto significand = Operand(this, state, insn.word(5));
auto exponent = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
// Assumes IEEE 754
auto in = significand.Float(i);
@@ -573,7 +573,7 @@
case GLSLstd450Radians:
{
auto degrees = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, degrees.Float(i) * SIMD::Float(PI / 180.0f));
}
@@ -582,7 +582,7 @@
case GLSLstd450Degrees:
{
auto radians = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, radians.Float(i) * SIMD::Float(180.0f / PI));
}
@@ -591,7 +591,7 @@
case GLSLstd450Sin:
{
auto radians = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Sin(radians.Float(i)));
}
@@ -600,7 +600,7 @@
case GLSLstd450Cos:
{
auto radians = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Cos(radians.Float(i)));
}
@@ -609,7 +609,7 @@
case GLSLstd450Tan:
{
auto radians = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Tan(radians.Float(i)));
}
@@ -618,7 +618,7 @@
case GLSLstd450Asin:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Asin(val.Float(i)));
}
@@ -627,7 +627,7 @@
case GLSLstd450Acos:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Acos(val.Float(i)));
}
@@ -636,7 +636,7 @@
case GLSLstd450Atan:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Atan(val.Float(i)));
}
@@ -645,7 +645,7 @@
case GLSLstd450Sinh:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Sinh(val.Float(i)));
}
@@ -654,7 +654,7 @@
case GLSLstd450Cosh:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Cosh(val.Float(i)));
}
@@ -663,7 +663,7 @@
case GLSLstd450Tanh:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Tanh(val.Float(i)));
}
@@ -672,7 +672,7 @@
case GLSLstd450Asinh:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Asinh(val.Float(i)));
}
@@ -681,7 +681,7 @@
case GLSLstd450Acosh:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Acosh(val.Float(i)));
}
@@ -690,7 +690,7 @@
case GLSLstd450Atanh:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Atanh(val.Float(i)));
}
@@ -700,7 +700,7 @@
{
auto x = Operand(this, state, insn.word(5));
auto y = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Atan2(x.Float(i), y.Float(i)));
}
@@ -710,7 +710,7 @@
{
auto x = Operand(this, state, insn.word(5));
auto y = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Pow(x.Float(i), y.Float(i)));
}
@@ -719,7 +719,7 @@
case GLSLstd450Exp:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Exp(val.Float(i)));
}
@@ -728,7 +728,7 @@
case GLSLstd450Log:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Log(val.Float(i)));
}
@@ -737,7 +737,7 @@
case GLSLstd450Exp2:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Exp2(val.Float(i)));
}
@@ -746,7 +746,7 @@
case GLSLstd450Log2:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Log2(val.Float(i)));
}
@@ -755,7 +755,7 @@
case GLSLstd450Sqrt:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, Sqrt(val.Float(i)));
}
@@ -768,14 +768,14 @@
ApplyDecorationsForId(&d, insn.word(5));
if(d.RelaxedPrecision)
{
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, RcpSqrt_pp(val.Float(i)));
}
}
else
{
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, SIMD::Float(1.0f) / Sqrt(val.Float(i)));
}
@@ -785,7 +785,7 @@
case GLSLstd450Determinant:
{
auto mat = Operand(this, state, insn.word(5));
- auto numComponents = getType(mat).sizeInComponents;
+ auto numComponents = getType(mat).componentCount;
switch(numComponents)
{
case 4: // 2x2
@@ -814,7 +814,7 @@
case GLSLstd450MatrixInverse:
{
auto mat = Operand(this, state, insn.word(5));
- auto numComponents = getType(mat).sizeInComponents;
+ auto numComponents = getType(mat).componentCount;
switch(numComponents)
{
case 4: // 2x2
@@ -876,7 +876,7 @@
case GLSLstd450FindILsb:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto v = val.UInt(i);
dst.move(i, Cttz(v, true) | CmpEQ(v, SIMD::UInt(0)));
@@ -886,7 +886,7 @@
case GLSLstd450FindSMsb:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto v = val.UInt(i) ^ As<SIMD::UInt>(CmpLT(val.Int(i), SIMD::Int(0)));
dst.move(i, SIMD::UInt(31) - Ctlz(v, false));
@@ -896,7 +896,7 @@
case GLSLstd450FindUMsb:
{
auto val = Operand(this, state, insn.word(5));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, SIMD::UInt(31) - Ctlz(val.UInt(i), false));
}
@@ -921,7 +921,7 @@
{
auto x = Operand(this, state, insn.word(5));
auto y = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, NMin(x.Float(i), y.Float(i)));
}
@@ -931,7 +931,7 @@
{
auto x = Operand(this, state, insn.word(5));
auto y = Operand(this, state, insn.word(6));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, NMax(x.Float(i), y.Float(i)));
}
@@ -942,7 +942,7 @@
auto x = Operand(this, state, insn.word(5));
auto minVal = Operand(this, state, insn.word(6));
auto maxVal = Operand(this, state, insn.word(7));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto clamp = NMin(NMax(x.Float(i), minVal.Float(i)), maxVal.Float(i));
dst.move(i, clamp);
diff --git a/src/Pipeline/SpirvShaderGroup.cpp b/src/Pipeline/SpirvShaderGroup.cpp
index 680ea6c..c9faa23 100644
--- a/src/Pipeline/SpirvShaderGroup.cpp
+++ b/src/Pipeline/SpirvShaderGroup.cpp
@@ -36,7 +36,7 @@
{
SpirvShader::Operand value(shader, state, insn.word(5));
auto &type = shader->getType(SpirvShader::Type::ID(insn.word(1)));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
auto mask = As<SIMD::UInt>(state->activeLaneMask());
auto identity = TYPE(identityValue);
@@ -85,7 +85,7 @@
auto scope = spv::Scope(GetConstScalarInt(insn.word(3)));
ASSERT_MSG(scope == spv::ScopeSubgroup, "Scope for Non Uniform Group Operations must be Subgroup for Vulkan 1.1");
- auto &dst = state->createIntermediate(resultId, type.sizeInComponents);
+ auto &dst = state->createIntermediate(resultId, type.componentCount);
switch(insn.opcode())
{
@@ -122,7 +122,7 @@
auto res = SIMD::UInt(0xffffffff);
SIMD::UInt active = As<SIMD::UInt>(state->activeLaneMask());
SIMD::UInt inactive = ~active;
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::UInt v = value.UInt(i) & active;
SIMD::UInt filled = v;
@@ -142,7 +142,7 @@
auto id = SIMD::Int(GetConstScalarInt(insn.word(5)));
Operand value(this, state, valueId);
auto mask = CmpEQ(id, SIMD::Int(0, 1, 2, 3));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, OrAll(value.Int(i) & mask));
}
@@ -160,7 +160,7 @@
// elect = active & ~(active.Oxyz | active.OOxy | active.OOOx)
auto v0111 = SIMD::Int(0, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
auto elect = active & ~(v0111 & (active.xxyz | active.xxxy | active.xxxx));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
dst.move(i, OrAll(value.Int(i) & elect));
}
@@ -169,7 +169,7 @@
case spv::OpGroupNonUniformBallot:
{
- ASSERT(type.sizeInComponents == 4);
+ ASSERT(type.componentCount == 4);
Operand predicate(this, state, insn.word(4));
dst.move(0, SIMD::Int(SignMask(state->activeLaneMask() & predicate.Int(0))));
dst.move(1, SIMD::Int(0));
@@ -181,8 +181,8 @@
case spv::OpGroupNonUniformInverseBallot:
{
auto valueId = Object::ID(insn.word(4));
- ASSERT(type.sizeInComponents == 1);
- ASSERT(getType(getObject(valueId)).sizeInComponents == 4);
+ ASSERT(type.componentCount == 1);
+ ASSERT(getType(getObject(valueId)).componentCount == 4);
Operand value(this, state, valueId);
auto bit = (value.Int(0) >> SIMD::Int(0, 1, 2, 3)) & SIMD::Int(1);
dst.move(0, -bit);
@@ -193,9 +193,9 @@
{
auto valueId = Object::ID(insn.word(4));
auto indexId = Object::ID(insn.word(5));
- ASSERT(type.sizeInComponents == 1);
- ASSERT(getType(getObject(valueId)).sizeInComponents == 4);
- ASSERT(getType(getObject(indexId)).sizeInComponents == 1);
+ ASSERT(type.componentCount == 1);
+ ASSERT(getType(getObject(valueId)).componentCount == 4);
+ ASSERT(getType(getObject(indexId)).componentCount == 1);
Operand value(this, state, valueId);
Operand index(this, state, indexId);
auto vecIdx = index.Int(0) / SIMD::Int(32);
@@ -212,8 +212,8 @@
{
auto operation = spv::GroupOperation(insn.word(4));
auto valueId = Object::ID(insn.word(5));
- ASSERT(type.sizeInComponents == 1);
- ASSERT(getType(getObject(valueId)).sizeInComponents == 4);
+ ASSERT(type.componentCount == 1);
+ ASSERT(getType(getObject(valueId)).componentCount == 4);
Operand value(this, state, valueId);
switch(operation)
{
@@ -235,8 +235,8 @@
case spv::OpGroupNonUniformBallotFindLSB:
{
auto valueId = Object::ID(insn.word(4));
- ASSERT(type.sizeInComponents == 1);
- ASSERT(getType(getObject(valueId)).sizeInComponents == 4);
+ ASSERT(type.componentCount == 1);
+ ASSERT(getType(getObject(valueId)).componentCount == 4);
Operand value(this, state, valueId);
dst.move(0, Cttz(value.UInt(0) & SIMD::UInt(15), true));
break;
@@ -245,8 +245,8 @@
case spv::OpGroupNonUniformBallotFindMSB:
{
auto valueId = Object::ID(insn.word(4));
- ASSERT(type.sizeInComponents == 1);
- ASSERT(getType(getObject(valueId)).sizeInComponents == 4);
+ ASSERT(type.componentCount == 1);
+ ASSERT(getType(getObject(valueId)).componentCount == 4);
Operand value(this, state, valueId);
dst.move(0, SIMD::UInt(31) - Ctlz(value.UInt(0) & SIMD::UInt(15), false));
break;
@@ -260,7 +260,7 @@
auto y = CmpEQ(SIMD::Int(1), id.Int(0));
auto z = CmpEQ(SIMD::Int(2), id.Int(0));
auto w = CmpEQ(SIMD::Int(3), id.Int(0));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::Int v = value.Int(i);
dst.move(i, (x & v.xxxx) | (y & v.yyyy) | (z & v.zzzz) | (w & v.wwww));
@@ -276,7 +276,7 @@
auto y = CmpEQ(SIMD::Int(1), SIMD::Int(0, 1, 2, 3) ^ mask.Int(0));
auto z = CmpEQ(SIMD::Int(2), SIMD::Int(0, 1, 2, 3) ^ mask.Int(0));
auto w = CmpEQ(SIMD::Int(3), SIMD::Int(0, 1, 2, 3) ^ mask.Int(0));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::Int v = value.Int(i);
dst.move(i, (x & v.xxxx) | (y & v.yyyy) | (z & v.zzzz) | (w & v.wwww));
@@ -292,7 +292,7 @@
auto d1 = CmpEQ(SIMD::Int(1), delta.Int(0));
auto d2 = CmpEQ(SIMD::Int(2), delta.Int(0));
auto d3 = CmpEQ(SIMD::Int(3), delta.Int(0));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::Int v = value.Int(i);
dst.move(i, (d0 & v.xyzw) | (d1 & v.xxyz) | (d2 & v.xxxy) | (d3 & v.xxxx));
@@ -308,7 +308,7 @@
auto d1 = CmpEQ(SIMD::Int(1), delta.Int(0));
auto d2 = CmpEQ(SIMD::Int(2), delta.Int(0));
auto d3 = CmpEQ(SIMD::Int(3), delta.Int(0));
- for(auto i = 0u; i < type.sizeInComponents; i++)
+ for(auto i = 0u; i < type.componentCount; i++)
{
SIMD::Int v = value.Int(i);
dst.move(i, (d0 & v.xyzw) | (d1 & v.yzww) | (d2 & v.zwww) | (d3 & v.wwww));
diff --git a/src/Pipeline/SpirvShaderImage.cpp b/src/Pipeline/SpirvShaderImage.cpp
index a00c2fc..e6dab75 100644
--- a/src/Pipeline/SpirvShaderImage.cpp
+++ b/src/Pipeline/SpirvShaderImage.cpp
@@ -111,7 +111,7 @@
Object::ID coordinateId = insn.word(4);
auto &resultType = getType(insn.resultTypeId());
- auto &result = state->createIntermediate(insn.resultId(), resultType.sizeInComponents);
+ auto &result = state->createIntermediate(insn.resultId(), resultType.componentCount);
auto imageDescriptor = state->getPointer(sampledImageId).base; // vk::SampledImageDescriptor*
// If using a separate sampler, look through the OpSampledImage instruction to find the sampler descriptor
@@ -204,7 +204,7 @@
Array<SIMD::Float> in(16); // Maximum 16 input parameter components.
- uint32_t coordinates = coordinateType.sizeInComponents - instruction.isProj();
+ uint32_t coordinates = coordinateType.componentCount - instruction.isProj();
instruction.coordinates = coordinates;
uint32_t i = 0;
@@ -247,16 +247,16 @@
auto dxValue = Operand(this, state, gradDxId);
auto dyValue = Operand(this, state, gradDyId);
auto &dxyType = getType(dxValue);
- ASSERT(dxyType.sizeInComponents == getType(dyValue).sizeInComponents);
+ ASSERT(dxyType.componentCount == getType(dyValue).componentCount);
- instruction.grad = dxyType.sizeInComponents;
+ instruction.grad = dxyType.componentCount;
- for(uint32_t j = 0; j < dxyType.sizeInComponents; j++, i++)
+ for(uint32_t j = 0; j < dxyType.componentCount; j++, i++)
{
in[i] = dxValue.Float(j);
}
- for(uint32_t j = 0; j < dxyType.sizeInComponents; j++, i++)
+ for(uint32_t j = 0; j < dxyType.componentCount; j++, i++)
{
in[i] = dyValue.Float(j);
}
@@ -275,9 +275,9 @@
auto offsetValue = Operand(this, state, offsetId);
auto &offsetType = getType(offsetValue);
- instruction.offset = offsetType.sizeInComponents;
+ instruction.offset = offsetType.componentCount;
- for(uint32_t j = 0; j < offsetType.sizeInComponents; j++, i++)
+ for(uint32_t j = 0; j < offsetType.componentCount; j++, i++)
{
in[i] = As<SIMD::Float>(offsetValue.Int(j)); // Integer values, but transfered as float.
}
@@ -304,7 +304,7 @@
Array<SIMD::Float> out(4);
Call<ImageSampler>(cache.function, texture, &in[0], &out[0], state->routine->constants);
- for(auto i = 0u; i < resultType.sizeInComponents; i++) { result.move(i, out[i]); }
+ for(auto i = 0u; i < resultType.componentCount; i++) { result.move(i, out[i]); }
return EmitResult::Continue;
}
@@ -315,7 +315,7 @@
auto imageId = Object::ID(insn.word(3));
auto lodId = Object::ID(insn.word(4));
- auto &dst = state->createIntermediate(insn.resultId(), resultTy.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), resultTy.componentCount);
GetImageDimensions(state, resultTy, imageId, lodId, dst);
return EmitResult::Continue;
@@ -327,7 +327,7 @@
auto imageId = Object::ID(insn.word(3));
auto lodId = Object::ID(0);
- auto &dst = state->createIntermediate(insn.resultId(), resultTy.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), resultTy.componentCount);
GetImageDimensions(state, resultTy, imageId, lodId, dst);
return EmitResult::Continue;
@@ -378,12 +378,12 @@
UNREACHABLE("Image descriptorType: %d", int(bindingLayout.descriptorType));
}
- auto dimensions = resultTy.sizeInComponents - (isArrayed ? 1 : 0);
+ auto dimensions = resultTy.componentCount - (isArrayed ? 1 : 0);
std::vector<Int> out;
if(lodId != 0)
{
auto lodVal = Operand(this, state, lodId);
- ASSERT(getType(lodVal).sizeInComponents == 1);
+ ASSERT(getType(lodVal).componentCount == 1);
auto lod = lodVal.Int(0);
auto one = SIMD::Int(1);
for(uint32_t i = 0; i < dimensions; i++)
@@ -409,7 +409,7 @@
SpirvShader::EmitResult SpirvShader::EmitImageQueryLevels(InsnIterator insn, EmitState *state) const
{
auto &resultTy = getType(Type::ID(insn.resultTypeId()));
- ASSERT(resultTy.sizeInComponents == 1);
+ ASSERT(resultTy.componentCount == 1);
auto imageId = Object::ID(insn.word(3));
const DescriptorDecorations &d = descriptorDecorations.at(imageId);
@@ -438,7 +438,7 @@
SpirvShader::EmitResult SpirvShader::EmitImageQuerySamples(InsnIterator insn, EmitState *state) const
{
auto &resultTy = getType(Type::ID(insn.resultTypeId()));
- ASSERT(resultTy.sizeInComponents == 1);
+ ASSERT(resultTy.componentCount == 1);
auto imageId = Object::ID(insn.word(3));
auto imageTy = getType(getObject(imageId));
ASSERT(imageTy.definition.opcode() == spv::OpTypeImage);
@@ -476,12 +476,12 @@
auto routine = state->routine;
bool isArrayed = imageType.definition.word(5) != 0;
auto dim = static_cast<spv::Dim>(imageType.definition.word(3));
- int dims = getType(coordinate).sizeInComponents - (isArrayed ? 1 : 0);
+ int dims = getType(coordinate).componentCount - (isArrayed ? 1 : 0);
SIMD::Int u = coordinate.Int(0);
SIMD::Int v = SIMD::Int(0);
- if(getType(coordinate).sizeInComponents > 1)
+ if(getType(coordinate).componentCount > 1)
{
v = coordinate.Int(1);
}
@@ -586,7 +586,7 @@
auto imageSizeInBytes = *Pointer<Int>(binding + OFFSET(vk::StorageImageDescriptor, sizeInBytes));
- auto &dst = state->createIntermediate(insn.resultId(), resultType.sizeInComponents);
+ auto &dst = state->createIntermediate(insn.resultId(), resultType.componentCount);
auto texelSize = vk::Format(vkFormat).bytes();
auto basePtr = SIMD::Pointer(imageBase, imageSizeInBytes);
diff --git a/src/Pipeline/SpirvShaderMemory.cpp b/src/Pipeline/SpirvShaderMemory.cpp
index 58b05fe..b85200f 100644
--- a/src/Pipeline/SpirvShaderMemory.cpp
+++ b/src/Pipeline/SpirvShaderMemory.cpp
@@ -54,7 +54,7 @@
auto ptr = GetPointerToData(pointerId, 0, state);
bool interleavedByLane = IsStorageInterleavedByLane(pointerTy.storageClass);
- auto &dst = state->createIntermediate(resultId, resultTy.sizeInComponents);
+ auto &dst = state->createIntermediate(resultId, resultTy.componentCount);
auto robustness = state->getOutOfBoundsBehavior(pointerTy.storageClass);
VisitMemoryObject(pointerId, [&](const MemoryElement &el) {
@@ -136,7 +136,7 @@
ASSERT(objectTy.opcode() == spv::OpTypePointer);
auto base = &routine->getVariable(resultId)[0];
auto elementTy = getType(objectTy.element);
- auto size = elementTy.sizeInComponents * static_cast<uint32_t>(sizeof(float)) * SIMD::Width;
+ auto size = elementTy.componentCount * static_cast<uint32_t>(sizeof(float)) * SIMD::Width;
state->createPointer(resultId, SIMD::Pointer(base, size));
break;
}
@@ -163,7 +163,7 @@
ASSERT(objectTy.opcode() == spv::OpTypePointer);
auto base = &routine->getVariable(resultId)[0];
auto elementTy = getType(objectTy.element);
- auto size = elementTy.sizeInComponents * static_cast<uint32_t>(sizeof(float)) * SIMD::Width;
+ auto size = elementTy.componentCount * static_cast<uint32_t>(sizeof(float)) * SIMD::Width;
state->createPointer(resultId, SIMD::Pointer(base, size));
break;
}
@@ -378,7 +378,7 @@
{
// Objects without explicit layout are tightly packed.
auto &elType = getType(type.element);
- for(auto index = 0u; index < elType.sizeInComponents; index++)
+ for(auto index = 0u; index < elType.componentCount; index++)
{
auto offset = static_cast<uint32_t>(index * sizeof(float));
f({ index, offset, elType });
diff --git a/src/Pipeline/SpirvShaderSpec.cpp b/src/Pipeline/SpirvShaderSpec.cpp
index 27abddd..fd96185 100644
--- a/src/Pipeline/SpirvShaderSpec.cpp
+++ b/src/Pipeline/SpirvShaderSpec.cpp
@@ -69,11 +69,11 @@
{
auto &result = CreateConstant(insn);
auto const &cond = getObject(insn.word(4));
- auto condIsScalar = (getType(cond).sizeInComponents == 1);
+ auto condIsScalar = (getType(cond).componentCount == 1);
auto const &left = getObject(insn.word(5));
auto const &right = getObject(insn.word(6));
- for(auto i = 0u; i < getType(result).sizeInComponents; i++)
+ for(auto i = 0u; i < getType(result).componentCount; i++)
{
auto sel = cond.constantValue[condIsScalar ? 0 : i];
result.constantValue[i] = sel ? left.constantValue[i] : right.constantValue[i];
@@ -87,7 +87,7 @@
auto const &compositeObject = getObject(insn.word(4));
auto firstComponent = WalkLiteralAccessChain(compositeObject.typeId(), insn.wordCount() - 5, insn.wordPointer(5));
- for(auto i = 0u; i < getType(result).sizeInComponents; i++)
+ for(auto i = 0u; i < getType(result).componentCount; i++)
{
result.constantValue[i] = compositeObject.constantValue[firstComponent + i];
}
@@ -107,12 +107,12 @@
result.constantValue[i] = oldObject.constantValue[i];
}
// new part
- for(auto i = 0u; i < getType(newPart).sizeInComponents; i++)
+ for(auto i = 0u; i < getType(newPart).componentCount; i++)
{
result.constantValue[firstNewComponent + i] = newPart.constantValue[i];
}
// old components after
- for(auto i = firstNewComponent + getType(newPart).sizeInComponents; i < getType(result).sizeInComponents; i++)
+ for(auto i = firstNewComponent + getType(newPart).componentCount; i < getType(result).componentCount; i++)
{
result.constantValue[i] = oldObject.constantValue[i];
}
@@ -125,7 +125,7 @@
auto const &firstHalf = getObject(insn.word(4));
auto const &secondHalf = getObject(insn.word(5));
- for(auto i = 0u; i < getType(result).sizeInComponents; i++)
+ for(auto i = 0u; i < getType(result).componentCount; i++)
{
auto selector = insn.word(6 + i);
if(selector == static_cast<uint32_t>(-1))
@@ -133,13 +133,13 @@
// Undefined value, we'll use zero
result.constantValue[i] = 0;
}
- else if(selector < getType(firstHalf).sizeInComponents)
+ else if(selector < getType(firstHalf).componentCount)
{
result.constantValue[i] = firstHalf.constantValue[selector];
}
else
{
- result.constantValue[i] = secondHalf.constantValue[selector - getType(firstHalf).sizeInComponents];
+ result.constantValue[i] = secondHalf.constantValue[selector - getType(firstHalf).componentCount];
}
}
break;
@@ -159,7 +159,7 @@
auto opcode = static_cast<spv::Op>(insn.word(3));
auto const &lhs = getObject(insn.word(4));
- auto size = getType(lhs).sizeInComponents;
+ auto size = getType(lhs).componentCount;
for(auto i = 0u; i < size; i++)
{
@@ -210,7 +210,7 @@
auto opcode = static_cast<spv::Op>(insn.word(3));
auto const &lhs = getObject(insn.word(4));
auto const &rhs = getObject(insn.word(5));
- auto size = getType(lhs).sizeInComponents;
+ auto size = getType(lhs).componentCount;
for(auto i = 0u; i < size; i++)
{