#include "tcuTextureUtil.hpp"
#include "tcuFloat.hpp"
#include "tcuStringTemplate.hpp"
+#include "tcuVectorUtil.hpp"
#include <string>
#include <vector>
case tcu::TEXTURECHANNELCLASS_SIGNED_FIXED_POINT:
{
+ const tcu::UVec4 bitDepth = tcu::getTextureFormatMantissaBitDepth(mapVkFormat(format)).cast<deUint32>() - 1u;
+ // To avoid bit-shifting with negative value, which is undefined behaviour.
+ const tcu::UVec4 fixedBitDepth = tcu::select(bitDepth, tcu::UVec4(0u, 0u, 0u, 0u), tcu::greaterThanEqual(bitDepth.cast<deInt32>(), tcu::IVec4(0, 0, 0, 0)));
+
// Allow error of minimum representable difference
- const tcu::Vec4 threshold (1.0f / ((tcu::UVec4(1u) << (tcu::getTextureFormatMantissaBitDepth(mapVkFormat(format)).cast<deUint32>() - 1u)) - 1u).cast<float>());
+ const tcu::Vec4 threshold (1.0f / ((tcu::UVec4(1u) << fixedBitDepth) - 1u).cast<float>());
ok = tcu::floatThresholdCompare(log, comparisonName.c_str(), comparisonDesc.c_str(), refLayer, resultLayer, threshold, tcu::COMPARE_LOG_RESULT);
break;
void StoreTest::checkSupport (Context& context) const
{
- const VkFormatProperties formatProperties (getPhysicalDeviceFormatProperties(context.getInstanceInterface(), context.getPhysicalDevice(), m_format));
+ const VkFormatProperties3KHR formatProperties (context.getFormatProperties(m_format));
- if (!m_declareImageFormatInShader)
- context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_SHADER_STORAGE_IMAGE_WRITE_WITHOUT_FORMAT);
+ if (!m_declareImageFormatInShader && !(formatProperties.bufferFeatures & VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR))
+ TCU_THROW(NotSupportedError, "Format not supported for unformatted stores via storage buffer");
+
+ if (!m_declareImageFormatInShader && !(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR))
+ TCU_THROW(NotSupportedError, "Format not supported for unformatted stores via storage images");
if (m_texture.type() == IMAGE_TYPE_CUBE_ARRAY)
context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_IMAGE_CUBE_ARRAY);
void LoadStoreTest::checkSupport (Context& context) const
{
- const vk::VkFormatProperties formatProperties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
- context.getPhysicalDevice(),
- m_format));
- const vk::VkFormatProperties imageFormatProperties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
- context.getPhysicalDevice(),
- m_imageFormat));
+ const VkFormatProperties3KHR formatProperties (context.getFormatProperties(m_format));
+ const VkFormatProperties3KHR imageFormatProperties (context.getFormatProperties(m_imageFormat));
+
if (m_imageLoadStoreLodAMD)
context.requireDeviceFunctionality("VK_AMD_shader_image_load_store_lod");
- if (!m_bufferLoadUniform && !m_declareImageFormatInShader)
- context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_SHADER_STORAGE_IMAGE_READ_WITHOUT_FORMAT);
+ if (!m_bufferLoadUniform && !m_declareImageFormatInShader && !(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT_KHR))
+ TCU_THROW(NotSupportedError, "Format not supported for unformatted loads via storage images");
if (m_texture.type() == IMAGE_TYPE_CUBE_ARRAY)
context.requireDeviceCoreFeature(DEVICE_CORE_FEATURE_IMAGE_CUBE_ARRAY);
if ((m_texture.type() == IMAGE_TYPE_BUFFER) && !(imageFormatProperties.bufferFeatures))
TCU_THROW(NotSupportedError, "Underlying format not supported at all for buffers");
- if (formatHasThreeComponents(m_format))
+ if (formatHasThreeComponents(m_format))
{
// When the source buffer is three-component, the destination buffer is single-component.
VkFormat dstFormat = getSingleComponentFormat(m_format);
- const vk::VkFormatProperties dstFormatProperties (vk::getPhysicalDeviceFormatProperties(context.getInstanceInterface(),
- context.getPhysicalDevice(),
- dstFormat));
+ const VkFormatProperties3KHR dstFormatProperties (context.getFormatProperties(dstFormat));
if (m_texture.type() == IMAGE_TYPE_BUFFER && !(dstFormatProperties.bufferFeatures & VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT))
TCU_THROW(NotSupportedError, "Format not supported for storage texel buffers");
const VkFormat writeFormat,
bool relaxedPrecision);
- virtual ~ImageExtendOperandTestInstance (void) {};
+ virtual ~ImageExtendOperandTestInstance (void) {}
protected:
{
}
-void checkFormatProperties (const InstanceInterface& vki, VkPhysicalDevice physDev, VkFormat format)
+void checkFormatProperties (Context& context, VkFormat format)
{
- const auto formatProperties = getPhysicalDeviceFormatProperties(vki, physDev, format);
+ const VkFormatProperties3KHR formatProperties (context.getFormatProperties(format));
if (!(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT))
TCU_THROW(NotSupportedError, "Format not supported for storage images");
void ImageExtendOperandTest::checkSupport (Context& context) const
{
- DE_ASSERT(m_texture.type() != IMAGE_TYPE_BUFFER);
-
if (!context.requireDeviceFunctionality("VK_KHR_spirv_1_4"))
TCU_THROW(NotSupportedError, "VK_KHR_spirv_1_4 not supported");
check64BitSupportIfNeeded(context, m_readFormat, m_writeFormat);
- const auto& vki = context.getInstanceInterface();
- const auto physDev = context.getPhysicalDevice();
-
- checkFormatProperties(vki, physDev, m_readFormat);
- checkFormatProperties(vki, physDev, m_writeFormat);
+ checkFormatProperties(context, m_readFormat);
+ checkFormatProperties(context, m_writeFormat);
}
void ImageExtendOperandTest::initPrograms (SourceCollections& programCollection) const