vktSSBOLayoutCase.hpp revision 01b0e6c691ace0a8968030b55dbcbfc72ede47d7
14f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal#ifndef _VKTSSBOLAYOUTCASE_HPP 24f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal#define _VKTSSBOLAYOUTCASE_HPP 34f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal/*------------------------------------------------------------------------ 44f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * Vulkan Conformance Tests 54f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * ------------------------ 64f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * 74f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * Copyright (c) 2015 The Khronos Group Inc. 84f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * Copyright (c) 2015 Samsung Electronics Co., Ltd. 94f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * 104f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * Permission is hereby granted, free of charge, to any person obtaining a 114f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * copy of this software and/or associated documentation files (the 124f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * "Materials"), to deal in the Materials without restriction, including 134f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * without limitation the rights to use, copy, modify, merge, publish, 144f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * distribute, sublicense, and/or sell copies of the Materials, and to 154f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * permit persons to whom the Materials are furnished to do so, subject to 164f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * the following conditions: 174f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * 184f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * The above copyright notice(s) and this permission notice shall be included 194f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * in all copies or substantial portions of the Materials. 204f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * 214f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * The Materials are Confidential Information as defined by the 224f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * Khronos Membership Agreement until designated non-confidential by Khronos, 234f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * at which point this condition clause shall be removed. 244f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * 254f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 264f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 274f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 284f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 294f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 304f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 314f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 324f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * 334f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal *//*! 344f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * \file 354f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal * \brief SSBO layout tests. 364f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal *//*--------------------------------------------------------------------*/ 374f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 38b7e19179f360dac21c36dbcbf366204d24376939Peter Gal#include "vktTestCase.hpp" 394f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal#include "tcuDefs.hpp" 404f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal#include "gluShaderUtil.hpp" 414f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal#include "gluVarType.hpp" 424f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 43b7e19179f360dac21c36dbcbf366204d24376939Peter Galnamespace vkt 444f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal{ 45b7e19179f360dac21c36dbcbf366204d24376939Peter Galnamespace ssbo 464f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal{ 474f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 484f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galenum BufferVarFlags 494f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal{ 50a69cb9ddb246aae91355ea0ca574c8cd85412280Peter Gal LAYOUT_STD140 = (1<<0), 5101b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal LAYOUT_STD430 = (1<<1), 5201b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal LAYOUT_ROW_MAJOR = (1<<2), 5301b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal LAYOUT_COLUMN_MAJOR = (1<<3), //!< \note Lack of both flags means column-major matrix. 5401b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal LAYOUT_MASK = LAYOUT_STD430|LAYOUT_STD140|LAYOUT_ROW_MAJOR|LAYOUT_COLUMN_MAJOR, 554f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 564f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal // \todo [2013-10-14 pyry] Investigate adding these. 5701b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal/* QUALIFIER_COHERENT = (1<<4), 5801b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal QUALIFIER_VOLATILE = (1<<5), 5901b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal QUALIFIER_RESTRICT = (1<<6), 6001b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal QUALIFIER_READONLY = (1<<7), 6101b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal QUALIFIER_WRITEONLY = (1<<8),*/ 62a69cb9ddb246aae91355ea0ca574c8cd85412280Peter Gal 6301b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal ACCESS_READ = (1<<9), //!< Buffer variable is read in the shader. 6401b0e6c691ace0a8968030b55dbcbfc72ede47d7Peter Gal ACCESS_WRITE = (1<<10), //!< Buffer variable is written in the shader. 654f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal}; 664f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 674f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galclass BufferVar 684f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal{ 694f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galpublic: 704f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal BufferVar (const char* name, const glu::VarType& type, deUint32 flags); 714f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 724f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal const char* getName (void) const { return m_name.c_str(); } 734f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal const glu::VarType& getType (void) const { return m_type; } 744f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal deUint32 getFlags (void) const { return m_flags; } 754f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 764f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galprivate: 774f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal std::string m_name; 784f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal glu::VarType m_type; 794f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal deUint32 m_flags; 804f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal}; 814f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 824f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galclass BufferBlock 834f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal{ 844f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galpublic: 854f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal typedef std::vector<BufferVar>::iterator iterator; 864f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal typedef std::vector<BufferVar>::const_iterator const_iterator; 874f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 884f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal BufferBlock (const char* blockName); 894f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 904f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal const char* getBlockName (void) const { return m_blockName.c_str(); } 914f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal const char* getInstanceName (void) const { return m_instanceName.empty() ? DE_NULL : m_instanceName.c_str(); } 924f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal bool isArray (void) const { return m_arraySize > 0; } 934f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal int getArraySize (void) const { return m_arraySize; } 944f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal deUint32 getFlags (void) const { return m_flags; } 954f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 964f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal void setInstanceName (const char* name) { m_instanceName = name; } 974f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal void setFlags (deUint32 flags) { m_flags = flags; } 984f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal void addMember (const BufferVar& var) { m_variables.push_back(var); } 994f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal void setArraySize (int arraySize); 1004f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1014f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal int getLastUnsizedArraySize (int instanceNdx) const { return m_lastUnsizedArraySizes[instanceNdx]; } 1024f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal void setLastUnsizedArraySize (int instanceNdx, int size) { m_lastUnsizedArraySizes[instanceNdx] = size; } 1034f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1044f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal inline iterator begin (void) { return m_variables.begin(); } 1054f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal inline const_iterator begin (void) const { return m_variables.begin(); } 1064f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal inline iterator end (void) { return m_variables.end(); } 1074f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal inline const_iterator end (void) const { return m_variables.end(); } 1084f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1094f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galprivate: 1104f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal std::string m_blockName; 1114f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal std::string m_instanceName; 1124f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal std::vector<BufferVar> m_variables; 1134f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal int m_arraySize; //!< Array size or 0 if not interface block array. 1144f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal std::vector<int> m_lastUnsizedArraySizes; //!< Sizes of last unsized array element, can be different per instance. 1154f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal deUint32 m_flags; 1164f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal}; 1174f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1184f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galclass ShaderInterface 1194f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal{ 1204f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galpublic: 1214f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal ShaderInterface (void); 1224f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal ~ShaderInterface (void); 1234f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1244f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal glu::StructType& allocStruct (const char* name); 1254f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal const glu::StructType* findStruct (const char* name) const; 1264f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal void getNamedStructs (std::vector<const glu::StructType*>& structs) const; 1274f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1284f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal BufferBlock& allocBlock (const char* name); 1294f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1304f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal int getNumBlocks (void) const { return (int)m_bufferBlocks.size(); } 1314f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal const BufferBlock& getBlock (int ndx) const { return *m_bufferBlocks[ndx]; } 1324f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1334f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galprivate: 1344f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal ShaderInterface (const ShaderInterface&); 1354f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal ShaderInterface& operator= (const ShaderInterface&); 1364f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 1374f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal std::vector<glu::StructType*> m_structs; 1384f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal std::vector<BufferBlock*> m_bufferBlocks; 1394f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal}; 1404f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 141ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Galstruct BufferVarLayoutEntry 142ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal{ 143ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal BufferVarLayoutEntry (void) 144ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal : type (glu::TYPE_LAST) 145ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , blockNdx (-1) 146ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , offset (-1) 147ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , arraySize (-1) 148ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , arrayStride (-1) 149ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , matrixStride (-1) 150ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , topLevelArraySize (-1) 151ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , topLevelArrayStride (-1) 152ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , isRowMajor (false) 153ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal { 154ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal } 155ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 156ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal std::string name; 157ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal glu::DataType type; 158ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int blockNdx; 159ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int offset; 160ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int arraySize; 161ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int arrayStride; 162ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int matrixStride; 163ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int topLevelArraySize; 164ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int topLevelArrayStride; 165ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal bool isRowMajor; 166ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal}; 167ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 168ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Galstruct BlockLayoutEntry 169ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal{ 170ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal BlockLayoutEntry (void) 171ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal : size(0) 172ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal { 173ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal } 174ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 175ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal std::string name; 176ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int size; 177ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal std::vector<int> activeVarIndices; 178ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal}; 179ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 180ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Galclass BufferLayout 181ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal{ 182ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Galpublic: 183ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal std::vector<BlockLayoutEntry> blocks; 184ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal std::vector<BufferVarLayoutEntry> bufferVars; 185ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 186ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int getVariableIndex (const std::string& name) const; 187ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int getBlockIndex (const std::string& name) const; 188ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal}; 189ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 190ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal// BlockDataPtr 191ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 192ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Galstruct BlockDataPtr 193ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal{ 194ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal void* ptr; 195ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int size; //!< Redundant, for debugging purposes. 196ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal int lastUnsizedArraySize; 197ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 198ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal BlockDataPtr (void* ptr_, int size_, int lastUnsizedArraySize_) 199ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal : ptr (ptr_) 200ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , size (size_) 201ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , lastUnsizedArraySize (lastUnsizedArraySize_) 202ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal { 203ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal } 204ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 205ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal BlockDataPtr (void) 206ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal : ptr (DE_NULL) 207ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , size (0) 208ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal , lastUnsizedArraySize (0) 209ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal { 210ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal } 211ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal}; 212ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal 213ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Galstruct RefDataStorage 214ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal{ 215ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal std::vector<deUint8> data; 216ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal std::vector<BlockDataPtr> pointers; 217ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal}; 2184f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 219b7e19179f360dac21c36dbcbf366204d24376939Peter Galclass SSBOLayoutCase : public vkt::TestCase 2204f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal{ 2214f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galpublic: 2224f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal enum BufferMode 2234f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal { 2244f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal BUFFERMODE_SINGLE = 0, //!< Single buffer shared between uniform blocks. 2254f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal BUFFERMODE_PER_BLOCK, //!< Per-block buffers 2264f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 2274f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal BUFFERMODE_LAST 2284f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal }; 2294f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 230b7e19179f360dac21c36dbcbf366204d24376939Peter Gal SSBOLayoutCase (tcu::TestContext& testCtx, const char* name, const char* description, BufferMode bufferMode); 231b7e19179f360dac21c36dbcbf366204d24376939Peter Gal virtual ~SSBOLayoutCase (void); 2324f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 233b7e19179f360dac21c36dbcbf366204d24376939Peter Gal virtual void initPrograms (vk::SourceCollections& programCollection) const; 234b7e19179f360dac21c36dbcbf366204d24376939Peter Gal virtual TestInstance* createInstance (Context& context) const; 2354f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 2364f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galprotected: 237b7e19179f360dac21c36dbcbf366204d24376939Peter Gal void init (void); 238b7e19179f360dac21c36dbcbf366204d24376939Peter Gal 2394f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal BufferMode m_bufferMode; 240b7e19179f360dac21c36dbcbf366204d24376939Peter Gal ShaderInterface m_interface; 2414f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 2424f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Galprivate: 2434f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal SSBOLayoutCase (const SSBOLayoutCase&); 2444f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal SSBOLayoutCase& operator= (const SSBOLayoutCase&); 245b7e19179f360dac21c36dbcbf366204d24376939Peter Gal 246ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal BufferLayout m_refLayout; 247ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal RefDataStorage m_initialData; // Initial data stored in buffer. 248ba1052444e1c4c3fa6442e60f842f52f1062c49dPeter Gal RefDataStorage m_writeData; // Data written by compute shader. 249b7e19179f360dac21c36dbcbf366204d24376939Peter Gal std::string m_computeShaderSrc; 2504f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal}; 2514f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 252b7e19179f360dac21c36dbcbf366204d24376939Peter Gal} // ssbo 253b7e19179f360dac21c36dbcbf366204d24376939Peter Gal} // vkt 2544f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal 2554f9bf161ec8d735ed2afdfa4aa7b8f86b02351bdPeter Gal#endif // _VKTSSBOLAYOUTCASE_HPP 256