bufferBarriers.push_back(bufferBarrier);
deMemcpy(buffer->getAllocation().getHostPtr(), imageData.getPlanePtr(planeNdx), imageData.getPlaneSize(planeNdx));
- flushMappedMemoryRange(vk, device, buffer->getAllocation().getMemory(), buffer->getAllocation().getOffset(), (deUint32)imageData.getPlaneSize(planeNdx));
+ flushAlloc(vk, device, buffer->getAllocation());
stagingBuffers.push_back(de::SharedPtr<de::MovePtr<vk::BufferWithMemory> >(new de::MovePtr<vk::BufferWithMemory>(buffer.release())));
}
for (deUint32 planeNdx = 0; planeNdx < imageData.getDescription().numPlanes; ++planeNdx)
{
- const vk::VkImageAspectFlagBits aspect = formatDesc.numPlanes > 1
+ const vk::VkImageAspectFlags aspect = formatDesc.numPlanes > 1
? vk::getPlaneAspect(planeNdx)
: vk::VK_IMAGE_ASPECT_COLOR_BIT;
for (deUint32 planeNdx = 0; planeNdx < imageData.getDescription().numPlanes; ++planeNdx)
{
- const vk::VkImageAspectFlagBits aspect = formatDesc.numPlanes > 1
+ const vk::VkImageAspectFlags aspect = formatDesc.numPlanes > 1
? vk::getPlaneAspect(planeNdx)
: vk::VK_IMAGE_ASPECT_COLOR_BIT;
bool validateImage (ProtectedContext& ctx,
const std::vector<YCbCrValidationData>& refData,
const vk::VkSampler sampler,
- const vk::VkImageView imageView)
+ const vk::VkImageView imageView,
+ const deUint32 combinedSamplerDescriptorCount)
{
{
tcu::TestLog& log (ctx.getTestContext().getLog());
// Set the reference uniform data
{
deMemcpy(refUniform->getAllocation().getHostPtr(), &refData[0], refUniformSize);
- vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+ flushAlloc(vk, device, refUniform->getAllocation());
}
const deUint32 helperBufferSize = (deUint32)(2 * sizeof(deUint32));
.addSingleBinding(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, vk::VK_SHADER_STAGE_COMPUTE_BIT)
.build(vk, device));
const vk::Unique<vk::VkDescriptorPool> descriptorPool(vk::DescriptorPoolBuilder()
- .addType(vk::VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1u)
+ .addType(vk::VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, combinedSamplerDescriptorCount)
.addType(vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1u)
.addType(vk::VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1u)
.build(vk, device, vk::VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u));
"layout(std140, set = 0, binding = 2) buffer ProtectedHelper\n"
"{\n"
" highp uint zero;\n"
- " highp uint dummyOut;\n"
+ " highp uint unusedOut;\n"
"} helper;\n"
"\n"
"void error()\n"
"{\n"
" for (uint x = 0u; x < 10u; x += helper.zero)\n"
- " atomicAdd(helper.dummyOut, 1u);\n"
+ " atomicAdd(helper.unusedOut, 1u);\n"
"}\n"
"\n"
"${COMPARE_FUNCTION}"
"layout(std140, set=0, binding=2) buffer ProtectedHelper\n"
"{\n"
" highp uint zero; // set to 0\n"
- " highp uint dummyOut;\n"
+ " highp uint unusedOut;\n"
"} helper;\n"
"\n"
"void main (void)\n"
"{\n"
" helper.zero = 0;\n"
- " helper.dummyOut = 0;\n"
+ " helper.unusedOut = 0;\n"
"}\n";
dst.glslSources.add("ResetSSBO") << glu::ComputeSource(resetSSBOShader);
const vk::VkImage colorImage,
const vk::VkImageView colorImageView,
const std::vector<YCbCrValidationData>& referenceData,
- const std::vector<tcu::Vec2>& posCoords)
+ const std::vector<tcu::Vec2>& posCoords,
+ const deUint32 combinedSamplerDescriptorCount)
{
const vk::DeviceInterface& vk = ctx.getDeviceInterface();
const vk::VkDevice device = ctx.getDevice();
.addSingleBinding(vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, vk::VK_SHADER_STAGE_ALL)
.build(vk, device));
const vk::Unique<vk::VkDescriptorPool> descriptorPool (vk::DescriptorPoolBuilder()
- .addType(vk::VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1u)
+ .addType(vk::VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, combinedSamplerDescriptorCount)
.addType(vk::VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1u)
.build(vk, device, vk::VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, 1u));
const vk::Unique<vk::VkDescriptorSet> descriptorSet (makeDescriptorSet(vk, device, *descriptorPool, *descriptorSetLayout));
// Set the reference uniform data
{
deMemcpy(refUniform->getAllocation().getHostPtr(), &referenceData[0], refUniformSize);
- vk::flushMappedMemoryRange(vk, device, refUniform->getAllocation().getMemory(), refUniform->getAllocation().getOffset(), refUniformSize);
+ flushAlloc(vk, device, refUniform->getAllocation());
}
// Update descriptor set
vk::MemoryRequirement::HostVisible);
deMemcpy(vertexBuffer->getAllocation().getHostPtr(), &posCoords[0], bufferSize);
- vk::flushMappedMemoryRange(vk, device, vertexBuffer->getAllocation().getMemory(), vertexBuffer->getAllocation().getOffset(), bufferSize);
+ flushAlloc(vk, device, vertexBuffer->getAllocation());
}
const vk::Unique<vk::VkPipeline> pipeline (makeGraphicsPipeline(vk,
*conversion));
const vk::Unique<vk::VkImageView> ycbcrImageView (createImageView(vk, device, **ycbcrImage, config.format, *conversion));
+ deUint32 combinedSamplerDescriptorCount = 1;
+ {
+ const vk::VkPhysicalDeviceImageFormatInfo2 imageFormatInfo =
+ {
+ vk::VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, // sType
+ DE_NULL, // pNext
+ config.format, // format
+ vk::VK_IMAGE_TYPE_2D, // type
+ vk::VK_IMAGE_TILING_OPTIMAL, // tiling
+ vk::VK_IMAGE_USAGE_TRANSFER_DST_BIT |
+ vk::VK_IMAGE_USAGE_SAMPLED_BIT, // usage
+ ycbcrImageFlags // flags
+ };
+
+ vk::VkSamplerYcbcrConversionImageFormatProperties samplerYcbcrConversionImage = {};
+ samplerYcbcrConversionImage.sType = vk::VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES;
+ samplerYcbcrConversionImage.pNext = DE_NULL;
+
+ vk::VkImageFormatProperties2 imageFormatProperties = {};
+ imageFormatProperties.sType = vk::VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2;
+ imageFormatProperties.pNext = &samplerYcbcrConversionImage;
+
+ VK_CHECK(context.getInstanceInterface().getPhysicalDeviceImageFormatProperties2(context.getPhysicalDevice(), &imageFormatInfo, &imageFormatProperties));
+ combinedSamplerDescriptorCount = samplerYcbcrConversionImage.combinedImageSamplerDescriptorCount;
+ }
// Input attributes
std::vector<tcu::Vec2> texCoords;
const vk::Unique<vk::VkImageView> colorImageView (createImageView(ctx, **colorImage, s_colorFormat));
const vk::Unique<vk::VkSampler> colorSampler (makeSampler(vk, device));
- renderYCbCrToColor(ctx, size, *ycbcrSampler, *ycbcrImageView, **colorImage, *colorImageView, referenceData, posCoords);
+ renderYCbCrToColor(ctx, size, *ycbcrSampler, *ycbcrImageView, **colorImage, *colorImageView, referenceData, posCoords, combinedSamplerDescriptorCount);
- if (!validateImage(ctx, colorReferenceData, *colorSampler, *colorImageView))
+ if (!validateImage(ctx, colorReferenceData, *colorSampler, *colorImageView, combinedSamplerDescriptorCount))
return tcu::TestStatus::fail("YCbCr image conversion via fragment shader failed");
}
else if (config.shaderType == glu::SHADERTYPE_COMPUTE)
{
- if (!validateImage(ctx, referenceData, *ycbcrSampler, *ycbcrImageView))
+ if (!validateImage(ctx, referenceData, *ycbcrSampler, *ycbcrImageView, combinedSamplerDescriptorCount))
return tcu::TestStatus::fail("YCbCr image conversion via compute shader failed");
}
else