Lines Matching refs:layout
21 * \brief SSBO layout case.
318 int findBlockIndex (const BufferLayout& layout, const string& name)
320 for (int ndx = 0; ndx < (int)layout.blocks.size(); ndx++)
322 if (layout.blocks[ndx].name == name)
328 // Layout computation.
462 //! Appends all child elements to layout, returns value that should be appended to offset.
464 BufferLayout& layout,
471 // Reference layout uses std430 rules by default. std140 rules are
472 // choosen only for blocks that have std140 layout.
515 layout.bufferVars.push_back(entry);
540 layout.bufferVars.push_back(entry);
565 layout.bufferVars.push_back(entry);
572 curOffset += computeReferenceLayout(layout, curBlockNdx, curOffset, curPrefix + "[" + de::toString(elemNdx) + "]", type.getElementType(), layoutFlags);
580 curOffset += computeReferenceLayout(layout, curBlockNdx, curOffset, curPrefix + "." + memberIter->getName(), memberIter->getType(), layoutFlags);
588 //! Appends all child elements to layout, returns offset increment.
589 int computeReferenceLayout (BufferLayout& layout, int curBlockNdx, const std::string& blockPrefix, int baseOffset, const BufferVar& bufVar, deUint32 blockLayoutFlags)
624 layout.bufferVars.push_back(entry);
653 layout.bufferVars.push_back(entry);
666 // the layout computation twice. Instead we fix stride to child elements afterwards.
668 const int firstChildNdx = (int)layout.bufferVars.size();
669 const int stride = computeReferenceLayout(layout, curBlockNdx, curOffset, prefix, varType.getElementType(), combinedFlags);
671 for (int childNdx = firstChildNdx; childNdx < (int)layout.bufferVars.size(); childNdx++)
673 layout.bufferVars[childNdx].topLevelArraySize = topLevelArraySize;
674 layout.bufferVars[childNdx].topLevelArrayStride = stride;
683 return computeReferenceLayout(layout, curBlockNdx, baseOffset, blockPrefix + bufVar.getName(), varType, combinedFlags);
686 void computeReferenceLayout (BufferLayout& layout, const ShaderInterface& interface)
696 int activeBlockNdx = (int)layout.blocks.size();
697 int firstVarNdx = (int)layout.bufferVars.size();
702 curOffset += computeReferenceLayout(layout, activeBlockNdx, blockPrefix, curOffset, bufVar, block.getFlags());
705 int varIndicesEnd = (int)layout.bufferVars.size();
709 // Create block layout entries for each instance.
713 layout.blocks.push_back(BlockLayoutEntry());
714 BlockLayoutEntry& blockEntry = layout.blocks.back();
781 void generateValues (const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers, deUint32 seed)
784 const int numBlocks = (int)layout.blocks.size();
790 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
792 const int numEntries = (int)layout.blocks[blockNdx].activeVarIndices.size();
797 const BufferVarLayoutEntry& varEntry = layout.bufferVars[varNdx];
939 src << "layout(" << LayoutFlagsFmt(bufferVar.getFlags() & LAYOUT_MASK) << ") ";
946 src << "layout(";
1173 void generateCompareSrc (std::ostream& src, const char* resultVar, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers)
1186 const int blockNdx = layout.getBlockIndex(instanceName);
1196 generateCompareSrc(src, resultVar, layout, block, instanceNdx, blockPtr, bufVar, glu::SubTypeAccess(bufVar.getType()));
1256 void generateWriteSrc (std::ostream& src, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& blockPointers)
1269 const int blockNdx = layout.getBlockIndex(instanceName);
1279 generateWriteSrc(src, layout, block, instanceNdx, blockPtr, bufVar, glu::SubTypeAccess(bufVar.getType()));
1285 string generateComputeShader (glu::GLSLVersion glslVersion, const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& comparePtrs, const vector<BlockDataPtr>& writePtrs)
1292 src << "layout(local_size_x = 1) in;\n";
1325 generateCompareSrc(src, "allOk", interface, layout, comparePtrs);
1332 generateWriteSrc(src, interface, layout, writePtrs);
1339 void getGLBufferLayout (const glw::Functions& gl, BufferLayout& layout, deUint32 program)
1350 layout.blocks.resize(numActiveBlocks);
1353 BlockLayoutEntry& entry = layout.blocks[blockNdx];
1406 layout.bufferVars.resize(numActiveBufferVars);
1409 BufferVarLayoutEntry& entry = layout.bufferVars[bufVarNdx];
1536 // \note Src layout is used as reference in case of activeVarIndices happens to be incorrect in dstLayout blocks.
1564 const BufferLayout& layout,
1579 copyNonWrittenData(layout, block, instanceNdx, srcBlockPtr, dstBlockPtr, bufVar, accessPath.element(elemNdx));
1586 copyNonWrittenData(layout, block, instanceNdx, srcBlockPtr, dstBlockPtr, bufVar, accessPath.member(memberNdx));
1593 const int varNdx = layout.getVariableIndex(apiName);
1597 const BufferVarLayoutEntry& varLayout = layout.bufferVars[varNdx];
1603 void copyNonWrittenData (const ShaderInterface& interface, const BufferLayout& layout, const vector<BlockDataPtr>& srcPtrs, const vector<BlockDataPtr>& dstPtrs)
1616 const int blockNdx = layout.getBlockIndex(instanceName);
1627 copyNonWrittenData(layout, block, instanceNdx, srcBlockPtr, dstBlockPtr, bufVar, glu::SubTypeAccess(bufVar.getType()));
1827 static bool hasUnsizedArray (const BufferLayout& layout, const BlockLayoutEntry& entry)
1831 if (isUnsizedArray(layout.bufferVars[*varNdx]))
1838 static int getUnsizedArrayStride (const BufferLayout& layout, const BlockLayoutEntry& entry)
1842 const BufferVarLayoutEntry& varEntry = layout.bufferVars[*varNdx];
1853 vector<int> computeBufferSizes (const ShaderInterface& interface, const BufferLayout& layout)
1855 vector<int> sizes(layout.blocks.size());
1866 const int blockNdx = layout.getBlockIndex(apiName);
1870 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1872 const bool isLastUnsized = hasUnsizedArray(layout, blockLayout);
1874 const int stride = isLastUnsized ? getUnsizedArrayStride(layout, blockLayout) : 0;
1884 BlockDataPtr getBlockDataPtr (const BufferLayout& layout, const BlockLayoutEntry& blockLayout, void* ptr, int bufferSize)
1886 const bool isLastUnsized = hasUnsizedArray(layout, blockLayout);
1891 const int lastArrayStride = getUnsizedArrayStride(layout, blockLayout);
1927 void initRefDataStorage (const ShaderInterface& interface, const BufferLayout& layout, RefDataStorage& storage)
1931 const vector<int> bufferSizes = computeBufferSizes(interface, layout);
1944 DE_ASSERT(bufferSizes.size() == layout.blocks.size());
1947 storage.pointers.resize(layout.blocks.size());
1949 for (int blockNdx = 0; blockNdx < (int)layout.blocks.size(); blockNdx++)
1951 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1954 storage.pointers[blockNdx] = getBlockDataPtr(layout, blockLayout, basePtr + curOffset, bufferSize);
1961 vector<BlockDataPtr> blockLocationsToPtrs (const BufferLayout& layout, const vector<BlockLocation>& blockLocations, const vector<void*>& bufPtrs)
1965 DE_ASSERT(layout.blocks.size() == blockLocations.size());
1967 for (int blockNdx = 0; blockNdx < (int)layout.blocks.size(); blockNdx++)
1969 const BlockLayoutEntry& blockLayout = layout.blocks[blockNdx];
1972 blockPtrs[blockNdx] = getBlockDataPtr(layout, blockLayout, (deUint8*)bufPtrs[location.index] + location.offset, location.size);
2093 BufferLayout refLayout; // std140 / std430 layout.
2094 BufferLayout glLayout; // Layout reported by GL.
2122 // Query layout from GL.
2125 // Print layout to log.
2142 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid layout");
2143 return STOP; // It is not safe to use the given layout.
2147 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid std140 or std430 layout");
2150 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Invalid shared layout");
2293 continue; // Not std* layout.
2342 log << TestLog::Message << "Error: Layout mismatch in '" << refEntry.name << "':\n"
2369 continue; // Not shared layout.
2458 log << TestLog::Message << "Error: Buffer variable '" << cmpEntry.name << "' not found in reference layout" << TestLog::EndMessage;
2492 bool SSBOLayoutCase::checkLayoutIndices (const BufferLayout& layout) const
2495 int numVars = (int)layout.bufferVars.size();
2496 int numBlocks = (int)layout.blocks.size();
2502 const BufferVarLayoutEntry& bufVar = layout.bufferVars[varNdx];
2514 const BlockLayoutEntry& block = layout.blocks[blockNdx];
2529 bool SSBOLayoutCase::checkLayoutBounds (const BufferLayout& layout) const
2532 const int numVars = (int)layout.bufferVars.size();
2537 const BufferVarLayoutEntry& var = layout.bufferVars[varNdx];
2542 const BlockLayoutEntry& block = layout.blocks[var.blockNdx];
2577 bool SSBOLayoutCase::checkIndexQueries (deUint32 program, const BufferLayout& layout) const
2585 for (int blockNdx = 0; blockNdx < (int)layout.blocks.size(); blockNdx++)
2587 const BlockLayoutEntry& block = layout.blocks[blockNdx];