Add support for YCbCr conversion samplers in vulkan. Refs #1194

This commit is contained in:
baldurk
2018-12-14 14:08:33 +00:00
parent 5ddefed02b
commit 2cf5129e71
14 changed files with 275 additions and 29 deletions
+36
View File
@@ -439,6 +439,42 @@ std::string DoStringise(const AddressMode &el)
END_ENUM_STRINGISE();
}
template <>
std::string DoStringise(const YcbcrConversion &el)
{
BEGIN_ENUM_STRINGISE(YcbcrConversion);
{
STRINGISE_ENUM_CLASS(Raw);
STRINGISE_ENUM_CLASS_NAMED(RangeOnly, "Range Only");
STRINGISE_ENUM_CLASS_NAMED(BT709, "BT.709");
STRINGISE_ENUM_CLASS_NAMED(BT601, "BT.601");
STRINGISE_ENUM_CLASS_NAMED(BT2020, "BT.2020");
}
END_ENUM_STRINGISE();
}
template <>
std::string DoStringise(const YcbcrRange &el)
{
BEGIN_ENUM_STRINGISE(YcbcrRange);
{
STRINGISE_ENUM_CLASS_NAMED(ITUFull, "Full");
STRINGISE_ENUM_CLASS_NAMED(ITUNarrow, "Narrow");
}
END_ENUM_STRINGISE();
}
template <>
std::string DoStringise(const ChromaSampleLocation &el)
{
BEGIN_ENUM_STRINGISE(ChromaSampleLocation);
{
STRINGISE_ENUM_CLASS_NAMED(CositedEven, "Even");
STRINGISE_ENUM_CLASS_NAMED(Midpoint, "Mid");
}
END_ENUM_STRINGISE();
}
template <>
std::string DoStringise(const ResourceType &el)
{
+27
View File
@@ -315,6 +315,33 @@ enum class AddressMode : uint32_t
DECLARE_REFLECTION_ENUM(AddressMode);
enum YcbcrConversion
{
Raw,
RangeOnly,
BT709,
BT601,
BT2020,
};
DECLARE_REFLECTION_ENUM(YcbcrConversion);
enum YcbcrRange
{
ITUFull,
ITUNarrow,
};
DECLARE_REFLECTION_ENUM(YcbcrRange);
enum ChromaSampleLocation
{
CositedEven,
Midpoint,
};
DECLARE_REFLECTION_ENUM(ChromaSampleLocation);
DOCUMENT(R"(The type of a resource referred to by binding or API usage.
In some cases there is a little overlap or fudging when mapping API concepts - this is primarily
+22
View File
@@ -166,6 +166,28 @@ struct BindingElement
DOCUMENT("For samplers - ``True`` if unnormalized co-ordinates are used in this sampler.");
bool unnormalized = false;
DOCUMENT(R"(For samplers - the :class:`ResourceId` of the ycbcr conversion object associated with
this sampler.
)");
ResourceId ycbcrSampler;
DOCUMENT("For ycbcr samplers - the :class:`YcbcrConversion` used for conversion.");
YcbcrConversion ycbcrModel;
DOCUMENT("For ycbcr samplers - the :class:`YcbcrRange` used for conversion.");
YcbcrRange ycbcrRange;
DOCUMENT(R"(For ycbcr samplers - Four :class:`TextureSwizzle` elements indicating the swizzle
applied before conversion.
)");
TextureSwizzle ycbcrSwizzle[4];
DOCUMENT("For ycbcr samplers - the :class:`ChromaSampleLocation` X-axis chroma offset.");
ChromaSampleLocation xChromaOffset;
DOCUMENT("For ycbcr samplers - the :class:`ChromaSampleLocation` Y-axis chroma offset.");
ChromaSampleLocation yChromaOffset;
DOCUMENT("For ycbcr samplers - the :class:`FilterMode` describing the chroma filtering mode.");
FilterMode chromaFilter;
DOCUMENT("For ycbcr samplers - ``True`` if explicit reconstruction is force enabled.");
bool forceExplicitReconstruction;
DOCUMENT(R"(For samplers - check if the border color is used in this Vulkan sampler.
:return: ``True`` if the border color is used, ``False`` otherwise.