Lines Matching defs:format
68 bool isSupportedVertexFormat (Context& context, VkFormat format)
70 if (isVertexFormatDouble(format) && !context.getDeviceFeatures().shaderFloat64)
75 context.getInstanceInterface().getPhysicalDeviceFormatProperties(context.getPhysicalDevice(), format, &formatProps);
80 float getRepresentableDifferenceUnorm (VkFormat format)
82 DE_ASSERT(isVertexFormatUnorm(format) || isVertexFormatSRGB(format));
84 return 1.0f / float((1 << (getVertexFormatComponentSize(format) * 8)) - 1);
87 float getRepresentableDifferenceUnormPacked(VkFormat format, deUint32 componentNdx)
89 DE_ASSERT((isVertexFormatUnorm(format) || isVertexFormatSRGB(format)) && isVertexFormatPacked(format));
91 return 1.0f / float((1 << (getPackedVertexFormatComponentWidth(format, componentNdx))) - 1);
94 float getRepresentableDifferenceSnorm (VkFormat format)
96 DE_ASSERT(isVertexFormatSnorm(format));
98 return 1.0f / float((1 << (getVertexFormatComponentSize(format) * 8 - 1)) - 1);
101 float getRepresentableDifferenceSnormPacked(VkFormat format, deUint32 componentNdx)
103 DE_ASSERT(isVertexFormatSnorm(format) && isVertexFormatPacked(format));
105 return 1.0f / float((1 << (getPackedVertexFormatComponentWidth(format, componentNdx) - 1)) - 1);
221 static bool isCompatibleType (VkFormat format, GlslType glslType);
230 static tcu::Vec4 getFormatThreshold (VkFormat format);
633 attributeInfo.vkType, // VkFormat format;
1060 tcu::Vec4 VertexInputTest::getFormatThreshold (VkFormat format)
1064 switch (format)
1080 if (isVertexFormatSnorm(format))
1082 return (isVertexFormatPacked(format) ? Vec4(1.5f * getRepresentableDifferenceSnormPacked(format, 0),
1083 1.5f * getRepresentableDifferenceSnormPacked(format, 1),
1084 1.5f * getRepresentableDifferenceSnormPacked(format, 2),
1085 1.5f * getRepresentableDifferenceSnormPacked(format, 3))
1086 : Vec4(1.5f * getRepresentableDifferenceSnorm(format)));
1088 else if (isVertexFormatUnorm(format))
1090 return (isVertexFormatPacked(format) ? Vec4(1.5f * getRepresentableDifferenceUnormPacked(format, 0),
1091 1.5f * getRepresentableDifferenceUnormPacked(format, 1),
1092 1.5f * getRepresentableDifferenceUnormPacked(format, 2),
1093 1.5f * getRepresentableDifferenceUnormPacked(format, 3))
1094 : Vec4(1.5f * getRepresentableDifferenceUnorm(format)));
1095 } else if (isVertexFormatUfloat(format))
1125 if (!isSupportedVertexFormat(context, attributeDescription.format))
1127 throw tcu::NotSupportedError(std::string("Unsupported format for vertex input: ") + getFormatName(attributeDescription.format));
1139 m_colorFormat, // VkFormat format;
1168 m_colorFormat, // VkFormat format;
1439 void writeVertexInputValueSint (deUint8* destPtr, VkFormat format, int componentNdx, deInt32 value)
1441 const deUint32 componentSize = getVertexFormatComponentSize(format);
1463 void writeVertexInputValueIntPacked(deUint8* destPtr, deUint32& packedFormat, deUint32& componentOffset, VkFormat format, deUint32 componentNdx, deUint32 value)
1465 const deUint32 componentWidth = getPackedVertexFormatComponentWidth(format, componentNdx);
1466 const deUint32 componentCount = getVertexFormatComponentCount(format);
1467 const deUint32 usedBits = ~(deUint32)0 >> ((getVertexFormatSize(format) * 8) - componentWidth);
1476 void writeVertexInputValueUint (deUint8* destPtr, VkFormat format, int componentNdx, deUint32 value)
1478 const deUint32 componentSize = getVertexFormatComponentSize(format);
1500 void writeVertexInputValueSfloat (deUint8* destPtr, VkFormat format, int componentNdx, float value)
1502 const deUint32 componentSize = getVertexFormatComponentSize(format);
1523 void writeVertexInputValueUfloat (deUint8* destPtr, deUint32& packedFormat, deUint32& componentOffset, VkFormat format, deUint32 componentNdx, float value)
1527 const deUint32 componentWidth = getPackedVertexFormatComponentWidth(format, componentNdx);
1528 const deUint32 componentCount = getVertexFormatComponentCount(format);
1529 const deUint32 usedBits = ~(deUint32)0 >> ((getVertexFormatSize(format) * 8) - componentWidth);
1535 DE_ASSERT(format == VK_FORMAT_B10G11R11_UFLOAT_PACK32);
1551 const bool hasBGROrder = isVertexFormatComponentOrderBGR(attribute.vkDescription.format);
1552 const bool hasABGROrder = isVertexFormatComponentOrderABGR(attribute.vkDescription.format);
1553 const bool hasARGBOrder = isVertexFormatComponentOrderARGB(attribute.vkDescription.format);
1554 deUint32 componentOffset = getVertexFormatSize(attribute.vkDescription.format) * 8;
1573 const deInt32 maxIntValue = isVertexFormatPacked(attribute.vkDescription.format) ? (1 << (getPackedVertexFormatComponentWidth(attribute.vkDescription.format, componentNdx) - 1)) - 1 : (1 << (getVertexFormatComponentSize(attribute.vkDescription.format) * 8 - 1)) - 1;
1574 const deUint32 maxUintValue = isVertexFormatPacked(attribute.vkDescription.format) ? ((1 << getPackedVertexFormatComponentWidth(attribute.vkDescription.format, componentNdx)) - 1) : (1 << (getVertexFormatComponentSize(attribute.vkDescription.format) * 8 )) - 1;
1585 if (isVertexFormatPacked(attribute.vkDescription.format))
1586 writeVertexInputValueIntPacked(destPtr, packedFormat32, componentOffset, attribute.vkDescription.format, componentNdx, deClamp32(-(deInt32)(vertexInputIndex + swizzledNdx), minIntValue, maxIntValue));
1588 writeVertexInputValueSint(destPtr, attribute.vkDescription.format, componentNdx, -(deInt32)(vertexInputIndex + swizzledNdx));
1597 if (isVertexFormatPacked(attribute.vkDescription.format))
1598 writeVertexInputValueIntPacked(destPtr, packedFormat32, componentOffset, attribute.vkDescription.format, componentNdx, deClamp32(vertexInputIndex + swizzledNdx, minUintValue, maxUintValue));
1600 writeVertexInputValueUint(destPtr, attribute.vkDescription.format, componentNdx, vertexInputIndex + swizzledNdx);
1616 if (isVertexFormatSfloat(attribute.vkDescription.format))
1618 writeVertexInputValueSfloat(destPtr, attribute.vkDescription.format, componentNdx, -(0.01f * (float)(vertexInputIndex + swizzledNdx)));
1619 } else if (isVertexFormatUfloat(attribute.vkDescription.format))
1621 writeVertexInputValueUfloat(destPtr, packedFormat32, componentOffset, attribute.vkDescription.format, componentNdx, 0.01f * (float)(vertexInputIndex + swizzledNdx));
1623 else if (isVertexFormatSscaled(attribute.vkDescription.format))
1625 if (isVertexFormatPacked(attribute.vkDescription.format))
1626 writeVertexInputValueIntPacked(destPtr, packedFormat32, componentOffset, attribute.vkDescription.format, componentNdx, deClamp32(-(deInt32)(vertexInputIndex + swizzledNdx), minIntValue, maxIntValue));
1628 writeVertexInputValueSint(destPtr, attribute.vkDescription.format, componentNdx, -(deInt32)(vertexInputIndex + swizzledNdx));
1630 else if (isVertexFormatUscaled(attribute.vkDescription.format) || isVertexFormatUnorm(attribute.vkDescription.format) || isVertexFormatSRGB(attribute.vkDescription.format))
1632 if (isVertexFormatPacked(attribute.vkDescription.format))
1633 writeVertexInputValueIntPacked(destPtr, packedFormat32, componentOffset, attribute.vkDescription.format, componentNdx, deClamp32(vertexInputIndex + swizzledNdx, minUintValue, maxUintValue));
1635 writeVertexInputValueUint(destPtr, attribute.vkDescription.format, componentNdx, vertexInputIndex + swizzledNdx);
1637 else if (isVertexFormatSnorm(attribute.vkDescription.format))
1639 if (isVertexFormatPacked(attribute.vkDescription.format))
1640 writeVertexInputValueIntPacked(destPtr, packedFormat32, componentOffset, attribute.vkDescription.format, componentNdx, deClamp32(minIntValue + (vertexInputIndex + swizzledNdx), minIntValue, maxIntValue));
1642 writeVertexInputValueSint(destPtr, attribute.vkDescription.format, componentNdx, minIntValue + (vertexInputIndex + swizzledNdx));
1676 bool VertexInputTest::isCompatibleType (VkFormat format, GlslType glslType)
1680 if ((deUint32)s_glslTypeDescriptions[glslType].vertexInputComponentCount == getVertexFormatComponentCount(format))
1685 return isVertexFormatSint(format);
1688 return isVertexFormatUint(format);
1691 return (isVertexFormatPacked(format) ? (getVertexFormatSize(format) <= 4) : getVertexFormatComponentSize(format) <= 4) && (isVertexFormatSfloat(format) ||
1692 isVertexFormatSnorm(format) || isVertexFormatUnorm(format) || isVertexFormatSscaled(format) || isVertexFormatUscaled(format) || isVertexFormatSRGB(format) ||
1693 isVertexFormatUfloat(format));
1696 return isVertexFormatSfloat(format) && getVertexFormatComponentSize(format) == 8;
1699 return ((isVertexFormatSfloat(format)/* || isVertexFormatSnorm(format) || isVertexFormatUnorm(format)*/) && getVertexFormatComponentSize(format) == 2);
1975 // Select a random compatible format for each attribute
2223 const VkFormat format = formats[randomFunc.getUint32() % formats.size()];
2227 attributeInfos[attributeNdx].vkType = format;