Lines Matching defs:const
71 std::ostream& operator<< (std::ostream& str, const LayoutFlagsFmt& fmt)
73 static const struct
76 const char* token;
103 BufferVar::BufferVar (const char* name, const VarType& type, deUint32 flags)
113 BufferBlock::BufferBlock (const char* blockName)
128 std::ostream& operator<< (std::ostream& stream, const BlockLayoutEntry& entry)
145 static bool isUnsizedArray (const BufferVarLayoutEntry& entry)
151 std::ostream& operator<< (std::ostream& stream, const BufferVarLayoutEntry& entry)
168 int BufferLayout::getVariableIndex (const string& name) const
178 int BufferLayout::getBlockIndex (const string& name) const
203 StructType& ShaderInterface::allocStruct (const char* name)
214 StructNameEquals (const char* name_) : name(name_) {}
216 bool operator() (const StructType* type) const
222 const StructType* ShaderInterface::findStruct (const char* name) const
228 void ShaderInterface::getNamedStructs (std::vector<const StructType*>& structs) const
237 BufferBlock& ShaderInterface::allocBlock (const char* name)
322 int computeStd140BaseAlignment (const VarType& type, deUint32 layoutFlags)
324 const int vec4Alignment = (int)sizeof(deUint32)*4;
332 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
333 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(basicType)
335 const int vecAlign = deAlign32(getDataTypeByteAlignment(glu::getDataTypeFloatVec(vecSize)), vec4Alignment);
362 int computeStd430BaseAlignment (const VarType& type, deUint32 layoutFlags)
373 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
374 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(basicType)
376 const int vecAlign = getDataTypeByteAlignment(glu::getDataTypeFloatVec(vecSize));
399 int computeRelaxedBlockBaseAlignment (const VarType& type, deUint32 layoutFlags)
410 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
411 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(basicType)
413 const int vecAlign = getDataTypeByteAlignment(glu::getDataTypeFloatVec(vecSize));
433 int computeScalarBlockAlignment (const VarType& type, deUint32 layoutFlags)
455 const deUint32 packingMask = LAYOUT_STD430|LAYOUT_STD140|LAYOUT_RELAXED|LAYOUT_SCALAR;
456 const deUint32 matrixMask = LAYOUT_ROW_MAJOR|LAYOUT_COLUMN_MAJOR;
471 const std::string& curPrefix,
472 const VarType& type,
477 const int baseAlignment = (layoutFlags & LAYOUT_SCALAR) != 0 ? computeScalarBlockAlignment(type, layoutFlags) :
482 const int topLevelArraySize = 1; // Default values
483 const int topLevelArrayStride = 0;
487 const glu::DataType basicType = type.getBasicType();
502 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
503 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(basicType)
505 const glu::DataType vecType = glu::getDataTypeFloatVec(vecSize);
506 const int numVecs = isRowMajor ? glu::getDataTypeMatrixNumRows(basicType)
508 const int vecStride = (layoutFlags & LAYOUT_SCALAR) ? getDataTypeByteSize(vecType) : baseAlignment;
532 const VarType& elemType = type.getElementType();
537 const glu::DataType elemBasicType = elemType.getBasicType();
538 const int stride = (layoutFlags & LAYOUT_SCALAR) ? getDataTypeByteSize(elemBasicType) : baseAlignment;
558 const glu::DataType elemBasicType = elemType.getBasicType();
559 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
560 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(elemBasicType)
562 const glu::DataType vecType = glu::getDataTypeFloatVec(vecSize);
563 const int numVecs = isRowMajor ? glu::getDataTypeMatrixNumRows(elemBasicType)
565 const int vecStride = (layoutFlags & LAYOUT_SCALAR) ? getDataTypeByteSize(vecType) : baseAlignment;
606 int computeReferenceLayout (BufferLayout& layout, int curBlockNdx, const std::string& blockPrefix, int baseOffset, const BufferVar& bufVar, deUint32 blockLayoutFlags)
608 const VarType& varType = bufVar.getType();
609 const deUint32 combinedFlags = mergeLayoutFlags(blockLayoutFlags, bufVar.getFlags());
614 const int topLevelArraySize = varType.getArraySize() == VarType::UNSIZED_ARRAY ? 0 : varType.getArraySize();
615 const string prefix = blockPrefix + bufVar.getName() + "[0]";
616 const bool isStd140 = (blockLayoutFlags & LAYOUT_STD140) != 0;
617 const int vec4Align = (int)sizeof(deUint32)*4;
618 const int baseAlignment = (blockLayoutFlags & LAYOUT_SCALAR) != 0 ? computeScalarBlockAlignment(varType, combinedFlags) :
623 const VarType& elemType = varType.getElementType();
628 const glu::DataType elemBasicType = elemType.getBasicType();
629 const int elemBaseAlign = getDataTypeByteAlignment(elemBasicType);
630 const int stride = (blockLayoutFlags & LAYOUT_SCALAR) ? getDataTypeByteSize(elemBasicType) :
653 const glu::DataType elemBasicType = elemType.getBasicType();
654 const bool isRowMajor = !!(combinedFlags & LAYOUT_ROW_MAJOR);
655 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(elemBasicType)
657 const int numVecs = isRowMajor ? glu::getDataTypeMatrixNumRows(elemBasicType)
659 const glu::DataType vecType = glu::getDataTypeFloatVec(vecSize);
660 const int vecBaseAlign = getDataTypeByteAlignment(vecType);
661 const int stride = (blockLayoutFlags & LAYOUT_SCALAR) ? getDataTypeByteSize(vecType) :
693 const int firstChildNdx = (int)layout.bufferVars.size();
695 const int size = computeReferenceLayout(layout, curBlockNdx, deAlign32(curOffset, baseAlignment), prefix, varType.getElementType(), combinedFlags);
696 const int stride = deAlign32(size, baseAlignment);
766 void generateValue (const BufferVarLayoutEntry& entry, int unsizedArraySize, void* basePtr, de::Random& rnd)
768 const glu::DataType scalarType = glu::getDataTypeScalarType(entry.type);
769 const int scalarSize = glu::getDataTypeScalarSize(entry.type);
770 const int arraySize = entry.arraySize == 0 ? unsizedArraySize : entry.arraySize;
771 const int arrayStride = entry.arrayStride;
772 const int topLevelSize = entry.topLevelArraySize == 0 ? unsizedArraySize : entry.topLevelArraySize;
773 const int topLevelStride = entry.topLevelArrayStride;
774 const bool isMatrix = glu::isDataTypeMatrix(entry.type);
775 const int numVecs = isMatrix ? (entry.isRowMajor ? glu::getDataTypeMatrixNumRows(entry.type) : glu::getDataTypeMatrixNumColumns(entry.type)) : 1;
776 const int vecSize = scalarSize / numVecs;
777 const size_t compSize = getDataTypeByteSize(scalarType);
785 deUint8* const topElemPtr = (deUint8*)basePtr + entry.offset + topElemNdx*topLevelStride;
789 deUint8* const elemPtr = topElemPtr + elemNdx*arrayStride;
793 deUint8* const vecPtr = elemPtr + (isMatrix ? vecNdx*entry.matrixStride : 0);
797 deUint8* const compPtr = vecPtr + compSize*compNdx;
821 void generateValues (const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers, deUint32 seed)
824 const int numBlocks = (int)layout.blocks.size();
830 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
831 const BlockDataPtr& blockPtr = blockPointers[blockNdx];
832 const int numEntries = (int)layout.blocks[blockNdx].activeVarIndices.size();
836 const int varNdx = blockLayout.activeVarIndices[entryNdx];
837 const BufferVarLayoutEntry& varEntry = layout.bufferVars[varNdx];
846 void collectUniqueBasicTypes (std::set<glu::DataType>& basicTypes, const BufferBlock& bufferBlock)
852 void collectUniqueBasicTypes (std::set<glu::DataType>& basicTypes, const ShaderInterface& interface)
858 void generateCompareFuncs (std::ostream& str, const ShaderInterface& interface)
879 bool usesRelaxedLayout (const ShaderInterface& interface)
890 bool uses16BitStorage (const ShaderInterface& interface)
901 bool uses8BitStorage (const ShaderInterface& interface)
912 bool usesScalarLayout (const ShaderInterface& interface)
923 bool usesDescriptorIndexing(const ShaderInterface& interface)
940 std::ostream& operator<< (std::ostream& str, const Indent& indent)
947 void generateDeclaration (std::ostream& src, const BufferVar& bufferVar, int indentLevel)
958 void generateDeclaration (std::ostream& src, const BufferBlock& block, int bindingPoint, bool usePhysStorageBuffer)
974 const BufferVar& bufVar = *varIter;
1013 void generateImmMatrixSrc (std::ostream& src, glu::DataType basicType, int matrixStride, bool isRowMajor, bool singleCol, int colNumber, const void* valuePtr)
1017 const int compSize = sizeof(deUint32);
1018 const int numRows = glu::getDataTypeMatrixNumRows(basicType);
1019 const int numCols = glu::getDataTypeMatrixNumColumns(basicType);
1032 const deUint8* compPtr = (const deUint8*)valuePtr + (isRowMajor ? rowNdx*matrixStride + colNdx*compSize
1038 src << de::floatToString(*((const float*)compPtr), 1);
1050 const void* valuePtr,
1051 const char* resultVar,
1052 const char* typeName,
1053 const string shaderName)
1055 const int compSize = sizeof(deUint32);
1056 const int numRows = glu::getDataTypeMatrixNumRows(basicType);
1057 const int numCols = glu::getDataTypeMatrixNumColumns(basicType);
1065 const deUint8* compPtr = (const deUint8*)valuePtr + (isRowMajor ? rowNdex*matrixStride + colNdex*compSize
1068 src << de::floatToString(*((const float*)compPtr), 1);
1079 const deUint8* compPtr = (const deUint8*)valuePtr + (isRowMajor ? (rowNdex * matrixStride + colNdex * compSize)
1081 src << de::floatToString(*((const float*)compPtr), 1);
1090 void generateImmScalarVectorSrc (std::ostream& src, glu::DataType basicType, const void* valuePtr)
1098 const glu::DataType scalarType = glu::getDataTypeScalarType(basicType);
1099 const int scalarSize = glu::getDataTypeScalarSize(basicType);
1100 const size_t compSize = getDataTypeByteSize(scalarType);
1107 const deUint8* compPtr = (const deUint8*)valuePtr + scalarNdx*compSize;
1114 case glu::TYPE_FLOAT16: src << de::floatToString(deFloat16To32(*((const deFloat16*)compPtr)), 1); break;
1115 case glu::TYPE_FLOAT: src << de::floatToString(*((const float*)compPtr), 1); break;
1116 case glu::TYPE_INT8: src << (deUint32)*((const deInt8*)compPtr); break;
1117 case glu::TYPE_INT16: src << *((const deInt16*)compPtr); break;
1118 case glu::TYPE_INT: src << *((const int*)compPtr); break;
1119 case glu::TYPE_UINT8: src << (deUint32)*((const deUint8*)compPtr) << "u"; break;
1120 case glu::TYPE_UINT16: src << *((const deUint16*)compPtr) << "u"; break;
1121 case glu::TYPE_UINT: src << *((const deUint32*)compPtr) << "u"; break;
1122 case glu::TYPE_BOOL: src << (*((const deUint32*)compPtr) != 0u ? "true" : "false"); break;
1132 string getAPIName (const BufferBlock& block, const BufferVar& var, const glu::TypeComponentVector& accessPath)
1145 const VarType curType = glu::getVarType(var.getType(), accessPath.begin(), pathComp);
1146 const StructType* structPtr = curType.getStructPtr();
1164 string getShaderName (const BufferBlock& block, int instanceNdx, const BufferVar& var, const glu::TypeComponentVector& accessPath)
1188 const VarType curType = glu::getVarType(var.getType(), accessPath.begin(), pathComp);
1189 const StructType* structPtr = curType.getStructPtr();
1202 int computeOffset (const BufferVarLayoutEntry& varLayout, const glu::TypeComponentVector& accessPath)
1204 const int topLevelNdx = (accessPath.size() > 1 && accessPath.front().type == glu::VarTypeComponent::ARRAY_ELEMENT) ? accessPath.front().index : 0;
1205 const int bottomLevelNdx = (!accessPath.empty() && accessPath.back().type == glu::VarTypeComponent::ARRAY_ELEMENT) ? accessPath.back().index : 0;
1212 const char* resultVar,
1213 const BufferLayout& bufferLayout,
1214 const BufferBlock& block,
1216 const BlockDataPtr& blockPtr,
1217 const BufferVar& bufVar,
1218 const glu::SubTypeAccess& accessPath,
1221 const VarType curType = accessPath.getType();
1225 const int arraySize = curType.getArraySize() == VarType::UNSIZED_ARRAY ? block.getLastUnsizedArraySize(instanceNdx) : curType.getArraySize();
1232 const int numMembers = curType.getStructPtr()->getNumMembers();
1241 const string apiName = getAPIName(block, bufVar, accessPath.getPath());
1242 const int varNdx = bufferLayout.getVariableIndex(apiName);
1246 const BufferVarLayoutEntry& varLayout = bufferLayout.bufferVars[varNdx];
1247 const string shaderName = getShaderName(block, instanceNdx, bufVar, accessPath.getPath());
1248 const glu::DataType basicType = curType.getBasicType();
1249 const bool isMatrix = glu::isDataTypeMatrix(basicType);
1250 const char* typeName = glu::getDataTypeName(basicType);
1251 const void* valuePtr = (const deUint8*)blockPtr.ptr + computeOffset(varLayout, accessPath.getPath());
1267 const char* castName = "";
1280 void generateCompareSrc (std::ostream& src, const char* resultVar, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers, MatrixLoadFlags matrixLoadFlag)
1284 const BufferBlock& block = interface.getBlock(declNdx);
1285 const bool isArray = block.isArray();
1286 const int numInstances = isArray ? block.getArraySize() : 1;
1292 const string instanceName = block.getBlockName() + (isArray ? "[" + de::toString(instanceNdx) + "]" : string(""));
1293 const int blockNdx = layout.getBlockIndex(instanceName);
1294 const BlockDataPtr& blockPtr = blockPointers[blockNdx];
1298 const BufferVar& bufVar = *varIter;
1313 const BufferLayout& bufferLayout,
1314 const BufferBlock& block,
1316 const BlockDataPtr& blockPtr,
1317 const BufferVar& bufVar,
1318 const glu::SubTypeAccess& accessPath,
1321 const VarType curType = accessPath.getType();
1325 const int arraySize = curType.getArraySize() == VarType::UNSIZED_ARRAY ? block.getLastUnsizedArraySize(instanceNdx) : curType.getArraySize();
1332 const int numMembers = curType.getStructPtr()->getNumMembers();
1341 const string apiName = getAPIName(block, bufVar, accessPath.getPath());
1342 const int varNdx = bufferLayout.getVariableIndex(apiName);
1346 const BufferVarLayoutEntry& varLayout = bufferLayout.bufferVars[varNdx];
1347 const string shaderName = getShaderName(block, instanceNdx, bufVar, accessPath.getPath());
1348 const glu::DataType basicType = curType.getBasicType();
1349 const bool isMatrix = glu::isDataTypeMatrix(basicType);
1350 const void* valuePtr = (const deUint8*)blockPtr.ptr + computeOffset(varLayout, accessPath.getPath());
1352 const char* castName = "";
1391 void generateWriteSrc (std::ostream& src, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers, MatrixStoreFlags matrixStoreFlag)
1395 const BufferBlock& block = interface.getBlock(declNdx);
1396 const bool isArray = block.isArray();
1397 const int numInstances = isArray ? block.getArraySize() : 1;
1403 const string instanceName = block.getBlockName() + (isArray ? "[" + de::toString(instanceNdx) + "]" : string(""));
1404 const int blockNdx = layout.getBlockIndex(instanceName);
1405 const BlockDataPtr& blockPtr = blockPointers[blockNdx];
1409 const BufferVar& bufVar = *varIter;
1420 string generateComputeShader (const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& comparePtrs, const vector<BlockDataPtr>& writePtrs, MatrixLoadFlags matrixLoadFlag, MatrixStoreFlags matrixStoreFlag, bool usePhysStorageBuffer)
1445 std::vector<const StructType*> namedStructs;
1447 for (std::vector<const StructType*>::const_iterator structIter = namedStructs.begin(); structIter != namedStructs.end(); structIter++)
1453 const BufferBlock& block = interface.getBlock(blockNdx);
1462 const BufferBlock& block = interface.getBlock(blockNdx);
1499 void copyBufferVarData (const BufferVarLayoutEntry& dstEntry, const BlockDataPtr& dstBlockPtr, const BufferVarLayoutEntry& srcEntry, const BlockDataPtr& srcBlockPtr)
1506 deUint8* const dstBasePtr = (deUint8*)dstBlockPtr.ptr + dstEntry.offset;
1507 const deUint8* const srcBasePtr = (const deUint8*)srcBlockPtr.ptr + srcEntry.offset;
1508 const int scalarSize = glu::getDataTypeScalarSize(dstEntry.type);
1509 const bool isMatrix = glu::isDataTypeMatrix(dstEntry.type);
1511 const size_t compSize = getDataTypeByteSize(scalarType);
1512 const int dstArraySize = dstEntry.arraySize == 0 ? dstBlockPtr.lastUnsizedArraySize : dstEntry.arraySize;
1513 const int dstArrayStride = dstEntry.arrayStride;
1514 const int dstTopLevelSize = dstEntry.topLevelArraySize == 0 ? dstBlockPtr.lastUnsizedArraySize : dstEntry.topLevelArraySize;
1515 const int dstTopLevelStride = dstEntry.topLevelArrayStride;
1516 const int srcArraySize = srcEntry.arraySize == 0 ? srcBlockPtr.lastUnsizedArraySize : srcEntry.arraySize;
1517 const int srcArrayStride = srcEntry.arrayStride;
1518 const int srcTopLevelSize = srcEntry.topLevelArraySize == 0 ? srcBlockPtr.lastUnsizedArraySize : srcEntry.topLevelArraySize;
1519 const int srcTopLevelStride = srcEntry.topLevelArrayStride;
1526 deUint8* const dstTopPtr = dstBasePtr + topElemNdx*dstTopLevelStride;
1527 const deUint8* const srcTopPtr = srcBasePtr + topElemNdx*srcTopLevelStride;
1531 deUint8* const dstElemPtr = dstTopPtr + elementNdx*dstArrayStride;
1532 const deUint8* const srcElemPtr = srcTopPtr + elementNdx*srcArrayStride;
1536 const int numRows = glu::getDataTypeMatrixNumRows(dstEntry.type);
1537 const int numCols = glu::getDataTypeMatrixNumColumns(dstEntry.type);
1545 const deUint8* srcCompPtr = srcElemPtr + (srcEntry.isRowMajor ? rowNdx*srcEntry.matrixStride + colNdx*compSize
1564 void copyData (const BufferLayout& dstLayout, const vector<BlockDataPtr>& dstBlockPointers, const BufferLayout& srcLayout, const vector<BlockDataPtr>& srcBlockPointers)
1571 const BlockLayoutEntry& srcBlock = srcLayout.blocks[srcBlockNdx];
1572 const BlockDataPtr& srcBlockPtr = srcBlockPointers[srcBlockNdx];
1579 const BlockDataPtr& dstBlockPtr = dstBlockPointers[dstBlockNdx];
1583 const BufferVarLayoutEntry& srcEntry = srcLayout.bufferVars[*srcVarNdxIter];
1594 const BufferLayout& layout,
1595 const BufferBlock& block,
1597 const BlockDataPtr& srcBlockPtr,
1598 const BlockDataPtr& dstBlockPtr,
1599 const BufferVar& bufVar,
1600 const glu::SubTypeAccess& accessPath)
1602 const VarType curType = accessPath.getType();
1606 const int arraySize = curType.getArraySize() == VarType::UNSIZED_ARRAY ? block.getLastUnsizedArraySize(instanceNdx) : curType.getArraySize();
1613 const int numMembers = curType.getStructPtr()->getNumMembers();
1622 const string apiName = getAPIName(block, bufVar, accessPath.getPath());
1623 const int varNdx = layout.getVariableIndex(apiName);
1627 const BufferVarLayoutEntry& varLayout = layout.bufferVars[varNdx];
1633 void copyNonWrittenData (const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& srcPtrs, const vector<BlockDataPtr>& dstPtrs)
1637 const BufferBlock& block = interface.getBlock(declNdx);
1638 const bool isArray = block.isArray();
1639 const int numInstances = isArray ? block.getArraySize() : 1;
1645 const string instanceName = block.getBlockName() + (isArray ? "[" + de::toString(instanceNdx) + "]" : string(""));
1646 const int blockNdx = layout.getBlockIndex(instanceName);
1647 const BlockDataPtr& srcBlockPtr = srcPtrs[blockNdx];
1648 const BlockDataPtr& dstBlockPtr = dstPtrs[blockNdx];
1652 const BufferVar& bufVar = *varIter;
1663 bool compareComponents (glu::DataType scalarType, const void* ref, const void* res, int numComps)
1667 const float threshold = 0.05f; // Same as used in shaders - should be fine for values being used.
1671 const float refVal = *((const float*)ref + ndx);
1672 const float resVal = *((const float*)res + ndx);
1682 const deUint32 refVal = *((const deUint32*)ref + ndx);
1683 const deUint32 resVal = *((const deUint32*)res + ndx);
1707 bool compareBufferVarData (tcu::TestLog& log, const BufferVarLayoutEntry& refEntry, const BlockDataPtr& refBlockPtr, const BufferVarLayoutEntry& resEntry, const BlockDataPtr& resBlockPtr)
1714 deUint8* const resBasePtr = (deUint8*)resBlockPtr.ptr + resEntry.offset;
1715 const deUint8* const refBasePtr = (const deUint8*)refBlockPtr.ptr + refEntry.offset;
1716 const glu::DataType scalarType = glu::getDataTypeScalarType(refEntry.type);
1717 const int scalarSize = glu::getDataTypeScalarSize(resEntry.type);
1718 const bool isMatrix = glu::isDataTypeMatrix(resEntry.type);
1719 const size_t compSize = getDataTypeByteSize(scalarType);
1720 const int maxPrints = 3;
1723 const int resArraySize = resEntry.arraySize == 0 ? resBlockPtr.lastUnsizedArraySize : resEntry.arraySize;
1724 const int resArrayStride = resEntry.arrayStride;
1725 const int resTopLevelSize = resEntry.topLevelArraySize == 0 ? resBlockPtr.lastUnsizedArraySize : resEntry.topLevelArraySize;
1726 const int resTopLevelStride = resEntry.topLevelArrayStride;
1727 const int refArraySize = refEntry.arraySize == 0 ? refBlockPtr.lastUnsizedArraySize : refEntry.arraySize;
1728 const int refArrayStride = refEntry.arrayStride;
1729 const int refTopLevelSize = refEntry.topLevelArraySize == 0 ? refBlockPtr.lastUnsizedArraySize : refEntry.topLevelArraySize;
1730 const int refTopLevelStride = refEntry.topLevelArrayStride;
1737 deUint8* const resTopPtr = resBasePtr + topElemNdx*resTopLevelStride;
1738 const deUint8* const refTopPtr = refBasePtr + topElemNdx*refTopLevelStride;
1742 deUint8* const resElemPtr = resTopPtr + elementNdx*resArrayStride;
1743 const deUint8* const refElemPtr = refTopPtr + elementNdx*refArrayStride;
1747 const int numRows = glu::getDataTypeMatrixNumRows(resEntry.type);
1748 const int numCols = glu::getDataTypeMatrixNumColumns(resEntry.type);
1757 const deUint8* refCompPtr = refElemPtr + (refEntry.isRowMajor ? rowNdx*refEntry.matrixStride + colNdx*compSize
1787 const bool isOk = compareComponents(scalarType, resElemPtr, refElemPtr, scalarSize);
1813 bool compareData (tcu::TestLog& log, const BufferLayout& refLayout, const vector<BlockDataPtr>& refBlockPointers, const BufferLayout& resLayout, const vector<BlockDataPtr>& resBlockPointers)
1815 const int numBlocks = (int)refLayout.blocks.size();
1820 const BlockLayoutEntry& refBlock = refLayout.blocks[refBlockNdx];
1821 const BlockDataPtr& refBlockPtr = refBlockPointers[refBlockNdx];
1828 const BlockDataPtr& resBlockPtr = resBlockPointers[resBlockNdx];
1832 const BufferVarLayoutEntry& refEntry = refLayout.bufferVars[*refVarNdxIter];
1837 const BufferVarLayoutEntry& resEntry = resLayout.bufferVars[resVarNdx];
1847 string getBlockAPIName (const BufferBlock& block, int instanceNdx)
1858 static bool hasUnsizedArray (const BufferLayout& layout, const BlockLayoutEntry& entry)
1869 static int getUnsizedArrayStride (const BufferLayout& layout, const BlockLayoutEntry& entry)
1873 const BufferVarLayoutEntry& varEntry = layout.bufferVars[*varNdx];
1884 vector<int> computeBufferSizes (const ShaderInterface& interface, const BufferLayout& layout)
1890 const BufferBlock& block = interface.getBlock(declNdx);
1891 const bool isArray = block.isArray();
1892 const int numInstances = isArray ? block.getArraySize() : 1;
1896 const string apiName = getBlockAPIName(block, instanceNdx);
1897 const int blockNdx = layout.getBlockIndex(apiName);
1901 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1902 const int baseSize = blockLayout.size;
1903 const bool isLastUnsized = hasUnsizedArray(layout, blockLayout);
1904 const int lastArraySize = isLastUnsized ? block.getLastUnsizedArraySize(instanceNdx) : 0;
1905 const int stride = isLastUnsized ? getUnsizedArrayStride(layout, blockLayout) : 0;
1915 BlockDataPtr getBlockDataPtr (const BufferLayout& layout, const BlockLayoutEntry& blockLayout, void* ptr, int bufferSize)
1917 const bool isLastUnsized = hasUnsizedArray(layout, blockLayout);
1918 const int baseSize = blockLayout.size;
1922 const int lastArrayStride = getUnsizedArrayStride(layout, blockLayout);
1923 const int lastArraySize = (bufferSize-baseSize) / (lastArrayStride ? lastArrayStride : 1);
1952 void initRefDataStorage (const ShaderInterface& interface, const BufferLayout& layout, RefDataStorage& storage)
1956 const vector<int> bufferSizes = computeBufferSizes(interface, layout);
1958 const int vec4Alignment = (int)sizeof(deUint32)*4;
1980 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1981 const int bufferSize = bufferSizes[blockNdx];
1992 vector<BlockDataPtr> blockLocationsToPtrs (const BufferLayout& layout, const vector<BlockLocation>& blockLocations, const vector<void*>& bufPtrs)
2000 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
2001 const BlockLocation& location = blockLocations[blockNdx];
2013 const vk::DeviceInterface& vkd = context.getDeviceInterface();
2014 const vk::VkMemoryRequirements bufReqs = vk::getBufferMemoryRequirements(vkd, context.getDevice(), buffer);
2024 const vk::VkDevice vkDevice = context.getDevice();
2025 const vk::DeviceInterface& vk = context.getDeviceInterface();
2026 const deUint32 queueFamilyIndex = context.getUniversalQueueFamilyIndex();
2028 const vk::VkBufferCreateInfo bufferInfo =
2031 DE_NULL, // const void* pNext;
2037 &queueFamilyIndex // const deUint32* pQueueFamilyIndices;
2050 const ShaderInterface& interface,
2051 const BufferLayout& refLayout,
2052 const RefDataStorage& initialData,
2053 const RefDataStorage& writeData,
2060 const ShaderInterface& m_interface;
2061 const BufferLayout& m_refLayout;
2062 const RefDataStorage& m_initialData; // Initial data stored in buffer.
2063 const RefDataStorage& m_writeData; // Data written by compute shader.
2064 const bool m_usePhysStorageBuffer;
2075 const ShaderInterface& interface,
2076 const BufferLayout& refLayout,
2077 const RefDataStorage& initialData,
2078 const RefDataStorage& writeData,
2097 const vk::DeviceInterface& vk = m_context.getDeviceInterface();
2098 const vk::VkDevice device = m_context.getDevice();
2099 const vk::VkQueue queue = m_context.getUniversalQueue();
2100 const deUint32 queueFamilyIndex = m_context.getUniversalQueueFamilyIndex();
2103 const deUint32 acBufferSize = 1024;
2117 const int numBindings = m_interface.getNumBlocks();
2120 const BufferBlock& block = m_interface.getBlock(bindingNdx);
2138 const vk::Unique<vk::VkDescriptorSetLayout> descriptorSetLayout(setLayoutBuilder.build(vk, device));
2139 const vk::Unique<vk::VkDescriptorPool> descriptorPool(poolBuilder.build(vk, device, vk::VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u));
2141 const vk::VkDescriptorSetAllocateInfo allocInfo =
2150 const vk::Unique<vk::VkDescriptorSet> descriptorSet(allocateDescriptorSet(vk, device, &allocInfo));
2151 const vk::VkDescriptorBufferInfo descriptorInfo = makeDescriptorBufferInfo(*acBuffer, 0ull, acBufferSize);
2171 const std::vector<int> bufferSizes = computeBufferSizes(m_interface, m_refLayout);
2183 const deUint32 bufferSize = bufferSizes[blockNdx];
2205 const int bindingAlignment = (int)properties.limits.minStorageBufferOffsetAlignment;
2209 const int bufferSize = bufferSizes[blockNdx];
2219 const int totalBufferSize = curOffset;
2227 const deUint32 bufferSize = bufferSizes[blockNdx];
2228 const deUint32 offset = blockLocations[blockNdx].offset;
2242 const BufferBlock& block = m_interface.getBlock(bindingNdx);
2243 const int numBlocksInBinding = (block.isArray() ? block.getArraySize() : 1);
2269 //const bool useKHR = m_context.isDeviceFunctionalitySupported("VK_KHR_buffer_device_address");
2274 DE_NULL, // const void* pNext;
2293 const vk::VkPushConstantRange pushConstRange =
2303 const vk::VkPipelineLayoutCreateInfo pipelineLayoutParams =
2306 DE_NULL, // const void* pNext;
2309 &*descriptorSetLayout, // const VkDescriptorSetLayout* pSetLayouts;
2311 &pushConstRange, // const VkPushConstantRange* pPushConstantRanges;
2318 const vk::VkPipelineShaderStageCreateInfo pipelineShaderStageParams =
2321 DE_NULL, // const void* pNext;
2326 DE_NULL, // const VkSpecializationInfo* pSpecializationInfo;
2328 const vk::VkComputePipelineCreateInfo pipelineCreateInfo =
2331 DE_NULL, // const void* pNext;
2363 const vk::VkBuffer uniformBuffer = m_uniformBuffers[blockNdx].get()->get();
2365 const vk::VkBufferMemoryBarrier barrier =
2382 const vk::VkBuffer uniformBuffer = m_uniformBuffers[0].get()->get();
2388 const vk::VkBufferMemoryBarrier barrier =
2412 const int refCount = 1;
2417 resCount = *((const int*)acBufferAlloc->getHostPtr());
2433 const bool compareOk = compareData(m_context.getTestContext().getLog(), m_refLayout, m_writeData.pointers, m_refLayout, mappedBlockPtrs);
2447 SSBOLayoutCase::SSBOLayoutCase (tcu::TestContext& testCtx, const char* name, BufferMode bufferMode, MatrixLoadFlags matrixLoadFlag, MatrixStoreFlags matrixStoreFlag, bool usePhysStorageBuffer)
2460 void SSBOLayoutCase::initPrograms (vk::SourceCollections& programCollection) const
2479 TestInstance* SSBOLayoutCase::createInstance (Context& context) const
2484 void SSBOLayoutCase::checkSupport(Context& context) const
2500 const vk::VkPhysicalDeviceProperties &properties = context.getDeviceProperties();