Lines Matching refs:DrawTestSpec

80 static GLenum targetToGL (DrawTestSpec::Target target)
88 return de::getSizedArrayElement<DrawTestSpec::TARGET_LAST>(targets, (int)target);
91 static GLenum usageToGL (DrawTestSpec::Usage usage)
109 return de::getSizedArrayElement<DrawTestSpec::USAGE_LAST>(usages, (int)usage);
112 static GLenum inputTypeToGL (DrawTestSpec::InputType type)
131 return de::getSizedArrayElement<DrawTestSpec::INPUTTYPE_LAST>(types, (int)type);
134 static std::string outputTypeToGLType (DrawTestSpec::OutputType type)
155 return de::getSizedArrayElement<DrawTestSpec::OUTPUTTYPE_LAST>(types, (int)type);
158 static GLenum primitiveToGL (DrawTestSpec::Primitive primitive)
175 return de::getSizedArrayElement<DrawTestSpec::PRIMITIVE_LAST>(primitives, (int)primitive);
178 static deUint32 indexTypeToGL (DrawTestSpec::IndexType indexType)
187 return de::getSizedArrayElement<DrawTestSpec::INDEXTYPE_LAST>(indexTypes, (int)indexType);
190 static bool inputTypeIsFloatType (DrawTestSpec::InputType type)
192 if (type == DrawTestSpec::INPUTTYPE_FLOAT)
194 if (type == DrawTestSpec::INPUTTYPE_FIXED)
196 if (type == DrawTestSpec::INPUTTYPE_HALF)
198 if (type == DrawTestSpec::INPUTTYPE_DOUBLE)
203 static bool outputTypeIsFloatType (DrawTestSpec::OutputType type)
205 if (type == DrawTestSpec::OUTPUTTYPE_FLOAT
206 || type == DrawTestSpec::OUTPUTTYPE_VEC2
207 || type == DrawTestSpec::OUTPUTTYPE_VEC3
208 || type == DrawTestSpec::OUTPUTTYPE_VEC4)
214 static bool outputTypeIsIntType (DrawTestSpec::OutputType type)
216 if (type == DrawTestSpec::OUTPUTTYPE_INT
217 || type == DrawTestSpec::OUTPUTTYPE_IVEC2
218 || type == DrawTestSpec::OUTPUTTYPE_IVEC3
219 || type == DrawTestSpec::OUTPUTTYPE_IVEC4)
225 static bool outputTypeIsUintType (DrawTestSpec::OutputType type)
227 if (type == DrawTestSpec::OUTPUTTYPE_UINT
228 || type == DrawTestSpec::OUTPUTTYPE_UVEC2
229 || type == DrawTestSpec::OUTPUTTYPE_UVEC3
230 || type == DrawTestSpec::OUTPUTTYPE_UVEC4)
236 static size_t getElementCount (DrawTestSpec::Primitive primitive, size_t primitiveCount)
240 case DrawTestSpec::PRIMITIVE_POINTS: return primitiveCount;
241 case DrawTestSpec::PRIMITIVE_TRIANGLES: return primitiveCount * 3;
242 case DrawTestSpec::PRIMITIVE_TRIANGLE_FAN: return primitiveCount + 2;
243 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP: return primitiveCount + 2;
244 case DrawTestSpec::PRIMITIVE_LINES: return primitiveCount * 2;
245 case DrawTestSpec::PRIMITIVE_LINE_STRIP: return primitiveCount + 1;
246 case DrawTestSpec::PRIMITIVE_LINE_LOOP: return (primitiveCount==1) ? (2) : (primitiveCount);
247 case DrawTestSpec::PRIMITIVE_LINES_ADJACENCY: return primitiveCount * 4;
248 case DrawTestSpec::PRIMITIVE_LINE_STRIP_ADJACENCY: return primitiveCount + 3;
249 case DrawTestSpec::PRIMITIVE_TRIANGLES_ADJACENCY: return primitiveCount * 6;
250 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP_ADJACENCY: return primitiveCount * 2 + 4;
267 static MethodInfo getMethodInfo (gls::DrawTestSpec::DrawMethod method)
284 return de::getSizedArrayElement<DrawTestSpec::DRAWMETHOD_LAST>(infos, (int)method);
293 static bool checkSpecsShaderCompatible (const DrawTestSpec& a, const DrawTestSpec& b)
531 GLValue (void) : type(DrawTestSpec::INPUTTYPE_LAST) {}
532 explicit GLValue (Float value) : type(DrawTestSpec::INPUTTYPE_FLOAT), fl(value) {}
533 explicit GLValue (Fixed value) : type(DrawTestSpec::INPUTTYPE_FIXED), fi(value) {}
534 explicit GLValue (Byte value) : type(DrawTestSpec::INPUTTYPE_BYTE), b(value) {}
535 explicit GLValue (Ubyte value) : type(DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE), ub(value) {}
536 explicit GLValue (Short value) : type(DrawTestSpec::INPUTTYPE_SHORT), s(value) {}
537 explicit GLValue (Ushort value) : type(DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT), us(value) {}
538 explicit GLValue (Int value) : type(DrawTestSpec::INPUTTYPE_INT), i(value) {}
539 explicit GLValue (Uint value) : type(DrawTestSpec::INPUTTYPE_UNSIGNED_INT), ui(value) {}
540 explicit GLValue (Half value) : type(DrawTestSpec::INPUTTYPE_HALF), h(value) {}
541 explicit GLValue (Double value) : type(DrawTestSpec::INPUTTYPE_DOUBLE), d(value) {}
545 static GLValue getMaxValue (DrawTestSpec::InputType type);
546 static GLValue getMinValue (DrawTestSpec::InputType type);
548 DrawTestSpec::InputType type;
582 case DrawTestSpec::INPUTTYPE_FLOAT:
585 case DrawTestSpec::INPUTTYPE_BYTE:
588 case DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE:
591 case DrawTestSpec::INPUTTYPE_SHORT:
594 case DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT:
597 case DrawTestSpec::INPUTTYPE_FIXED:
603 case DrawTestSpec::INPUTTYPE_UNSIGNED_INT:
606 case DrawTestSpec::INPUTTYPE_INT:
609 case DrawTestSpec::INPUTTYPE_HALF:
612 case DrawTestSpec::INPUTTYPE_DOUBLE:
621 GLValue GLValue::getMaxValue (DrawTestSpec::InputType type)
623 GLValue rangesHi[(int)DrawTestSpec::INPUTTYPE_LAST];
625 rangesHi[(int)DrawTestSpec::INPUTTYPE_FLOAT] = GLValue(Float::create(127.0f));
626 rangesHi[(int)DrawTestSpec::INPUTTYPE_DOUBLE] = GLValue(Double::create(127.0f));
627 rangesHi[(int)DrawTestSpec::INPUTTYPE_BYTE] = GLValue(Byte::create(127));
628 rangesHi[(int)DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE] = GLValue(Ubyte::create(255));
629 rangesHi[(int)DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT] = GLValue(Ushort::create(65530));
630 rangesHi[(int)DrawTestSpec::INPUTTYPE_SHORT] = GLValue(Short::create(32760));
631 rangesHi[(int)DrawTestSpec::INPUTTYPE_FIXED] = GLValue(Fixed::create(32760));
632 rangesHi[(int)DrawTestSpec::INPUTTYPE_INT] = GLValue(Int::create(2147483647));
633 rangesHi[(int)DrawTestSpec::INPUTTYPE_UNSIGNED_INT] = GLValue(Uint::create(4294967295u));
634 rangesHi[(int)DrawTestSpec::INPUTTYPE_HALF] = GLValue(Half::create(256.0f));
639 GLValue GLValue::getMinValue (DrawTestSpec::InputType type)
641 GLValue rangesLo[(int)DrawTestSpec::INPUTTYPE_LAST];
643 rangesLo[(int)DrawTestSpec::INPUTTYPE_FLOAT] = GLValue(Float::create(-127.0f));
644 rangesLo[(int)DrawTestSpec::INPUTTYPE_DOUBLE] = GLValue(Double::create(-127.0f));
645 rangesLo[(int)DrawTestSpec::INPUTTYPE_BYTE] = GLValue(Byte::create(-127));
646 rangesLo[(int)DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE] = GLValue(Ubyte::create(0));
647 rangesLo[(int)DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT] = GLValue(Ushort::create(0));
648 rangesLo[(int)DrawTestSpec::INPUTTYPE_SHORT] = GLValue(Short::create(-32760));
649 rangesLo[(int)DrawTestSpec::INPUTTYPE_FIXED] = GLValue(Fixed::create(-32760));
650 rangesLo[(int)DrawTestSpec::INPUTTYPE_INT] = GLValue(Int::create(-2147483647));
651 rangesLo[(int)DrawTestSpec::INPUTTYPE_UNSIGNED_INT] = GLValue(Uint::create(0));
652 rangesLo[(int)DrawTestSpec::INPUTTYPE_HALF] = GLValue(Half::create(-256.0f));
660 template<> struct GLValueTypeTraits<GLValue::Float> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_FLOAT; };
661 template<> struct GLValueTypeTraits<GLValue::Double> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_DOUBLE; };
662 template<> struct GLValueTypeTraits<GLValue::Byte> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_BYTE; };
663 template<> struct GLValueTypeTraits<GLValue::Ubyte> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE; };
664 template<> struct GLValueTypeTraits<GLValue::Ushort> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT; };
665 template<> struct GLValueTypeTraits<GLValue::Short> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_SHORT; };
666 template<> struct GLValueTypeTraits<GLValue::Fixed> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_FIXED; };
667 template<> struct GLValueTypeTraits<GLValue::Int> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_INT; };
668 template<> struct GLValueTypeTraits<GLValue::Uint> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_UNSIGNED_INT; };
669 template<> struct GLValueTypeTraits<GLValue::Half> { static const DrawTestSpec::InputType Type = DrawTestSpec::INPUTTYPE_HALF; };
913 AttributeArray (DrawTestSpec::Storage storage, sglr::Context& context);
916 void data (DrawTestSpec::Target target, size_t size, const char* data, DrawTestSpec::Usage usage);
917 void setupArray (bool bound, int offset, int size, DrawTestSpec::InputType inType, DrawTestSpec::OutputType outType, bool normalized, int stride, int instanceDivisor, const rr::GenericVec4& defaultAttrib, bool isPositionAttr, bool bgraComponentOrder);
919 void bindIndexArray (DrawTestSpec::Target storage);
922 DrawTestSpec::Target getTarget (void) const { return m_target; }
923 DrawTestSpec::InputType getInputType (void) const { return m_inputType; }
924 DrawTestSpec::OutputType getOutputType (void) const { return m_outputType; }
925 DrawTestSpec::Storage getStorageType (void) const { return m_storage; }
932 DrawTestSpec::Storage m_storage;
940 DrawTestSpec::Target m_target;
941 DrawTestSpec::InputType m_inputType;
942 DrawTestSpec::OutputType m_outputType;
952 AttributeArray::AttributeArray (DrawTestSpec::Storage storage, sglr::Context& context)
960 , m_target (DrawTestSpec::TARGET_ARRAY)
961 , m_inputType (DrawTestSpec::INPUTTYPE_FLOAT)
962 , m_outputType (DrawTestSpec::OUTPUTTYPE_VEC4)
970 if (m_storage == DrawTestSpec::STORAGE_BUFFER)
979 if (m_storage == DrawTestSpec::STORAGE_BUFFER)
984 else if (m_storage == DrawTestSpec::STORAGE_USER)
990 void AttributeArray::data (DrawTestSpec::Target target, size_t size, const char* ptr, DrawTestSpec::Usage usage)
995 if (m_storage == DrawTestSpec::STORAGE_BUFFER)
1003 else if (m_storage == DrawTestSpec::STORAGE_USER)
1015 void AttributeArray::setupArray (bool bound, int offset, int size, DrawTestSpec::InputType inputType, DrawTestSpec::OutputType outType, bool normalized, int stride, int instanceDivisor, const rr::GenericVec4& defaultAttrib, bool isPositionAttr, bool bgraComponentOrder)
1036 case DrawTestSpec::INPUTTYPE_FLOAT:
1050 case DrawTestSpec::INPUTTYPE_INT:
1056 case DrawTestSpec::INPUTTYPE_UNSIGNED_INT:
1071 if (m_storage == DrawTestSpec::STORAGE_BUFFER)
1078 else if (m_storage == DrawTestSpec::STORAGE_USER)
1125 void AttributeArray::bindIndexArray (DrawTestSpec::Target target)
1127 if (m_storage == DrawTestSpec::STORAGE_USER)
1130 else if (m_storage == DrawTestSpec::STORAGE_BUFFER)
1150 static rr::GenericVecType mapOutputType (const DrawTestSpec::OutputType& type);
1151 static int getComponentCount (const DrawTestSpec::OutputType& type);
1308 case (DrawTestSpec::OUTPUTTYPE_FLOAT):
1309 case (DrawTestSpec::OUTPUTTYPE_INT):
1310 case (DrawTestSpec::OUTPUTTYPE_UINT):
1315 case (DrawTestSpec::OUTPUTTYPE_VEC2):
1316 case (DrawTestSpec::OUTPUTTYPE_IVEC2):
1317 case (DrawTestSpec::OUTPUTTYPE_UVEC2):
1322 case (DrawTestSpec::OUTPUTTYPE_VEC3):
1323 case (DrawTestSpec::OUTPUTTYPE_IVEC3):
1324 case (DrawTestSpec::OUTPUTTYPE_UVEC3):
1330 case (DrawTestSpec::OUTPUTTYPE_VEC4):
1331 case (DrawTestSpec::OUTPUTTYPE_IVEC4):
1332 case (DrawTestSpec::OUTPUTTYPE_UVEC4):
1347 case (DrawTestSpec::OUTPUTTYPE_FLOAT):
1348 case (DrawTestSpec::OUTPUTTYPE_INT):
1349 case (DrawTestSpec::OUTPUTTYPE_UINT):
1354 case (DrawTestSpec::OUTPUTTYPE_VEC2):
1355 case (DrawTestSpec::OUTPUTTYPE_IVEC2):
1356 case (DrawTestSpec::OUTPUTTYPE_UVEC2):
1361 case (DrawTestSpec::OUTPUTTYPE_VEC3):
1362 case (DrawTestSpec::OUTPUTTYPE_IVEC3):
1363 case (DrawTestSpec::OUTPUTTYPE_UVEC3):
1368 case (DrawTestSpec::OUTPUTTYPE_VEC4):
1369 case (DrawTestSpec::OUTPUTTYPE_IVEC4):
1370 case (DrawTestSpec::OUTPUTTYPE_UVEC4):
1453 rr::GenericVecType DrawTestShaderProgram::mapOutputType (const DrawTestSpec::OutputType& type)
1457 case (DrawTestSpec::OUTPUTTYPE_FLOAT):
1458 case (DrawTestSpec::OUTPUTTYPE_VEC2):
1459 case (DrawTestSpec::OUTPUTTYPE_VEC3):
1460 case (DrawTestSpec::OUTPUTTYPE_VEC4):
1463 case (DrawTestSpec::OUTPUTTYPE_INT):
1464 case (DrawTestSpec::OUTPUTTYPE_IVEC2):
1465 case (DrawTestSpec::OUTPUTTYPE_IVEC3):
1466 case (DrawTestSpec::OUTPUTTYPE_IVEC4):
1469 case (DrawTestSpec::OUTPUTTYPE_UINT):
1470 case (DrawTestSpec::OUTPUTTYPE_UVEC2):
1471 case (DrawTestSpec::OUTPUTTYPE_UVEC3):
1472 case (DrawTestSpec::OUTPUTTYPE_UVEC4):
1481 int DrawTestShaderProgram::getComponentCount (const DrawTestSpec::OutputType& type)
1485 case (DrawTestSpec::OUTPUTTYPE_FLOAT):
1486 case (DrawTestSpec::OUTPUTTYPE_INT):
1487 case (DrawTestSpec::OUTPUTTYPE_UINT):
1490 case (DrawTestSpec::OUTPUTTYPE_VEC2):
1491 case (DrawTestSpec::OUTPUTTYPE_IVEC2):
1492 case (DrawTestSpec::OUTPUTTYPE_UVEC2):
1495 case (DrawTestSpec::OUTPUTTYPE_VEC3):
1496 case (DrawTestSpec::OUTPUTTYPE_IVEC3):
1497 case (DrawTestSpec::OUTPUTTYPE_UVEC3):
1500 case (DrawTestSpec::OUTPUTTYPE_VEC4):
1501 case (DrawTestSpec::OUTPUTTYPE_IVEC4):
1502 case (DrawTestSpec::OUTPUTTYPE_UVEC4):
1533 static char* generateArray (int seed, int elementCount, int componentCount, int offset, int stride, DrawTestSpec::InputType type);
1534 static char* generateIndices (int seed, int elementCount, DrawTestSpec::IndexType type, int offset, int min, int max, int indexBase);
1535 static rr::GenericVec4 generateAttributeValue (int seed, DrawTestSpec::InputType type);
1541 static char* generateBasicArray (int seed, int elementCount, int componentCount, int offset, int stride, DrawTestSpec::InputType type);
1547 char* RandomArrayGenerator::generateArray (int seed, int elementCount, int componentCount, int offset, int stride, DrawTestSpec::InputType type)
1549 if (type == DrawTestSpec::INPUTTYPE_INT_2_10_10_10 || type == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10)
1555 char* RandomArrayGenerator::generateBasicArray (int seed, int elementCount, int componentCount, int offset, int stride, DrawTestSpec::InputType type)
1559 case DrawTestSpec::INPUTTYPE_FLOAT: return createBasicArray<float, GLValue::Float> (seed, elementCount, componentCount, offset, stride);
1560 case DrawTestSpec::INPUTTYPE_DOUBLE: return createBasicArray<double, GLValue::Double>(seed, elementCount, componentCount, offset, stride);
1561 case DrawTestSpec::INPUTTYPE_SHORT: return createBasicArray<deInt16, GLValue::Short> (seed, elementCount, componentCount, offset, stride);
1562 case DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT: return createBasicArray<deUint16, GLValue::Ushort>(seed, elementCount, componentCount, offset, stride);
1563 case DrawTestSpec::INPUTTYPE_BYTE: return createBasicArray<deInt8, GLValue::Byte> (seed, elementCount, componentCount, offset, stride);
1564 case DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE: return createBasicArray<deUint8, GLValue::Ubyte> (seed, elementCount, componentCount, offset, stride);
1565 case DrawTestSpec::INPUTTYPE_FIXED: return createBasicArray<deInt32, GLValue::Fixed> (seed, elementCount, componentCount, offset, stride);
1566 case DrawTestSpec::INPUTTYPE_INT: return createBasicArray<deInt32, GLValue::Int> (seed, elementCount, componentCount, offset, stride);
1567 case DrawTestSpec::INPUTTYPE_UNSIGNED_INT: return createBasicArray<deUint32, GLValue::Uint> (seed, elementCount, componentCount, offset, stride);
1568 case DrawTestSpec::INPUTTYPE_HALF: return createBasicArray<deFloat16, GLValue::Half> (seed, elementCount, componentCount, offset, stride);
1669 char* RandomArrayGenerator::generateIndices (int seed, int elementCount, DrawTestSpec::IndexType type, int offset, int min, int max, int indexBase)
1675 case DrawTestSpec::INDEXTYPE_BYTE:
1679 case DrawTestSpec::INDEXTYPE_SHORT:
1683 case DrawTestSpec::INDEXTYPE_INT:
1743 rr::GenericVec4 RandomArrayGenerator::generateAttributeValue (int seed, DrawTestSpec::InputType type)
1749 case DrawTestSpec::INPUTTYPE_FLOAT:
1752 case DrawTestSpec::INPUTTYPE_INT:
1755 case DrawTestSpec::INPUTTYPE_UNSIGNED_INT:
1778 void newArray (DrawTestSpec::Storage storage);
1782 void render (DrawTestSpec::Primitive primitive, DrawTestSpec::DrawMethod drawMethod, int firstVertex, int vertexCount, DrawTestSpec::IndexType indexType, const void* indexOffset, int rangeStart, int rangeEnd, int instanceCount, int indirectOffset, int baseVertex, float coordScale, float colorScale, AttributeArray* indexArray);
1838 void AttributePack::newArray (DrawTestSpec::Storage storage)
1861 void AttributePack::render (DrawTestSpec::Primitive primitive, DrawTestSpec::DrawMethod drawMethod, int firstVertex, int vertexCount, DrawTestSpec::IndexType indexType, const void* indexOffset, int rangeStart, int rangeEnd, int instanceCount, int indirectOffset, int baseVertex, float coordScale, float colorScale, AttributeArray* indexArray)
1880 indexArray->bindIndexArray(DrawTestSpec::TARGET_ELEMENT_ARRAY);
1898 if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWARRAYS)
1903 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWARRAYS_INSTANCED)
1908 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS)
1913 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED)
1918 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED)
1923 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWARRAYS_INDIRECT)
1968 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INDIRECT)
1985 DE_ASSERT(offsetAsInteger % gls::DrawTestSpec::indexTypeSize(indexType) == 0); // \note This is checked in spec validation
1989 command.firstIndex = (glw::GLuint)(offsetAsInteger / gls::DrawTestSpec::indexTypeSize(indexType));
2020 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_BASEVERTEX)
2025 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED_BASEVERTEX)
2030 else if (drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED_BASEVERTEX)
2059 // DrawTestSpec
2061 DrawTestSpec::AttributeSpec DrawTestSpec::AttributeSpec::createAttributeArray (InputType inputType, OutputType outputType, Storage storage, Usage usage, int componentCount, int offset, int stride, bool normalize, int instanceDivisor)
2063 DrawTestSpec::AttributeSpec spec;
2080 DrawTestSpec::AttributeSpec DrawTestSpec::AttributeSpec::createDefaultAttribute (InputType inputType, OutputType outputType, int componentCount)
2085 DrawTestSpec::AttributeSpec spec;
2089 spec.storage = DrawTestSpec::STORAGE_LAST;
2090 spec.usage = DrawTestSpec::USAGE_LAST;
2102 DrawTestSpec::AttributeSpec::AttributeSpec (void)
2104 inputType = DrawTestSpec::INPUTTYPE_LAST;
2105 outputType = DrawTestSpec::OUTPUTTYPE_LAST;
2106 storage = DrawTestSpec::STORAGE_LAST;
2107 usage = DrawTestSpec::USAGE_LAST;
2118 int DrawTestSpec::AttributeSpec::hash (void) const
2130 bool DrawTestSpec::AttributeSpec::valid (glu::ApiType ctxType) const
2132 const bool inputTypeFloat = inputType == DrawTestSpec::INPUTTYPE_FLOAT || inputType == DrawTestSpec::INPUTTYPE_FIXED || inputType == DrawTestSpec::INPUTTYPE_HALF;
2133 const bool inputTypeUnsignedInteger = inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE || inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT || inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT || inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10;
2134 const bool inputTypeSignedInteger = inputType == DrawTestSpec::INPUTTYPE_BYTE || inputType == DrawTestSpec::INPUTTYPE_SHORT || inputType == DrawTestSpec::INPUTTYPE_INT || inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10;
2135 const bool inputTypePacked = inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10;
2137 const bool outputTypeFloat = outputType == DrawTestSpec::OUTPUTTYPE_FLOAT || outputType == DrawTestSpec::OUTPUTTYPE_VEC2 || outputType == DrawTestSpec::OUTPUTTYPE_VEC3 || outputType == DrawTestSpec::OUTPUTTYPE_VEC4;
2138 const bool outputTypeSignedInteger = outputType == DrawTestSpec::OUTPUTTYPE_INT || outputType == DrawTestSpec::OUTPUTTYPE_IVEC2 || outputType == DrawTestSpec::OUTPUTTYPE_IVEC3 || outputType == DrawTestSpec::OUTPUTTYPE_IVEC4;
2139 const bool outputTypeUnsignedInteger = outputType == DrawTestSpec::OUTPUTTYPE_UINT || outputType == DrawTestSpec::OUTPUTTYPE_UVEC2 || outputType == DrawTestSpec::OUTPUTTYPE_UVEC3 || outputType == DrawTestSpec::OUTPUTTYPE_UVEC4;
2143 if (inputType != DrawTestSpec::INPUTTYPE_INT && inputType != DrawTestSpec::INPUTTYPE_UNSIGNED_INT && inputType != DrawTestSpec::INPUTTYPE_FLOAT)
2146 if (inputType != DrawTestSpec::INPUTTYPE_FLOAT && componentCount != 4)
2150 if (inputType == DrawTestSpec::INPUTTYPE_INT && !outputTypeSignedInteger)
2152 if (inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT && !outputTypeUnsignedInteger)
2184 if (bgraComponentOrder && inputType != DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10 && inputType != DrawTestSpec::INPUTTYPE_INT_2_10_10_10 && inputType != DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE)
2192 if (inputType != DrawTestSpec::INPUTTYPE_FLOAT && inputType != DrawTestSpec::INPUTTYPE_FIXED &&
2193 inputType != DrawTestSpec::INPUTTYPE_BYTE && inputType != DrawTestSpec::INPUTTYPE_UNSIGNED_BYTE &&
2194 inputType != DrawTestSpec::INPUTTYPE_SHORT && inputType != DrawTestSpec::INPUTTYPE_UNSIGNED_SHORT)
2214 if (!useDefaultAttribute && storage == DrawTestSpec::STORAGE_USER)
2221 bool DrawTestSpec::AttributeSpec::isBufferAligned (void) const
2223 const bool inputTypePacked = inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10;
2228 int dataTypeSize = gls::DrawTestSpec::inputTypeSize(inputType);
2239 bool DrawTestSpec::AttributeSpec::isBufferStrideAligned (void) const
2241 const bool inputTypePacked = inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10 || inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10;
2246 int dataTypeSize = gls::DrawTestSpec::inputTypeSize(inputType);
2257 std::string DrawTestSpec::targetToString(Target target)
2265 return de::getSizedArrayElement<DrawTestSpec::TARGET_LAST>(targets, (int)target);
2268 std::string DrawTestSpec::inputTypeToString(InputType type)
2289 return de::getSizedArrayElement<DrawTestSpec::INPUTTYPE_LAST>(types, (int)type);
2292 std::string DrawTestSpec::outputTypeToString(OutputType type)
2313 return de::getSizedArrayElement<DrawTestSpec::OUTPUTTYPE_LAST>(types, (int)type);
2316 std::string DrawTestSpec::usageTypeToString(Usage usage)
2334 return de::getSizedArrayElement<DrawTestSpec::USAGE_LAST>(usages, (int)usage);
2337 std::string DrawTestSpec::storageToString (Storage storage)
2345 return de::getSizedArrayElement<DrawTestSpec::STORAGE_LAST>(storages, (int)storage);
2348 std::string DrawTestSpec::primitiveToString (Primitive primitive)
2365 return de::getSizedArrayElement<DrawTestSpec::PRIMITIVE_LAST>(primitives, (int)primitive);
2368 std::string DrawTestSpec::indexTypeToString (IndexType type)
2377 return de::getSizedArrayElement<DrawTestSpec::INDEXTYPE_LAST>(indexTypes, (int)type);
2380 std::string DrawTestSpec::drawMethodToString (DrawTestSpec::DrawMethod method)
2396 return de::getSizedArrayElement<DrawTestSpec::DRAWMETHOD_LAST>(methods, (int)method);
2399 int DrawTestSpec::inputTypeSize (InputType type)
2420 return de::getSizedArrayElement<DrawTestSpec::INPUTTYPE_LAST>(size, (int)type);
2423 int DrawTestSpec::indexTypeSize (IndexType type)
2432 return de::getSizedArrayElement<DrawTestSpec::INDEXTYPE_LAST>(size, (int)type);
2435 std::string DrawTestSpec::getName (void) const
2461 << DrawTestSpec::inputTypeToString((DrawTestSpec::InputType)attrib.inputType) << "_"
2463 << DrawTestSpec::outputTypeToString(attrib.outputType) << "_";
2468 << DrawTestSpec::storageToString(attrib.storage) << "_"
2471 << DrawTestSpec::inputTypeToString((DrawTestSpec::InputType)attrib.inputType);
2472 if (attrib.inputType != DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10 && attrib.inputType != DrawTestSpec::INPUTTYPE_INT_2_10_10_10)
2477 << DrawTestSpec::outputTypeToString(attrib.outputType) << "_"
2478 << DrawTestSpec::usageTypeToString(attrib.usage) << "_"
2485 << "index_" << DrawTestSpec::indexTypeToString(indexType) << "_"
2486 << DrawTestSpec::storageToString(indexStorage) << "_"
2497 case DrawTestSpec::PRIMITIVE_POINTS:
2500 case DrawTestSpec::PRIMITIVE_TRIANGLES:
2503 case DrawTestSpec::PRIMITIVE_TRIANGLE_FAN:
2506 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP:
2509 case DrawTestSpec::PRIMITIVE_LINES:
2512 case DrawTestSpec::PRIMITIVE_LINE_STRIP:
2515 case DrawTestSpec::PRIMITIVE_LINE_LOOP:
2518 case DrawTestSpec::PRIMITIVE_LINES_ADJACENCY:
2521 case DrawTestSpec::PRIMITIVE_LINE_STRIP_ADJACENCY:
2524 case DrawTestSpec::PRIMITIVE_TRIANGLES_ADJACENCY:
2527 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP_ADJACENCY:
2540 std::string DrawTestSpec::getDesc (void) const
2552 << "input datatype " << DrawTestSpec::inputTypeToString((DrawTestSpec::InputType)attrib.inputType) << ", "
2554 << "used as " << DrawTestSpec::outputTypeToString(attrib.outputType) << ", ";
2560 << "Storage in " << DrawTestSpec::storageToString(attrib.storage) << ", "
2562 << "input datatype " << DrawTestSpec::inputTypeToString((DrawTestSpec::InputType)attrib.inputType) << ", "
2565 << "used as " << DrawTestSpec::outputTypeToString(attrib.outputType) << ", "
2587 << "index type " << DrawTestSpec::indexTypeToString(indexType) << ", "
2588 << "index storage in " << DrawTestSpec::storageToString(indexStorage) << ", "
2595 << "index type " << DrawTestSpec::indexTypeToString(indexType) << ", "
2596 << "index storage in " << DrawTestSpec::storageToString(indexStorage) << ", "
2605 << "index type " << DrawTestSpec::indexTypeToString(indexType) << ", "
2606 << "index storage in " << DrawTestSpec::storageToString(indexStorage) << ", "
2622 << "index type " << DrawTestSpec::indexTypeToString(indexType) << ", "
2623 << "index storage in " << DrawTestSpec::storageToString(indexStorage) << ", "
2636 case DrawTestSpec::PRIMITIVE_POINTS:
2639 case DrawTestSpec::PRIMITIVE_TRIANGLES:
2642 case DrawTestSpec::PRIMITIVE_TRIANGLE_FAN:
2645 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP:
2648 case DrawTestSpec::PRIMITIVE_LINES:
2651 case DrawTestSpec::PRIMITIVE_LINE_STRIP:
2654 case DrawTestSpec::PRIMITIVE_LINE_LOOP:
2657 case DrawTestSpec::PRIMITIVE_LINES_ADJACENCY:
2660 case DrawTestSpec::PRIMITIVE_LINE_STRIP_ADJACENCY:
2663 case DrawTestSpec::PRIMITIVE_TRIANGLES_ADJACENCY:
2666 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP_ADJACENCY:
2677 std::string DrawTestSpec::getMultilineDesc (void) const
2689 << "\tinput datatype " << DrawTestSpec::inputTypeToString((DrawTestSpec::InputType)attrib.inputType) << "\n"
2691 << "\tused as " << DrawTestSpec::outputTypeToString(attrib.outputType) << "\n";
2697 << "\tStorage in " << DrawTestSpec::storageToString(attrib.storage) << "\n"
2699 << "\tinput datatype " << DrawTestSpec::inputTypeToString((DrawTestSpec::InputType)attrib.inputType) << "\n"
2702 << "\tused as " << DrawTestSpec::outputTypeToString(attrib.outputType) << "\n"
2724 << "\tindex type " << DrawTestSpec::indexTypeToString(indexType) << "\n"
2725 << "\tindex storage in " << DrawTestSpec::storageToString(indexStorage) << "\n"
2732 << "\tindex type " << DrawTestSpec::indexTypeToString(indexType) << "\n"
2733 << "\tindex storage in " << DrawTestSpec::storageToString(indexStorage) << "\n"
2742 << "\tindex type " << DrawTestSpec::indexTypeToString(indexType) << "\n"
2743 << "\tindex storage in " << DrawTestSpec::storageToString(indexStorage) << "\n"
2759 << "\tindex type " << DrawTestSpec::indexTypeToString(indexType) << "\n"
2760 << "\tindex storage in " << DrawTestSpec::storageToString(indexStorage) << "\n"
2770 << "\tindex type " << DrawTestSpec::indexTypeToString(indexType) << "\n"
2771 << "\tindex storage in " << DrawTestSpec::storageToString(indexStorage) << "\n"
2779 << "\tindex type " << DrawTestSpec::indexTypeToString(indexType) << "\n"
2780 << "\tindex storage in " << DrawTestSpec::storageToString(indexStorage) << "\n"
2789 << "\tindex type " << DrawTestSpec::indexTypeToString(indexType) << "\n"
2790 << "\tindex storage in " << DrawTestSpec::storageToString(indexStorage) << "\n"
2803 case DrawTestSpec::PRIMITIVE_POINTS:
2806 case DrawTestSpec::PRIMITIVE_TRIANGLES:
2809 case DrawTestSpec::PRIMITIVE_TRIANGLE_FAN:
2812 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP:
2815 case DrawTestSpec::PRIMITIVE_LINES:
2818 case DrawTestSpec::PRIMITIVE_LINE_STRIP:
2821 case DrawTestSpec::PRIMITIVE_LINE_LOOP:
2824 case DrawTestSpec::PRIMITIVE_LINES_ADJACENCY:
2827 case DrawTestSpec::PRIMITIVE_LINE_STRIP_ADJACENCY:
2830 case DrawTestSpec::PRIMITIVE_TRIANGLES_ADJACENCY:
2833 case DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP_ADJACENCY:
2846 DrawTestSpec::DrawTestSpec (void)
2862 int DrawTestSpec::hash (void) const
2884 bool DrawTestSpec::valid (void) const
2922 if (drawMethod != gls::DrawTestSpec::DRAWMETHOD_DRAWARRAYS && drawMethod != gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS)
2924 if (drawMethod == gls::DrawTestSpec::DRAWMETHOD_DRAWELEMENTS && (indexType != INDEXTYPE_BYTE && indexType != INDEXTYPE_SHORT))
2937 if (!attribs[ndx].useDefaultAttribute && attribs[ndx].storage == gls::DrawTestSpec::STORAGE_USER)
2943 if (indexPointerOffset % gls::DrawTestSpec::indexTypeSize(indexType) != 0)
2954 if (methodInfo.indexed && indexStorage == DrawTestSpec::STORAGE_USER)
2961 DrawTestSpec::CompatibilityTestType DrawTestSpec::isCompatibilityTest (void) const
3016 static PrimitiveClass getDrawPrimitiveClass (gls::DrawTestSpec::Primitive primitiveType)
3020 case gls::DrawTestSpec::PRIMITIVE_POINTS:
3023 case gls::DrawTestSpec::PRIMITIVE_LINES:
3024 case gls::DrawTestSpec::PRIMITIVE_LINE_STRIP:
3025 case gls::DrawTestSpec::PRIMITIVE_LINE_LOOP:
3026 case gls::DrawTestSpec::PRIMITIVE_LINES_ADJACENCY:
3027 case gls::DrawTestSpec::PRIMITIVE_LINE_STRIP_ADJACENCY:
3030 case gls::DrawTestSpec::PRIMITIVE_TRIANGLES:
3031 case gls::DrawTestSpec::PRIMITIVE_TRIANGLE_FAN:
3032 case gls::DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP:
3033 case gls::DrawTestSpec::PRIMITIVE_TRIANGLES_ADJACENCY:
3034 case gls::DrawTestSpec::PRIMITIVE_TRIANGLE_STRIP_ADJACENCY:
3043 static bool containsLineCases (const std::vector<DrawTestSpec>& m_specs)
3055 DrawTest::DrawTest (tcu::TestContext& testCtx, glu::RenderContext& renderCtx, const DrawTestSpec& spec, const char* name, const char* desc)
3095 void DrawTest::addIteration (const DrawTestSpec& spec, const char* description)
3179 const DrawTestSpec& spec = m_specs[specNdx];
3181 if (spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_BASEVERTEX ||
3182 spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_INSTANCED_BASEVERTEX ||
3183 spec.drawMethod == DrawTestSpec::DRAWMETHOD_DRAWELEMENTS_RANGED_BASEVERTEX)
3229 DrawTestSpec::AttributeSpec attribSpec = spec.attribs[attribNdx];
3237 m_glArrayPack->newArray(DrawTestSpec::STORAGE_USER);
3238 m_rrArrayPack->newArray(DrawTestSpec::STORAGE_USER);
3246 const size_t elementSize = attribSpec.componentCount * DrawTestSpec::inputTypeSize(attribSpec.inputType);
3258 m_glArrayPack->getArray(attribNdx)->data(DrawTestSpec::TARGET_ARRAY, bufferSize, data, attribSpec.usage);
3259 m_rrArrayPack->getArray(attribNdx)->data(DrawTestSpec::TARGET_ARRAY, bufferSize, data, attribSpec.usage);
3289 const size_t indexElementSize = DrawTestSpec::indexTypeSize(spec.indexType);
3292 const char* indexPointerBase = (spec.indexStorage == DrawTestSpec::STORAGE_USER) ? (indexArray) : ((char*)DE_NULL);
3300 glArray->data(DrawTestSpec::TARGET_ELEMENT_ARRAY, indexArraySize, indexArray, DrawTestSpec::USAGE_STATIC_DRAW);
3301 rrArray->data(DrawTestSpec::TARGET_ELEMENT_ARRAY, indexArraySize, indexArray, DrawTestSpec::USAGE_STATIC_DRAW);
3317 m_glArrayPack->render(spec.primitive, spec.drawMethod, spec.first, (int)primitiveElementCount, DrawTestSpec::INDEXTYPE_LAST, DE_NULL, 0, 0, spec.instanceCount, spec.indirectOffset, 0, coordScale, colorScale, DE_NULL);
3319 m_rrArrayPack->render(spec.primitive, spec.drawMethod, spec.first, (int)primitiveElementCount, DrawTestSpec::INDEXTYPE_LAST, DE_NULL, 0, 0, spec.instanceCount, spec.indirectOffset, 0, coordScale, colorScale, DE_NULL);
3326 const DrawTestSpec::CompatibilityTestType ctype = spec.isCompatibilityTest();
3330 if (ctype == DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET)
3332 else if (ctype == DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE)
3342 const DrawTestSpec::CompatibilityTestType ctype = spec.isCompatibilityTest();
3344 if (ctype == DrawTestSpec::COMPATIBILITY_UNALIGNED_OFFSET)
3346 else if (ctype == DrawTestSpec::COMPATIBILITY_UNALIGNED_STRIDE)
3712 bool DrawTest::compare (gls::DrawTestSpec::Primitive primitiveType)
3787 float DrawTest::getCoordScale (const DrawTestSpec& spec) const
3793 DrawTestSpec::AttributeSpec attribSpec = spec.attribs[arrayNdx];
3800 if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10)
3807 else if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10)
3821 if (attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_VEC3 || attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_VEC4
3822 || attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_IVEC3 || attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_IVEC4
3823 || attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_UVEC3 || attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_UVEC4)
3832 float DrawTest::getColorScale (const DrawTestSpec& spec) const
3838 DrawTestSpec::AttributeSpec attribSpec = spec.attribs[arrayNdx];
3844 if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_UNSIGNED_INT_2_10_10_10)
3849 else if (attribSpec.inputType == DrawTestSpec::INPUTTYPE_INT_2_10_10_10)
3859 if (attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_VEC4 ||
3860 attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_UVEC4 ||
3861 attribSpec.outputType == DrawTestSpec::OUTPUTTYPE_IVEC4)