Lines Matching defs:const

71 std::ostream& operator<< (std::ostream& str, const LayoutFlagsFmt& fmt)
73 static const struct
76 const char* token;
104 BufferVar::BufferVar (const char* name, const VarType& type, deUint32 flags)
113 BufferBlock::BufferBlock (const char* blockName)
140 std::ostream& operator<< (std::ostream& stream, const BlockLayoutEntry& entry)
184 static bool isUnsizedArray (const BufferVarLayoutEntry& entry)
190 std::ostream& operator<< (std::ostream& stream, const BufferVarLayoutEntry& entry)
211 int getVariableIndex (const string& name) const;
212 int getBlockIndex (const string& name) const;
217 int BufferLayout::getVariableIndex (const string& name) const
227 int BufferLayout::getBlockIndex (const string& name) const
252 StructType& ShaderInterface::allocStruct (const char* name)
263 StructNameEquals (const char* name_) : name(name_) {}
265 bool operator() (const StructType* type) const
271 const StructType* ShaderInterface::findStruct (const char* name) const
277 void ShaderInterface::getNamedStructs (std::vector<const StructType*>& structs) const
286 BufferBlock& ShaderInterface::allocBlock (const char* name)
319 int findBlockIndex (const BufferLayout& layout, const string& name)
366 int computeStd140BaseAlignment (const VarType& type, deUint32 layoutFlags)
368 const int vec4Alignment = (int)sizeof(deUint32)*4;
376 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
377 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(basicType)
379 const int vecAlign = deAlign32(getDataTypeByteAlignment(glu::getDataTypeFloatVec(vecSize)), vec4Alignment);
406 int computeStd430BaseAlignment (const VarType& type, deUint32 layoutFlags)
417 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
418 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(basicType)
420 const int vecAlign = getDataTypeByteAlignment(glu::getDataTypeFloatVec(vecSize));
446 const deUint32 packingMask = LAYOUT_PACKED|LAYOUT_SHARED|LAYOUT_STD140|LAYOUT_STD430;
447 const deUint32 matrixMask = LAYOUT_ROW_MAJOR|LAYOUT_COLUMN_MAJOR;
462 const std::string& curPrefix,
463 const VarType& type,
468 const bool isStd140 = (layoutFlags & LAYOUT_STD140) != 0;
469 const int baseAlignment = isStd140 ? computeStd140BaseAlignment(type, layoutFlags)
472 const int topLevelArraySize = 1; // Default values
473 const int topLevelArrayStride = 0;
477 const glu::DataType basicType = type.getBasicType();
492 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
493 const int numVecs = isRowMajor ? glu::getDataTypeMatrixNumRows(basicType)
514 const VarType& elemType = type.getElementType();
519 const glu::DataType elemBasicType = elemType.getBasicType();
520 const int stride = baseAlignment;
540 const glu::DataType elemBasicType = elemType.getBasicType();
541 const bool isRowMajor = !!(layoutFlags & LAYOUT_ROW_MAJOR);
542 const int numVecs = isRowMajor ? glu::getDataTypeMatrixNumRows(elemBasicType)
544 const int vecStride = baseAlignment;
584 int computeReferenceLayout (BufferLayout& layout, int curBlockNdx, const std::string& blockPrefix, int baseOffset, const BufferVar& bufVar, deUint32 blockLayoutFlags)
586 const VarType& varType = bufVar.getType();
587 const deUint32 combinedFlags = mergeLayoutFlags(blockLayoutFlags, bufVar.getFlags());
592 const int topLevelArraySize = varType.getArraySize() == VarType::UNSIZED_ARRAY ? 0 : varType.getArraySize();
593 const string prefix = blockPrefix + bufVar.getName() + "[0]";
594 const bool isStd140 = (blockLayoutFlags & LAYOUT_STD140) != 0;
595 const int vec4Align = (int)sizeof(deUint32)*4;
596 const int baseAlignment = isStd140 ? computeStd140BaseAlignment(varType, combinedFlags)
599 const VarType& elemType = varType.getElementType();
604 const glu::DataType elemBasicType = elemType.getBasicType();
605 const int elemBaseAlign = getDataTypeByteAlignment(elemBasicType);
606 const int stride = isStd140 ? deAlign32(elemBaseAlign, vec4Align) : elemBaseAlign;
626 const glu::DataType elemBasicType = elemType.getBasicType();
627 const bool isRowMajor = !!(combinedFlags & LAYOUT_ROW_MAJOR);
628 const int vecSize = isRowMajor ? glu::getDataTypeMatrixNumColumns(elemBasicType)
630 const int numVecs = isRowMajor ? glu::getDataTypeMatrixNumRows(elemBasicType)
632 const glu::DataType vecType = glu::getDataTypeFloatVec(vecSize);
633 const int vecBaseAlign = getDataTypeByteAlignment(vecType);
634 const int stride = isStd140 ? deAlign32(vecBaseAlign, vec4Align) : vecBaseAlign;
663 const int firstChildNdx = (int)layout.bufferVars.size();
664 const int stride = computeReferenceLayout(layout, curBlockNdx, curOffset, prefix, varType.getElementType(), combinedFlags);
681 void computeReferenceLayout (BufferLayout& layout, const ShaderInterface& interface)
687 const BufferBlock& block = interface.getBlock(blockNdx);
696 const BufferVar& bufVar = *varIter;
726 void generateValue (const BufferVarLayoutEntry& entry, int unsizedArraySize, void* basePtr, de::Random& rnd)
728 const glu::DataType scalarType = glu::getDataTypeScalarType(entry.type);
729 const int scalarSize = glu::getDataTypeScalarSize(entry.type);
730 const int arraySize = entry.arraySize == 0 ? unsizedArraySize : entry.arraySize;
731 const int arrayStride = entry.arrayStride;
732 const int topLevelSize = entry.topLevelArraySize == 0 ? unsizedArraySize : entry.topLevelArraySize;
733 const int topLevelStride = entry.topLevelArrayStride;
734 const bool isMatrix = glu::isDataTypeMatrix(entry.type);
735 const int numVecs = isMatrix ? (entry.isRowMajor ? glu::getDataTypeMatrixNumRows(entry.type) : glu::getDataTypeMatrixNumColumns(entry.type)) : 1;
736 const int vecSize = scalarSize / numVecs;
737 const int compSize = sizeof(deUint32);
745 deUint8* const topElemPtr = (deUint8*)basePtr + entry.offset + topElemNdx*topLevelStride;
749 deUint8* const elemPtr = topElemPtr + elemNdx*arrayStride;
753 deUint8* const vecPtr = elemPtr + (isMatrix ? vecNdx*entry.matrixStride : 0);
757 deUint8* const compPtr = vecPtr + compSize*compNdx;
776 void generateValues (const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers, deUint32 seed)
779 const int numBlocks = (int)layout.blocks.size();
785 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
786 const BlockDataPtr& blockPtr = blockPointers[blockNdx];
787 const int numEntries = (int)layout.blocks[blockNdx].activeVarIndices.size();
791 const int varNdx = blockLayout.activeVarIndices[entryNdx];
792 const BufferVarLayoutEntry& varEntry = layout.bufferVars[varNdx];
801 const char* getCompareFuncForType (glu::DataType type)
867 void collectUniqueBasicTypes (std::set<glu::DataType>& basicTypes, const VarType& type)
883 void collectUniqueBasicTypes (std::set<glu::DataType>& basicTypes, const BufferBlock& bufferBlock)
889 void collectUniqueBasicTypes (std::set<glu::DataType>& basicTypes, const ShaderInterface& interface)
895 void generateCompareFuncs (std::ostream& str, const ShaderInterface& interface)
922 std::ostream& operator<< (std::ostream& str, const Indent& indent)
929 void generateDeclaration (std::ostream& src, const BufferVar& bufferVar, int indentLevel)
939 void generateDeclaration (std::ostream& src, const BufferBlock& block, int bindingPoint)
974 void generateImmMatrixSrc (std::ostream& src, glu::DataType basicType, int matrixStride, bool isRowMajor, const void* valuePtr)
978 const int compSize = sizeof(deUint32);
979 const int numRows = glu::getDataTypeMatrixNumRows(basicType);
980 const int numCols = glu::getDataTypeMatrixNumColumns(basicType);
989 const deUint8* compPtr = (const deUint8*)valuePtr + (isRowMajor ? rowNdx*matrixStride + colNdx*compSize
995 src << de::floatToString(*((const float*)compPtr), 1);
1002 void generateImmScalarVectorSrc (std::ostream& src, glu::DataType basicType, const void* valuePtr)
1009 const glu::DataType scalarType = glu::getDataTypeScalarType(basicType);
1010 const int scalarSize = glu::getDataTypeScalarSize(basicType);
1011 const int compSize = sizeof(deUint32);
1018 const deUint8* compPtr = (const deUint8*)valuePtr + scalarNdx*compSize;
1025 case glu::TYPE_FLOAT: src << de::floatToString(*((const float*)compPtr), 1); break;
1026 case glu::TYPE_INT: src << *((const int*)compPtr); break;
1027 case glu::TYPE_UINT: src << *((const deUint32*)compPtr) << "u"; break;
1028 case glu::TYPE_BOOL: src << (*((const deUint32*)compPtr) != 0u ? "true" : "false"); break;
1038 string getAPIName (const BufferBlock& block, const BufferVar& var, const glu::TypeComponentVector& accessPath)
1051 const VarType curType = glu::getVarType(var.getType(), accessPath.begin(), pathComp);
1052 const StructType* structPtr = curType.getStructPtr();
1070 string getShaderName (const BufferBlock& block, int instanceNdx, const BufferVar& var, const glu::TypeComponentVector& accessPath)
1092 const VarType curType = glu::getVarType(var.getType(), accessPath.begin(), pathComp);
1093 const StructType* structPtr = curType.getStructPtr();
1106 int computeOffset (const BufferVarLayoutEntry& varLayout, const glu::TypeComponentVector& accessPath)
1108 const int topLevelNdx = (accessPath.size() > 1 && accessPath.front().type == glu::VarTypeComponent::ARRAY_ELEMENT) ? accessPath.front().index : 0;
1109 const int bottomLevelNdx = (!accessPath.empty() && accessPath.back().type == glu::VarTypeComponent::ARRAY_ELEMENT) ? accessPath.back().index : 0;
1116 const char* resultVar,
1117 const BufferLayout& bufferLayout,
1118 const BufferBlock& block,
1120 const BlockDataPtr& blockPtr,
1121 const BufferVar& bufVar,
1122 const glu::SubTypeAccess& accessPath)
1124 const VarType curType = accessPath.getType();
1128 const int arraySize = curType.getArraySize() == VarType::UNSIZED_ARRAY ? block.getLastUnsizedArraySize(instanceNdx) : curType.getArraySize();
1135 const int numMembers = curType.getStructPtr()->getNumMembers();
1144 const string apiName = getAPIName(block, bufVar, accessPath.getPath());
1145 const int varNdx = bufferLayout.getVariableIndex(apiName);
1149 const BufferVarLayoutEntry& varLayout = bufferLayout.bufferVars[varNdx];
1150 const string shaderName = getShaderName(block, instanceNdx, bufVar, accessPath.getPath());
1151 const glu::DataType basicType = curType.getBasicType();
1152 const bool isMatrix = glu::isDataTypeMatrix(basicType);
1153 const char* typeName = glu::getDataTypeName(basicType);
1154 const void* valuePtr = (const deUint8*)blockPtr.ptr + computeOffset(varLayout, accessPath.getPath());
1168 void generateCompareSrc (std::ostream& src, const char* resultVar, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers)
1172 const BufferBlock& block = interface.getBlock(declNdx);
1173 const bool isArray = block.isArray();
1174 const int numInstances = isArray ? block.getArraySize() : 1;
1180 const string instanceName = block.getBlockName() + (isArray ? "[" + de::toString(instanceNdx) + "]" : string(""));
1181 const int blockNdx = layout.getBlockIndex(instanceName);
1182 const BlockDataPtr& blockPtr = blockPointers[blockNdx];
1186 const BufferVar& bufVar = *varIter;
1201 const BufferLayout& bufferLayout,
1202 const BufferBlock& block,
1204 const BlockDataPtr& blockPtr,
1205 const BufferVar& bufVar,
1206 const glu::SubTypeAccess& accessPath)
1208 const VarType curType = accessPath.getType();
1212 const int arraySize = curType.getArraySize() == VarType::UNSIZED_ARRAY ? block.getLastUnsizedArraySize(instanceNdx) : curType.getArraySize();
1219 const int numMembers = curType.getStructPtr()->getNumMembers();
1228 const string apiName = getAPIName(block, bufVar, accessPath.getPath());
1229 const int varNdx = bufferLayout.getVariableIndex(apiName);
1233 const BufferVarLayoutEntry& varLayout = bufferLayout.bufferVars[varNdx];
1234 const string shaderName = getShaderName(block, instanceNdx, bufVar, accessPath.getPath());
1235 const glu::DataType basicType = curType.getBasicType();
1236 const bool isMatrix = glu::isDataTypeMatrix(basicType);
1237 const void* valuePtr = (const deUint8*)blockPtr.ptr + computeOffset(varLayout, accessPath.getPath());
1251 void generateWriteSrc (std::ostream& src, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers)
1255 const BufferBlock& block = interface.getBlock(declNdx);
1256 const bool isArray = block.isArray();
1257 const int numInstances = isArray ? block.getArraySize() : 1;
1263 const string instanceName = block.getBlockName() + (isArray ? "[" + de::toString(instanceNdx) + "]" : string(""));
1264 const int blockNdx = layout.getBlockIndex(instanceName);
1265 const BlockDataPtr& blockPtr = blockPointers[blockNdx];
1269 const BufferVar& bufVar = *varIter;
1280 string generateComputeShader (const glw::Functions& gl, glu::GLSLVersion glslVersion, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& comparePtrs, const vector<BlockDataPtr>& writePtrs)
1295 std::vector<const StructType*> namedStructs;
1297 for (std::vector<const StructType*>::const_iterator structIter = namedStructs.begin(); structIter != namedStructs.end(); structIter++)
1305 const BufferBlock& block = interface.getBlock(blockNdx);
1348 void getGLBufferLayout (const glw::Functions& gl, BufferLayout& layout, deUint32 program)
1363 const deUint32 queryParams[] = { GL_BUFFER_DATA_SIZE, GL_NUM_ACTIVE_VARIABLES, GL_NAME_LENGTH };
1382 const int numBlockVars = returnValues[1];
1383 const deUint32 queryArg = GL_ACTIVE_VARIABLES;
1397 const int nameLen = returnValues[2];
1419 const deUint32 queryParams[] =
1460 const int nameLen = returnValues[9];
1479 void copyBufferVarData (const BufferVarLayoutEntry& dstEntry, const BlockDataPtr& dstBlockPtr, const BufferVarLayoutEntry& srcEntry, const BlockDataPtr& srcBlockPtr)
1486 deUint8* const dstBasePtr = (deUint8*)dstBlockPtr.ptr + dstEntry.offset;
1487 const deUint8* const srcBasePtr = (const deUint8*)srcBlockPtr.ptr + srcEntry.offset;
1488 const int scalarSize = glu::getDataTypeScalarSize(dstEntry.type);
1489 const bool isMatrix = glu::isDataTypeMatrix(dstEntry.type);
1490 const int compSize = sizeof(deUint32);
1491 const int dstArraySize = dstEntry.arraySize == 0 ? dstBlockPtr.lastUnsizedArraySize : dstEntry.arraySize;
1492 const int dstArrayStride = dstEntry.arrayStride;
1493 const int dstTopLevelSize = dstEntry.topLevelArraySize == 0 ? dstBlockPtr.lastUnsizedArraySize : dstEntry.topLevelArraySize;
1494 const int dstTopLevelStride = dstEntry.topLevelArrayStride;
1495 const int srcArraySize = srcEntry.arraySize == 0 ? srcBlockPtr.lastUnsizedArraySize : srcEntry.arraySize;
1496 const int srcArrayStride = srcEntry.arrayStride;
1497 const int srcTopLevelSize = srcEntry.topLevelArraySize == 0 ? srcBlockPtr.lastUnsizedArraySize : srcEntry.topLevelArraySize;
1498 const int srcTopLevelStride = srcEntry.topLevelArrayStride;
1505 deUint8* const dstTopPtr = dstBasePtr + topElemNdx*dstTopLevelStride;
1506 const deUint8* const srcTopPtr = srcBasePtr + topElemNdx*srcTopLevelStride;
1510 deUint8* const dstElemPtr = dstTopPtr + elementNdx*dstArrayStride;
1511 const deUint8* const srcElemPtr = srcTopPtr + elementNdx*srcArrayStride;
1515 const int numRows = glu::getDataTypeMatrixNumRows(dstEntry.type);
1516 const int numCols = glu::getDataTypeMatrixNumColumns(dstEntry.type);
1524 const deUint8* srcCompPtr = srcElemPtr + (srcEntry.isRowMajor ? rowNdx*srcEntry.matrixStride + colNdx*compSize
1543 void copyData (const BufferLayout& dstLayout, const vector<BlockDataPtr>& dstBlockPointers, const BufferLayout& srcLayout, const vector<BlockDataPtr>& srcBlockPointers)
1550 const BlockLayoutEntry& srcBlock = srcLayout.blocks[srcBlockNdx];
1551 const BlockDataPtr& srcBlockPtr = srcBlockPointers[srcBlockNdx];
1558 const BlockDataPtr& dstBlockPtr = dstBlockPointers[dstBlockNdx];
1562 const BufferVarLayoutEntry& srcEntry = srcLayout.bufferVars[*srcVarNdxIter];
1573 const BufferLayout& layout,
1574 const BufferBlock& block,
1576 const BlockDataPtr& srcBlockPtr,
1577 const BlockDataPtr& dstBlockPtr,
1578 const BufferVar& bufVar,
1579 const glu::SubTypeAccess& accessPath)
1581 const VarType curType = accessPath.getType();
1585 const int arraySize = curType.getArraySize() == VarType::UNSIZED_ARRAY ? block.getLastUnsizedArraySize(instanceNdx) : curType.getArraySize();
1592 const int numMembers = curType.getStructPtr()->getNumMembers();
1601 const string apiName = getAPIName(block, bufVar, accessPath.getPath());
1602 const int varNdx = layout.getVariableIndex(apiName);
1606 const BufferVarLayoutEntry& varLayout = layout.bufferVars[varNdx];
1612 void copyNonWrittenData (const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& srcPtrs, const vector<BlockDataPtr>& dstPtrs)
1616 const BufferBlock& block = interface.getBlock(declNdx);
1617 const bool isArray = block.isArray();
1618 const int numInstances = isArray ? block.getArraySize() : 1;
1624 const string instanceName = block.getBlockName() + (isArray ? "[" + de::toString(instanceNdx) + "]" : string(""));
1625 const int blockNdx = layout.getBlockIndex(instanceName);
1626 const BlockDataPtr& srcBlockPtr = srcPtrs[blockNdx];
1627 const BlockDataPtr& dstBlockPtr = dstPtrs[blockNdx];
1631 const BufferVar& bufVar = *varIter;
1642 bool compareComponents (glu::DataType scalarType, const void* ref, const void* res, int numComps)
1646 const float threshold = 0.05f; // Same as used in shaders - should be fine for values being used.
1650 const float refVal = *((const float*)ref + ndx);
1651 const float resVal = *((const float*)res + ndx);
1661 const deUint32 refVal = *((const deUint32*)ref + ndx);
1662 const deUint32 resVal = *((const deUint32*)res + ndx);
1674 const deUint32 refVal = *((const deUint32*)ref + ndx);
1675 const deUint32 resVal = *((const deUint32*)res + ndx);
1685 bool compareBufferVarData (tcu::TestLog& log, const BufferVarLayoutEntry& refEntry, const BlockDataPtr& refBlockPtr, const BufferVarLayoutEntry& resEntry, const BlockDataPtr& resBlockPtr)
1692 deUint8* const resBasePtr = (deUint8*)resBlockPtr.ptr + resEntry.offset;
1693 const deUint8* const refBasePtr = (const deUint8*)refBlockPtr.ptr + refEntry.offset;
1694 const glu::DataType scalarType = glu::getDataTypeScalarType(refEntry.type);
1695 const int scalarSize = glu::getDataTypeScalarSize(resEntry.type);
1696 const bool isMatrix = glu::isDataTypeMatrix(resEntry.type);
1697 const int compSize = sizeof(deUint32);
1698 const int maxPrints = 3;
1701 const int resArraySize = resEntry.arraySize == 0 ? resBlockPtr.lastUnsizedArraySize : resEntry.arraySize;
1702 const int resArrayStride = resEntry.arrayStride;
1703 const int resTopLevelSize = resEntry.topLevelArraySize == 0 ? resBlockPtr.lastUnsizedArraySize : resEntry.topLevelArraySize;
1704 const int resTopLevelStride = resEntry.topLevelArrayStride;
1705 const int refArraySize = refEntry.arraySize == 0 ? refBlockPtr.lastUnsizedArraySize : refEntry.arraySize;
1706 const int refArrayStride = refEntry.arrayStride;
1707 const int refTopLevelSize = refEntry.topLevelArraySize == 0 ? refBlockPtr.lastUnsizedArraySize : refEntry.topLevelArraySize;
1708 const int refTopLevelStride = refEntry.topLevelArrayStride;
1715 deUint8* const resTopPtr = resBasePtr + topElemNdx*resTopLevelStride;
1716 const deUint8* const refTopPtr = refBasePtr + topElemNdx*refTopLevelStride;
1720 deUint8* const resElemPtr = resTopPtr + elementNdx*resArrayStride;
1721 const deUint8* const refElemPtr = refTopPtr + elementNdx*refArrayStride;
1725 const int numRows = glu::getDataTypeMatrixNumRows(resEntry.type);
1726 const int numCols = glu::getDataTypeMatrixNumColumns(resEntry.type);
1735 const deUint8* refCompPtr = refElemPtr + (refEntry.isRowMajor ? rowNdx*refEntry.matrixStride + colNdx*compSize
1765 const bool isOk = compareComponents(scalarType, resElemPtr, refElemPtr, scalarSize);
1791 bool compareData (tcu::TestLog& log, const BufferLayout& refLayout, const vector<BlockDataPtr>& refBlockPointers, const BufferLayout& resLayout, const vector<BlockDataPtr>& resBlockPointers)
1793 const int numBlocks = (int)refLayout.blocks.size();
1798 const BlockLayoutEntry& refBlock = refLayout.blocks[refBlockNdx];
1799 const BlockDataPtr& refBlockPtr = refBlockPointers[refBlockNdx];
1806 const BlockDataPtr& resBlockPtr = resBlockPointers[resBlockNdx];
1810 const BufferVarLayoutEntry& refEntry = refLayout.bufferVars[*refVarNdxIter];
1815 const BufferVarLayoutEntry& resEntry = resLayout.bufferVars[resVarNdx];
1825 string getBlockAPIName (const BufferBlock& block, int instanceNdx)
1836 static bool hasUnsizedArray (const BufferLayout& layout, const BlockLayoutEntry& entry)
1847 static int getUnsizedArrayStride (const BufferLayout& layout, const BlockLayoutEntry& entry)
1851 const BufferVarLayoutEntry& varEntry = layout.bufferVars[*varNdx];
1862 vector<int> computeBufferSizes (const ShaderInterface& interface, const BufferLayout& layout)
1868 const BufferBlock& block = interface.getBlock(declNdx);
1869 const bool isArray = block.isArray();
1870 const int numInstances = isArray ? block.getArraySize() : 1;
1874 const string apiName = getBlockAPIName(block, instanceNdx);
1875 const int blockNdx = layout.getBlockIndex(apiName);
1879 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1880 const int baseSize = blockLayout.size;
1881 const bool isLastUnsized = hasUnsizedArray(layout, blockLayout);
1882 const int lastArraySize = isLastUnsized ? block.getLastUnsizedArraySize(instanceNdx) : 0;
1883 const int stride = isLastUnsized ? getUnsizedArrayStride(layout, blockLayout) : 0;
1893 BlockDataPtr getBlockDataPtr (const BufferLayout& layout, const BlockLayoutEntry& blockLayout, void* ptr, int bufferSize)
1895 const bool isLastUnsized = hasUnsizedArray(layout, blockLayout);
1896 const int baseSize = blockLayout.size;
1900 const int lastArrayStride = getUnsizedArrayStride(layout, blockLayout);
1901 const int lastArraySize = (bufferSize-baseSize) / (lastArrayStride ? lastArrayStride : 1);
1936 void initRefDataStorage (const ShaderInterface& interface, const BufferLayout& layout, RefDataStorage& storage)
1940 const vector<int> bufferSizes = computeBufferSizes(interface, layout);
1960 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1961 const int bufferSize = bufferSizes[blockNdx];
1970 vector<BlockDataPtr> blockLocationsToPtrs (const BufferLayout& layout, const vector<BlockLocation>& blockLocations, const vector<void*>& bufPtrs)
1978 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1979 const BlockLocation& location = blockLocations[blockNdx];
1987 vector<void*> mapBuffers (const glw::Functions& gl, const vector<Buffer>& buffers, deUint32 access)
2023 void unmapBuffers (const glw::Functions& gl, const vector<Buffer>& buffers)
2042 BufferManager (const glu::RenderContext& renderCtx);
2048 BufferManager (const BufferManager& other);
2049 BufferManager& operator= (const BufferManager& other);
2051 const glu::RenderContext& m_renderCtx;
2055 BufferManager::BufferManager (const glu::RenderContext& renderCtx)
2084 SSBOLayoutCase::SSBOLayoutCase (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const char* name, const char* description, glu::GLSLVersion glslVersion, BufferMode bufferMode)
2100 const glw::Functions& gl = m_renderCtx.getFunctions();
2121 const glu::ShaderProgram program(m_renderCtx, glu::ProgramSources() << glu::ComputeSource(generateComputeShader(gl, m_glslVersion, m_interface, refLayout, initialData.pointers, writeData.pointers)));
2167 const int numBlocks = (int)glLayout.blocks.size();
2168 const vector<int> bufferSizes = computeBufferSizes(m_interface, glLayout);
2180 const int bufferSize = bufferSizes[blockNdx];
2200 const int bufferSize = bufferSizes[blockNdx];
2217 const int bufferSize = buffers[bufNdx].size;
2218 const deUint32 buffer = bufferManager.allocBuffer();
2229 const vector<void*> mapPtrs = mapBuffers(gl, buffers, GL_MAP_WRITE_BIT);
2230 const vector<BlockDataPtr> mappedBlockPtrs = blockLocationsToPtrs(glLayout, blockLocations, mapPtrs);
2242 const BufferBlock& block = m_interface.getBlock(blockDeclNdx);
2243 const int numInst = block.isArray() ? block.getArraySize() : 1;
2247 const string instName = getBlockAPIName(block, instNdx);
2248 const int layoutNdx = findBlockIndex(glLayout, instName);
2252 const BlockLocation& blockLoc = blockLocations[layoutNdx];
2266 const bool execOk = execute(program.getProgram());
2270 const vector<void*> mapPtrs = mapBuffers(gl, buffers, GL_MAP_READ_BIT);
2271 const vector<BlockDataPtr> mappedBlockPtrs = blockLocationsToPtrs(glLayout, blockLocations, mapPtrs);
2273 const bool compareOk = compareData(m_testCtx.getLog(), refLayout, writeData.pointers, glLayout, mappedBlockPtrs);
2287 bool SSBOLayoutCase::compareStdBlocks (const BufferLayout& refLayout, const BufferLayout& cmpLayout) const
2295 const BufferBlock& block = m_interface.getBlock(blockNdx);
2314 const BlockLayoutEntry& refBlockLayout = refLayout.blocks[refBlockNdx];
2315 const BlockLayoutEntry& cmpBlockLayout = cmpLayout.blocks[cmpBlockNdx];
2330 const BufferVarLayoutEntry& refEntry = refLayout.bufferVars[*ndxIter];
2340 const BufferVarLayoutEntry& cmpEntry = cmpLayout.bufferVars[cmpEntryNdx];
2363 bool SSBOLayoutCase::compareSharedBlocks (const BufferLayout& refLayout, const BufferLayout& cmpLayout) const
2371 const BufferBlock& block = m_interface.getBlock(blockNdx);
2390 const BlockLayoutEntry& refBlockLayout = refLayout.blocks[refBlockNdx];
2391 const BlockLayoutEntry& cmpBlockLayout = cmpLayout.blocks[cmpBlockNdx];
2404 const BufferVarLayoutEntry& refEntry = refLayout.bufferVars[*ndxIter];
2414 const BufferVarLayoutEntry& cmpEntry = cmpLayout.bufferVars[cmpEntryNdx];
2433 bool SSBOLayoutCase::compareTypes (const BufferLayout& refLayout, const BufferLayout& cmpLayout) const
2441 const BufferBlock& block = m_interface.getBlock(blockNdx);
2458 const BlockLayoutEntry& cmpBlockLayout = cmpLayout.blocks[cmpBlockNdx];
2462 const BufferVarLayoutEntry& cmpEntry = cmpLayout.bufferVars[*ndxIter];
2472 const BufferVarLayoutEntry& refEntry = refLayout.bufferVars[refEntryNdx];
2501 bool SSBOLayoutCase::checkLayoutIndices (const BufferLayout& layout) const
2511 const BufferVarLayoutEntry& bufVar = layout.bufferVars[varNdx];
2523 const BlockLayoutEntry& block = layout.blocks[blockNdx];
2538 bool SSBOLayoutCase::checkLayoutBounds (const BufferLayout& layout) const
2541 const int numVars = (int)layout.bufferVars.size();
2546 const BufferVarLayoutEntry& var = layout.bufferVars[varNdx];
2551 const BlockLayoutEntry& block = layout.blocks[var.blockNdx];
2552 const bool isMatrix = glu::isDataTypeMatrix(var.type);
2553 const int numVecs = isMatrix ? (var.isRowMajor ? glu::getDataTypeMatrixNumRows(var.type) : glu::getDataTypeMatrixNumColumns(var.type)) : 1;
2554 const int numComps = isMatrix ? (var.isRowMajor ? glu::getDataTypeMatrixNumColumns(var.type) : glu::getDataTypeMatrixNumRows(var.type)) : glu::getDataTypeScalarSize(var.type);
2555 const int numElements = var.arraySize;
2556 const int topLevelSize = var.topLevelArraySize;
2557 const int arrayStride = var.arrayStride;
2558 const int topLevelStride = var.topLevelArrayStride;
2559 const int compSize = sizeof(deUint32);
2560 const int vecSize = numComps*compSize;
2586 bool SSBOLayoutCase::checkIndexQueries (deUint32 program, const BufferLayout& layout) const
2589 const glw::Functions& gl = m_renderCtx.getFunctions();
2596 const BlockLayoutEntry& block = layout.blocks[blockNdx];
2597 const int queriedNdx = gl.getProgramResourceIndex(program, GL_SHADER_STORAGE_BLOCK, block.name.c_str());
2613 const glw::Functions& gl = m_renderCtx.getFunctions();
2614 const deUint32 numPassedLoc = gl.getProgramResourceIndex(program, GL_UNIFORM, "ac_numPassed");
2615 const glu::InterfaceVariableInfo acVarInfo = numPassedLoc != GL_INVALID_INDEX ? glu::getProgramInterfaceVariableInfo(gl, program, GL_UNIFORM, numPassedLoc)
2617 const glu::InterfaceBlockInfo acBufferInfo = acVarInfo.atomicCounterBufferIndex != GL_INVALID_INDEX ? glu::getProgramInterfaceBlockInfo(gl, program, GL_ATOMIC_COUNTER_BUFFER, acVarInfo.atomicCounterBufferIndex)
2619 const glu::Buffer acBuffer (m_renderCtx);
2647 const void* mapPtr = gl.mapBufferRange(GL_ATOMIC_COUNTER_BUFFER, 0, acBufferInfo.dataSize, GL_MAP_READ_BIT);
2648 const int refCount = 1;
2654 resCount = *(const int*)((const deUint8*)mapPtr + acVarInfo.offset);