}
}
-std::vector<tcu::UVec3> getMipLevelSizes (tcu::UVec3 baseSize)
-{
- std::vector<tcu::UVec3> levels;
- levels.push_back(baseSize);
-
- while (baseSize.x() != 1 || baseSize.y() != 1 || baseSize.z() != 1)
- {
- baseSize.x() = deMax32(baseSize.x() >> 1, 1);
- baseSize.y() = deMax32(baseSize.y() >> 1, 1);
- baseSize.z() = deMax32(baseSize.z() >> 1, 1);
- levels.push_back(baseSize);
- }
-
- return levels;
-}
-
VkBufferCreateInfo makeBufferCreateInfo (const VkDeviceSize bufferSize,
const VkBufferUsageFlags usage)
{
const VkShaderModule vertexModule,
const VkShaderModule fragmentModule,
const VkExtent2D renderSize,
- const deUint32 colorAttachmentCount)
+ const deUint32 colorAttachmentCount,
+ const bool dynamicSize)
{
const VkFormat vertexFormatPosition = VK_FORMAT_R32G32B32A32_SFLOAT;
const deUint32 vertexSizePosition = tcu::getPixelSize(mapVkFormat(vertexFormatPosition));
DE_NULL, // const VkSpecializationInfo* pSpecializationInfo;
}
};
-
const deUint32 numActiveShaderStages = DE_LENGTH_OF_ARRAY(pShaderStages);
+ const VkDynamicState dynamicStates[] =
+ {
+ VK_DYNAMIC_STATE_VIEWPORT,
+ VK_DYNAMIC_STATE_SCISSOR,
+ };
+
+ const VkPipelineDynamicStateCreateInfo dynamicStateCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ (VkPipelineDynamicStateCreateFlags)0, // VkPipelineDynamicStateCreateFlags flags;
+ DE_LENGTH_OF_ARRAY(dynamicStates), // deUint32 dynamicStateCount;
+ dynamicStates, // const VkDynamicState* pDynamicStates;
+ };
+
const VkGraphicsPipelineCreateInfo graphicsPipelineInfo =
{
VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO, // VkStructureType sType;
&pipelineMultisampleStateInfo, // const VkPipelineMultisampleStateCreateInfo* pMultisampleState;
DE_NULL, // const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState;
&pipelineColorBlendStateInfo, // const VkPipelineColorBlendStateCreateInfo* pColorBlendState;
- DE_NULL, // const VkPipelineDynamicStateCreateInfo* pDynamicState;
+ dynamicSize ? &dynamicStateCreateInfo : DE_NULL, // const VkPipelineDynamicStateCreateInfo* pDynamicState;
pipelineLayout, // VkPipelineLayout layout;
renderPass, // VkRenderPass renderPass;
0u, // deUint32 subpass;
VK_ATTACHMENT_LOAD_OP_DONT_CARE, // VkAttachmentLoadOp stencilLoadOp;
VK_ATTACHMENT_STORE_OP_DONT_CARE, // VkAttachmentStoreOp stencilStoreOp;
VK_IMAGE_LAYOUT_UNDEFINED, // VkImageLayout initialLayout;
- VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL, // VkImageLayout finalLayout;
+ VK_IMAGE_LAYOUT_GENERAL, // VkImageLayout finalLayout;
}
};
return barrier;
}
+VkImageViewUsageCreateInfoKHR makeImageViewUsageCreateInfo (const VkImageUsageFlags imageUsageFlags)
+{
+ VkImageViewUsageCreateInfoKHR imageViewUsageCreateInfoKHR =
+ {
+ VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR, //VkStructureType sType;
+ DE_NULL, //const void* pNext;
+ imageUsageFlags, //VkImageUsageFlags usage;
+ };
+
+ return imageViewUsageCreateInfoKHR;
+}
+
VkSamplerCreateInfo makeSamplerCreateInfo ()
{
const VkSamplerCreateInfo defaultSamplerParams =
0.0f, // float mipLodBias;
VK_FALSE, // VkBool32 anisotropyEnable;
1.0f, // float maxAnisotropy;
- false, // VkBool32 compareEnable;
+ VK_FALSE, // VkBool32 compareEnable;
VK_COMPARE_OP_NEVER, // VkCompareOp compareOp;
0.0f, // float minLod;
0.25f, // float maxLod;
VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, // VkBorderColor borderColor;
- false // VkBool32 unnormalizedCoordinates;
+ VK_FALSE // VkBool32 unnormalizedCoordinates;
};
return defaultSamplerParams;
const VkSubmitInfo submitInfo =
{
- VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
- DE_NULL, // const void* pNext;
- 0u, // deUint32 waitSemaphoreCount;
- DE_NULL, // const VkSemaphore* pWaitSemaphores;
- (const VkPipelineStageFlags*)DE_NULL,
- 1u, // deUint32 commandBufferCount;
- &commandBuffer, // const VkCommandBuffer* pCommandBuffers;
- 0u, // deUint32 signalSemaphoreCount;
- DE_NULL, // const VkSemaphore* pSignalSemaphores;
+ VK_STRUCTURE_TYPE_SUBMIT_INFO, // VkStructureType sType;
+ DE_NULL, // const void* pNext;
+ 0u, // deUint32 waitSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pWaitSemaphores;
+ (const VkPipelineStageFlags*)DE_NULL, // const VkPipelineStageFlags* pWaitDstStageMask;
+ 1u, // deUint32 commandBufferCount;
+ &commandBuffer, // const VkCommandBuffer* pCommandBuffers;
+ 0u, // deUint32 signalSemaphoreCount;
+ DE_NULL, // const VkSemaphore* pSignalSemaphores;
};
VK_CHECK(vk.queueSubmit(queue, 1u, &submitInfo, *fence));
VK_CHECK(vk.waitForFences(device, 1u, &fence.get(), DE_TRUE, ~0ull));
}
-tcu::UVec3 getCompressedImageResolutionInBlocks(const vk::VkFormat format, const tcu::UVec3 size)
+tcu::UVec3 getCompressedImageResolutionInBlocks (const vk::VkFormat format, const tcu::UVec3& size)
{
deUint32 blockWidth = getBlockWidth(format);
deUint32 blockHeight = getBlockHeight(format);
return tcu::UVec3(widthInBlocks, heightInBlocks, 1);
}
+tcu::UVec3 getCompressedImageResolutionBlockCeil (const vk::VkFormat format, const tcu::UVec3& size)
+{
+ deUint32 blockWidth = getBlockWidth(format);
+ deUint32 blockHeight = getBlockHeight(format);
+
+ DE_ASSERT(size[2] == 1);
+ DE_ASSERT(blockWidth != 0 && blockHeight != 0);
+
+ deUint32 widthInBlocks = (size[0] + blockWidth - 1) / blockWidth;
+ deUint32 heightInBlocks = (size[1] + blockHeight - 1) / blockHeight;
+
+ return tcu::UVec3(blockWidth * widthInBlocks, blockHeight * heightInBlocks, 1);
+}
+
VkDeviceSize getCompressedImageSizeInBytes (const vk::VkFormat format, const tcu::UVec3& size)
{
tcu::UVec3 sizeInBlocks = getCompressedImageResolutionInBlocks(format, size);
}
}
+const char* getGlslAttachmentType (const vk::VkFormat format)
+{
+ const tcu::TextureFormat textureFormat = mapVkFormat(format);
+ const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(textureFormat.type);
+
+ switch (channelClass)
+ {
+ case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER:
+ return "ivec4";
+
+ case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER:
+ return "uvec4";
+
+ case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT:
+ case tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT:
+ case tcu::TEXTURECHANNELCLASS_FLOATING_POINT:
+ return "vec4";
+
+ default:
+ DE_FATAL("Unknown channel class");
+ return "";
+ }
+}
+
+const char* getGlslInputAttachmentType (const vk::VkFormat format)
+{
+ const tcu::TextureFormat textureFormat = mapVkFormat(format);
+ const tcu::TextureChannelClass channelClass = tcu::getTextureChannelClass(textureFormat.type);
+
+ switch (channelClass)
+ {
+ case tcu::TEXTURECHANNELCLASS_SIGNED_INTEGER:
+ return "isubpassInput";
+
+ case tcu::TEXTURECHANNELCLASS_UNSIGNED_INTEGER:
+ return "usubpassInput";
+
+ case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT:
+ case tcu::TEXTURECHANNELCLASS_UNSIGNED_FIXED_POINT:
+ case tcu::TEXTURECHANNELCLASS_FLOATING_POINT:
+ return "subpassInput";
+
+ default:
+ DE_FATAL("Unknown channel class");
+ return "";
+ }
+}
+
+bool isPackedType (const vk::VkFormat format)
+{
+ const tcu::TextureFormat textureFormat = mapVkFormat(format);
+
+ DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELTYPE_LAST == 40);
+
+ switch (textureFormat.type)
+ {
+ case tcu::TextureFormat::UNORM_BYTE_44:
+ case tcu::TextureFormat::UNORM_SHORT_565:
+ case tcu::TextureFormat::UNORM_SHORT_555:
+ case tcu::TextureFormat::UNORM_SHORT_4444:
+ case tcu::TextureFormat::UNORM_SHORT_5551:
+ case tcu::TextureFormat::UNORM_SHORT_1555:
+ case tcu::TextureFormat::UNORM_INT_101010:
+ case tcu::TextureFormat::SNORM_INT_1010102_REV:
+ case tcu::TextureFormat::UNORM_INT_1010102_REV:
+ case tcu::TextureFormat::UNSIGNED_BYTE_44:
+ case tcu::TextureFormat::UNSIGNED_SHORT_565:
+ case tcu::TextureFormat::UNSIGNED_SHORT_4444:
+ case tcu::TextureFormat::UNSIGNED_SHORT_5551:
+ case tcu::TextureFormat::SIGNED_INT_1010102_REV:
+ case tcu::TextureFormat::UNSIGNED_INT_1010102_REV:
+ case tcu::TextureFormat::UNSIGNED_INT_11F_11F_10F_REV:
+ case tcu::TextureFormat::UNSIGNED_INT_999_E5_REV:
+ case tcu::TextureFormat::UNSIGNED_INT_16_8_8:
+ case tcu::TextureFormat::UNSIGNED_INT_24_8:
+ case tcu::TextureFormat::UNSIGNED_INT_24_8_REV:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+bool isComponentSwizzled (const vk::VkFormat format)
+{
+ const tcu::TextureFormat textureFormat = mapVkFormat(format);
+
+ DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELORDER_LAST == 21);
+
+ switch (textureFormat.order)
+ {
+ case tcu::TextureFormat::ARGB:
+ case tcu::TextureFormat::BGR:
+ case tcu::TextureFormat::BGRA:
+ case tcu::TextureFormat::sBGR:
+ case tcu::TextureFormat::sBGRA:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+int getNumUsedChannels (const vk::VkFormat format)
+{
+ // make sure this function will be checked if type table is updated
+ DE_STATIC_ASSERT(tcu::TextureFormat::CHANNELORDER_LAST == 21);
+
+ const tcu::TextureFormat textureFormat = mapVkFormat(format);
+
+ return getNumUsedChannels(textureFormat.order);
+}
+
std::string getFormatShortString (const VkFormat format)
{
const std::string fullName = getFormatName(format);
return std::vector<tcu::Vec4>(vertices, vertices + DE_LENGTH_OF_ARRAY(vertices));
}
-vk::VkBufferImageCopy makeBufferImageCopy (const deUint32 imageWidth, const deUint32 imageHeight)
+vk::VkBufferImageCopy makeBufferImageCopy (const deUint32 imageWidth, const deUint32 imageHeight, const deUint32 mipLevel, const deUint32 layer)
{
const VkBufferImageCopy copyParams =
{
imageHeight, // bufferImageHeight
{
VK_IMAGE_ASPECT_COLOR_BIT, // aspectMask
- 0u, // mipLevel
- 0u, // baseArrayLayer
+ mipLevel, // mipLevel
+ layer, // baseArrayLayer
+ 1u, // layerCount
+ }, // imageSubresource
+ { 0u, 0u, 0u }, // imageOffset
+ {
+ imageWidth,
+ imageHeight,
+ 1u
+ } // imageExtent
+ };
+
+ return copyParams;
+}
+
+vk::VkBufferImageCopy makeBufferImageCopy (const deUint32 imageWidth, const deUint32 imageHeight, const deUint32 mipLevel, const deUint32 layer, const deUint32 bufferRowLength, const deUint32 bufferImageHeight)
+{
+ const VkBufferImageCopy copyParams =
+ {
+ (VkDeviceSize)0u, // bufferOffset
+ bufferRowLength, // bufferRowLength
+ bufferImageHeight, // bufferImageHeight
+ {
+ VK_IMAGE_ASPECT_COLOR_BIT, // aspectMask
+ mipLevel, // mipLevel
+ layer, // baseArrayLayer
1u, // layerCount
}, // imageSubresource
{ 0u, 0u, 0u }, // imageOffset
return createFramebuffer(vk, device, &framebufferInfo);
}
+VkRect2D makeScissor (const deUint32 width,
+ const deUint32 height)
+{
+ const VkRect2D scissor =
+ {
+ { 0u, 0u }, // VkOffset2D offset;
+ { width, height } // VkExtent2D extent;
+ };
+
+ return scissor;
+}
} // image
} // vkt