, interfaces (interfaces_)
, failResult (QP_TEST_RESULT_FAIL)
, failMessageTemplate ("${reason}")
+ , renderFullSquare (false)
{
inputColors[0] = inputs[0];
inputColors[1] = inputs[1];
, interfaces (other.interfaces)
, failResult (other.failResult)
, failMessageTemplate (other.failMessageTemplate)
+ , renderFullSquare (other.renderFullSquare)
{
inputColors[0] = other.inputColors[0];
inputColors[1] = other.inputColors[1];
Move<VkBuffer> createBufferForResource (const DeviceInterface& vk, const VkDevice vkDevice, const Resource& resource, deUint32 queueFamilyIndex)
{
+ const vk::VkDescriptorType resourceType = resource.getDescriptorType();
+
vector<deUint8> resourceBytes;
- resource.second->getBytes(resourceBytes);
+ resource.getBytes(resourceBytes);
const VkBufferCreateInfo resourceBufferParams =
{
DE_NULL, // pNext
(VkBufferCreateFlags)0, // flags
(VkDeviceSize)resourceBytes.size(), // size
- (VkBufferUsageFlags)getMatchingBufferUsageFlagBit(resource.first), // usage
+ (VkBufferUsageFlags)getMatchingBufferUsageFlagBit(resourceType), // usage
VK_SHARING_MODE_EXCLUSIVE, // sharingMode
1u, // queueFamilyCount
&queueFamilyIndex, // pQueueFamilyIndices
1u, // deUint32 arraySize;
VK_SAMPLE_COUNT_1_BIT, // deUint32 samples;
VK_IMAGE_TILING_OPTIMAL, // VkImageTiling tiling;
- getMatchingImageUsageFlags(resource.first), // VkImageUsageFlags usage;
+ getMatchingImageUsageFlags(resource.getDescriptorType()), // VkImageUsageFlags usage;
VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1u, // deUint32 queueFamilyCount;
&queueFamilyIndex, // const deUint32* pQueueFamilyIndices;
const deUint32 numResources = static_cast<deUint32>(instance.resources.inputs.size() + instance.resources.outputs.size());
const bool needInterface = !instance.interfaces.empty();
const VkPhysicalDeviceFeatures& features = context.getDeviceFeatures();
+ const Vec4 defaulClearColor (0.125f, 0.25f, 0.75f, 1.0f);
supportsGeometry = features.geometryShader == VK_TRUE;
supportsTessellation = features.tessellationShader == VK_TRUE;
}
}
- // 8bit storage features
+ // Core features
{
- if (!is8BitStorageFeaturesSupported(context, instance.requestedFeatures.ext8BitStorage))
- TCU_THROW(NotSupportedError, "Requested 8bit storage features not supported");
+ const char* unsupportedFeature = DE_NULL;
+
+ if (!isCoreFeaturesSupported(context, instance.requestedFeatures.coreFeatures, &unsupportedFeature))
+ TCU_THROW(NotSupportedError, std::string("At least following requested core feature is not supported: ") + unsupportedFeature);
}
- // 16bit storage features
+ // Extension features
{
- if (!is16BitStorageFeaturesSupported(context, instance.requestedFeatures.ext16BitStorage))
- TCU_THROW(NotSupportedError, "Requested 16bit storage features not supported");
+ // 16bit storage features
+ {
+ if (!is16BitStorageFeaturesSupported(context, instance.requestedFeatures.ext16BitStorage))
+ TCU_THROW(NotSupportedError, "Requested 16bit storage features not supported");
+ }
+
+ // 8bit storage features
+ {
+ if (!is8BitStorageFeaturesSupported(context, instance.requestedFeatures.ext8BitStorage))
+ TCU_THROW(NotSupportedError, "Requested 8bit storage features not supported");
+ }
}
// fragment stores and atomics feature
const Vec4 vertexData[] =
{
// Upper left corner:
- Vec4(-1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(),
- Vec4(-0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(),
- Vec4(-1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[0].toVec(),
+ Vec4(-1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(), //1
+ Vec4(-0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[0].toVec(), //2
+ Vec4(-1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[0].toVec(), //3
// Upper right corner:
- Vec4(+0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(),
- Vec4(+1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(),
- Vec4(+1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[1].toVec(),
+ Vec4(+0.5f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(), //4
+ Vec4(+1.0f, -1.0f, 0.0f, 1.0f), instance.inputColors[1].toVec(), //5
+ Vec4(+1.0f, -0.5f, 0.0f, 1.0f), instance.inputColors[1].toVec(), //6
// Lower left corner:
- Vec4(-1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[2].toVec(),
- Vec4(-0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(),
- Vec4(-1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(),
+ Vec4(-1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[2].toVec(), //7
+ Vec4(-0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(), //8
+ Vec4(-1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[2].toVec(), //9
// Lower right corner:
- Vec4(+1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[3].toVec(),
- Vec4(+1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec(),
- Vec4(+0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec()
+ Vec4(+1.0f, +0.5f, 0.0f, 1.0f), instance.inputColors[3].toVec(), //10
+ Vec4(+1.0f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec(), //11
+ Vec4(+0.5f, +1.0f, 0.0f, 1.0f), instance.inputColors[3].toVec(), //12
+
+ // The rest is used only renderFullSquare specified. Fills area already filled with clear color
+ // Left 1
+ Vec4(-1.0f, -0.5f, 0.0f, 1.0f), defaulClearColor, //3
+ Vec4(-0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor, //2
+ Vec4(-1.0f, +0.5f, 0.0f, 1.0f), defaulClearColor, //7
+
+ // Left 2
+ Vec4(-1.0f, +0.5f, 0.0f, 1.0f), defaulClearColor, //7
+ Vec4(-0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor, //2
+ Vec4(-0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor, //8
+
+ // Left-Center
+ Vec4(-0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor, //8
+ Vec4(-0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor, //2
+ Vec4(+0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor, //4
+
+ // Right-Center
+ Vec4(+0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor, //4
+ Vec4(+0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor, //12
+ Vec4(-0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor, //8
+
+ // Right 2
+ Vec4(+0.5f, -1.0f, 0.0f, 1.0f), defaulClearColor, //4
+ Vec4(+1.0f, -0.5f, 0.0f, 1.0f), defaulClearColor, //6
+ Vec4(+0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor, //12
+
+ // Right 1
+ Vec4(+0.5f, +1.0f, 0.0f, 1.0f), defaulClearColor, //12
+ Vec4(+1.0f, -0.5f, 0.0f, 1.0f), defaulClearColor, //6
+ Vec4(+1.0f, +0.5f, 0.0f, 1.0f), defaulClearColor, //10
};
+
const size_t singleVertexDataSize = 2 * sizeof(Vec4);
- const size_t vertexCount = sizeof(vertexData) / singleVertexDataSize;
+ const size_t vertexCount = instance.renderFullSquare ? sizeof(vertexData) / singleVertexDataSize : 4*3;
+ const size_t vertexDataSize = vertexCount * singleVertexDataSize;
Move<VkBuffer> vertexInputBuffer;
de::MovePtr<Allocation> vertexInputMemory;
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType;
DE_NULL, // const void* pNext;
0u, // VkBufferCreateFlags flags;
- (VkDeviceSize)sizeof(vertexData), // VkDeviceSize size;
+ (VkDeviceSize)vertexDataSize, // VkDeviceSize size;
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, // VkBufferUsageFlags usage;
VK_SHARING_MODE_EXCLUSIVE, // VkSharingMode sharingMode;
1u, // deUint32 queueFamilyCount;
{
const Resource& resource = instance.resources.inputs[inputNdx];
- const bool hasImage = (resource.first == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) ||
- (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
- (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+ const bool hasImage = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
- const bool hasSampler = (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
- (resource.first == VK_DESCRIPTOR_TYPE_SAMPLER) ||
- (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+ const bool hasSampler = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLER) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
// Resource is a buffer
if (!hasImage && !hasSampler)
};
vector<deUint8> resourceBytes;
- resource.second->getBytes(resourceBytes);
+ resource.getBytes(resourceBytes);
deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
};
vector<deUint8> resourceBytes;
- resource.second->getBytes(resourceBytes);
+ resource.getBytes(resourceBytes);
deMemcpy(resourceMemory->getHostPtr(), &resourceBytes.front(), resourceBytes.size());
VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
const VkDescriptorSetLayoutBinding binding =
{
inputNdx, // binding
- resource.first, // descriptorType
+ resource.getDescriptorType(), // descriptorType
1u, // descriptorCount
VK_SHADER_STAGE_ALL_GRAPHICS, // stageFlags
DE_NULL, // pImmutableSamplers
// Note: the following code doesn't check and unify descriptors of the same type.
const VkDescriptorPoolSize poolSize =
{
- resource.first, // type
+ resource.getDescriptorType(), // type
1u, // descriptorCount
};
poolSizes.push_back(poolSize);
VK_WHOLE_SIZE, // VkDeviceSize size;
};
- resource.second->getBytes(resourceBytes);
+ resource.getBytes(resourceBytes);
deMemset((deUint8*)resourceMemory->getHostPtr(), 0xff, resourceBytes.size());
VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
const VkDescriptorSetLayoutBinding binding =
{
numInResources + outputNdx, // binding
- resource.first, // descriptorType
+ resource.getDescriptorType(), // descriptorType
1u, // descriptorCount
VK_SHADER_STAGE_ALL_GRAPHICS, // stageFlags
DE_NULL, // pImmutableSamplers
// Note: the following code doesn't check and unify descriptors of the same type.
const VkDescriptorPoolSize poolSize =
{
- resource.first, // type
+ resource.getDescriptorType(), // type
1u, // descriptorCount
};
poolSizes.push_back(poolSize);
{
const Resource& resource = instance.resources.inputs[inputNdx];
- const bool hasImage = (resource.first == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) ||
- (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
- (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+ const bool hasImage = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
- const bool hasSampler = (resource.first == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
- (resource.first == VK_DESCRIPTOR_TYPE_SAMPLER) ||
- (resource.first == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
+ const bool hasSampler = (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_SAMPLER) ||
+ (resource.getDescriptorType() == VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER);
// Create image view and sampler
if (hasImage || hasSampler)
{
- if (resource.first != VK_DESCRIPTOR_TYPE_SAMPLER)
+ if (resource.getDescriptorType() != VK_DESCRIPTOR_TYPE_SAMPLER)
{
const VkImageViewCreateInfo imgViewParams =
{
}
// Create descriptor buffer and image infos
- switch (resource.first)
+ switch (resource.getDescriptorType())
{
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
inputNdx, // binding
0, // dstArrayElement
1u, // descriptorCount
- instance.resources.inputs[inputNdx].first, // descriptorType
+ instance.resources.inputs[inputNdx].getDescriptorType(), // descriptorType
( (hasImage | hasSampler) ? &dImageInfos.back() : DE_NULL), // pImageInfo
(!(hasImage | hasSampler) ? &dBufferInfos.back() : DE_NULL), // pBufferInfo
DE_NULL, // pTexelBufferView
dBufferInfos.push_back(bufInfo);
const VkWriteDescriptorSet writeSpec = {
- VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, // sType
- DE_NULL, // pNext
- rawSet, // dstSet
- numInResources + outputNdx, // binding
- 0, // dstArrayElement
- 1u, // descriptorCount
- instance.resources.outputs[outputNdx].first, // descriptorType
- DE_NULL, // pImageInfo
- &dBufferInfos.back(), // pBufferInfo
- DE_NULL, // pTexelBufferView
+ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, // sType
+ DE_NULL, // pNext
+ rawSet, // dstSet
+ numInResources + outputNdx, // binding
+ 0, // dstArrayElement
+ 1u, // descriptorCount
+ instance.resources.outputs[outputNdx].getDescriptorType(), // descriptorType
+ DE_NULL, // pImageInfo
+ &dBufferInfos.back(), // pBufferInfo
+ DE_NULL, // pTexelBufferView
};
writeSpecs.push_back(writeSpec);
}
if (stageIt != instance.specConstants.end())
{
- const size_t numSpecConstants = stageIt->second.size();
+ const size_t numSpecConstants = stageIt->second.getValuesCount();
vector<VkSpecializationMapEntry> entries;
VkSpecializationInfo specInfo;
+ size_t offset = 0;
entries.resize(numSpecConstants);
- // Only support 32-bit integers as spec constants now. And their constant IDs are numbered sequentially starting from 0.
+ // Constant IDs are numbered sequentially starting from 0.
for (size_t ndx = 0; ndx < numSpecConstants; ++ndx)
{
+ const size_t valueSize = stageIt->second.getValueSize(ndx);
+
entries[ndx].constantID = (deUint32)ndx;
- entries[ndx].offset = deUint32(ndx * sizeof(deInt32));
- entries[ndx].size = sizeof(deInt32);
+ entries[ndx].offset = static_cast<deUint32>(offset);
+ entries[ndx].size = valueSize;
+
+ offset += valueSize;
}
specConstantEntries.push_back(entries);
specInfo.mapEntryCount = (deUint32)numSpecConstants;
specInfo.pMapEntries = specConstantEntries.back().data();
- specInfo.dataSize = numSpecConstants * sizeof(deInt32);
- specInfo.pData = stageIt->second.data();
+ specInfo.dataSize = offset;
+ specInfo.pData = stageIt->second.getValuesBuffer();
specializationInfos.push_back(specInfo);
stageInfo->pSpecializationInfo = &specializationInfos.back();
{
vector<VkClearValue> clearValue;
- clearValue.push_back(makeClearValueColorF32(0.125f, 0.25f, 0.75f, 1.0f));
+ clearValue.push_back(makeClearValueColorF32(defaulClearColor[0], defaulClearColor[1], defaulClearColor[2], defaulClearColor[3]));
if (needInterface)
{
clearValue.push_back(makeClearValueColorU32(0, 0, 0, 0));
DE_NULL, // const void* pNext;
vertexBufferMemory->getMemory(), // VkDeviceMemory mem;
0, // VkDeviceSize offset;
- (VkDeviceSize)sizeof(vertexData), // VkDeviceSize size;
+ (VkDeviceSize)vertexDataSize, // VkDeviceSize size;
};
void* vertexBufPtr = vertexBufferMemory->getHostPtr();
- deMemcpy(vertexBufPtr, &vertexData[0], sizeof(vertexData));
+ deMemcpy(vertexBufPtr, &vertexData[0], vertexDataSize);
VK_CHECK(vk.flushMappedMemoryRanges(device, 1u, &range));
}
// Check the contents in output resources match with expected.
for (deUint32 outputNdx = 0; outputNdx < numOutResources; ++outputNdx)
{
- const BufferSp& expected = instance.resources.outputs[outputNdx].second;
+ const BufferSp& expected = instance.resources.outputs[outputNdx].getBuffer();
if (instance.resources.verifyIO != DE_NULL)
{
const RGBA (&inputColors)[4],
const RGBA (&outputColors)[4],
const map<string, string>& testCodeFragments,
- const vector<deInt32>& specConstants,
+ const SpecConstants& specConstants,
const PushConstants& pushConstants,
const GraphicsResources& resources,
const GraphicsInterfaces& interfaces,
VulkanFeatures vulkanFeatures,
tcu::TestCaseGroup* tests,
const qpTestResult failResult,
- const string& failMessageTemplate)
+ const string& failMessageTemplate,
+ const bool renderFullSquare)
{
const StageData& stageData = getStageData(stage);
DE_ASSERT(stageData.getPipelineFn || stageData.initProgramsFn);
if (!failMessageTemplate.empty())
ctx.failMessageTemplate = failMessageTemplate;
+ ctx.renderFullSquare = renderFullSquare;
addFunctionCaseWithPrograms<InstanceContext>(tests, name, "", stageData.initProgramsFn, runAndVerifyDefaultPipeline, ctx);
}
const RGBA (&inputColors)[4],
const RGBA (&outputColors)[4],
const map<string, string>& testCodeFragments,
- const vector<deInt32>& specConstants,
+ const SpecConstants& specConstants,
const PushConstants& pushConstants,
const GraphicsResources& resources,
const GraphicsInterfaces& interfaces,
getDefaultColors(defaultColors);
createTestForStage(VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, name,
- defaultColors, defaultColors, fragments, vector<deInt32>(), PushConstants(), GraphicsResources(),
+ defaultColors, defaultColors, fragments, SpecConstants(), PushConstants(), GraphicsResources(),
GraphicsInterfaces(), vector<string>(), vector<string>(), VulkanFeatures(), group);
}