return v;
}
+inline VkClearValue makeClearValueColorVec4 (tcu::Vec4 vec)
+{
+ return makeClearValueColorF32(vec.x(), vec.y(), vec.z(), vec.w());
+}
+
inline VkClearValue makeClearValueColorU32 (deUint32 r, deUint32 g, deUint32 b, deUint32 a)
{
VkClearValue v;
{
std::vector<AttachmentInfo> attachments;
- attachments.push_back(AttachmentInfo(format, rnd.getInt(1, maxDimension), rnd.getInt(1, maxDimension), 1));
+ const int i0 = rnd.getInt(1, maxDimension);
+ const int i1 = rnd.getInt(1, maxDimension);
+ attachments.push_back(AttachmentInfo(format, i0, i1, 1));
single->addChild(new GranularityCase(testCtx, name.c_str(), description, attachments));
}
{
std::vector<AttachmentInfo> attachments;
- deUint32 iterations = rnd.getInt(minIteration, maxIteration);
+ const deUint32 iterations = rnd.getInt(minIteration, maxIteration);
+ const int i0 = rnd.getInt(1, maxDimension);
+ const int i1 = rnd.getInt(1, maxDimension);
for (deUint32 idx = 0; idx < iterations; ++idx)
- attachments.push_back(AttachmentInfo(VkFormat(formatIdx), rnd.getInt(1, maxDimension), rnd.getInt(1, maxDimension), 1));
+ attachments.push_back(AttachmentInfo(VkFormat(formatIdx), i0, i1, 1));
multi->addChild(new GranularityCase(testCtx, name.c_str(), description, attachments));
}
{
std::vector<AttachmentInfo> attachments;
- deUint32 iterations = rnd.getInt(minIteration, maxIteration);
- attachments.push_back(AttachmentInfo(VkFormat(formatIdx), rnd.getInt(1, maxDimension), rnd.getInt(1, maxDimension), 1));
+ const deUint32 iterations = rnd.getInt(minIteration, maxIteration);
+ const int i0 = rnd.getInt(1, maxDimension);
+ const int i1 = rnd.getInt(1, maxDimension);
+ attachments.push_back(AttachmentInfo(VkFormat(formatIdx), i0, i1, 1));
for (deUint32 idx = 0; idx < iterations; ++idx)
- attachments.push_back(AttachmentInfo(mandatoryFormats[rnd.getInt(0, DE_LENGTH_OF_ARRAY(mandatoryFormats) - 1)], rnd.getInt(1, maxDimension), rnd.getInt(1, maxDimension), 1));
+ {
+ const int i2 = rnd.getInt(0, DE_LENGTH_OF_ARRAY(mandatoryFormats) - 1);
+ const int i3 = rnd.getInt(1, maxDimension);
+ const int i4 = rnd.getInt(1, maxDimension);
+ attachments.push_back(AttachmentInfo(mandatoryFormats[i2], i3, i4, 1));
+ }
random->addChild(new GranularityCase(testCtx, name.c_str(), description, attachments));
}
{
std::vector<AttachmentInfo> attachments;
- attachments.push_back(AttachmentInfo(format, rnd.getInt(1, maxDimension), rnd.getInt(1, maxDimension), 1));
+ const int i0 = rnd.getInt(1, maxDimension);
+ const int i1 = rnd.getInt(1, maxDimension);
+ attachments.push_back(AttachmentInfo(format, i0, i1, 1));
inRenderPass->addChild(new GranularityCase(testCtx, name.c_str(), description, attachments, true));
}
}
#include "tcuRGBA.hpp"
#include "tcuTextureUtil.hpp"
#include "tcuImageCompare.hpp"
+#include "tcuVectorUtil.hpp"
#include "rrRenderer.hpp"
// Fill only the used indexes
for (deUint32 vertexIdx = m_data.params.firstVertex; vertexIdx < vectorSize; ++vertexIdx)
{
+ const float f0 = rnd.getFloat(-1.0f, 1.0f);
+ const float f1 = rnd.getFloat(-1.0f, 1.0f);
+
m_data.vertices[vertexIdx] = PositionColorVertex(
- tcu::Vec4(rnd.getFloat(-1.0, 1.0), rnd.getFloat(-1.0, 1.0), 1.0, 1.0), // Coord
- tcu::Vec4(rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0))); // Color
+ tcu::Vec4(f0, f1, 1.0f, 1.0f), // Coord
+ tcu::randomVec4(rnd)); // Color
}
}
std::vector<PositionColorVertex>::iterator vertexIt = m_data.vertices.begin() + m_data.params.vertexOffset + *indexIt;
tcu::VecAccess<float, 4, 4> positionAccess = vertexIt->position.xyzw();
- positionAccess = tcu::Vec4(rnd.getFloat(-1.0, 1.0), rnd.getFloat(-1.0, 1.0), 1.0, 1.0);
+ const float f0 = rnd.getFloat(-1.0f, 1.0f);
+ const float f1 = rnd.getFloat(-1.0f, 1.0f);
+ positionAccess = tcu::Vec4(f0, f1, 1.0f, 1.0f);
tcu::VecAccess<float, 4, 4> colorAccess = vertexIt->color.xyzw();
- colorAccess = tcu::Vec4(rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0));
+ colorAccess = tcu::randomVec4(rnd);
}
}
std::vector<PositionColorVertex>::iterator vertexIt = vertexStart + idx;
tcu::VecAccess<float, 4, 4> positionAccess = vertexIt->position.xyzw();
- positionAccess = tcu::Vec4(rnd.getFloat(-1.0, 1.0), rnd.getFloat(-1.0, 1.0), 1.0, 1.0);
+ const float f0 = rnd.getFloat(-1.0f, 1.0f);
+ const float f1 = rnd.getFloat(-1.0f, 1.0f);
+ positionAccess = tcu::Vec4(f0, f1, 1.0f, 1.0f);
tcu::VecAccess<float, 4, 4> colorAccess = vertexIt->color.xyzw();
- colorAccess = tcu::Vec4(rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0));
+ colorAccess = tcu::randomVec4(rnd);
}
}
}
std::vector<PositionColorVertex>::iterator vertexIt = m_data.vertices.begin() + cmdIt->vertexOffset + m_data.indexes[idx];
tcu::VecAccess<float, 4, 4> positionAccess = vertexIt->position.xyzw();
- positionAccess = tcu::Vec4(rnd.getFloat(-1.0, 1.0), rnd.getFloat(-1.0, 1.0), 1.0, 1.0);
+ const float f0 = rnd.getFloat(-1.0f, 1.0f);
+ const float f1 = rnd.getFloat(-1.0f, 1.0f);
+ positionAccess = tcu::Vec4(f0, f1, 1.0f, 1.0f);
tcu::VecAccess<float, 4, 4> colorAccess = vertexIt->color.xyzw();
- colorAccess = tcu::Vec4(rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0), rnd.getFloat(0.0, 1.0));
+ colorAccess = tcu::randomVec4(rnd);
}
}
}
#include "deRandom.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
#include "vkPrograms.hpp"
#include "vktTestCase.hpp"
for (int ndx = 0; ndx < testCount; ++ndx)
{
const std::string name = "clear_" + de::toString(ndx + 1);
- vk::VkClearValue clearValue = vk::makeClearValueColorF32(
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f));
+ vk::VkClearValue clearValue = vk::makeClearValueColorVec4(tcu::randomVec4(rnd));
+ const tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
+ const tcu::Vec4 vec0 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec1 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec2 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec3 = tcu::randomVec4(rnd);
- tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
ValidationData data =
{
- { tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
#include "deRandom.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
#include "vkPrograms.hpp"
#include "vktTestCase.hpp"
for (int ndx = 0; ndx < testCount; ++ndx)
{
const std::string name = "clear_" + de::toString(ndx + 1);
- vk::VkClearValue clearValue = vk::makeClearValueColorF32(
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f));
+ vk::VkClearValue clearValue = vk::makeClearValueColorVec4(tcu::randomVec4(rnd));
+ const tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
+ const tcu::Vec4 vec0 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec1 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec2 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec3 = tcu::randomVec4(rnd);
- tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
ValidationData data = {
- { tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
#include "deRandom.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
#include "vkPrograms.hpp"
#include "vktTestCase.hpp"
for (int ndx = 0; ndx < testCount; ++ndx)
{
const std::string name = "blit_" + de::toString(ndx + 1);
- vk::VkClearValue clearValue = vk::makeClearValueColorF32(
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f));
+ vk::VkClearValue clearValue = vk::makeClearValueColorVec4(tcu::randomVec4(rnd));
+ const tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
+ const tcu::Vec4 vec0 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec1 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec2 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec3 = tcu::randomVec4(rnd);
- tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
ValidationData data =
{
- { tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
blitRandomTests->addChild(new BlitImageTestCase(testCtx, name.c_str(), clearValue.color, data, cmdBufferType));
#include "deRandom.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
#include "vkPrograms.hpp"
#include "vktTestCase.hpp"
for (int ndx = 0; ndx < testCount; ++ndx)
{
const std::string name = "clear_" + de::toString(ndx + 1);
- vk::VkClearValue clearValue = vk::makeClearValueColorF32(
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f));
+ vk::VkClearValue clearValue = vk::makeClearValueColorVec4(tcu::randomVec4(rnd));
+ const tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
+ const tcu::Vec4 vec0 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec1 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec2 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec3 = tcu::randomVec4(rnd);
- tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
ValidationData data =
{
- { tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
clearRandomTests->addChild(new ClearColorImageTestCase(testCtx, name.c_str(), clearValue.color, data, cmdBufferType));
#include "deRandom.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
#include "vkPrograms.hpp"
#include "vktTestCase.hpp"
deUint32 uint;
} fillValue = { rnd.getFloat(0.0, 1.0f) };
- tcu::Vec4 refValue (fillValue.flt);
+ const tcu::Vec4 refValue (fillValue.flt);
+ const tcu::Vec4 vec0 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec1 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec2 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec3 = tcu::randomVec4(rnd);
+
ValidationData data =
{
- { tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
copyRandomTests->addChild(new CopyBufferToImageTestCase(testCtx, name.c_str(), fillValue.uint, data, cmdBufferType));
#include "deRandom.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
#include "vkPrograms.hpp"
#include "vktTestCase.hpp"
for (int ndx = 0; ndx < testCount; ++ndx)
{
const std::string name = "copy_" + de::toString(ndx + 1);
- vk::VkClearValue clearValue = vk::makeClearValueColorF32(
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f));
+ vk::VkClearValue clearValue = vk::makeClearValueColorVec4(tcu::randomVec4(rnd));
+ const tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
+ const tcu::Vec4 vec0 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec1 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec2 = tcu::randomVec4(rnd);
+ const tcu::Vec4 vec3 = tcu::randomVec4(rnd);
- tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
ValidationData data =
{
- { tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)),
- tcu::Vec4(rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f), rnd.getFloat(0.0f, 1.0f)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
copyRandomTests->addChild(new CopyImageTestCase(testCtx, name.c_str(), clearValue.color, data, cmdBufferType));
#include "deRandom.hpp"
#include "tcuTestLog.hpp"
#include "tcuVector.hpp"
+#include "tcuVectorUtil.hpp"
#include "vkPrograms.hpp"
#include "vktTestCase.hpp"
for (int ndx = 0; ndx < testCount; ++ndx)
{
const std::string name = "copy_" + de::toString(ndx + 1);
- vk::VkClearValue clearValue = vk::makeClearValueColorF32(
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f),
- rnd.getFloat(0.0, 1.0f));
+ vk::VkClearValue clearValue = vk::makeClearValueColorVec4(tcu::randomVec4(rnd));
+ const tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
+ const tcu::IVec4 vec0 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 vec1 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 vec2 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 vec3 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
- tcu::Vec4 refValue (clearValue.color.float32[0], clearValue.color.float32[1], clearValue.color.float32[2], clearValue.color.float32[3]);
ValidationDataVec4 data =
{
- { tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
deUint32 uint;
} fillValue = { rnd.getFloat(std::numeric_limits<float>::min(), std::numeric_limits<float>::max() - 1) };
- tcu::Vec4 refValue (fillValue.flt);
+ const tcu::Vec4 refValue (fillValue.flt);
+ const tcu::IVec4 vec0 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 vec1 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 vec2 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 vec3 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+
ValidationDataVec4 data =
{
- { tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)) },
+ { vec0, vec1, vec2, vec3 },
{ refValue, refValue, refValue, refValue }
};
deUint32 uint;
} fillValue = { rnd.getInt(std::numeric_limits<deInt32>::min(), std::numeric_limits<deInt32>::max() - 1) };
- tcu::IVec4 refValue (fillValue.integer);
+ const tcu::IVec4 refValue (fillValue.integer);
+ const tcu::IVec4 v0 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 v1 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 v2 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 v3 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+
ValidationDataIVec4 data =
{
- { tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)) },
+ { v0, v1, v2, v3 },
{ refValue, refValue, refValue, refValue }
};
for (int ndx = 0; ndx < testCount; ++ndx)
{
const std::string name = "test_" + de::toString(ndx + 1);
- deUint32 fillValue = rnd.getUint32();
- tcu::UVec4 refValue (fillValue);
+ const deUint32 fillValue = rnd.getUint32();
+ const tcu::UVec4 refValue (fillValue);
+ const tcu::IVec4 v0 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 v1 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 v2 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+ const tcu::IVec4 v3 = tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1));
+
ValidationDataUVec4 data =
{
- { tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)),
- tcu::IVec4(rnd.getInt(0, MAX_POSITION - 1)) },
+ { v0, v1, v2, v3 },
{ refValue, refValue, refValue, refValue }
};
testData.resize(testCount);
for (size_t ndx = 0; ndx < testCount; ++ndx)
- testData[ndx].values = tcu::UVec4(rnd.getUint32(), rnd.getUint32(), rnd.getUint32(), rnd.getUint32());
+ for (deUint32 compIdx = 0; compIdx < 4; ++compIdx)
+ testData[ndx].values[compIdx] = rnd.getUint32();
return createSpecifiedStorageBufferTests(testCtx, "random", testType, shaderType, testData.data(), testData.size());
}
#include "tcuFloat.hpp"
#include "tcuInterval.hpp"
#include "tcuFloatFormat.hpp"
+#include "tcuVectorUtil.hpp"
#include "deRandom.hpp"
#include "deMath.h"
#include "deString.h"
tcu::Vector<T, Size>* m_array;
};
-template<typename T> T randomScalar (de::Random& rnd, T minValue, T maxValue);
-template<> inline float randomScalar (de::Random& rnd, float minValue, float maxValue) { return rnd.getFloat(minValue, maxValue); }
-template<> inline deInt32 randomScalar (de::Random& rnd, deInt32 minValue, deInt32 maxValue) { return rnd.getInt(minValue, maxValue); }
-
-template<typename T, int Size>
-inline tcu::Vector<T, Size> randomVector (de::Random& rnd, const tcu::Vector<T, Size>& minValue, const tcu::Vector<T, Size>& maxValue)
-{
- tcu::Vector<T, Size> res;
- for (int ndx = 0; ndx < Size; ndx++)
- res[ndx] = randomScalar<T>(rnd, minValue[ndx], maxValue[ndx]);
- return res;
-}
-
template<typename T, int Size>
static void fillRandomVectors (de::Random& rnd, const tcu::Vector<T, Size>& minValue, const tcu::Vector<T, Size>& maxValue, void* dst, int numValues, int offset = 0)
{
VecArrayAccess<T, Size> access(dst);
for (int ndx = 0; ndx < numValues; ndx++)
- access[offset + ndx] = randomVector<T, Size>(rnd, minValue, maxValue);
+ access[offset + ndx] = tcu::randomVector<T, Size>(rnd, minValue, maxValue);
}
template<typename T>
{
T* typedPtr = (T*)dst;
for (int ndx = 0; ndx < numValues; ndx++)
- typedPtr[offset + ndx] = randomScalar<T>(rnd, minValue, maxValue);
+ typedPtr[offset + ndx] = de::randomScalar<T>(rnd, minValue, maxValue);
}
inline int numBitsLostInOp (float input, float output)
#include "tcuTestLog.hpp"
#include "tcuFormatUtil.hpp"
#include "tcuFloat.hpp"
+#include "tcuVectorUtil.hpp"
#include "deRandom.hpp"
#include "deMath.h"
#include "deString.h"
// Random values, mostly in range.
for (int ndx = 0; ndx < 15; ndx++)
{
- const float x = rnd.getFloat()*2.5f - 1.25f;
- const float y = rnd.getFloat()*2.5f - 1.25f;
- inputs.push_back(tcu::Vec2(x, y));
+ inputs.push_back(tcu::randomVector<float, 2>(rnd, tcu::Vec2(-1.25f), tcu::Vec2(1.25f)));
}
// Large random values.
for (int ndx = 0; ndx < 80; ndx++)
{
- const float x = rnd.getFloat()*1e6f - 0.5e6f;
- const float y = rnd.getFloat()*1e6f - 0.5e6f;
- inputs.push_back(tcu::Vec2(x, y));
+ inputs.push_back(tcu::randomVector<float, 2>(rnd, tcu::Vec2(-0.5e6f), tcu::Vec2(0.5e6f)));
}
outputs.resize(inputs.size());
// Random values, mostly in range.
for (int ndx = 0; ndx < 15; ndx++)
{
- const float x = rnd.getFloat()*1.25f;
- const float y = rnd.getFloat()*1.25f;
- inputs.push_back(tcu::Vec2(x, y));
+ inputs.push_back(tcu::randomVector<float, 2>(rnd, tcu::Vec2(0.0f), tcu::Vec2(1.25f)));
}
// Large random values.
for (int ndx = 0; ndx < 80; ndx++)
{
- const float x = rnd.getFloat()*1e6f - 1e5f;
- const float y = rnd.getFloat()*1e6f - 1e5f;
- inputs.push_back(tcu::Vec2(x, y));
+ inputs.push_back(tcu::randomVector<float, 2>(rnd, tcu::Vec2(-1e5f), tcu::Vec2(0.9e6f)));
}
outputs.resize(inputs.size());
// Random values, mostly in range.
for (int ndx = 0; ndx < 15; ndx++)
{
- const float x = rnd.getFloat()*2.5f - 1.25f;
- const float y = rnd.getFloat()*2.5f - 1.25f;
- const float z = rnd.getFloat()*2.5f - 1.25f;
- const float w = rnd.getFloat()*2.5f - 1.25f;
- inputs.push_back(tcu::Vec4(x, y, z, w));
+ inputs.push_back(tcu::randomVector<float, 4>(rnd, tcu::Vec4(-1.25f), tcu::Vec4(1.25f)));
}
// Large random values.
for (int ndx = 0; ndx < 80; ndx++)
{
- const float x = rnd.getFloat()*1e6f - 0.5e6f;
- const float y = rnd.getFloat()*1e6f - 0.5e6f;
- const float z = rnd.getFloat()*1e6f - 0.5e6f;
- const float w = rnd.getFloat()*1e6f - 0.5e6f;
- inputs.push_back(tcu::Vec4(x, y, z, w));
+ inputs.push_back(tcu::randomVector<float, 4>(rnd, tcu::Vec4(-0.5e6f), tcu::Vec4(0.5e6f)));
}
outputs.resize(inputs.size());
// Random values, mostly in range.
for (int ndx = 0; ndx < 15; ndx++)
{
- const float x = rnd.getFloat()*1.25f - 0.125f;
- const float y = rnd.getFloat()*1.25f - 0.125f;
- const float z = rnd.getFloat()*1.25f - 0.125f;
- const float w = rnd.getFloat()*1.25f - 0.125f;
- inputs.push_back(tcu::Vec4(x, y, z, w));
+ inputs.push_back(tcu::randomVector<float, 4>(rnd, tcu::Vec4(-0.125f), tcu::Vec4(1.125f)));
}
// Large random values.
for (int ndx = 0; ndx < 80; ndx++)
{
- const float x = rnd.getFloat()*1e6f - 1e5f;
- const float y = rnd.getFloat()*1e6f - 1e5f;
- const float z = rnd.getFloat()*1e6f - 1e5f;
- const float w = rnd.getFloat()*1e6f - 1e5f;
- inputs.push_back(tcu::Vec4(x, y, z, w));
+ inputs.push_back(tcu::randomVector<float, 4>(rnd, tcu::Vec4(-1e5f), tcu::Vec4(0.9e6f)));
}
outputs.resize(inputs.size());
const int yEnd = (row+1)*dst.getHeight()/numRows;
const int xBegin = (col+0)*dst.getWidth()/numCols;
const int xEnd = (col+1)*dst.getWidth()/numCols;
- Vec4 color;
- for (int i = 0; i < 4; i++)
- color[i] = rnd.getFloat(minVal[i], maxVal[i]);
+ const Vec4 color = tcu::randomVector<float, 4>(rnd, minVal, maxVal);
+
tcu::clear(tcu::getSubregion(dst, xBegin, yBegin, slice, xEnd-xBegin, yEnd-yBegin, 1), color);
}
}
return ss.str();
}
-template<typename T> T randomScalar (de::Random& rnd, T minValue, T maxValue);
-template<> inline float randomScalar (de::Random& rnd, float minValue, float maxValue) { return rnd.getFloat(minValue, maxValue); }
-template<> inline deInt32 randomScalar (de::Random& rnd, deInt32 minValue, deInt32 maxValue) { return rnd.getInt(minValue, maxValue); }
-
void getDefaultColors (tcu::RGBA (&colors)[4]);
void getHalfColorsFullAlpha (tcu::RGBA (&colors)[4]);
#include "vkImageUtil.hpp"
#include "tcuTextureUtil.hpp"
+#include "tcuVectorUtil.hpp"
namespace vkt
{
inputData.reserve(numDataPoints);
for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
- inputData.push_back(tcu::Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat()));
+ inputData.push_back(tcu::randomVec4(rnd));
for (deUint32 opNdx = 0u; opNdx <= READOP_IMAGESAMPLE; opNdx++)
{
vector<tcu::Vec4> inputData(numDataPoints);
for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
- inputData[numIdx] = tcu::Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat());
+ inputData[numIdx] = tcu::randomVec4(rnd);
for (deUint32 opNdx = 0u; opNdx <= READOP_IMAGESAMPLE; opNdx++)
{
inputDataVec4.reserve(numDataPoints);
for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
- inputDataVec4.push_back(Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat()));
+ inputDataVec4.push_back(tcu::randomVec4(rnd));
de::MovePtr<tcu::TestCaseGroup> testGroup (new tcu::TestCaseGroup(testCtx, "depth_property", ""));
#include "vktSpvAsmGraphicsShaderTestUtil.hpp"
#include "tcuStringTemplate.hpp"
+#include "tcuVectorUtil.hpp"
namespace vkt
{
indexSelectorData.reserve(numItems);
for (deUint32 numIdx = 0; numIdx < numItems; ++numIdx)
- indexSelectorData.push_back(UVec4(rnd.getUint32() % 32, rnd.getUint32() % 32, rnd.getUint32() % 4, rnd.getUint32() % 4));
+ indexSelectorData.push_back(tcu::randomVector<deUint32, 4>(rnd, UVec4(0), UVec4(31, 31, 3, 3)));
for (int chainOpIdx = 0; chainOpIdx < CHAIN_OP_LAST; ++chainOpIdx)
{
indexSelectorData.reserve(numItems);
for (deUint32 numIdx = 0; numIdx < numItems; ++numIdx)
- indexSelectorData.push_back(UVec4(rnd.getUint32() % 32, rnd.getUint32() % 32, rnd.getUint32() % 4, rnd.getUint32() % 4));
+ indexSelectorData.push_back(tcu::randomVector<deUint32, 4>(rnd, UVec4(0), UVec4(31, 31, 3, 3)));
getDefaultColors(defaultColors);
#include "deStringUtil.hpp"
#include "deUniquePtr.hpp"
#include "deMath.h"
+#include "deRandom.hpp"
#include "tcuStringTemplate.hpp"
#include "vktSpvAsmCrossStageInterfaceTests.hpp"
{
T* const typedPtr = (T*)dst;
for (int ndx = 0; ndx < numValues; ndx++)
- typedPtr[offset + ndx] = randomScalar<T>(rnd, minValue, maxValue);
+ typedPtr[offset + ndx] = de::randomScalar<T>(rnd, minValue, maxValue);
}
// Filter is a function that returns true if a value should pass, false otherwise.
for (int ndx = 0; ndx < numValues; ndx++)
{
do
- value = randomScalar<T>(rnd, minValue, maxValue);
+ value = de::randomScalar<T>(rnd, minValue, maxValue);
while (!filter(value));
typedPtr[offset + ndx] = value;
#include "vktSpvAsmComputeShaderCase.hpp"
#include "vktSpvAsmComputeShaderTestUtil.hpp"
#include "vktSpvAsmGraphicsShaderTestUtil.hpp"
+#include "tcuVectorUtil.hpp"
namespace vkt
{
inputData.reserve(numElements);
for (deUint32 numIdx = 0; numIdx < numElements; ++numIdx)
- inputData.push_back(tcu::Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat()));
+ inputData.push_back(tcu::randomVec4(rnd));
spec.assembly = shaderSource;
spec.numWorkGroups = IVec3(numElements, 1, 1);
vector<tcu::Vec4> inputData(numDataPoints);
for (deUint32 numIdx = 0; numIdx < numDataPoints; ++numIdx)
- inputData[numIdx] = tcu::Vec4(rnd.getFloat(), rnd.getFloat(), rnd.getFloat(), rnd.getFloat());
+ inputData[numIdx] = tcu::randomVec4(rnd);
resources.inputs.push_back(Resource(BufferSp(new Vec4Buffer(inputData)), VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER));
// Shader is expected to pass the input data by treating the input vec4 as mat2x2
{
T* const typedPtr = (T*)dst;
for (int ndx = 0; ndx < numValues; ndx++)
- typedPtr[offset + ndx] = randomScalar<T>(rnd, minValue, maxValue);
+ typedPtr[offset + ndx] = de::randomScalar<T>(rnd, minValue, maxValue);
}
// The following structure (outer_struct) is passed as a vector of 64 32-bit floats into some shaders.
#include "tcuDefs.hpp"
#include "tcuVector.hpp"
+#include "deRandom.hpp"
#include "deMeta.hpp"
#include "deMath.h"
#include "deInt32.h"
return res;
}
+template<typename T, int Size>
+inline tcu::Vector<T, Size> randomVector (de::Random& rnd, const tcu::Vector<T, Size>& minValue, const tcu::Vector<T, Size>& maxValue)
+{
+ tcu::Vector<T, Size> res;
+
+ for (int ndx = 0; ndx < Size; ndx++)
+ res[ndx] = de::randomScalar<T>(rnd, minValue[ndx], maxValue[ndx]);
+
+ return res;
+}
+
+inline Vector<float, 2> randomVec2 (de::Random& rnd)
+{
+ return randomVector<float, 2>(rnd, tcu::Vector<float, 2>(0.0f), tcu::Vector<float, 2>(1.0f));
+}
+
+inline Vector<float, 3> randomVec3 (de::Random& rnd)
+{
+ return randomVector<float, 3>(rnd, tcu::Vector<float, 3>(0.0f), tcu::Vector<float, 3>(1.0f));
+}
+
+inline Vector<float, 4> randomVec4 (de::Random& rnd)
+{
+ return randomVector<float, 4>(rnd, tcu::Vector<float, 4>(0.0f), tcu::Vector<float, 4>(1.0f));
+}
+
// Macros for component-wise ops.
#define TCU_DECLARE_VECTOR_UNARY_FUNC(FUNC_NAME, OP_NAME) \
}
}
+template<typename T> T randomScalar (de::Random& rnd, T minValue, T maxValue);
+template<> inline float randomScalar (de::Random& rnd, float minValue, float maxValue) { return rnd.getFloat(minValue, maxValue); }
+template<> inline deInt32 randomScalar (de::Random& rnd, deInt32 minValue, deInt32 maxValue) { return rnd.getInt(minValue, maxValue); }
+template<> inline deUint32 randomScalar (de::Random& rnd, deUint32 minValue, deUint32 maxValue) { return minValue + rnd.getUint32() % (maxValue - minValue + 1); }
+
} // de
#endif // _DERANDOM_HPP
#include "glsShaderExecUtil.hpp"
#include "tcuTestLog.hpp"
#include "tcuFormatUtil.hpp"
+#include "tcuVectorUtil.hpp"
#include "tcuFloat.hpp"
#include "deRandom.hpp"
#include "deMath.h"
tcu::Vector<T, Size>* m_array;
};
-template<typename T> T randomScalar (de::Random& rnd, T minValue, T maxValue);
-template<> inline float randomScalar (de::Random& rnd, float minValue, float maxValue) { return rnd.getFloat(minValue, maxValue); }
-template<> inline deInt32 randomScalar (de::Random& rnd, deInt32 minValue, deInt32 maxValue) { return rnd.getInt(minValue, maxValue); }
-template<> inline deUint32 randomScalar (de::Random& rnd, deUint32 minValue, deUint32 maxValue) { return minValue + rnd.getUint32() % (maxValue - minValue + 1); }
-
-template<typename T, int Size>
-inline tcu::Vector<T, Size> randomVector (de::Random& rnd, const tcu::Vector<T, Size>& minValue, const tcu::Vector<T, Size>& maxValue)
-{
- tcu::Vector<T, Size> res;
- for (int ndx = 0; ndx < Size; ndx++)
- res[ndx] = randomScalar<T>(rnd, minValue[ndx], maxValue[ndx]);
- return res;
-}
-
template<typename T, int Size>
static void fillRandomVectors (de::Random& rnd, const tcu::Vector<T, Size>& minValue, const tcu::Vector<T, Size>& maxValue, void* dst, int numValues, int offset = 0)
{
VecArrayAccess<T, Size> access(dst);
for (int ndx = 0; ndx < numValues; ndx++)
- access[offset + ndx] = randomVector<T, Size>(rnd, minValue, maxValue);
+ access[offset + ndx] = tcu::randomVector<T, Size>(rnd, minValue, maxValue);
}
template<typename T>
{
T* typedPtr = (T*)dst;
for (int ndx = 0; ndx < numValues; ndx++)
- typedPtr[offset + ndx] = randomScalar<T>(rnd, minValue, maxValue);
+ typedPtr[offset + ndx] = de::randomScalar<T>(rnd, minValue, maxValue);
}
inline int numBitsLostInOp (float input, float output)
#include "tcuFloat.hpp"
#include "tcuInterval.hpp"
#include "tcuFloatFormat.hpp"
+#include "tcuVectorUtil.hpp"
#include "deRandom.hpp"
#include "deMath.h"
#include "deString.h"
tcu::Vector<T, Size>* m_array;
};
-template<typename T> T randomScalar (de::Random& rnd, T minValue, T maxValue);
-template<> inline float randomScalar (de::Random& rnd, float minValue, float maxValue) { return rnd.getFloat(minValue, maxValue); }
-template<> inline deInt32 randomScalar (de::Random& rnd, deInt32 minValue, deInt32 maxValue) { return rnd.getInt(minValue, maxValue); }
-template<> inline deUint32 randomScalar (de::Random& rnd, deUint32 minValue, deUint32 maxValue) { return minValue + rnd.getUint32() % (maxValue - minValue + 1); }
-
-template<typename T, int Size>
-inline tcu::Vector<T, Size> randomVector (de::Random& rnd, const tcu::Vector<T, Size>& minValue, const tcu::Vector<T, Size>& maxValue)
-{
- tcu::Vector<T, Size> res;
- for (int ndx = 0; ndx < Size; ndx++)
- res[ndx] = randomScalar<T>(rnd, minValue[ndx], maxValue[ndx]);
- return res;
-}
-
template<typename T, int Size>
static void fillRandomVectors (de::Random& rnd, const tcu::Vector<T, Size>& minValue, const tcu::Vector<T, Size>& maxValue, void* dst, int numValues, int offset = 0)
{
VecArrayAccess<T, Size> access(dst);
for (int ndx = 0; ndx < numValues; ndx++)
- access[offset + ndx] = randomVector<T, Size>(rnd, minValue, maxValue);
+ access[offset + ndx] = tcu::randomVector<T, Size>(rnd, minValue, maxValue);
}
template<typename T>
{
T* typedPtr = (T*)dst;
for (int ndx = 0; ndx < numValues; ndx++)
- typedPtr[offset + ndx] = randomScalar<T>(rnd, minValue, maxValue);
+ typedPtr[offset + ndx] = de::randomScalar<T>(rnd, minValue, maxValue);
}
inline int numBitsLostInOp (float input, float output)